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 // ResolverEndpointSummary 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 ResolverEndpointSummary 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() ResolverEndpointSummaryLifecycleStateEnum
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 resolverendpointsummary 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 ResolverEndpointSummaryLifecycleStateEnum `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 *resolverendpointsummary) UnmarshalJSON(data []byte) error {
80 m.JsonData = data
81 type Unmarshalerresolverendpointsummary resolverendpointsummary
82 s := struct {
83 Model Unmarshalerresolverendpointsummary
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 *resolverendpointsummary) 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 := ResolverVnicEndpointSummary{}
115 err = json.Unmarshal(data, &mm)
116 return mm, err
117 default:
118 common.Logf("Received unsupported enum value for ResolverEndpointSummary: %s.", m.EndpointType)
119 return *m, nil
120 }
121 }
122 123 // GetForwardingAddress returns ForwardingAddress
124 func (m resolverendpointsummary) GetForwardingAddress() *string {
125 return m.ForwardingAddress
126 }
127 128 // GetListeningAddress returns ListeningAddress
129 func (m resolverendpointsummary) GetListeningAddress() *string {
130 return m.ListeningAddress
131 }
132 133 // GetName returns Name
134 func (m resolverendpointsummary) GetName() *string {
135 return m.Name
136 }
137 138 // GetIsForwarding returns IsForwarding
139 func (m resolverendpointsummary) GetIsForwarding() *bool {
140 return m.IsForwarding
141 }
142 143 // GetIsListening returns IsListening
144 func (m resolverendpointsummary) GetIsListening() *bool {
145 return m.IsListening
146 }
147 148 // GetCompartmentId returns CompartmentId
149 func (m resolverendpointsummary) GetCompartmentId() *string {
150 return m.CompartmentId
151 }
152 153 // GetTimeCreated returns TimeCreated
154 func (m resolverendpointsummary) GetTimeCreated() *common.SDKTime {
155 return m.TimeCreated
156 }
157 158 // GetTimeUpdated returns TimeUpdated
159 func (m resolverendpointsummary) GetTimeUpdated() *common.SDKTime {
160 return m.TimeUpdated
161 }
162 163 // GetLifecycleState returns LifecycleState
164 func (m resolverendpointsummary) GetLifecycleState() ResolverEndpointSummaryLifecycleStateEnum {
165 return m.LifecycleState
166 }
167 168 // GetSelf returns Self
169 func (m resolverendpointsummary) GetSelf() *string {
170 return m.Self
171 }
172 173 func (m resolverendpointsummary) 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 resolverendpointsummary) ValidateEnumValue() (bool, error) {
181 errMessage := []string{}
182 if _, ok := GetMappingResolverEndpointSummaryLifecycleStateEnum(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(GetResolverEndpointSummaryLifecycleStateEnumStringValues(), ",")))
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 // ResolverEndpointSummaryLifecycleStateEnum Enum with underlying type: string
193 type ResolverEndpointSummaryLifecycleStateEnum string
194 195 // Set of constants representing the allowable values for ResolverEndpointSummaryLifecycleStateEnum
196 const (
197 ResolverEndpointSummaryLifecycleStateActive ResolverEndpointSummaryLifecycleStateEnum = "ACTIVE"
198 ResolverEndpointSummaryLifecycleStateCreating ResolverEndpointSummaryLifecycleStateEnum = "CREATING"
199 ResolverEndpointSummaryLifecycleStateDeleted ResolverEndpointSummaryLifecycleStateEnum = "DELETED"
200 ResolverEndpointSummaryLifecycleStateDeleting ResolverEndpointSummaryLifecycleStateEnum = "DELETING"
201 ResolverEndpointSummaryLifecycleStateFailed ResolverEndpointSummaryLifecycleStateEnum = "FAILED"
202 ResolverEndpointSummaryLifecycleStateUpdating ResolverEndpointSummaryLifecycleStateEnum = "UPDATING"
203 )
204 205 var mappingResolverEndpointSummaryLifecycleStateEnum = map[string]ResolverEndpointSummaryLifecycleStateEnum{
206 "ACTIVE": ResolverEndpointSummaryLifecycleStateActive,
207 "CREATING": ResolverEndpointSummaryLifecycleStateCreating,
208 "DELETED": ResolverEndpointSummaryLifecycleStateDeleted,
209 "DELETING": ResolverEndpointSummaryLifecycleStateDeleting,
210 "FAILED": ResolverEndpointSummaryLifecycleStateFailed,
211 "UPDATING": ResolverEndpointSummaryLifecycleStateUpdating,
212 }
213 214 var mappingResolverEndpointSummaryLifecycleStateEnumLowerCase = map[string]ResolverEndpointSummaryLifecycleStateEnum{
215 "active": ResolverEndpointSummaryLifecycleStateActive,
216 "creating": ResolverEndpointSummaryLifecycleStateCreating,
217 "deleted": ResolverEndpointSummaryLifecycleStateDeleted,
218 "deleting": ResolverEndpointSummaryLifecycleStateDeleting,
219 "failed": ResolverEndpointSummaryLifecycleStateFailed,
220 "updating": ResolverEndpointSummaryLifecycleStateUpdating,
221 }
222 223 // GetResolverEndpointSummaryLifecycleStateEnumValues Enumerates the set of values for ResolverEndpointSummaryLifecycleStateEnum
224 func GetResolverEndpointSummaryLifecycleStateEnumValues() []ResolverEndpointSummaryLifecycleStateEnum {
225 values := make([]ResolverEndpointSummaryLifecycleStateEnum, 0)
226 for _, v := range mappingResolverEndpointSummaryLifecycleStateEnum {
227 values = append(values, v)
228 }
229 return values
230 }
231 232 // GetResolverEndpointSummaryLifecycleStateEnumStringValues Enumerates the set of values in String for ResolverEndpointSummaryLifecycleStateEnum
233 func GetResolverEndpointSummaryLifecycleStateEnumStringValues() []string {
234 return []string{
235 "ACTIVE",
236 "CREATING",
237 "DELETED",
238 "DELETING",
239 "FAILED",
240 "UPDATING",
241 }
242 }
243 244 // GetMappingResolverEndpointSummaryLifecycleStateEnum performs case Insensitive comparison on enum value and return the desired enum
245 func GetMappingResolverEndpointSummaryLifecycleStateEnum(val string) (ResolverEndpointSummaryLifecycleStateEnum, bool) {
246 enum, ok := mappingResolverEndpointSummaryLifecycleStateEnumLowerCase[strings.ToLower(val)]
247 return enum, ok
248 }
249 250 // ResolverEndpointSummaryEndpointTypeEnum Enum with underlying type: string
251 type ResolverEndpointSummaryEndpointTypeEnum string
252 253 // Set of constants representing the allowable values for ResolverEndpointSummaryEndpointTypeEnum
254 const (
255 ResolverEndpointSummaryEndpointTypeVnic ResolverEndpointSummaryEndpointTypeEnum = "VNIC"
256 )
257 258 var mappingResolverEndpointSummaryEndpointTypeEnum = map[string]ResolverEndpointSummaryEndpointTypeEnum{
259 "VNIC": ResolverEndpointSummaryEndpointTypeVnic,
260 }
261 262 var mappingResolverEndpointSummaryEndpointTypeEnumLowerCase = map[string]ResolverEndpointSummaryEndpointTypeEnum{
263 "vnic": ResolverEndpointSummaryEndpointTypeVnic,
264 }
265 266 // GetResolverEndpointSummaryEndpointTypeEnumValues Enumerates the set of values for ResolverEndpointSummaryEndpointTypeEnum
267 func GetResolverEndpointSummaryEndpointTypeEnumValues() []ResolverEndpointSummaryEndpointTypeEnum {
268 values := make([]ResolverEndpointSummaryEndpointTypeEnum, 0)
269 for _, v := range mappingResolverEndpointSummaryEndpointTypeEnum {
270 values = append(values, v)
271 }
272 return values
273 }
274 275 // GetResolverEndpointSummaryEndpointTypeEnumStringValues Enumerates the set of values in String for ResolverEndpointSummaryEndpointTypeEnum
276 func GetResolverEndpointSummaryEndpointTypeEnumStringValues() []string {
277 return []string{
278 "VNIC",
279 }
280 }
281 282 // GetMappingResolverEndpointSummaryEndpointTypeEnum performs case Insensitive comparison on enum value and return the desired enum
283 func GetMappingResolverEndpointSummaryEndpointTypeEnum(val string) (ResolverEndpointSummaryEndpointTypeEnum, bool) {
284 enum, ok := mappingResolverEndpointSummaryEndpointTypeEnumLowerCase[strings.ToLower(val)]
285 return enum, ok
286 }
287