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 TriggerAction(object):
12    """
13    The trigger action to be performed.
14    """
15
16    #: A constant which can be used with the type property of a TriggerAction.
17    #: This constant has a value of "TRIGGER_BUILD_PIPELINE"
18    TYPE_TRIGGER_BUILD_PIPELINE = "TRIGGER_BUILD_PIPELINE"
19
20    def __init__(self, **kwargs):
21        """
22        Initializes a new TriggerAction object with values from keyword arguments. This class has the following subclasses and if you are using this class as input
23        to a service operations then you should favor using a subclass over the base class:
24
25        * :class:`~oci.devops.models.TriggerBuildPipelineAction`
26
27        The following keyword arguments are supported (corresponding to the getters/setters of this class):
28
29        :param type:
30            The value to assign to the type property of this TriggerAction.
31            Allowed values for this property are: "TRIGGER_BUILD_PIPELINE", 'UNKNOWN_ENUM_VALUE'.
32            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
33        :type type: str
34
35        :param filter:
36            The value to assign to the filter property of this TriggerAction.
37        :type filter: oci.devops.models.Filter
38
39        """
40        self.swagger_types = {
41            'type': 'str',
42            'filter': 'Filter'
43        }
44
45        self.attribute_map = {
46            'type': 'type',
47            'filter': 'filter'
48        }
49
50        self._type = None
51        self._filter = None
52
53    @staticmethod
54    def get_subtype(object_dictionary):
55        """
56        Given the hash representation of a subtype of this class,
57        use the info in the hash to return the class of the subtype.
58        """
59        type = object_dictionary['type']
60
61        if type == 'TRIGGER_BUILD_PIPELINE':
62            return 'TriggerBuildPipelineAction'
63        else:
64            return 'TriggerAction'
65
66    @property
67    def type(self):
68        """
69        **[Required]** Gets the type of this TriggerAction.
70        The type of action that will be taken. Allowed value is TRIGGER_BUILD_PIPELINE.
71
72        Allowed values for this property are: "TRIGGER_BUILD_PIPELINE", 'UNKNOWN_ENUM_VALUE'.
73        Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
74
75
76        :return: The type of this TriggerAction.
77        :rtype: str
78        """
79        return self._type
80
81    @type.setter
82    def type(self, type):
83        """
84        Sets the type of this TriggerAction.
85        The type of action that will be taken. Allowed value is TRIGGER_BUILD_PIPELINE.
86
87
88        :param type: The type of this TriggerAction.
89        :type: str
90        """
91        allowed_values = ["TRIGGER_BUILD_PIPELINE"]
92        if not value_allowed_none_or_none_sentinel(type, allowed_values):
93            type = 'UNKNOWN_ENUM_VALUE'
94        self._type = type
95
96    @property
97    def filter(self):
98        """
99        Gets the filter of this TriggerAction.
100
101        :return: The filter of this TriggerAction.
102        :rtype: oci.devops.models.Filter
103        """
104        return self._filter
105
106    @filter.setter
107    def filter(self, filter):
108        """
109        Sets the filter of this TriggerAction.
110
111        :param filter: The filter of this TriggerAction.
112        :type: oci.devops.models.Filter
113        """
114        self._filter = filter
115
116    def __repr__(self):
117        return formatted_flat_dict(self)
118
119    def __eq__(self, other):
120        if other is None:
121            return False
122
123        return self.__dict__ == other.__dict__
124
125    def __ne__(self, other):
126        return not self == other
127