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
5
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 Zone(object):
12    """
13    A DNS 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 Zone.
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 Zone.
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 Zone.
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 Zone.
31    #: This constant has a value of "PRIVATE"
32    SCOPE_PRIVATE = "PRIVATE"
33
34    #: A constant which can be used with the lifecycle_state property of a Zone.
35    #: This constant has a value of "ACTIVE"
36    LIFECYCLE_STATE_ACTIVE = "ACTIVE"
37
38    #: A constant which can be used with the lifecycle_state property of a Zone.
39    #: This constant has a value of "CREATING"
40    LIFECYCLE_STATE_CREATING = "CREATING"
41
42    #: A constant which can be used with the lifecycle_state property of a Zone.
43    #: This constant has a value of "DELETED"
44    LIFECYCLE_STATE_DELETED = "DELETED"
45
46    #: A constant which can be used with the lifecycle_state property of a Zone.
47    #: This constant has a value of "DELETING"
48    LIFECYCLE_STATE_DELETING = "DELETING"
49
50    #: A constant which can be used with the lifecycle_state property of a Zone.
51    #: This constant has a value of "FAILED"
52    LIFECYCLE_STATE_FAILED = "FAILED"
53
54    #: A constant which can be used with the lifecycle_state property of a Zone.
55    #: This constant has a value of "UPDATING"
56    LIFECYCLE_STATE_UPDATING = "UPDATING"
57
58    def __init__(self, **kwargs):
59        """
60        Initializes a new Zone object with values from keyword arguments.
61        The following keyword arguments are supported (corresponding to the getters/setters of this class):
62
63        :param name:
64            The value to assign to the name property of this Zone.
65        :type name: str
66
67        :param zone_type:
68            The value to assign to the zone_type property of this Zone.
69            Allowed values for this property are: "PRIMARY", "SECONDARY", 'UNKNOWN_ENUM_VALUE'.
70            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
71        :type zone_type: str
72
73        :param compartment_id:
74            The value to assign to the compartment_id property of this Zone.
75        :type compartment_id: str
76
77        :param view_id:
78            The value to assign to the view_id property of this Zone.
79        :type view_id: str
80
81        :param scope:
82            The value to assign to the scope property of this Zone.
83            Allowed values for this property are: "GLOBAL", "PRIVATE", 'UNKNOWN_ENUM_VALUE'.
84            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
85        :type scope: str
86
87        :param freeform_tags:
88            The value to assign to the freeform_tags property of this Zone.
89        :type freeform_tags: dict(str, str)
90
91        :param defined_tags:
92            The value to assign to the defined_tags property of this Zone.
93        :type defined_tags: dict(str, dict(str, object))
94
95        :param external_masters:
96            The value to assign to the external_masters property of this Zone.
97        :type external_masters: list[oci.dns.models.ExternalMaster]
98
99        :param self_uri:
100            The value to assign to the self_uri property of this Zone.
101        :type self_uri: str
102
103        :param id:
104            The value to assign to the id property of this Zone.
105        :type id: str
106
107        :param time_created:
108            The value to assign to the time_created property of this Zone.
109        :type time_created: datetime
110
111        :param version:
112            The value to assign to the version property of this Zone.
113        :type version: str
114
115        :param serial:
116            The value to assign to the serial property of this Zone.
117        :type serial: int
118
119        :param lifecycle_state:
120            The value to assign to the lifecycle_state property of this Zone.
121            Allowed values for this property are: "ACTIVE", "CREATING", "DELETED", "DELETING", "FAILED", "UPDATING", 'UNKNOWN_ENUM_VALUE'.
122            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
123        :type lifecycle_state: str
124
125        :param is_protected:
126            The value to assign to the is_protected property of this Zone.
127        :type is_protected: bool
128
129        :param nameservers:
130            The value to assign to the nameservers property of this Zone.
131        :type nameservers: list[oci.dns.models.Nameserver]
132
133        :param zone_transfer_servers:
134            The value to assign to the zone_transfer_servers property of this Zone.
135        :type zone_transfer_servers: list[oci.dns.models.ZoneTransferServer]
136
137        """
138        self.swagger_types = {
139            'name': 'str',
140            'zone_type': 'str',
141            'compartment_id': 'str',
142            'view_id': 'str',
143            'scope': 'str',
144            'freeform_tags': 'dict(str, str)',
145            'defined_tags': 'dict(str, dict(str, object))',
146            'external_masters': 'list[ExternalMaster]',
147            'self_uri': 'str',
148            'id': 'str',
149            'time_created': 'datetime',
150            'version': 'str',
151            'serial': 'int',
152            'lifecycle_state': 'str',
153            'is_protected': 'bool',
154            'nameservers': 'list[Nameserver]',
155            'zone_transfer_servers': 'list[ZoneTransferServer]'
156        }
157
158        self.attribute_map = {
159            'name': 'name',
160            'zone_type': 'zoneType',
161            'compartment_id': 'compartmentId',
162            'view_id': 'viewId',
163            'scope': 'scope',
164            'freeform_tags': 'freeformTags',
165            'defined_tags': 'definedTags',
166            'external_masters': 'externalMasters',
167            'self_uri': 'self',
168            'id': 'id',
169            'time_created': 'timeCreated',
170            'version': 'version',
171            'serial': 'serial',
172            'lifecycle_state': 'lifecycleState',
173            'is_protected': 'isProtected',
174            'nameservers': 'nameservers',
175            'zone_transfer_servers': 'zoneTransferServers'
176        }
177
178        self._name = None
179        self._zone_type = None
180        self._compartment_id = None
181        self._view_id = None
182        self._scope = None
183        self._freeform_tags = None
184        self._defined_tags = None
185        self._external_masters = None
186        self._self_uri = None
187        self._id = None
188        self._time_created = None
189        self._version = None
190        self._serial = None
191        self._lifecycle_state = None
192        self._is_protected = None
193        self._nameservers = None
194        self._zone_transfer_servers = None
195
196    @property
197    def name(self):
198        """
199        **[Required]** Gets the name of this Zone.
200        The name of the zone.
201
202
203        :return: The name of this Zone.
204        :rtype: str
205        """
206        return self._name
207
208    @name.setter
209    def name(self, name):
210        """
211        Sets the name of this Zone.
212        The name of the zone.
213
214
215        :param name: The name of this Zone.
216        :type: str
217        """
218        self._name = name
219
220    @property
221    def zone_type(self):
222        """
223        **[Required]** Gets the zone_type of this Zone.
224        The type of the zone. Must be either `PRIMARY` or `SECONDARY`. `SECONDARY` is only supported for GLOBAL zones.
225
226        Allowed values for this property are: "PRIMARY", "SECONDARY", 'UNKNOWN_ENUM_VALUE'.
227        Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
228
229
230        :return: The zone_type of this Zone.
231        :rtype: str
232        """
233        return self._zone_type
234
235    @zone_type.setter
236    def zone_type(self, zone_type):
237        """
238        Sets the zone_type of this Zone.
239        The type of the zone. Must be either `PRIMARY` or `SECONDARY`. `SECONDARY` is only supported for GLOBAL zones.
240
241
242        :param zone_type: The zone_type of this Zone.
243        :type: str
244        """
245        allowed_values = ["PRIMARY", "SECONDARY"]
246        if not value_allowed_none_or_none_sentinel(zone_type, allowed_values):
247            zone_type = 'UNKNOWN_ENUM_VALUE'
248        self._zone_type = zone_type
249
250    @property
251    def compartment_id(self):
252        """
253        **[Required]** Gets the compartment_id of this Zone.
254        The OCID of the compartment containing the zone.
255
256
257        :return: The compartment_id of this Zone.
258        :rtype: str
259        """
260        return self._compartment_id
261
262    @compartment_id.setter
263    def compartment_id(self, compartment_id):
264        """
265        Sets the compartment_id of this Zone.
266        The OCID of the compartment containing the zone.
267
268
269        :param compartment_id: The compartment_id of this Zone.
270        :type: str
271        """
272        self._compartment_id = compartment_id
273
274    @property
275    def view_id(self):
276        """
277        Gets the view_id of this Zone.
278        The OCID of the private view containing the zone. This value will
279        be null for zones in the global DNS, which are publicly resolvable and
280        not part of a private view.
281
282
283        :return: The view_id of this Zone.
284        :rtype: str
285        """
286        return self._view_id
287
288    @view_id.setter
289    def view_id(self, view_id):
290        """
291        Sets the view_id of this Zone.
292        The OCID of the private view containing the zone. This value will
293        be null for zones in the global DNS, which are publicly resolvable and
294        not part of a private view.
295
296
297        :param view_id: The view_id of this Zone.
298        :type: str
299        """
300        self._view_id = view_id
301
302    @property
303    def scope(self):
304        """
305        **[Required]** Gets the scope of this Zone.
306        The scope of the zone.
307
308        Allowed values for this property are: "GLOBAL", "PRIVATE", 'UNKNOWN_ENUM_VALUE'.
309        Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
310
311
312        :return: The scope of this Zone.
313        :rtype: str
314        """
315        return self._scope
316
317    @scope.setter
318    def scope(self, scope):
319        """
320        Sets the scope of this Zone.
321        The scope of the zone.
322
323
324        :param scope: The scope of this Zone.
325        :type: str
326        """
327        allowed_values = ["GLOBAL", "PRIVATE"]
328        if not value_allowed_none_or_none_sentinel(scope, allowed_values):
329            scope = 'UNKNOWN_ENUM_VALUE'
330        self._scope = scope
331
332    @property
333    def freeform_tags(self):
334        """
335        **[Required]** Gets the freeform_tags of this Zone.
336        Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace.
337        For more information, see `Resource Tags`__.
338
339
340        **Example:** `{\"Department\": \"Finance\"}`
341
342        __ https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm
343
344
345        :return: The freeform_tags of this Zone.
346        :rtype: dict(str, str)
347        """
348        return self._freeform_tags
349
350    @freeform_tags.setter
351    def freeform_tags(self, freeform_tags):
352        """
353        Sets the freeform_tags of this Zone.
354        Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace.
355        For more information, see `Resource Tags`__.
356
357
358        **Example:** `{\"Department\": \"Finance\"}`
359
360        __ https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm
361
362
363        :param freeform_tags: The freeform_tags of this Zone.
364        :type: dict(str, str)
365        """
366        self._freeform_tags = freeform_tags
367
368    @property
369    def defined_tags(self):
370        """
371        **[Required]** Gets the defined_tags of this Zone.
372        Defined tags for this resource. Each key is predefined and scoped to a namespace.
373        For more information, see `Resource Tags`__.
374
375
376        **Example:** `{\"Operations\": {\"CostCenter\": \"42\"}}`
377
378        __ https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm
379
380
381        :return: The defined_tags of this Zone.
382        :rtype: dict(str, dict(str, object))
383        """
384        return self._defined_tags
385
386    @defined_tags.setter
387    def defined_tags(self, defined_tags):
388        """
389        Sets the defined_tags of this Zone.
390        Defined tags for this resource. Each key is predefined and scoped to a namespace.
391        For more information, see `Resource Tags`__.
392
393
394        **Example:** `{\"Operations\": {\"CostCenter\": \"42\"}}`
395
396        __ https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm
397
398
399        :param defined_tags: The defined_tags of this Zone.
400        :type: dict(str, dict(str, object))
401        """
402        self._defined_tags = defined_tags
403
404    @property
405    def external_masters(self):
406        """
407        **[Required]** Gets the external_masters of this Zone.
408        External master servers for the zone. `externalMasters` becomes a
409        required parameter when the `zoneType` value is `SECONDARY`.
410
411
412        :return: The external_masters of this Zone.
413        :rtype: list[oci.dns.models.ExternalMaster]
414        """
415        return self._external_masters
416
417    @external_masters.setter
418    def external_masters(self, external_masters):
419        """
420        Sets the external_masters of this Zone.
421        External master servers for the zone. `externalMasters` becomes a
422        required parameter when the `zoneType` value is `SECONDARY`.
423
424
425        :param external_masters: The external_masters of this Zone.
426        :type: list[oci.dns.models.ExternalMaster]
427        """
428        self._external_masters = external_masters
429
430    @property
431    def self_uri(self):
432        """
433        **[Required]** Gets the self_uri of this Zone.
434        The canonical absolute URL of the resource.
435
436
437        :return: The self_uri of this Zone.
438        :rtype: str
439        """
440        return self._self_uri
441
442    @self_uri.setter
443    def self_uri(self, self_uri):
444        """
445        Sets the self_uri of this Zone.
446        The canonical absolute URL of the resource.
447
448
449        :param self_uri: The self_uri of this Zone.
450        :type: str
451        """
452        self._self_uri = self_uri
453
454    @property
455    def id(self):
456        """
457        **[Required]** Gets the id of this Zone.
458        The OCID of the zone.
459
460
461        :return: The id of this Zone.
462        :rtype: str
463        """
464        return self._id
465
466    @id.setter
467    def id(self, id):
468        """
469        Sets the id of this Zone.
470        The OCID of the zone.
471
472
473        :param id: The id of this Zone.
474        :type: str
475        """
476        self._id = id
477
478    @property
479    def time_created(self):
480        """
481        **[Required]** Gets the time_created of this Zone.
482        The date and time the resource was created in \"YYYY-MM-ddThh:mm:ssZ\" format
483        with a Z offset, as defined by RFC 3339.
484
485        **Example:** `2016-07-22T17:23:59:60Z`
486
487
488        :return: The time_created of this Zone.
489        :rtype: datetime
490        """
491        return self._time_created
492
493    @time_created.setter
494    def time_created(self, time_created):
495        """
496        Sets the time_created of this Zone.
497        The date and time the resource was created in \"YYYY-MM-ddThh:mm:ssZ\" format
498        with a Z offset, as defined by RFC 3339.
499
500        **Example:** `2016-07-22T17:23:59:60Z`
501
502
503        :param time_created: The time_created of this Zone.
504        :type: datetime
505        """
506        self._time_created = time_created
507
508    @property
509    def version(self):
510        """
511        **[Required]** Gets the version of this Zone.
512        Version is the never-repeating, totally-orderable, version of the
513        zone, from which the serial field of the zone's SOA record is
514        derived.
515
516
517        :return: The version of this Zone.
518        :rtype: str
519        """
520        return self._version
521
522    @version.setter
523    def version(self, version):
524        """
525        Sets the version of this Zone.
526        Version is the never-repeating, totally-orderable, version of the
527        zone, from which the serial field of the zone's SOA record is
528        derived.
529
530
531        :param version: The version of this Zone.
532        :type: str
533        """
534        self._version = version
535
536    @property
537    def serial(self):
538        """
539        **[Required]** Gets the serial of this Zone.
540        The current serial of the zone. As seen in the zone's SOA record.
541
542
543        :return: The serial of this Zone.
544        :rtype: int
545        """
546        return self._serial
547
548    @serial.setter
549    def serial(self, serial):
550        """
551        Sets the serial of this Zone.
552        The current serial of the zone. As seen in the zone's SOA record.
553
554
555        :param serial: The serial of this Zone.
556        :type: int
557        """
558        self._serial = serial
559
560    @property
561    def lifecycle_state(self):
562        """
563        **[Required]** Gets the lifecycle_state of this Zone.
564        The current state of the zone resource.
565
566        Allowed values for this property are: "ACTIVE", "CREATING", "DELETED", "DELETING", "FAILED", "UPDATING", 'UNKNOWN_ENUM_VALUE'.
567        Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
568
569
570        :return: The lifecycle_state of this Zone.
571        :rtype: str
572        """
573        return self._lifecycle_state
574
575    @lifecycle_state.setter
576    def lifecycle_state(self, lifecycle_state):
577        """
578        Sets the lifecycle_state of this Zone.
579        The current state of the zone resource.
580
581
582        :param lifecycle_state: The lifecycle_state of this Zone.
583        :type: str
584        """
585        allowed_values = ["ACTIVE", "CREATING", "DELETED", "DELETING", "FAILED", "UPDATING"]
586        if not value_allowed_none_or_none_sentinel(lifecycle_state, allowed_values):
587            lifecycle_state = 'UNKNOWN_ENUM_VALUE'
588        self._lifecycle_state = lifecycle_state
589
590    @property
591    def is_protected(self):
592        """
593        **[Required]** Gets the is_protected of this Zone.
594        A Boolean flag indicating whether or not parts of the resource are unable to be explicitly managed.
595
596
597        :return: The is_protected of this Zone.
598        :rtype: bool
599        """
600        return self._is_protected
601
602    @is_protected.setter
603    def is_protected(self, is_protected):
604        """
605        Sets the is_protected of this Zone.
606        A Boolean flag indicating whether or not parts of the resource are unable to be explicitly managed.
607
608
609        :param is_protected: The is_protected of this Zone.
610        :type: bool
611        """
612        self._is_protected = is_protected
613
614    @property
615    def nameservers(self):
616        """
617        **[Required]** Gets the nameservers of this Zone.
618        The authoritative nameservers for the zone.
619
620
621        :return: The nameservers of this Zone.
622        :rtype: list[oci.dns.models.Nameserver]
623        """
624        return self._nameservers
625
626    @nameservers.setter
627    def nameservers(self, nameservers):
628        """
629        Sets the nameservers of this Zone.
630        The authoritative nameservers for the zone.
631
632
633        :param nameservers: The nameservers of this Zone.
634        :type: list[oci.dns.models.Nameserver]
635        """
636        self._nameservers = nameservers
637
638    @property
639    def zone_transfer_servers(self):
640        """
641        Gets the zone_transfer_servers of this Zone.
642        The OCI nameservers that transfer the zone data with external nameservers.
643
644
645        :return: The zone_transfer_servers of this Zone.
646        :rtype: list[oci.dns.models.ZoneTransferServer]
647        """
648        return self._zone_transfer_servers
649
650    @zone_transfer_servers.setter
651    def zone_transfer_servers(self, zone_transfer_servers):
652        """
653        Sets the zone_transfer_servers of this Zone.
654        The OCI nameservers that transfer the zone data with external nameservers.
655
656
657        :param zone_transfer_servers: The zone_transfer_servers of this Zone.
658        :type: list[oci.dns.models.ZoneTransferServer]
659        """
660        self._zone_transfer_servers = zone_transfer_servers
661
662    def __repr__(self):
663        return formatted_flat_dict(self)
664
665    def __eq__(self, other):
666        if other is None:
667            return False
668
669        return self.__dict__ == other.__dict__
670
671    def __ne__(self, other):
672        return not self == other
673