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 // CreateZoneBaseDetails The body for either defining a new zone or migrating a zone from migrationSource. This is determined by the migrationSource discriminator.
22 // NONE indicates creation of a new zone (default). DYNECT indicates migration from a DynECT zone.
23 // **Warning:** Oracle recommends that you avoid using any confidential information when you supply string values using the API.
24 type CreateZoneBaseDetails interface {
25 26 // The name of the zone.
27 // Global zone names must be unique across all other zones within the realm. Private zone names must be unique
28 // within their view.
29 // Unicode characters will be converted into punycode, see RFC 3492 (https://tools.ietf.org/html/rfc3492).
30 GetName() *string
31 32 // The OCID of the compartment containing the zone.
33 GetCompartmentId() *string
34 35 // Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace.
36 // For more information, see Resource Tags (https://docs.oracle.com/iaas/Content/General/Concepts/resourcetags.htm).
37 //
38 // **Example:** `{"Department": "Finance"}`
39 GetFreeformTags() map[string]string
40 41 // Defined tags for this resource. Each key is predefined and scoped to a namespace.
42 // For more information, see Resource Tags (https://docs.oracle.com/iaas/Content/General/Concepts/resourcetags.htm).
43 //
44 // **Example:** `{"Operations": {"CostCenter": "42"}}`
45 GetDefinedTags() map[string]map[string]interface{}
46 }
47 48 type createzonebasedetails struct {
49 JsonData []byte
50 FreeformTags map[string]string `mandatory:"false" json:"freeformTags"`
51 DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"`
52 Name *string `mandatory:"true" json:"name"`
53 CompartmentId *string `mandatory:"true" json:"compartmentId"`
54 MigrationSource string `json:"migrationSource"`
55 }
56 57 // UnmarshalJSON unmarshals json
58 func (m *createzonebasedetails) UnmarshalJSON(data []byte) error {
59 m.JsonData = data
60 type Unmarshalercreatezonebasedetails createzonebasedetails
61 s := struct {
62 Model Unmarshalercreatezonebasedetails
63 }{}
64 err := json.Unmarshal(data, &s.Model)
65 if err != nil {
66 return err
67 }
68 m.Name = s.Model.Name
69 m.CompartmentId = s.Model.CompartmentId
70 m.FreeformTags = s.Model.FreeformTags
71 m.DefinedTags = s.Model.DefinedTags
72 m.MigrationSource = s.Model.MigrationSource
73 74 return err
75 }
76 77 // UnmarshalPolymorphicJSON unmarshals polymorphic json
78 func (m *createzonebasedetails) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) {
79 80 if data == nil || string(data) == "null" {
81 return nil, nil
82 }
83 84 var err error
85 switch m.MigrationSource {
86 case "NONE":
87 mm := CreateZoneDetails{}
88 err = json.Unmarshal(data, &mm)
89 return mm, err
90 case "DYNECT":
91 mm := CreateMigratedDynectZoneDetails{}
92 err = json.Unmarshal(data, &mm)
93 return mm, err
94 default:
95 common.Logf("Received unsupported enum value for CreateZoneBaseDetails: %s.", m.MigrationSource)
96 return *m, nil
97 }
98 }
99 100 // GetFreeformTags returns FreeformTags
101 func (m createzonebasedetails) GetFreeformTags() map[string]string {
102 return m.FreeformTags
103 }
104 105 // GetDefinedTags returns DefinedTags
106 func (m createzonebasedetails) GetDefinedTags() map[string]map[string]interface{} {
107 return m.DefinedTags
108 }
109 110 // GetName returns Name
111 func (m createzonebasedetails) GetName() *string {
112 return m.Name
113 }
114 115 // GetCompartmentId returns CompartmentId
116 func (m createzonebasedetails) GetCompartmentId() *string {
117 return m.CompartmentId
118 }
119 120 func (m createzonebasedetails) String() string {
121 return common.PointerString(m)
122 }
123 124 // ValidateEnumValue returns an error when providing an unsupported enum value
125 // This function is being called during constructing API request process
126 // Not recommended for calling this function directly
127 func (m createzonebasedetails) ValidateEnumValue() (bool, error) {
128 errMessage := []string{}
129 130 if len(errMessage) > 0 {
131 return true, fmt.Errorf("%s", strings.Join(errMessage, "\n"))
132 }
133 return false, nil
134 }
135 136 // CreateZoneBaseDetailsMigrationSourceEnum Enum with underlying type: string
137 type CreateZoneBaseDetailsMigrationSourceEnum string
138 139 // Set of constants representing the allowable values for CreateZoneBaseDetailsMigrationSourceEnum
140 const (
141 CreateZoneBaseDetailsMigrationSourceNone CreateZoneBaseDetailsMigrationSourceEnum = "NONE"
142 CreateZoneBaseDetailsMigrationSourceDynect CreateZoneBaseDetailsMigrationSourceEnum = "DYNECT"
143 )
144 145 var mappingCreateZoneBaseDetailsMigrationSourceEnum = map[string]CreateZoneBaseDetailsMigrationSourceEnum{
146 "NONE": CreateZoneBaseDetailsMigrationSourceNone,
147 "DYNECT": CreateZoneBaseDetailsMigrationSourceDynect,
148 }
149 150 var mappingCreateZoneBaseDetailsMigrationSourceEnumLowerCase = map[string]CreateZoneBaseDetailsMigrationSourceEnum{
151 "none": CreateZoneBaseDetailsMigrationSourceNone,
152 "dynect": CreateZoneBaseDetailsMigrationSourceDynect,
153 }
154 155 // GetCreateZoneBaseDetailsMigrationSourceEnumValues Enumerates the set of values for CreateZoneBaseDetailsMigrationSourceEnum
156 func GetCreateZoneBaseDetailsMigrationSourceEnumValues() []CreateZoneBaseDetailsMigrationSourceEnum {
157 values := make([]CreateZoneBaseDetailsMigrationSourceEnum, 0)
158 for _, v := range mappingCreateZoneBaseDetailsMigrationSourceEnum {
159 values = append(values, v)
160 }
161 return values
162 }
163 164 // GetCreateZoneBaseDetailsMigrationSourceEnumStringValues Enumerates the set of values in String for CreateZoneBaseDetailsMigrationSourceEnum
165 func GetCreateZoneBaseDetailsMigrationSourceEnumStringValues() []string {
166 return []string{
167 "NONE",
168 "DYNECT",
169 }
170 }
171 172 // GetMappingCreateZoneBaseDetailsMigrationSourceEnum performs case Insensitive comparison on enum value and return the desired enum
173 func GetMappingCreateZoneBaseDetailsMigrationSourceEnum(val string) (CreateZoneBaseDetailsMigrationSourceEnum, bool) {
174 enum, ok := mappingCreateZoneBaseDetailsMigrationSourceEnumLowerCase[strings.ToLower(val)]
175 return enum, ok
176 }
177