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 TopologyEntityRelationship(object):
12    """
13    Defines the relationship between Virtual Network topology entities.
14    """
15
16    #: A constant which can be used with the type property of a TopologyEntityRelationship.
17    #: This constant has a value of "CONTAINS"
18    TYPE_CONTAINS = "CONTAINS"
19
20    #: A constant which can be used with the type property of a TopologyEntityRelationship.
21    #: This constant has a value of "ASSOCIATED_WITH"
22    TYPE_ASSOCIATED_WITH = "ASSOCIATED_WITH"
23
24    #: A constant which can be used with the type property of a TopologyEntityRelationship.
25    #: This constant has a value of "ROUTES_TO"
26    TYPE_ROUTES_TO = "ROUTES_TO"
27
28    def __init__(self, **kwargs):
29        """
30        Initializes a new TopologyEntityRelationship object with values from keyword arguments. This class has the following subclasses and if you are using this class as input
31        to a service operations then you should favor using a subclass over the base class:
32
33        * :class:`~oci.core.models.TopologyRoutesToEntityRelationship`
34        * :class:`~oci.core.models.TopologyAssociatedWithEntityRelationship`
35        * :class:`~oci.core.models.TopologyContainsEntityRelationship`
36
37        The following keyword arguments are supported (corresponding to the getters/setters of this class):
38
39        :param id1:
40            The value to assign to the id1 property of this TopologyEntityRelationship.
41        :type id1: str
42
43        :param id2:
44            The value to assign to the id2 property of this TopologyEntityRelationship.
45        :type id2: str
46
47        :param type:
48            The value to assign to the type property of this TopologyEntityRelationship.
49            Allowed values for this property are: "CONTAINS", "ASSOCIATED_WITH", "ROUTES_TO", 'UNKNOWN_ENUM_VALUE'.
50            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
51        :type type: str
52
53        """
54        self.swagger_types = {
55            'id1': 'str',
56            'id2': 'str',
57            'type': 'str'
58        }
59
60        self.attribute_map = {
61            'id1': 'id1',
62            'id2': 'id2',
63            'type': 'type'
64        }
65
66        self._id1 = None
67        self._id2 = None
68        self._type = None
69
70    @staticmethod
71    def get_subtype(object_dictionary):
72        """
73        Given the hash representation of a subtype of this class,
74        use the info in the hash to return the class of the subtype.
75        """
76        type = object_dictionary['type']
77
78        if type == 'ROUTES_TO':
79            return 'TopologyRoutesToEntityRelationship'
80
81        if type == 'ASSOCIATED_WITH':
82            return 'TopologyAssociatedWithEntityRelationship'
83
84        if type == 'CONTAINS':
85            return 'TopologyContainsEntityRelationship'
86        else:
87            return 'TopologyEntityRelationship'
88
89    @property
90    def id1(self):
91        """
92        **[Required]** Gets the id1 of this TopologyEntityRelationship.
93        The `OCID`__ of the first entity in the relationship.
94
95        __ https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm
96
97
98        :return: The id1 of this TopologyEntityRelationship.
99        :rtype: str
100        """
101        return self._id1
102
103    @id1.setter
104    def id1(self, id1):
105        """
106        Sets the id1 of this TopologyEntityRelationship.
107        The `OCID`__ of the first entity in the relationship.
108
109        __ https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm
110
111
112        :param id1: The id1 of this TopologyEntityRelationship.
113        :type: str
114        """
115        self._id1 = id1
116
117    @property
118    def id2(self):
119        """
120        **[Required]** Gets the id2 of this TopologyEntityRelationship.
121        The `OCID`__ of the second entity in the relationship.
122
123        __ https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm
124
125
126        :return: The id2 of this TopologyEntityRelationship.
127        :rtype: str
128        """
129        return self._id2
130
131    @id2.setter
132    def id2(self, id2):
133        """
134        Sets the id2 of this TopologyEntityRelationship.
135        The `OCID`__ of the second entity in the relationship.
136
137        __ https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm
138
139
140        :param id2: The id2 of this TopologyEntityRelationship.
141        :type: str
142        """
143        self._id2 = id2
144
145    @property
146    def type(self):
147        """
148        **[Required]** Gets the type of this TopologyEntityRelationship.
149        The type of relationship between the entities.
150
151        Allowed values for this property are: "CONTAINS", "ASSOCIATED_WITH", "ROUTES_TO", 'UNKNOWN_ENUM_VALUE'.
152        Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
153
154
155        :return: The type of this TopologyEntityRelationship.
156        :rtype: str
157        """
158        return self._type
159
160    @type.setter
161    def type(self, type):
162        """
163        Sets the type of this TopologyEntityRelationship.
164        The type of relationship between the entities.
165
166
167        :param type: The type of this TopologyEntityRelationship.
168        :type: str
169        """
170        allowed_values = ["CONTAINS", "ASSOCIATED_WITH", "ROUTES_TO"]
171        if not value_allowed_none_or_none_sentinel(type, allowed_values):
172            type = 'UNKNOWN_ENUM_VALUE'
173        self._type = type
174
175    def __repr__(self):
176        return formatted_flat_dict(self)
177
178    def __eq__(self, other):
179        if other is None:
180            return False
181
182        return self.__dict__ == other.__dict__
183
184    def __ne__(self, other):
185        return not self == other
186