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 SteeringPolicyLimitRule(SteeringPolicyRule):
12    """
13    SteeringPolicyLimitRule model.
14    """
15
16    def __init__(self, **kwargs):
17        """
18        Initializes a new SteeringPolicyLimitRule object with values from keyword arguments. The default value of the :py:attr:`~oci.dns.models.SteeringPolicyLimitRule.rule_type` attribute
19        of this class is ``LIMIT`` 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 SteeringPolicyLimitRule.
24        :type description: str
25
26        :param rule_type:
27            The value to assign to the rule_type property of this SteeringPolicyLimitRule.
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 SteeringPolicyLimitRule.
33        :type cases: list[oci.dns.models.SteeringPolicyLimitRuleCase]
34
35        :param default_count:
36            The value to assign to the default_count property of this SteeringPolicyLimitRule.
37        :type default_count: int
38
39        """
40        self.swagger_types = {
41            'description': 'str',
42            'rule_type': 'str',
43            'cases': 'list[SteeringPolicyLimitRuleCase]',
44            'default_count': 'int'
45        }
46
47        self.attribute_map = {
48            'description': 'description',
49            'rule_type': 'ruleType',
50            'cases': 'cases',
51            'default_count': 'defaultCount'
52        }
53
54        self._description = None
55        self._rule_type = None
56        self._cases = None
57        self._default_count = None
58        self._rule_type = 'LIMIT'
59
60    @property
61    def cases(self):
62        """
63        Gets the cases of this SteeringPolicyLimitRule.
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 SteeringPolicyLimitRule.
75        :rtype: list[oci.dns.models.SteeringPolicyLimitRuleCase]
76        """
77        return self._cases
78
79    @cases.setter
80    def cases(self, cases):
81        """
82        Sets the cases of this SteeringPolicyLimitRule.
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 SteeringPolicyLimitRule.
94        :type: list[oci.dns.models.SteeringPolicyLimitRuleCase]
95        """
96        self._cases = cases
97
98    @property
99    def default_count(self):
100        """
101        Gets the default_count of this SteeringPolicyLimitRule.
102        Defines a default count if `cases` is not defined for the rule or a matching case does
103        not define `count`. `defaultCount` is **not** applied if `cases` is defined and there
104        are no matching cases. In this scenario, the next rule will be processed. If no rules
105        remain to be processed, the answer will be chosen from the remaining list of answers.
106
107
108        :return: The default_count of this SteeringPolicyLimitRule.
109        :rtype: int
110        """
111        return self._default_count
112
113    @default_count.setter
114    def default_count(self, default_count):
115        """
116        Sets the default_count of this SteeringPolicyLimitRule.
117        Defines a default count if `cases` is not defined for the rule or a matching case does
118        not define `count`. `defaultCount` is **not** applied if `cases` is defined and there
119        are no matching cases. In this scenario, the next rule will be processed. If no rules
120        remain to be processed, the answer will be chosen from the remaining list of answers.
121
122
123        :param default_count: The default_count of this SteeringPolicyLimitRule.
124        :type: int
125        """
126        self._default_count = default_count
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