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
5from .steering_policy_rule import SteeringPolicyRule
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 SteeringPolicyPriorityRule(SteeringPolicyRule):
12    """
13    SteeringPolicyPriorityRule model.
14    """
15
16    def __init__(self, **kwargs):
17        """
18        Initializes a new SteeringPolicyPriorityRule object with values from keyword arguments. The default value of the :py:attr:`~oci.dns.models.SteeringPolicyPriorityRule.rule_type` attribute
19        of this class is ``PRIORITY`` and it should not be changed.
20        The following keyword arguments are supported (corresponding to the getters/setters of this class):
21
22        :param description:
23            The value to assign to the description property of this SteeringPolicyPriorityRule.
24        :type description: str
25
26        :param rule_type:
27            The value to assign to the rule_type property of this SteeringPolicyPriorityRule.
28            Allowed values for this property are: "FILTER", "HEALTH", "WEIGHTED", "PRIORITY", "LIMIT"
29        :type rule_type: str
30
31        :param cases:
32            The value to assign to the cases property of this SteeringPolicyPriorityRule.
33        :type cases: list[oci.dns.models.SteeringPolicyPriorityRuleCase]
34
35        :param default_answer_data:
36            The value to assign to the default_answer_data property of this SteeringPolicyPriorityRule.
37        :type default_answer_data: list[oci.dns.models.SteeringPolicyPriorityAnswerData]
38
39        """
40        self.swagger_types = {
41            'description': 'str',
42            'rule_type': 'str',
43            'cases': 'list[SteeringPolicyPriorityRuleCase]',
44            'default_answer_data': 'list[SteeringPolicyPriorityAnswerData]'
45        }
46
47        self.attribute_map = {
48            'description': 'description',
49            'rule_type': 'ruleType',
50            'cases': 'cases',
51            'default_answer_data': 'defaultAnswerData'
52        }
53
54        self._description = None
55        self._rule_type = None
56        self._cases = None
57        self._default_answer_data = None
58        self._rule_type = 'PRIORITY'
59
60    @property
61    def cases(self):
62        """
63        Gets the cases of this SteeringPolicyPriorityRule.
64        An array of `caseConditions`. A rule may optionally include a sequence of cases defining alternate
65        configurations for how it should behave during processing for any given DNS query. When a rule has
66        no sequence of `cases`, it is always evaluated with the same configuration during processing. When
67        a rule has an empty sequence of `cases`, it is always ignored during processing. When a rule has a
68        non-empty sequence of `cases`, its behavior during processing is configured by the first matching
69        `case` in the sequence. When a rule has no matching cases the rule is ignored. A rule case with no
70        `caseCondition` always matches. A rule case with a `caseCondition` matches only when that expression
71        evaluates to true for the given query.
72
73
74        :return: The cases of this SteeringPolicyPriorityRule.
75        :rtype: list[oci.dns.models.SteeringPolicyPriorityRuleCase]
76        """
77        return self._cases
78
79    @cases.setter
80    def cases(self, cases):
81        """
82        Sets the cases of this SteeringPolicyPriorityRule.
83        An array of `caseConditions`. A rule may optionally include a sequence of cases defining alternate
84        configurations for how it should behave during processing for any given DNS query. When a rule has
85        no sequence of `cases`, it is always evaluated with the same configuration during processing. When
86        a rule has an empty sequence of `cases`, it is always ignored during processing. When a rule has a
87        non-empty sequence of `cases`, its behavior during processing is configured by the first matching
88        `case` in the sequence. When a rule has no matching cases the rule is ignored. A rule case with no
89        `caseCondition` always matches. A rule case with a `caseCondition` matches only when that expression
90        evaluates to true for the given query.
91
92
93        :param cases: The cases of this SteeringPolicyPriorityRule.
94        :type: list[oci.dns.models.SteeringPolicyPriorityRuleCase]
95        """
96        self._cases = cases
97
98    @property
99    def default_answer_data(self):
100        """
101        Gets the default_answer_data of this SteeringPolicyPriorityRule.
102        Defines a default set of answer conditions and values that are applied to an answer when
103        `cases` is not defined for the rule or a matching case does not have any matching
104        `answerCondition`s in its `answerData`. `defaultAnswerData` is not applied if `cases` is
105        defined and there are no matching cases. In this scenario, the next rule will be processed.
106
107
108        :return: The default_answer_data of this SteeringPolicyPriorityRule.
109        :rtype: list[oci.dns.models.SteeringPolicyPriorityAnswerData]
110        """
111        return self._default_answer_data
112
113    @default_answer_data.setter
114    def default_answer_data(self, default_answer_data):
115        """
116        Sets the default_answer_data of this SteeringPolicyPriorityRule.
117        Defines a default set of answer conditions and values that are applied to an answer when
118        `cases` is not defined for the rule or a matching case does not have any matching
119        `answerCondition`s in its `answerData`. `defaultAnswerData` is not applied if `cases` is
120        defined and there are no matching cases. In this scenario, the next rule will be processed.
121
122
123        :param default_answer_data: The default_answer_data of this SteeringPolicyPriorityRule.
124        :type: list[oci.dns.models.SteeringPolicyPriorityAnswerData]
125        """
126        self._default_answer_data = default_answer_data
127
128    def __repr__(self):
129        return formatted_flat_dict(self)
130
131    def __eq__(self, other):
132        if other is None:
133            return False
134
135        return self.__dict__ == other.__dict__
136
137    def __ne__(self, other):
138        return not self == other
139