1 // Copyright (c) 2016, 2018, 2025, Oracle and/or its affiliates. All rights reserved.
2 // 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.
3 // Code generated. DO NOT EDIT.
4 5 // DNS API
6 //
7 // API for the DNS service. Use this API to manage DNS zones, records, and other DNS resources.
8 // For more information, see Overview of the DNS Service (https://docs.oracle.com/iaas/Content/DNS/Concepts/dnszonemanagement.htm).
9 //
10 11 package dns
12 13 import (
14 "fmt"
15 "strings"
16 17 "github.com/nrdcg/oci-go-sdk/common/v1065"
18 )
19 20 // Zone A DNS zone.
21 // **Warning:** Oracle recommends that you avoid using any confidential information when you supply string values using the API.
22 type Zone struct {
23 24 // The name of the zone.
25 Name *string `mandatory:"true" json:"name"`
26 27 // The type of the zone. Must be either `PRIMARY` or `SECONDARY`. `SECONDARY` is only supported for GLOBAL zones.
28 ZoneType ZoneZoneTypeEnum `mandatory:"true" json:"zoneType"`
29 30 // The OCID of the compartment containing the zone.
31 CompartmentId *string `mandatory:"true" json:"compartmentId"`
32 33 // The scope of the zone.
34 Scope ScopeEnum `mandatory:"true" json:"scope"`
35 36 // Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace.
37 // For more information, see Resource Tags (https://docs.oracle.com/iaas/Content/General/Concepts/resourcetags.htm).
38 //
39 // **Example:** `{"Department": "Finance"}`
40 FreeformTags map[string]string `mandatory:"true" json:"freeformTags"`
41 42 // Defined tags for this resource. Each key is predefined and scoped to a namespace.
43 // For more information, see Resource Tags (https://docs.oracle.com/iaas/Content/General/Concepts/resourcetags.htm).
44 //
45 // **Example:** `{"Operations": {"CostCenter": "42"}}`
46 DefinedTags map[string]map[string]interface{} `mandatory:"true" json:"definedTags"`
47 48 // The state of DNSSEC on the zone.
49 // For DNSSEC to function, every parent zone in the DNS tree up to the top-level domain (or an independent
50 // trust anchor) must also have DNSSEC correctly set up.
51 // After enabling DNSSEC, you must add a DS record to the zone's parent zone containing the
52 // `KskDnssecKeyVersion` data. You can find the DS data in the `dsData` attribute of the `KskDnssecKeyVersion`.
53 // Then, use the `PromoteZoneDnssecKeyVersion` operation to promote the `KskDnssecKeyVersion`.
54 // New `KskDnssecKeyVersion`s are generated annually, a week before the existing `KskDnssecKeyVersion`'s expiration.
55 // To rollover a `KskDnssecKeyVersion`, you must replace the parent zone's DS record containing the old
56 // `KskDnssecKeyVersion` data with the data from the new `KskDnssecKeyVersion`.
57 // To remove the old DS record without causing service disruption, wait until the old DS record's TTL has
58 // expired, and the new DS record has propagated. After the DS replacement has been completed, then the
59 // `PromoteZoneDnssecKeyVersion` operation must be called.
60 // Metrics are emitted in the `oci_dns` namespace daily for each `KskDnssecKeyVersion` indicating how many
61 // days are left until expiration.
62 // We recommend that you set up alarms and notifications for KskDnssecKeyVersion expiration so that the
63 // necessary parent zone updates can be made and the `PromoteZoneDnssecKeyVersion` operation can be called.
64 // Enabling DNSSEC results in additional records in DNS responses which increases their size and can
65 // cause higher response latency.
66 // For more information, see DNSSEC (https://docs.oracle.com/iaas/Content/DNS/Concepts/dnssec.htm).
67 DnssecState ZoneDnssecStateEnum `mandatory:"true" json:"dnssecState"`
68 69 // External master servers for the zone. `externalMasters` becomes a
70 // required parameter when the `zoneType` value is `SECONDARY`.
71 ExternalMasters []ExternalMaster `mandatory:"true" json:"externalMasters"`
72 73 // External secondary servers for the zone.
74 // This field is currently not supported when `zoneType` is `SECONDARY` or `scope` is `PRIVATE`.
75 ExternalDownstreams []ExternalDownstream `mandatory:"true" json:"externalDownstreams"`
76 77 // The canonical absolute URL of the resource.
78 Self *string `mandatory:"true" json:"self"`
79 80 // The OCID of the zone.
81 Id *string `mandatory:"true" json:"id"`
82 83 // The date and time the resource was created in "YYYY-MM-ddThh:mm:ssZ" format
84 // with a Z offset, as defined by RFC 3339.
85 // **Example:** `2016-07-22T17:23:59:60Z`
86 TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"`
87 88 // Version is the never-repeating, totally-orderable, version of the
89 // zone, from which the serial field of the zone's SOA record is
90 // derived.
91 Version *string `mandatory:"true" json:"version"`
92 93 // The current serial of the zone. As seen in the zone's SOA record.
94 Serial *int64 `mandatory:"true" json:"serial"`
95 96 // The current state of the zone resource.
97 LifecycleState ZoneLifecycleStateEnum `mandatory:"true" json:"lifecycleState"`
98 99 // A Boolean flag indicating whether or not parts of the resource are unable to be explicitly managed.
100 IsProtected *bool `mandatory:"true" json:"isProtected"`
101 102 // The authoritative nameservers for the zone.
103 Nameservers []Nameserver `mandatory:"true" json:"nameservers"`
104 105 // The OCID of the private view containing the zone. This value will
106 // be null for zones in the global DNS, which are publicly resolvable and
107 // not part of a private view.
108 ViewId *string `mandatory:"false" json:"viewId"`
109 110 DnssecConfig *DnssecConfig `mandatory:"false" json:"dnssecConfig"`
111 112 // The OCI nameservers that transfer the zone data with external nameservers.
113 ZoneTransferServers []ZoneTransferServer `mandatory:"false" json:"zoneTransferServers"`
114 }
115 116 func (m Zone) String() string {
117 return common.PointerString(m)
118 }
119 120 // ValidateEnumValue returns an error when providing an unsupported enum value
121 // This function is being called during constructing API request process
122 // Not recommended for calling this function directly
123 func (m Zone) ValidateEnumValue() (bool, error) {
124 errMessage := []string{}
125 if _, ok := GetMappingZoneZoneTypeEnum(string(m.ZoneType)); !ok && m.ZoneType != "" {
126 errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for ZoneType: %s. Supported values are: %s.", m.ZoneType, strings.Join(GetZoneZoneTypeEnumStringValues(), ",")))
127 }
128 if _, ok := GetMappingScopeEnum(string(m.Scope)); !ok && m.Scope != "" {
129 errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Scope: %s. Supported values are: %s.", m.Scope, strings.Join(GetScopeEnumStringValues(), ",")))
130 }
131 if _, ok := GetMappingZoneDnssecStateEnum(string(m.DnssecState)); !ok && m.DnssecState != "" {
132 errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for DnssecState: %s. Supported values are: %s.", m.DnssecState, strings.Join(GetZoneDnssecStateEnumStringValues(), ",")))
133 }
134 if _, ok := GetMappingZoneLifecycleStateEnum(string(m.LifecycleState)); !ok && m.LifecycleState != "" {
135 errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for LifecycleState: %s. Supported values are: %s.", m.LifecycleState, strings.Join(GetZoneLifecycleStateEnumStringValues(), ",")))
136 }
137 138 if len(errMessage) > 0 {
139 return true, fmt.Errorf("%s", strings.Join(errMessage, "\n"))
140 }
141 return false, nil
142 }
143 144 // ZoneZoneTypeEnum Enum with underlying type: string
145 type ZoneZoneTypeEnum string
146 147 // Set of constants representing the allowable values for ZoneZoneTypeEnum
148 const (
149 ZoneZoneTypePrimary ZoneZoneTypeEnum = "PRIMARY"
150 ZoneZoneTypeSecondary ZoneZoneTypeEnum = "SECONDARY"
151 )
152 153 var mappingZoneZoneTypeEnum = map[string]ZoneZoneTypeEnum{
154 "PRIMARY": ZoneZoneTypePrimary,
155 "SECONDARY": ZoneZoneTypeSecondary,
156 }
157 158 var mappingZoneZoneTypeEnumLowerCase = map[string]ZoneZoneTypeEnum{
159 "primary": ZoneZoneTypePrimary,
160 "secondary": ZoneZoneTypeSecondary,
161 }
162 163 // GetZoneZoneTypeEnumValues Enumerates the set of values for ZoneZoneTypeEnum
164 func GetZoneZoneTypeEnumValues() []ZoneZoneTypeEnum {
165 values := make([]ZoneZoneTypeEnum, 0)
166 for _, v := range mappingZoneZoneTypeEnum {
167 values = append(values, v)
168 }
169 return values
170 }
171 172 // GetZoneZoneTypeEnumStringValues Enumerates the set of values in String for ZoneZoneTypeEnum
173 func GetZoneZoneTypeEnumStringValues() []string {
174 return []string{
175 "PRIMARY",
176 "SECONDARY",
177 }
178 }
179 180 // GetMappingZoneZoneTypeEnum performs case Insensitive comparison on enum value and return the desired enum
181 func GetMappingZoneZoneTypeEnum(val string) (ZoneZoneTypeEnum, bool) {
182 enum, ok := mappingZoneZoneTypeEnumLowerCase[strings.ToLower(val)]
183 return enum, ok
184 }
185 186 // ZoneLifecycleStateEnum Enum with underlying type: string
187 type ZoneLifecycleStateEnum string
188 189 // Set of constants representing the allowable values for ZoneLifecycleStateEnum
190 const (
191 ZoneLifecycleStateActive ZoneLifecycleStateEnum = "ACTIVE"
192 ZoneLifecycleStateCreating ZoneLifecycleStateEnum = "CREATING"
193 ZoneLifecycleStateDeleted ZoneLifecycleStateEnum = "DELETED"
194 ZoneLifecycleStateDeleting ZoneLifecycleStateEnum = "DELETING"
195 ZoneLifecycleStateFailed ZoneLifecycleStateEnum = "FAILED"
196 ZoneLifecycleStateUpdating ZoneLifecycleStateEnum = "UPDATING"
197 )
198 199 var mappingZoneLifecycleStateEnum = map[string]ZoneLifecycleStateEnum{
200 "ACTIVE": ZoneLifecycleStateActive,
201 "CREATING": ZoneLifecycleStateCreating,
202 "DELETED": ZoneLifecycleStateDeleted,
203 "DELETING": ZoneLifecycleStateDeleting,
204 "FAILED": ZoneLifecycleStateFailed,
205 "UPDATING": ZoneLifecycleStateUpdating,
206 }
207 208 var mappingZoneLifecycleStateEnumLowerCase = map[string]ZoneLifecycleStateEnum{
209 "active": ZoneLifecycleStateActive,
210 "creating": ZoneLifecycleStateCreating,
211 "deleted": ZoneLifecycleStateDeleted,
212 "deleting": ZoneLifecycleStateDeleting,
213 "failed": ZoneLifecycleStateFailed,
214 "updating": ZoneLifecycleStateUpdating,
215 }
216 217 // GetZoneLifecycleStateEnumValues Enumerates the set of values for ZoneLifecycleStateEnum
218 func GetZoneLifecycleStateEnumValues() []ZoneLifecycleStateEnum {
219 values := make([]ZoneLifecycleStateEnum, 0)
220 for _, v := range mappingZoneLifecycleStateEnum {
221 values = append(values, v)
222 }
223 return values
224 }
225 226 // GetZoneLifecycleStateEnumStringValues Enumerates the set of values in String for ZoneLifecycleStateEnum
227 func GetZoneLifecycleStateEnumStringValues() []string {
228 return []string{
229 "ACTIVE",
230 "CREATING",
231 "DELETED",
232 "DELETING",
233 "FAILED",
234 "UPDATING",
235 }
236 }
237 238 // GetMappingZoneLifecycleStateEnum performs case Insensitive comparison on enum value and return the desired enum
239 func GetMappingZoneLifecycleStateEnum(val string) (ZoneLifecycleStateEnum, bool) {
240 enum, ok := mappingZoneLifecycleStateEnumLowerCase[strings.ToLower(val)]
241 return enum, ok
242 }
243