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 .compute_instance_group_failure_policy import ComputeInstanceGroupFailurePolicy
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 ComputeInstanceGroupFailurePolicyByCount(ComputeInstanceGroupFailurePolicy):
12    """
13    Specifies a failure policy by count for a compute instance group rolling deployment stage.
14    """
15
16    def __init__(self, **kwargs):
17        """
18        Initializes a new ComputeInstanceGroupFailurePolicyByCount object with values from keyword arguments. The default value of the :py:attr:`~oci.devops.models.ComputeInstanceGroupFailurePolicyByCount.policy_type` attribute
19        of this class is ``COMPUTE_INSTANCE_GROUP_FAILURE_POLICY_BY_COUNT`` and it should not be changed.
20        The following keyword arguments are supported (corresponding to the getters/setters of this class):
21
22        :param policy_type:
23            The value to assign to the policy_type property of this ComputeInstanceGroupFailurePolicyByCount.
24            Allowed values for this property are: "COMPUTE_INSTANCE_GROUP_FAILURE_POLICY_BY_COUNT", "COMPUTE_INSTANCE_GROUP_FAILURE_POLICY_BY_PERCENTAGE"
25        :type policy_type: str
26
27        :param failure_count:
28            The value to assign to the failure_count property of this ComputeInstanceGroupFailurePolicyByCount.
29        :type failure_count: int
30
31        """
32        self.swagger_types = {
33            'policy_type': 'str',
34            'failure_count': 'int'
35        }
36
37        self.attribute_map = {
38            'policy_type': 'policyType',
39            'failure_count': 'failureCount'
40        }
41
42        self._policy_type = None
43        self._failure_count = None
44        self._policy_type = 'COMPUTE_INSTANCE_GROUP_FAILURE_POLICY_BY_COUNT'
45
46    @property
47    def failure_count(self):
48        """
49        **[Required]** Gets the failure_count of this ComputeInstanceGroupFailurePolicyByCount.
50        The threshold count of failed instances in the group, which when reached or exceeded sets the stage as FAILED.
51
52
53        :return: The failure_count of this ComputeInstanceGroupFailurePolicyByCount.
54        :rtype: int
55        """
56        return self._failure_count
57
58    @failure_count.setter
59    def failure_count(self, failure_count):
60        """
61        Sets the failure_count of this ComputeInstanceGroupFailurePolicyByCount.
62        The threshold count of failed instances in the group, which when reached or exceeded sets the stage as FAILED.
63
64
65        :param failure_count: The failure_count of this ComputeInstanceGroupFailurePolicyByCount.
66        :type: int
67        """
68        self._failure_count = failure_count
69
70    def __repr__(self):
71        return formatted_flat_dict(self)
72
73    def __eq__(self, other):
74        if other is None:
75            return False
76
77        return self.__dict__ == other.__dict__
78
79    def __ne__(self, other):
80        return not self == other
81