1# coding: utf-8 2# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. 3# 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. 4 5 6from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 7from oci.decorators import init_model_state_from_kwargs 8 9 10@init_model_state_from_kwargs 11class UpdateSteeringPolicyDetails(object): 12 """ 13 The body for updating a steering policy. New rules and answers provided in the request will 14 replace the existing rules and answers in the policy. 15 16 17 **Warning:** Oracle recommends that you avoid using any confidential information when you supply string values using the API. 18 """ 19 20 #: A constant which can be used with the template property of a UpdateSteeringPolicyDetails. 21 #: This constant has a value of "FAILOVER" 22 TEMPLATE_FAILOVER = "FAILOVER" 23 24 #: A constant which can be used with the template property of a UpdateSteeringPolicyDetails. 25 #: This constant has a value of "LOAD_BALANCE" 26 TEMPLATE_LOAD_BALANCE = "LOAD_BALANCE" 27 28 #: A constant which can be used with the template property of a UpdateSteeringPolicyDetails. 29 #: This constant has a value of "ROUTE_BY_GEO" 30 TEMPLATE_ROUTE_BY_GEO = "ROUTE_BY_GEO" 31 32 #: A constant which can be used with the template property of a UpdateSteeringPolicyDetails. 33 #: This constant has a value of "ROUTE_BY_ASN" 34 TEMPLATE_ROUTE_BY_ASN = "ROUTE_BY_ASN" 35 36 #: A constant which can be used with the template property of a UpdateSteeringPolicyDetails. 37 #: This constant has a value of "ROUTE_BY_IP" 38 TEMPLATE_ROUTE_BY_IP = "ROUTE_BY_IP" 39 40 #: A constant which can be used with the template property of a UpdateSteeringPolicyDetails. 41 #: This constant has a value of "CUSTOM" 42 TEMPLATE_CUSTOM = "CUSTOM" 43 44 def __init__(self, **kwargs): 45 """ 46 Initializes a new UpdateSteeringPolicyDetails object with values from keyword arguments. 47 The following keyword arguments are supported (corresponding to the getters/setters of this class): 48 49 :param display_name: 50 The value to assign to the display_name property of this UpdateSteeringPolicyDetails. 51 :type display_name: str 52 53 :param ttl: 54 The value to assign to the ttl property of this UpdateSteeringPolicyDetails. 55 :type ttl: int 56 57 :param health_check_monitor_id: 58 The value to assign to the health_check_monitor_id property of this UpdateSteeringPolicyDetails. 59 :type health_check_monitor_id: str 60 61 :param template: 62 The value to assign to the template property of this UpdateSteeringPolicyDetails. 63 Allowed values for this property are: "FAILOVER", "LOAD_BALANCE", "ROUTE_BY_GEO", "ROUTE_BY_ASN", "ROUTE_BY_IP", "CUSTOM" 64 :type template: str 65 66 :param freeform_tags: 67 The value to assign to the freeform_tags property of this UpdateSteeringPolicyDetails. 68 :type freeform_tags: dict(str, str) 69 70 :param defined_tags: 71 The value to assign to the defined_tags property of this UpdateSteeringPolicyDetails. 72 :type defined_tags: dict(str, dict(str, object)) 73 74 :param answers: 75 The value to assign to the answers property of this UpdateSteeringPolicyDetails. 76 :type answers: list[oci.dns.models.SteeringPolicyAnswer] 77 78 :param rules: 79 The value to assign to the rules property of this UpdateSteeringPolicyDetails. 80 :type rules: list[oci.dns.models.SteeringPolicyRule] 81 82 """ 83 self.swagger_types = { 84 'display_name': 'str', 85 'ttl': 'int', 86 'health_check_monitor_id': 'str', 87 'template': 'str', 88 'freeform_tags': 'dict(str, str)', 89 'defined_tags': 'dict(str, dict(str, object))', 90 'answers': 'list[SteeringPolicyAnswer]', 91 'rules': 'list[SteeringPolicyRule]' 92 } 93 94 self.attribute_map = { 95 'display_name': 'displayName', 96 'ttl': 'ttl', 97 'health_check_monitor_id': 'healthCheckMonitorId', 98 'template': 'template', 99 'freeform_tags': 'freeformTags', 100 'defined_tags': 'definedTags', 101 'answers': 'answers', 102 'rules': 'rules' 103 } 104 105 self._display_name = None 106 self._ttl = None 107 self._health_check_monitor_id = None 108 self._template = None 109 self._freeform_tags = None 110 self._defined_tags = None 111 self._answers = None 112 self._rules = None 113 114 @property 115 def display_name(self): 116 """ 117 Gets the display_name of this UpdateSteeringPolicyDetails. 118 A user-friendly name for the steering policy. Does not have to be unique and can be changed. 119 Avoid entering confidential information. 120 121 122 :return: The display_name of this UpdateSteeringPolicyDetails. 123 :rtype: str 124 """ 125 return self._display_name 126 127 @display_name.setter 128 def display_name(self, display_name): 129 """ 130 Sets the display_name of this UpdateSteeringPolicyDetails. 131 A user-friendly name for the steering policy. Does not have to be unique and can be changed. 132 Avoid entering confidential information. 133 134 135 :param display_name: The display_name of this UpdateSteeringPolicyDetails. 136 :type: str 137 """ 138 self._display_name = display_name 139 140 @property 141 def ttl(self): 142 """ 143 Gets the ttl of this UpdateSteeringPolicyDetails. 144 The Time To Live (TTL) for responses from the steering policy, in seconds. 145 If not specified during creation, a value of 30 seconds will be used. 146 147 148 :return: The ttl of this UpdateSteeringPolicyDetails. 149 :rtype: int 150 """ 151 return self._ttl 152 153 @ttl.setter 154 def ttl(self, ttl): 155 """ 156 Sets the ttl of this UpdateSteeringPolicyDetails. 157 The Time To Live (TTL) for responses from the steering policy, in seconds. 158 If not specified during creation, a value of 30 seconds will be used. 159 160 161 :param ttl: The ttl of this UpdateSteeringPolicyDetails. 162 :type: int 163 """ 164 self._ttl = ttl 165 166 @property 167 def health_check_monitor_id(self): 168 """ 169 Gets the health_check_monitor_id of this UpdateSteeringPolicyDetails. 170 The OCID of the health check monitor providing health data about the answers of the 171 steering policy. A steering policy answer with `rdata` matching a monitored endpoint 172 will use the health data of that endpoint. A steering policy answer with `rdata` not 173 matching any monitored endpoint will be assumed healthy. 174 175 176 **Note:** To use the Health Check monitoring feature in a steering policy, a monitor 177 must be created using the Health Checks service first. For more information on how to 178 create a monitor, please see `Managing Health Checks`__. 179 180 __ https://docs.cloud.oracle.com/iaas/Content/HealthChecks/Tasks/managinghealthchecks.htm 181 182 183 :return: The health_check_monitor_id of this UpdateSteeringPolicyDetails. 184 :rtype: str 185 """ 186 return self._health_check_monitor_id 187 188 @health_check_monitor_id.setter 189 def health_check_monitor_id(self, health_check_monitor_id): 190 """ 191 Sets the health_check_monitor_id of this UpdateSteeringPolicyDetails. 192 The OCID of the health check monitor providing health data about the answers of the 193 steering policy. A steering policy answer with `rdata` matching a monitored endpoint 194 will use the health data of that endpoint. A steering policy answer with `rdata` not 195 matching any monitored endpoint will be assumed healthy. 196 197 198 **Note:** To use the Health Check monitoring feature in a steering policy, a monitor 199 must be created using the Health Checks service first. For more information on how to 200 create a monitor, please see `Managing Health Checks`__. 201 202 __ https://docs.cloud.oracle.com/iaas/Content/HealthChecks/Tasks/managinghealthchecks.htm 203 204 205 :param health_check_monitor_id: The health_check_monitor_id of this UpdateSteeringPolicyDetails. 206 :type: str 207 """ 208 self._health_check_monitor_id = health_check_monitor_id 209 210 @property 211 def template(self): 212 """ 213 Gets the template of this UpdateSteeringPolicyDetails. 214 A set of predefined rules based on the desired purpose of the steering policy. Each 215 template utilizes Traffic Management's rules in a different order to produce the desired 216 results when answering DNS queries. 217 218 219 **Example:** The `FAILOVER` template determines answers by filtering the policy's answers 220 using the `FILTER` rule first, then the following rules in succession: `HEALTH`, `PRIORITY`, 221 and `LIMIT`. This gives the domain dynamic failover capability. 222 223 224 It is **strongly recommended** to use a template other than `CUSTOM` when creating 225 a steering policy. 226 227 228 All templates require the rule order to begin with an unconditional `FILTER` rule that keeps 229 answers contingent upon `answer.isDisabled != true`, except for `CUSTOM`. A defined 230 `HEALTH` rule must follow the `FILTER` rule if the policy references a `healthCheckMonitorId`. 231 The last rule of a template must must be a `LIMIT` rule. For more information about templates 232 and code examples, see `Traffic Management API Guide`__. 233 234 **Template Types** 235 236 * `FAILOVER` - Uses health check information on your endpoints to determine which DNS answers 237 to serve. If an endpoint fails a health check, the answer for that endpoint will be removed 238 from the list of available answers until the endpoint is detected as healthy. 239 240 241 * `LOAD_BALANCE` - Distributes web traffic to specified endpoints based on defined weights. 242 243 244 * `ROUTE_BY_GEO` - Answers DNS queries based on the query's geographic location. For a list of geographic 245 locations to route by, see `Traffic Management Geographic Locations`__. 246 247 248 * `ROUTE_BY_ASN` - Answers DNS queries based on the query's originating ASN. 249 250 251 * `ROUTE_BY_IP` - Answers DNS queries based on the query's IP address. 252 253 254 * `CUSTOM` - Allows a customized configuration of rules. 255 256 __ https://docs.cloud.oracle.com/iaas/Content/TrafficManagement/Concepts/trafficmanagementapi.htm 257 __ https://docs.cloud.oracle.com/iaas/Content/TrafficManagement/Reference/trafficmanagementgeo.htm 258 259 Allowed values for this property are: "FAILOVER", "LOAD_BALANCE", "ROUTE_BY_GEO", "ROUTE_BY_ASN", "ROUTE_BY_IP", "CUSTOM" 260 261 262 :return: The template of this UpdateSteeringPolicyDetails. 263 :rtype: str 264 """ 265 return self._template 266 267 @template.setter 268 def template(self, template): 269 """ 270 Sets the template of this UpdateSteeringPolicyDetails. 271 A set of predefined rules based on the desired purpose of the steering policy. Each 272 template utilizes Traffic Management's rules in a different order to produce the desired 273 results when answering DNS queries. 274 275 276 **Example:** The `FAILOVER` template determines answers by filtering the policy's answers 277 using the `FILTER` rule first, then the following rules in succession: `HEALTH`, `PRIORITY`, 278 and `LIMIT`. This gives the domain dynamic failover capability. 279 280 281 It is **strongly recommended** to use a template other than `CUSTOM` when creating 282 a steering policy. 283 284 285 All templates require the rule order to begin with an unconditional `FILTER` rule that keeps 286 answers contingent upon `answer.isDisabled != true`, except for `CUSTOM`. A defined 287 `HEALTH` rule must follow the `FILTER` rule if the policy references a `healthCheckMonitorId`. 288 The last rule of a template must must be a `LIMIT` rule. For more information about templates 289 and code examples, see `Traffic Management API Guide`__. 290 291 **Template Types** 292 293 * `FAILOVER` - Uses health check information on your endpoints to determine which DNS answers 294 to serve. If an endpoint fails a health check, the answer for that endpoint will be removed 295 from the list of available answers until the endpoint is detected as healthy. 296 297 298 * `LOAD_BALANCE` - Distributes web traffic to specified endpoints based on defined weights. 299 300 301 * `ROUTE_BY_GEO` - Answers DNS queries based on the query's geographic location. For a list of geographic 302 locations to route by, see `Traffic Management Geographic Locations`__. 303 304 305 * `ROUTE_BY_ASN` - Answers DNS queries based on the query's originating ASN. 306 307 308 * `ROUTE_BY_IP` - Answers DNS queries based on the query's IP address. 309 310 311 * `CUSTOM` - Allows a customized configuration of rules. 312 313 __ https://docs.cloud.oracle.com/iaas/Content/TrafficManagement/Concepts/trafficmanagementapi.htm 314 __ https://docs.cloud.oracle.com/iaas/Content/TrafficManagement/Reference/trafficmanagementgeo.htm 315 316 317 :param template: The template of this UpdateSteeringPolicyDetails. 318 :type: str 319 """ 320 allowed_values = ["FAILOVER", "LOAD_BALANCE", "ROUTE_BY_GEO", "ROUTE_BY_ASN", "ROUTE_BY_IP", "CUSTOM"] 321 if not value_allowed_none_or_none_sentinel(template, allowed_values): 322 raise ValueError( 323 "Invalid value for `template`, must be None or one of {0}" 324 .format(allowed_values) 325 ) 326 self._template = template 327 328 @property 329 def freeform_tags(self): 330 """ 331 Gets the freeform_tags of this UpdateSteeringPolicyDetails. 332 Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. 333 For more information, see `Resource Tags`__. 334 335 336 **Example:** `{\"Department\": \"Finance\"}` 337 338 __ https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm 339 340 341 :return: The freeform_tags of this UpdateSteeringPolicyDetails. 342 :rtype: dict(str, str) 343 """ 344 return self._freeform_tags 345 346 @freeform_tags.setter 347 def freeform_tags(self, freeform_tags): 348 """ 349 Sets the freeform_tags of this UpdateSteeringPolicyDetails. 350 Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. 351 For more information, see `Resource Tags`__. 352 353 354 **Example:** `{\"Department\": \"Finance\"}` 355 356 __ https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm 357 358 359 :param freeform_tags: The freeform_tags of this UpdateSteeringPolicyDetails. 360 :type: dict(str, str) 361 """ 362 self._freeform_tags = freeform_tags 363 364 @property 365 def defined_tags(self): 366 """ 367 Gets the defined_tags of this UpdateSteeringPolicyDetails. 368 Defined tags for this resource. Each key is predefined and scoped to a namespace. 369 For more information, see `Resource Tags`__. 370 371 372 **Example:** `{\"Operations\": {\"CostCenter\": \"42\"}}` 373 374 __ https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm 375 376 377 :return: The defined_tags of this UpdateSteeringPolicyDetails. 378 :rtype: dict(str, dict(str, object)) 379 """ 380 return self._defined_tags 381 382 @defined_tags.setter 383 def defined_tags(self, defined_tags): 384 """ 385 Sets the defined_tags of this UpdateSteeringPolicyDetails. 386 Defined tags for this resource. Each key is predefined and scoped to a namespace. 387 For more information, see `Resource Tags`__. 388 389 390 **Example:** `{\"Operations\": {\"CostCenter\": \"42\"}}` 391 392 __ https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm 393 394 395 :param defined_tags: The defined_tags of this UpdateSteeringPolicyDetails. 396 :type: dict(str, dict(str, object)) 397 """ 398 self._defined_tags = defined_tags 399 400 @property 401 def answers(self): 402 """ 403 Gets the answers of this UpdateSteeringPolicyDetails. 404 The set of all answers that can potentially issue from the steering policy. 405 406 407 :return: The answers of this UpdateSteeringPolicyDetails. 408 :rtype: list[oci.dns.models.SteeringPolicyAnswer] 409 """ 410 return self._answers 411 412 @answers.setter 413 def answers(self, answers): 414 """ 415 Sets the answers of this UpdateSteeringPolicyDetails. 416 The set of all answers that can potentially issue from the steering policy. 417 418 419 :param answers: The answers of this UpdateSteeringPolicyDetails. 420 :type: list[oci.dns.models.SteeringPolicyAnswer] 421 """ 422 self._answers = answers 423 424 @property 425 def rules(self): 426 """ 427 Gets the rules of this UpdateSteeringPolicyDetails. 428 The series of rules that will be processed in sequence to reduce the pool of answers 429 to a response for any given request. 430 431 432 The first rule receives a shuffled list of all answers, and every other rule receives 433 the list of answers emitted by the one preceding it. The last rule populates the 434 response. 435 436 437 :return: The rules of this UpdateSteeringPolicyDetails. 438 :rtype: list[oci.dns.models.SteeringPolicyRule] 439 """ 440 return self._rules 441 442 @rules.setter 443 def rules(self, rules): 444 """ 445 Sets the rules of this UpdateSteeringPolicyDetails. 446 The series of rules that will be processed in sequence to reduce the pool of answers 447 to a response for any given request. 448 449 450 The first rule receives a shuffled list of all answers, and every other rule receives 451 the list of answers emitted by the one preceding it. The last rule populates the 452 response. 453 454 455 :param rules: The rules of this UpdateSteeringPolicyDetails. 456 :type: list[oci.dns.models.SteeringPolicyRule] 457 """ 458 self._rules = rules 459 460 def __repr__(self): 461 return formatted_flat_dict(self) 462 463 def __eq__(self, other): 464 if other is None: 465 return False 466 467 return self.__dict__ == other.__dict__ 468 469 def __ne__(self, other): 470 return not self == other 471