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 "encoding/json"
15 "fmt"
16 "strings"
17 18 "github.com/nrdcg/oci-go-sdk/common/v1065"
19 )
20 21 // CreateZoneDetails The body for defining a new zone.
22 // **Warning:** Oracle recommends that you avoid using any confidential information when you supply string values using the API.
23 type CreateZoneDetails struct {
24 25 // The name of the zone.
26 // Global zone names must be unique across all other zones within the realm. Private zone names must be unique
27 // within their view.
28 // Unicode characters will be converted into punycode, see RFC 3492 (https://tools.ietf.org/html/rfc3492).
29 Name *string `mandatory:"true" json:"name"`
30 31 // The OCID of the compartment containing the zone.
32 CompartmentId *string `mandatory:"true" json:"compartmentId"`
33 34 // Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace.
35 // For more information, see Resource Tags (https://docs.oracle.com/iaas/Content/General/Concepts/resourcetags.htm).
36 //
37 // **Example:** `{"Department": "Finance"}`
38 FreeformTags map[string]string `mandatory:"false" json:"freeformTags"`
39 40 // Defined tags for this resource. Each key is predefined and scoped to a namespace.
41 // For more information, see Resource Tags (https://docs.oracle.com/iaas/Content/General/Concepts/resourcetags.htm).
42 //
43 // **Example:** `{"Operations": {"CostCenter": "42"}}`
44 DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"`
45 46 // This value will be null for zones in the global DNS.
47 ViewId *string `mandatory:"false" json:"viewId"`
48 49 // External master servers for the zone. `externalMasters` becomes a
50 // required parameter when the `zoneType` value is `SECONDARY`.
51 ExternalMasters []ExternalMaster `mandatory:"false" json:"externalMasters"`
52 53 // External secondary servers for the zone.
54 // This field is currently not supported when `zoneType` is `SECONDARY` or `scope` is `PRIVATE`.
55 ExternalDownstreams []ExternalDownstream `mandatory:"false" json:"externalDownstreams"`
56 57 // The type of the zone. Must be either `PRIMARY` or `SECONDARY`. `SECONDARY` is only supported for GLOBAL
58 // zones.
59 ZoneType CreateZoneDetailsZoneTypeEnum `mandatory:"false" json:"zoneType,omitempty"`
60 61 // The scope of the zone.
62 Scope ScopeEnum `mandatory:"false" json:"scope,omitempty"`
63 64 // The state of DNSSEC on the zone.
65 // For DNSSEC to function, every parent zone in the DNS tree up to the top-level domain (or an independent
66 // trust anchor) must also have DNSSEC correctly set up.
67 // After enabling DNSSEC, you must add a DS record to the zone's parent zone containing the
68 // `KskDnssecKeyVersion` data. You can find the DS data in the `dsData` attribute of the `KskDnssecKeyVersion`.
69 // Then, use the `PromoteZoneDnssecKeyVersion` operation to promote the `KskDnssecKeyVersion`.
70 // New `KskDnssecKeyVersion`s are generated annually, a week before the existing `KskDnssecKeyVersion`'s expiration.
71 // To rollover a `KskDnssecKeyVersion`, you must replace the parent zone's DS record containing the old
72 // `KskDnssecKeyVersion` data with the data from the new `KskDnssecKeyVersion`.
73 // To remove the old DS record without causing service disruption, wait until the old DS record's TTL has
74 // expired, and the new DS record has propagated. After the DS replacement has been completed, then the
75 // `PromoteZoneDnssecKeyVersion` operation must be called.
76 // Metrics are emitted in the `oci_dns` namespace daily for each `KskDnssecKeyVersion` indicating how many
77 // days are left until expiration.
78 // We recommend that you set up alarms and notifications for KskDnssecKeyVersion expiration so that the
79 // necessary parent zone updates can be made and the `PromoteZoneDnssecKeyVersion` operation can be called.
80 // Enabling DNSSEC results in additional records in DNS responses which increases their size and can
81 // cause higher response latency.
82 // For more information, see DNSSEC (https://docs.oracle.com/iaas/Content/DNS/Concepts/dnssec.htm).
83 DnssecState ZoneDnssecStateEnum `mandatory:"false" json:"dnssecState,omitempty"`
84 }
85 86 // GetName returns Name
87 func (m CreateZoneDetails) GetName() *string {
88 return m.Name
89 }
90 91 // GetCompartmentId returns CompartmentId
92 func (m CreateZoneDetails) GetCompartmentId() *string {
93 return m.CompartmentId
94 }
95 96 // GetFreeformTags returns FreeformTags
97 func (m CreateZoneDetails) GetFreeformTags() map[string]string {
98 return m.FreeformTags
99 }
100 101 // GetDefinedTags returns DefinedTags
102 func (m CreateZoneDetails) GetDefinedTags() map[string]map[string]interface{} {
103 return m.DefinedTags
104 }
105 106 func (m CreateZoneDetails) String() string {
107 return common.PointerString(m)
108 }
109 110 // ValidateEnumValue returns an error when providing an unsupported enum value
111 // This function is being called during constructing API request process
112 // Not recommended for calling this function directly
113 func (m CreateZoneDetails) ValidateEnumValue() (bool, error) {
114 errMessage := []string{}
115 if _, ok := GetMappingCreateZoneDetailsZoneTypeEnum(string(m.ZoneType)); !ok && m.ZoneType != "" {
116 errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for ZoneType: %s. Supported values are: %s.", m.ZoneType, strings.Join(GetCreateZoneDetailsZoneTypeEnumStringValues(), ",")))
117 }
118 119 if _, ok := GetMappingScopeEnum(string(m.Scope)); !ok && m.Scope != "" {
120 errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Scope: %s. Supported values are: %s.", m.Scope, strings.Join(GetScopeEnumStringValues(), ",")))
121 }
122 if _, ok := GetMappingZoneDnssecStateEnum(string(m.DnssecState)); !ok && m.DnssecState != "" {
123 errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for DnssecState: %s. Supported values are: %s.", m.DnssecState, strings.Join(GetZoneDnssecStateEnumStringValues(), ",")))
124 }
125 if len(errMessage) > 0 {
126 return true, fmt.Errorf("%s", strings.Join(errMessage, "\n"))
127 }
128 return false, nil
129 }
130 131 // MarshalJSON marshals to json representation
132 func (m CreateZoneDetails) MarshalJSON() (buff []byte, e error) {
133 type MarshalTypeCreateZoneDetails CreateZoneDetails
134 s := struct {
135 DiscriminatorParam string `json:"migrationSource"`
136 MarshalTypeCreateZoneDetails
137 }{
138 "NONE",
139 (MarshalTypeCreateZoneDetails)(m),
140 }
141 142 return json.Marshal(&s)
143 }
144 145 // CreateZoneDetailsZoneTypeEnum Enum with underlying type: string
146 type CreateZoneDetailsZoneTypeEnum string
147 148 // Set of constants representing the allowable values for CreateZoneDetailsZoneTypeEnum
149 const (
150 CreateZoneDetailsZoneTypePrimary CreateZoneDetailsZoneTypeEnum = "PRIMARY"
151 CreateZoneDetailsZoneTypeSecondary CreateZoneDetailsZoneTypeEnum = "SECONDARY"
152 )
153 154 var mappingCreateZoneDetailsZoneTypeEnum = map[string]CreateZoneDetailsZoneTypeEnum{
155 "PRIMARY": CreateZoneDetailsZoneTypePrimary,
156 "SECONDARY": CreateZoneDetailsZoneTypeSecondary,
157 }
158 159 var mappingCreateZoneDetailsZoneTypeEnumLowerCase = map[string]CreateZoneDetailsZoneTypeEnum{
160 "primary": CreateZoneDetailsZoneTypePrimary,
161 "secondary": CreateZoneDetailsZoneTypeSecondary,
162 }
163 164 // GetCreateZoneDetailsZoneTypeEnumValues Enumerates the set of values for CreateZoneDetailsZoneTypeEnum
165 func GetCreateZoneDetailsZoneTypeEnumValues() []CreateZoneDetailsZoneTypeEnum {
166 values := make([]CreateZoneDetailsZoneTypeEnum, 0)
167 for _, v := range mappingCreateZoneDetailsZoneTypeEnum {
168 values = append(values, v)
169 }
170 return values
171 }
172 173 // GetCreateZoneDetailsZoneTypeEnumStringValues Enumerates the set of values in String for CreateZoneDetailsZoneTypeEnum
174 func GetCreateZoneDetailsZoneTypeEnumStringValues() []string {
175 return []string{
176 "PRIMARY",
177 "SECONDARY",
178 }
179 }
180 181 // GetMappingCreateZoneDetailsZoneTypeEnum performs case Insensitive comparison on enum value and return the desired enum
182 func GetMappingCreateZoneDetailsZoneTypeEnum(val string) (CreateZoneDetailsZoneTypeEnum, bool) {
183 enum, ok := mappingCreateZoneDetailsZoneTypeEnumLowerCase[strings.ToLower(val)]
184 return enum, ok
185 }
186