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 // UpdateResolverDetails The body for updating an existing resolver.
22 // **Warning:** Oracle recommends that you avoid using any confidential information when you supply string values using the API.
23 type UpdateResolverDetails struct {
24 25 // The display name of the resolver.
26 DisplayName *string `mandatory:"false" json:"displayName"`
27 28 // Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace.
29 // For more information, see Resource Tags (https://docs.oracle.com/iaas/Content/General/Concepts/resourcetags.htm).
30 //
31 // **Example:** `{"Department": "Finance"}`
32 FreeformTags map[string]string `mandatory:"false" json:"freeformTags"`
33 34 // Defined tags for this resource. Each key is predefined and scoped to a namespace.
35 // For more information, see Resource Tags (https://docs.oracle.com/iaas/Content/General/Concepts/resourcetags.htm).
36 //
37 // **Example:** `{"Operations": {"CostCenter": "42"}}`
38 DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"`
39 40 // The attached views. Views are evaluated in order.
41 AttachedViews []AttachedViewDetails `mandatory:"false" json:"attachedViews"`
42 43 // Rules for the resolver. Rules are evaluated in order.
44 Rules []ResolverRuleDetails `mandatory:"false" json:"rules"`
45 }
46 47 func (m UpdateResolverDetails) String() string {
48 return common.PointerString(m)
49 }
50 51 // ValidateEnumValue returns an error when providing an unsupported enum value
52 // This function is being called during constructing API request process
53 // Not recommended for calling this function directly
54 func (m UpdateResolverDetails) ValidateEnumValue() (bool, error) {
55 errMessage := []string{}
56 57 if len(errMessage) > 0 {
58 return true, fmt.Errorf("%s", strings.Join(errMessage, "\n"))
59 }
60 return false, nil
61 }
62 63 // UnmarshalJSON unmarshals from json
64 func (m *UpdateResolverDetails) UnmarshalJSON(data []byte) (e error) {
65 model := struct {
66 DisplayName *string `json:"displayName"`
67 FreeformTags map[string]string `json:"freeformTags"`
68 DefinedTags map[string]map[string]interface{} `json:"definedTags"`
69 AttachedViews []AttachedViewDetails `json:"attachedViews"`
70 Rules []resolverruledetails `json:"rules"`
71 }{}
72 73 e = json.Unmarshal(data, &model)
74 if e != nil {
75 return
76 }
77 var nn interface{}
78 m.DisplayName = model.DisplayName
79 80 m.FreeformTags = model.FreeformTags
81 82 m.DefinedTags = model.DefinedTags
83 84 m.AttachedViews = make([]AttachedViewDetails, len(model.AttachedViews))
85 copy(m.AttachedViews, model.AttachedViews)
86 m.Rules = make([]ResolverRuleDetails, len(model.Rules))
87 for i, n := range model.Rules {
88 nn, e = n.UnmarshalPolymorphicJSON(n.JsonData)
89 if e != nil {
90 return e
91 }
92 if nn != nil {
93 m.Rules[i] = nn.(ResolverRuleDetails)
94 } else {
95 m.Rules[i] = nil
96 }
97 }
98 return
99 }
100