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 "fmt"
15 "strings"
16 17 "github.com/nrdcg/oci-go-sdk/common/v1065"
18 )
19 20 // SteeringPolicySummary A DNS steering policy.
21 // **Warning:** Oracle recommends that you avoid using any confidential information when you supply string values using the API.
22 type SteeringPolicySummary struct {
23 24 // The OCID of the compartment containing the steering policy.
25 CompartmentId *string `mandatory:"true" json:"compartmentId"`
26 27 // A user-friendly name for the steering policy. Does not have to be unique and can be changed.
28 // Avoid entering confidential information.
29 DisplayName *string `mandatory:"true" json:"displayName"`
30 31 // The Time To Live (TTL) for responses from the steering policy, in seconds.
32 // If not specified during creation, a value of 30 seconds will be used.
33 Ttl *int `mandatory:"true" json:"ttl"`
34 35 // A set of predefined rules based on the desired purpose of the steering policy. Each
36 // template utilizes Traffic Management's rules in a different order to produce the desired
37 // results when answering DNS queries.
38 //
39 // **Example:** The `FAILOVER` template determines answers by filtering the policy's answers
40 // using the `FILTER` rule first, then the following rules in succession: `HEALTH`, `PRIORITY`,
41 // and `LIMIT`. This gives the domain dynamic failover capability.
42 //
43 // It is **strongly recommended** to use a template other than `CUSTOM` when creating
44 // a steering policy.
45 //
46 // All templates require the rule order to begin with an unconditional `FILTER` rule that keeps
47 // answers contingent upon `answer.isDisabled != true`, except for `CUSTOM`. A defined
48 // `HEALTH` rule must follow the `FILTER` rule if the policy references a `healthCheckMonitorId`.
49 // The last rule of a template must must be a `LIMIT` rule. For more information about templates
50 // and code examples, see Traffic Management API Guide (https://docs.oracle.com/iaas/Content/TrafficManagement/Concepts/trafficmanagementapi.htm).
51 // **Template Types**
52 // * `FAILOVER` - Uses health check information on your endpoints to determine which DNS answers
53 // to serve. If an endpoint fails a health check, the answer for that endpoint will be removed
54 // from the list of available answers until the endpoint is detected as healthy.
55 //
56 // * `LOAD_BALANCE` - Distributes web traffic to specified endpoints based on defined weights.
57 //
58 // * `ROUTE_BY_GEO` - Answers DNS queries based on the query's geographic location. For a list of geographic
59 // locations to route by, see Traffic Management Geographic Locations (https://docs.oracle.com/iaas/Content/TrafficManagement/Reference/trafficmanagementgeo.htm).
60 //
61 // * `ROUTE_BY_ASN` - Answers DNS queries based on the query's originating ASN.
62 //
63 // * `ROUTE_BY_IP` - Answers DNS queries based on the query's IP address.
64 //
65 // * `CUSTOM` - Allows a customized configuration of rules.
66 Template SteeringPolicySummaryTemplateEnum `mandatory:"true" json:"template"`
67 68 // Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace.
69 // For more information, see Resource Tags (https://docs.oracle.com/iaas/Content/General/Concepts/resourcetags.htm).
70 //
71 // **Example:** `{"Department": "Finance"}`
72 FreeformTags map[string]string `mandatory:"true" json:"freeformTags"`
73 74 // Defined tags for this resource. Each key is predefined and scoped to a namespace.
75 // For more information, see Resource Tags (https://docs.oracle.com/iaas/Content/General/Concepts/resourcetags.htm).
76 //
77 // **Example:** `{"Operations": {"CostCenter": "42"}}`
78 DefinedTags map[string]map[string]interface{} `mandatory:"true" json:"definedTags"`
79 80 // The canonical absolute URL of the resource.
81 Self *string `mandatory:"true" json:"self"`
82 83 // The OCID of the resource.
84 Id *string `mandatory:"true" json:"id"`
85 86 // The date and time the resource was created, expressed in RFC 3339 timestamp format.
87 // **Example:** `2016-07-22T17:23:59:60Z`
88 TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"`
89 90 // The current state of the resource.
91 LifecycleState SteeringPolicySummaryLifecycleStateEnum `mandatory:"true" json:"lifecycleState"`
92 93 // The OCID of the health check monitor providing health data about the answers of the
94 // steering policy. A steering policy answer with `rdata` matching a monitored endpoint
95 // will use the health data of that endpoint. A steering policy answer with `rdata` not
96 // matching any monitored endpoint will be assumed healthy.
97 //
98 // **Note:** To use the Health Check monitoring feature in a steering policy, a monitor
99 // must be created using the Health Checks service first. For more information on how to
100 // create a monitor, please see Managing Health Checks (https://docs.oracle.com/iaas/Content/HealthChecks/Tasks/managinghealthchecks.htm).
101 HealthCheckMonitorId *string `mandatory:"false" json:"healthCheckMonitorId"`
102 }
103 104 func (m SteeringPolicySummary) String() string {
105 return common.PointerString(m)
106 }
107 108 // ValidateEnumValue returns an error when providing an unsupported enum value
109 // This function is being called during constructing API request process
110 // Not recommended for calling this function directly
111 func (m SteeringPolicySummary) ValidateEnumValue() (bool, error) {
112 errMessage := []string{}
113 if _, ok := GetMappingSteeringPolicySummaryTemplateEnum(string(m.Template)); !ok && m.Template != "" {
114 errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Template: %s. Supported values are: %s.", m.Template, strings.Join(GetSteeringPolicySummaryTemplateEnumStringValues(), ",")))
115 }
116 if _, ok := GetMappingSteeringPolicySummaryLifecycleStateEnum(string(m.LifecycleState)); !ok && m.LifecycleState != "" {
117 errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for LifecycleState: %s. Supported values are: %s.", m.LifecycleState, strings.Join(GetSteeringPolicySummaryLifecycleStateEnumStringValues(), ",")))
118 }
119 120 if len(errMessage) > 0 {
121 return true, fmt.Errorf("%s", strings.Join(errMessage, "\n"))
122 }
123 return false, nil
124 }
125 126 // SteeringPolicySummaryTemplateEnum Enum with underlying type: string
127 type SteeringPolicySummaryTemplateEnum string
128 129 // Set of constants representing the allowable values for SteeringPolicySummaryTemplateEnum
130 const (
131 SteeringPolicySummaryTemplateFailover SteeringPolicySummaryTemplateEnum = "FAILOVER"
132 SteeringPolicySummaryTemplateLoadBalance SteeringPolicySummaryTemplateEnum = "LOAD_BALANCE"
133 SteeringPolicySummaryTemplateRouteByGeo SteeringPolicySummaryTemplateEnum = "ROUTE_BY_GEO"
134 SteeringPolicySummaryTemplateRouteByAsn SteeringPolicySummaryTemplateEnum = "ROUTE_BY_ASN"
135 SteeringPolicySummaryTemplateRouteByIp SteeringPolicySummaryTemplateEnum = "ROUTE_BY_IP"
136 SteeringPolicySummaryTemplateCustom SteeringPolicySummaryTemplateEnum = "CUSTOM"
137 )
138 139 var mappingSteeringPolicySummaryTemplateEnum = map[string]SteeringPolicySummaryTemplateEnum{
140 "FAILOVER": SteeringPolicySummaryTemplateFailover,
141 "LOAD_BALANCE": SteeringPolicySummaryTemplateLoadBalance,
142 "ROUTE_BY_GEO": SteeringPolicySummaryTemplateRouteByGeo,
143 "ROUTE_BY_ASN": SteeringPolicySummaryTemplateRouteByAsn,
144 "ROUTE_BY_IP": SteeringPolicySummaryTemplateRouteByIp,
145 "CUSTOM": SteeringPolicySummaryTemplateCustom,
146 }
147 148 var mappingSteeringPolicySummaryTemplateEnumLowerCase = map[string]SteeringPolicySummaryTemplateEnum{
149 "failover": SteeringPolicySummaryTemplateFailover,
150 "load_balance": SteeringPolicySummaryTemplateLoadBalance,
151 "route_by_geo": SteeringPolicySummaryTemplateRouteByGeo,
152 "route_by_asn": SteeringPolicySummaryTemplateRouteByAsn,
153 "route_by_ip": SteeringPolicySummaryTemplateRouteByIp,
154 "custom": SteeringPolicySummaryTemplateCustom,
155 }
156 157 // GetSteeringPolicySummaryTemplateEnumValues Enumerates the set of values for SteeringPolicySummaryTemplateEnum
158 func GetSteeringPolicySummaryTemplateEnumValues() []SteeringPolicySummaryTemplateEnum {
159 values := make([]SteeringPolicySummaryTemplateEnum, 0)
160 for _, v := range mappingSteeringPolicySummaryTemplateEnum {
161 values = append(values, v)
162 }
163 return values
164 }
165 166 // GetSteeringPolicySummaryTemplateEnumStringValues Enumerates the set of values in String for SteeringPolicySummaryTemplateEnum
167 func GetSteeringPolicySummaryTemplateEnumStringValues() []string {
168 return []string{
169 "FAILOVER",
170 "LOAD_BALANCE",
171 "ROUTE_BY_GEO",
172 "ROUTE_BY_ASN",
173 "ROUTE_BY_IP",
174 "CUSTOM",
175 }
176 }
177 178 // GetMappingSteeringPolicySummaryTemplateEnum performs case Insensitive comparison on enum value and return the desired enum
179 func GetMappingSteeringPolicySummaryTemplateEnum(val string) (SteeringPolicySummaryTemplateEnum, bool) {
180 enum, ok := mappingSteeringPolicySummaryTemplateEnumLowerCase[strings.ToLower(val)]
181 return enum, ok
182 }
183 184 // SteeringPolicySummaryLifecycleStateEnum Enum with underlying type: string
185 type SteeringPolicySummaryLifecycleStateEnum string
186 187 // Set of constants representing the allowable values for SteeringPolicySummaryLifecycleStateEnum
188 const (
189 SteeringPolicySummaryLifecycleStateActive SteeringPolicySummaryLifecycleStateEnum = "ACTIVE"
190 SteeringPolicySummaryLifecycleStateCreating SteeringPolicySummaryLifecycleStateEnum = "CREATING"
191 SteeringPolicySummaryLifecycleStateDeleted SteeringPolicySummaryLifecycleStateEnum = "DELETED"
192 SteeringPolicySummaryLifecycleStateDeleting SteeringPolicySummaryLifecycleStateEnum = "DELETING"
193 )
194 195 var mappingSteeringPolicySummaryLifecycleStateEnum = map[string]SteeringPolicySummaryLifecycleStateEnum{
196 "ACTIVE": SteeringPolicySummaryLifecycleStateActive,
197 "CREATING": SteeringPolicySummaryLifecycleStateCreating,
198 "DELETED": SteeringPolicySummaryLifecycleStateDeleted,
199 "DELETING": SteeringPolicySummaryLifecycleStateDeleting,
200 }
201 202 var mappingSteeringPolicySummaryLifecycleStateEnumLowerCase = map[string]SteeringPolicySummaryLifecycleStateEnum{
203 "active": SteeringPolicySummaryLifecycleStateActive,
204 "creating": SteeringPolicySummaryLifecycleStateCreating,
205 "deleted": SteeringPolicySummaryLifecycleStateDeleted,
206 "deleting": SteeringPolicySummaryLifecycleStateDeleting,
207 }
208 209 // GetSteeringPolicySummaryLifecycleStateEnumValues Enumerates the set of values for SteeringPolicySummaryLifecycleStateEnum
210 func GetSteeringPolicySummaryLifecycleStateEnumValues() []SteeringPolicySummaryLifecycleStateEnum {
211 values := make([]SteeringPolicySummaryLifecycleStateEnum, 0)
212 for _, v := range mappingSteeringPolicySummaryLifecycleStateEnum {
213 values = append(values, v)
214 }
215 return values
216 }
217 218 // GetSteeringPolicySummaryLifecycleStateEnumStringValues Enumerates the set of values in String for SteeringPolicySummaryLifecycleStateEnum
219 func GetSteeringPolicySummaryLifecycleStateEnumStringValues() []string {
220 return []string{
221 "ACTIVE",
222 "CREATING",
223 "DELETED",
224 "DELETING",
225 }
226 }
227 228 // GetMappingSteeringPolicySummaryLifecycleStateEnum performs case Insensitive comparison on enum value and return the desired enum
229 func GetMappingSteeringPolicySummaryLifecycleStateEnum(val string) (SteeringPolicySummaryLifecycleStateEnum, bool) {
230 enum, ok := mappingSteeringPolicySummaryLifecycleStateEnumLowerCase[strings.ToLower(val)]
231 return enum, ok
232 }
233