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 Topology(object):
12    """
13    Defines the representation of a virtual network topology.
14    """
15
16    #: A constant which can be used with the type property of a Topology.
17    #: This constant has a value of "NETWORKING"
18    TYPE_NETWORKING = "NETWORKING"
19
20    #: A constant which can be used with the type property of a Topology.
21    #: This constant has a value of "VCN"
22    TYPE_VCN = "VCN"
23
24    #: A constant which can be used with the type property of a Topology.
25    #: This constant has a value of "SUBNET"
26    TYPE_SUBNET = "SUBNET"
27
28    def __init__(self, **kwargs):
29        """
30        Initializes a new Topology 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.VcnTopology`
34        * :class:`~oci.core.models.NetworkingTopology`
35        * :class:`~oci.core.models.SubnetTopology`
36
37        The following keyword arguments are supported (corresponding to the getters/setters of this class):
38
39        :param type:
40            The value to assign to the type property of this Topology.
41            Allowed values for this property are: "NETWORKING", "VCN", "SUBNET"
42        :type type: str
43
44        :param entities:
45            The value to assign to the entities property of this Topology.
46        :type entities: list[object]
47
48        :param relationships:
49            The value to assign to the relationships property of this Topology.
50        :type relationships: list[oci.core.models.TopologyEntityRelationship]
51
52        :param time_created:
53            The value to assign to the time_created property of this Topology.
54        :type time_created: datetime
55
56        """
57        self.swagger_types = {
58            'type': 'str',
59            'entities': 'list[object]',
60            'relationships': 'list[TopologyEntityRelationship]',
61            'time_created': 'datetime'
62        }
63
64        self.attribute_map = {
65            'type': 'type',
66            'entities': 'entities',
67            'relationships': 'relationships',
68            'time_created': 'timeCreated'
69        }
70
71        self._type = None
72        self._entities = None
73        self._relationships = None
74        self._time_created = None
75
76    @staticmethod
77    def get_subtype(object_dictionary):
78        """
79        Given the hash representation of a subtype of this class,
80        use the info in the hash to return the class of the subtype.
81        """
82        type = object_dictionary['type']
83
84        if type == 'VCN':
85            return 'VcnTopology'
86
87        if type == 'NETWORKING':
88            return 'NetworkingTopology'
89
90        if type == 'SUBNET':
91            return 'SubnetTopology'
92        else:
93            return 'Topology'
94
95    @property
96    def type(self):
97        """
98        **[Required]** Gets the type of this Topology.
99        Type of the topology object.
100
101        Allowed values for this property are: "NETWORKING", "VCN", "SUBNET"
102
103
104        :return: The type of this Topology.
105        :rtype: str
106        """
107        return self._type
108
109    @type.setter
110    def type(self, type):
111        """
112        Sets the type of this Topology.
113        Type of the topology object.
114
115
116        :param type: The type of this Topology.
117        :type: str
118        """
119        allowed_values = ["NETWORKING", "VCN", "SUBNET"]
120        if not value_allowed_none_or_none_sentinel(type, allowed_values):
121            raise ValueError(
122                "Invalid value for `type`, must be None or one of {0}"
123                .format(allowed_values)
124            )
125        self._type = type
126
127    @property
128    def entities(self):
129        """
130        **[Required]** Gets the entities of this Topology.
131        Lists entities comprising the virtual network topology.
132
133
134        :return: The entities of this Topology.
135        :rtype: list[object]
136        """
137        return self._entities
138
139    @entities.setter
140    def entities(self, entities):
141        """
142        Sets the entities of this Topology.
143        Lists entities comprising the virtual network topology.
144
145
146        :param entities: The entities of this Topology.
147        :type: list[object]
148        """
149        self._entities = entities
150
151    @property
152    def relationships(self):
153        """
154        **[Required]** Gets the relationships of this Topology.
155        Lists relationships between entities in the virtual network topology.
156
157
158        :return: The relationships of this Topology.
159        :rtype: list[oci.core.models.TopologyEntityRelationship]
160        """
161        return self._relationships
162
163    @relationships.setter
164    def relationships(self, relationships):
165        """
166        Sets the relationships of this Topology.
167        Lists relationships between entities in the virtual network topology.
168
169
170        :param relationships: The relationships of this Topology.
171        :type: list[oci.core.models.TopologyEntityRelationship]
172        """
173        self._relationships = relationships
174
175    @property
176    def time_created(self):
177        """
178        **[Required]** Gets the time_created of this Topology.
179        Records when the virtual network topology was created, in `RFC3339`__ format for date and time.
180
181        __ https://tools.ietf.org/html/rfc3339
182
183
184        :return: The time_created of this Topology.
185        :rtype: datetime
186        """
187        return self._time_created
188
189    @time_created.setter
190    def time_created(self, time_created):
191        """
192        Sets the time_created of this Topology.
193        Records when the virtual network topology was created, in `RFC3339`__ format for date and time.
194
195        __ https://tools.ietf.org/html/rfc3339
196
197
198        :param time_created: The time_created of this Topology.
199        :type: datetime
200        """
201        self._time_created = time_created
202
203    def __repr__(self):
204        return formatted_flat_dict(self)
205
206    def __eq__(self, other):
207        if other is None:
208            return False
209
210        return self.__dict__ == other.__dict__
211
212    def __ne__(self, other):
213        return not self == other
214