1# coding: utf-8
2# Copyright (c) 2016, 2021, Oracle and/or its affiliates.  All rights reserved.
3# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
4
5from .create_zone_base_details import CreateZoneBaseDetails
6from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel  # noqa: F401
7from oci.decorators import init_model_state_from_kwargs
8
9
10@init_model_state_from_kwargs
11class CreateZoneDetails(CreateZoneBaseDetails):
12    """
13    The body for defining a new zone.
14
15    **Warning:** Oracle recommends that you avoid using any confidential information when you supply string values using the API.
16    """
17
18    #: A constant which can be used with the zone_type property of a CreateZoneDetails.
19    #: This constant has a value of "PRIMARY"
20    ZONE_TYPE_PRIMARY = "PRIMARY"
21
22    #: A constant which can be used with the zone_type property of a CreateZoneDetails.
23    #: This constant has a value of "SECONDARY"
24    ZONE_TYPE_SECONDARY = "SECONDARY"
25
26    #: A constant which can be used with the scope property of a CreateZoneDetails.
27    #: This constant has a value of "GLOBAL"
28    SCOPE_GLOBAL = "GLOBAL"
29
30    #: A constant which can be used with the scope property of a CreateZoneDetails.
31    #: This constant has a value of "PRIVATE"
32    SCOPE_PRIVATE = "PRIVATE"
33
34    def __init__(self, **kwargs):
35        """
36        Initializes a new CreateZoneDetails object with values from keyword arguments. The default value of the :py:attr:`~oci.dns.models.CreateZoneDetails.migration_source` attribute
37        of this class is ``NONE`` and it should not be changed.
38        The following keyword arguments are supported (corresponding to the getters/setters of this class):
39
40        :param migration_source:
41            The value to assign to the migration_source property of this CreateZoneDetails.
42            Allowed values for this property are: "NONE", "DYNECT"
43        :type migration_source: str
44
45        :param name:
46            The value to assign to the name property of this CreateZoneDetails.
47        :type name: str
48
49        :param compartment_id:
50            The value to assign to the compartment_id property of this CreateZoneDetails.
51        :type compartment_id: str
52
53        :param freeform_tags:
54            The value to assign to the freeform_tags property of this CreateZoneDetails.
55        :type freeform_tags: dict(str, str)
56
57        :param defined_tags:
58            The value to assign to the defined_tags property of this CreateZoneDetails.
59        :type defined_tags: dict(str, dict(str, object))
60
61        :param zone_type:
62            The value to assign to the zone_type property of this CreateZoneDetails.
63            Allowed values for this property are: "PRIMARY", "SECONDARY"
64        :type zone_type: str
65
66        :param view_id:
67            The value to assign to the view_id property of this CreateZoneDetails.
68        :type view_id: str
69
70        :param scope:
71            The value to assign to the scope property of this CreateZoneDetails.
72            Allowed values for this property are: "GLOBAL", "PRIVATE"
73        :type scope: str
74
75        :param external_masters:
76            The value to assign to the external_masters property of this CreateZoneDetails.
77        :type external_masters: list[oci.dns.models.ExternalMaster]
78
79        """
80        self.swagger_types = {
81            'migration_source': 'str',
82            'name': 'str',
83            'compartment_id': 'str',
84            'freeform_tags': 'dict(str, str)',
85            'defined_tags': 'dict(str, dict(str, object))',
86            'zone_type': 'str',
87            'view_id': 'str',
88            'scope': 'str',
89            'external_masters': 'list[ExternalMaster]'
90        }
91
92        self.attribute_map = {
93            'migration_source': 'migrationSource',
94            'name': 'name',
95            'compartment_id': 'compartmentId',
96            'freeform_tags': 'freeformTags',
97            'defined_tags': 'definedTags',
98            'zone_type': 'zoneType',
99            'view_id': 'viewId',
100            'scope': 'scope',
101            'external_masters': 'externalMasters'
102        }
103
104        self._migration_source = None
105        self._name = None
106        self._compartment_id = None
107        self._freeform_tags = None
108        self._defined_tags = None
109        self._zone_type = None
110        self._view_id = None
111        self._scope = None
112        self._external_masters = None
113        self._migration_source = 'NONE'
114
115    @property
116    def zone_type(self):
117        """
118        Gets the zone_type of this CreateZoneDetails.
119        The type of the zone. Must be either `PRIMARY` or `SECONDARY`. `SECONDARY` is only supported for GLOBAL
120        zones.
121
122        Allowed values for this property are: "PRIMARY", "SECONDARY"
123
124
125        :return: The zone_type of this CreateZoneDetails.
126        :rtype: str
127        """
128        return self._zone_type
129
130    @zone_type.setter
131    def zone_type(self, zone_type):
132        """
133        Sets the zone_type of this CreateZoneDetails.
134        The type of the zone. Must be either `PRIMARY` or `SECONDARY`. `SECONDARY` is only supported for GLOBAL
135        zones.
136
137
138        :param zone_type: The zone_type of this CreateZoneDetails.
139        :type: str
140        """
141        allowed_values = ["PRIMARY", "SECONDARY"]
142        if not value_allowed_none_or_none_sentinel(zone_type, allowed_values):
143            raise ValueError(
144                "Invalid value for `zone_type`, must be None or one of {0}"
145                .format(allowed_values)
146            )
147        self._zone_type = zone_type
148
149    @property
150    def view_id(self):
151        """
152        Gets the view_id of this CreateZoneDetails.
153        This value will be null for zones in the global DNS.
154
155
156        :return: The view_id of this CreateZoneDetails.
157        :rtype: str
158        """
159        return self._view_id
160
161    @view_id.setter
162    def view_id(self, view_id):
163        """
164        Sets the view_id of this CreateZoneDetails.
165        This value will be null for zones in the global DNS.
166
167
168        :param view_id: The view_id of this CreateZoneDetails.
169        :type: str
170        """
171        self._view_id = view_id
172
173    @property
174    def scope(self):
175        """
176        Gets the scope of this CreateZoneDetails.
177        The scope of the zone.
178
179        Allowed values for this property are: "GLOBAL", "PRIVATE"
180
181
182        :return: The scope of this CreateZoneDetails.
183        :rtype: str
184        """
185        return self._scope
186
187    @scope.setter
188    def scope(self, scope):
189        """
190        Sets the scope of this CreateZoneDetails.
191        The scope of the zone.
192
193
194        :param scope: The scope of this CreateZoneDetails.
195        :type: str
196        """
197        allowed_values = ["GLOBAL", "PRIVATE"]
198        if not value_allowed_none_or_none_sentinel(scope, allowed_values):
199            raise ValueError(
200                "Invalid value for `scope`, must be None or one of {0}"
201                .format(allowed_values)
202            )
203        self._scope = scope
204
205    @property
206    def external_masters(self):
207        """
208        Gets the external_masters of this CreateZoneDetails.
209        External master servers for the zone. `externalMasters` becomes a
210        required parameter when the `zoneType` value is `SECONDARY`.
211
212
213        :return: The external_masters of this CreateZoneDetails.
214        :rtype: list[oci.dns.models.ExternalMaster]
215        """
216        return self._external_masters
217
218    @external_masters.setter
219    def external_masters(self, external_masters):
220        """
221        Sets the external_masters of this CreateZoneDetails.
222        External master servers for the zone. `externalMasters` becomes a
223        required parameter when the `zoneType` value is `SECONDARY`.
224
225
226        :param external_masters: The external_masters of this CreateZoneDetails.
227        :type: list[oci.dns.models.ExternalMaster]
228        """
229        self._external_masters = external_masters
230
231    def __repr__(self):
232        return formatted_flat_dict(self)
233
234    def __eq__(self, other):
235        if other is None:
236            return False
237
238        return self.__dict__ == other.__dict__
239
240    def __ne__(self, other):
241        return not self == other
242