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 // ResolverEndpoint An OCI DNS resolver endpoint.
22 // **Warning:** Oracle recommends that you avoid using any confidential information when you supply string values using the API.
23 type ResolverEndpoint interface {
24 25 // The name of the resolver endpoint. Must be unique, case-insensitive, within the resolver.
26 GetName() *string
27 28 // A Boolean flag indicating whether or not the resolver endpoint is for forwarding.
29 GetIsForwarding() *bool
30 31 // A Boolean flag indicating whether or not the resolver endpoint is for listening.
32 GetIsListening() *bool
33 34 // The OCID of the owning compartment. This will match the resolver that the resolver endpoint is under
35 // and will be updated if the resolver's compartment is changed.
36 GetCompartmentId() *string
37 38 // The date and time the resource was created in "YYYY-MM-ddThh:mm:ssZ" format
39 // with a Z offset, as defined by RFC 3339.
40 // **Example:** `2016-07-22T17:23:59:60Z`
41 GetTimeCreated() *common.SDKTime
42 43 // The date and time the resource was last updated in "YYYY-MM-ddThh:mm:ssZ"
44 // format with a Z offset, as defined by RFC 3339.
45 // **Example:** `2016-07-22T17:23:59:60Z`
46 GetTimeUpdated() *common.SDKTime
47 48 // The current state of the resource.
49 GetLifecycleState() ResolverEndpointLifecycleStateEnum
50 51 // The canonical absolute URL of the resource.
52 GetSelf() *string
53 54 // An IP address from which forwarded queries may be sent. For VNIC endpoints, this IP address must be part
55 // of the subnet and will be assigned by the system if unspecified when isForwarding is true.
56 GetForwardingAddress() *string
57 58 // An IP address to listen to queries on. For VNIC endpoints this IP address must be part of the
59 // subnet and will be assigned by the system if unspecified when isListening is true.
60 GetListeningAddress() *string
61 }
62 63 type resolverendpoint struct {
64 JsonData []byte
65 ForwardingAddress *string `mandatory:"false" json:"forwardingAddress"`
66 ListeningAddress *string `mandatory:"false" json:"listeningAddress"`
67 Name *string `mandatory:"true" json:"name"`
68 IsForwarding *bool `mandatory:"true" json:"isForwarding"`
69 IsListening *bool `mandatory:"true" json:"isListening"`
70 CompartmentId *string `mandatory:"true" json:"compartmentId"`
71 TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"`
72 TimeUpdated *common.SDKTime `mandatory:"true" json:"timeUpdated"`
73 LifecycleState ResolverEndpointLifecycleStateEnum `mandatory:"true" json:"lifecycleState"`
74 Self *string `mandatory:"true" json:"self"`
75 EndpointType string `json:"endpointType"`
76 }
77 78 // UnmarshalJSON unmarshals json
79 func (m *resolverendpoint) UnmarshalJSON(data []byte) error {
80 m.JsonData = data
81 type Unmarshalerresolverendpoint resolverendpoint
82 s := struct {
83 Model Unmarshalerresolverendpoint
84 }{}
85 err := json.Unmarshal(data, &s.Model)
86 if err != nil {
87 return err
88 }
89 m.Name = s.Model.Name
90 m.IsForwarding = s.Model.IsForwarding
91 m.IsListening = s.Model.IsListening
92 m.CompartmentId = s.Model.CompartmentId
93 m.TimeCreated = s.Model.TimeCreated
94 m.TimeUpdated = s.Model.TimeUpdated
95 m.LifecycleState = s.Model.LifecycleState
96 m.Self = s.Model.Self
97 m.ForwardingAddress = s.Model.ForwardingAddress
98 m.ListeningAddress = s.Model.ListeningAddress
99 m.EndpointType = s.Model.EndpointType
100 101 return err
102 }
103 104 // UnmarshalPolymorphicJSON unmarshals polymorphic json
105 func (m *resolverendpoint) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) {
106 107 if data == nil || string(data) == "null" {
108 return nil, nil
109 }
110 111 var err error
112 switch m.EndpointType {
113 case "VNIC":
114 mm := ResolverVnicEndpoint{}
115 err = json.Unmarshal(data, &mm)
116 return mm, err
117 default:
118 common.Logf("Received unsupported enum value for ResolverEndpoint: %s.", m.EndpointType)
119 return *m, nil
120 }
121 }
122 123 // GetForwardingAddress returns ForwardingAddress
124 func (m resolverendpoint) GetForwardingAddress() *string {
125 return m.ForwardingAddress
126 }
127 128 // GetListeningAddress returns ListeningAddress
129 func (m resolverendpoint) GetListeningAddress() *string {
130 return m.ListeningAddress
131 }
132 133 // GetName returns Name
134 func (m resolverendpoint) GetName() *string {
135 return m.Name
136 }
137 138 // GetIsForwarding returns IsForwarding
139 func (m resolverendpoint) GetIsForwarding() *bool {
140 return m.IsForwarding
141 }
142 143 // GetIsListening returns IsListening
144 func (m resolverendpoint) GetIsListening() *bool {
145 return m.IsListening
146 }
147 148 // GetCompartmentId returns CompartmentId
149 func (m resolverendpoint) GetCompartmentId() *string {
150 return m.CompartmentId
151 }
152 153 // GetTimeCreated returns TimeCreated
154 func (m resolverendpoint) GetTimeCreated() *common.SDKTime {
155 return m.TimeCreated
156 }
157 158 // GetTimeUpdated returns TimeUpdated
159 func (m resolverendpoint) GetTimeUpdated() *common.SDKTime {
160 return m.TimeUpdated
161 }
162 163 // GetLifecycleState returns LifecycleState
164 func (m resolverendpoint) GetLifecycleState() ResolverEndpointLifecycleStateEnum {
165 return m.LifecycleState
166 }
167 168 // GetSelf returns Self
169 func (m resolverendpoint) GetSelf() *string {
170 return m.Self
171 }
172 173 func (m resolverendpoint) String() string {
174 return common.PointerString(m)
175 }
176 177 // ValidateEnumValue returns an error when providing an unsupported enum value
178 // This function is being called during constructing API request process
179 // Not recommended for calling this function directly
180 func (m resolverendpoint) ValidateEnumValue() (bool, error) {
181 errMessage := []string{}
182 if _, ok := GetMappingResolverEndpointLifecycleStateEnum(string(m.LifecycleState)); !ok && m.LifecycleState != "" {
183 errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for LifecycleState: %s. Supported values are: %s.", m.LifecycleState, strings.Join(GetResolverEndpointLifecycleStateEnumStringValues(), ",")))
184 }
185 186 if len(errMessage) > 0 {
187 return true, fmt.Errorf("%s", strings.Join(errMessage, "\n"))
188 }
189 return false, nil
190 }
191 192 // ResolverEndpointLifecycleStateEnum Enum with underlying type: string
193 type ResolverEndpointLifecycleStateEnum string
194 195 // Set of constants representing the allowable values for ResolverEndpointLifecycleStateEnum
196 const (
197 ResolverEndpointLifecycleStateActive ResolverEndpointLifecycleStateEnum = "ACTIVE"
198 ResolverEndpointLifecycleStateCreating ResolverEndpointLifecycleStateEnum = "CREATING"
199 ResolverEndpointLifecycleStateDeleted ResolverEndpointLifecycleStateEnum = "DELETED"
200 ResolverEndpointLifecycleStateDeleting ResolverEndpointLifecycleStateEnum = "DELETING"
201 ResolverEndpointLifecycleStateFailed ResolverEndpointLifecycleStateEnum = "FAILED"
202 ResolverEndpointLifecycleStateUpdating ResolverEndpointLifecycleStateEnum = "UPDATING"
203 )
204 205 var mappingResolverEndpointLifecycleStateEnum = map[string]ResolverEndpointLifecycleStateEnum{
206 "ACTIVE": ResolverEndpointLifecycleStateActive,
207 "CREATING": ResolverEndpointLifecycleStateCreating,
208 "DELETED": ResolverEndpointLifecycleStateDeleted,
209 "DELETING": ResolverEndpointLifecycleStateDeleting,
210 "FAILED": ResolverEndpointLifecycleStateFailed,
211 "UPDATING": ResolverEndpointLifecycleStateUpdating,
212 }
213 214 var mappingResolverEndpointLifecycleStateEnumLowerCase = map[string]ResolverEndpointLifecycleStateEnum{
215 "active": ResolverEndpointLifecycleStateActive,
216 "creating": ResolverEndpointLifecycleStateCreating,
217 "deleted": ResolverEndpointLifecycleStateDeleted,
218 "deleting": ResolverEndpointLifecycleStateDeleting,
219 "failed": ResolverEndpointLifecycleStateFailed,
220 "updating": ResolverEndpointLifecycleStateUpdating,
221 }
222 223 // GetResolverEndpointLifecycleStateEnumValues Enumerates the set of values for ResolverEndpointLifecycleStateEnum
224 func GetResolverEndpointLifecycleStateEnumValues() []ResolverEndpointLifecycleStateEnum {
225 values := make([]ResolverEndpointLifecycleStateEnum, 0)
226 for _, v := range mappingResolverEndpointLifecycleStateEnum {
227 values = append(values, v)
228 }
229 return values
230 }
231 232 // GetResolverEndpointLifecycleStateEnumStringValues Enumerates the set of values in String for ResolverEndpointLifecycleStateEnum
233 func GetResolverEndpointLifecycleStateEnumStringValues() []string {
234 return []string{
235 "ACTIVE",
236 "CREATING",
237 "DELETED",
238 "DELETING",
239 "FAILED",
240 "UPDATING",
241 }
242 }
243 244 // GetMappingResolverEndpointLifecycleStateEnum performs case Insensitive comparison on enum value and return the desired enum
245 func GetMappingResolverEndpointLifecycleStateEnum(val string) (ResolverEndpointLifecycleStateEnum, bool) {
246 enum, ok := mappingResolverEndpointLifecycleStateEnumLowerCase[strings.ToLower(val)]
247 return enum, ok
248 }
249 250 // ResolverEndpointEndpointTypeEnum Enum with underlying type: string
251 type ResolverEndpointEndpointTypeEnum string
252 253 // Set of constants representing the allowable values for ResolverEndpointEndpointTypeEnum
254 const (
255 ResolverEndpointEndpointTypeVnic ResolverEndpointEndpointTypeEnum = "VNIC"
256 )
257 258 var mappingResolverEndpointEndpointTypeEnum = map[string]ResolverEndpointEndpointTypeEnum{
259 "VNIC": ResolverEndpointEndpointTypeVnic,
260 }
261 262 var mappingResolverEndpointEndpointTypeEnumLowerCase = map[string]ResolverEndpointEndpointTypeEnum{
263 "vnic": ResolverEndpointEndpointTypeVnic,
264 }
265 266 // GetResolverEndpointEndpointTypeEnumValues Enumerates the set of values for ResolverEndpointEndpointTypeEnum
267 func GetResolverEndpointEndpointTypeEnumValues() []ResolverEndpointEndpointTypeEnum {
268 values := make([]ResolverEndpointEndpointTypeEnum, 0)
269 for _, v := range mappingResolverEndpointEndpointTypeEnum {
270 values = append(values, v)
271 }
272 return values
273 }
274 275 // GetResolverEndpointEndpointTypeEnumStringValues Enumerates the set of values in String for ResolverEndpointEndpointTypeEnum
276 func GetResolverEndpointEndpointTypeEnumStringValues() []string {
277 return []string{
278 "VNIC",
279 }
280 }
281 282 // GetMappingResolverEndpointEndpointTypeEnum performs case Insensitive comparison on enum value and return the desired enum
283 func GetMappingResolverEndpointEndpointTypeEnum(val string) (ResolverEndpointEndpointTypeEnum, bool) {
284 enum, ok := mappingResolverEndpointEndpointTypeEnumLowerCase[strings.ToLower(val)]
285 return enum, ok
286 }
287