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 Stream(object):
12    """
13    Detailed representation of a stream, including all its partitions.
14    """
15
16    #: A constant which can be used with the lifecycle_state property of a Stream.
17    #: This constant has a value of "CREATING"
18    LIFECYCLE_STATE_CREATING = "CREATING"
19
20    #: A constant which can be used with the lifecycle_state property of a Stream.
21    #: This constant has a value of "ACTIVE"
22    LIFECYCLE_STATE_ACTIVE = "ACTIVE"
23
24    #: A constant which can be used with the lifecycle_state property of a Stream.
25    #: This constant has a value of "DELETING"
26    LIFECYCLE_STATE_DELETING = "DELETING"
27
28    #: A constant which can be used with the lifecycle_state property of a Stream.
29    #: This constant has a value of "DELETED"
30    LIFECYCLE_STATE_DELETED = "DELETED"
31
32    #: A constant which can be used with the lifecycle_state property of a Stream.
33    #: This constant has a value of "FAILED"
34    LIFECYCLE_STATE_FAILED = "FAILED"
35
36    #: A constant which can be used with the lifecycle_state property of a Stream.
37    #: This constant has a value of "UPDATING"
38    LIFECYCLE_STATE_UPDATING = "UPDATING"
39
40    def __init__(self, **kwargs):
41        """
42        Initializes a new Stream object with values from keyword arguments.
43        The following keyword arguments are supported (corresponding to the getters/setters of this class):
44
45        :param name:
46            The value to assign to the name property of this Stream.
47        :type name: str
48
49        :param id:
50            The value to assign to the id property of this Stream.
51        :type id: str
52
53        :param partitions:
54            The value to assign to the partitions property of this Stream.
55        :type partitions: int
56
57        :param retention_in_hours:
58            The value to assign to the retention_in_hours property of this Stream.
59        :type retention_in_hours: int
60
61        :param compartment_id:
62            The value to assign to the compartment_id property of this Stream.
63        :type compartment_id: str
64
65        :param stream_pool_id:
66            The value to assign to the stream_pool_id property of this Stream.
67        :type stream_pool_id: str
68
69        :param lifecycle_state:
70            The value to assign to the lifecycle_state property of this Stream.
71            Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "UPDATING", 'UNKNOWN_ENUM_VALUE'.
72            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
73        :type lifecycle_state: str
74
75        :param lifecycle_state_details:
76            The value to assign to the lifecycle_state_details property of this Stream.
77        :type lifecycle_state_details: str
78
79        :param time_created:
80            The value to assign to the time_created property of this Stream.
81        :type time_created: datetime
82
83        :param messages_endpoint:
84            The value to assign to the messages_endpoint property of this Stream.
85        :type messages_endpoint: str
86
87        :param freeform_tags:
88            The value to assign to the freeform_tags property of this Stream.
89        :type freeform_tags: dict(str, str)
90
91        :param defined_tags:
92            The value to assign to the defined_tags property of this Stream.
93        :type defined_tags: dict(str, dict(str, object))
94
95        """
96        self.swagger_types = {
97            'name': 'str',
98            'id': 'str',
99            'partitions': 'int',
100            'retention_in_hours': 'int',
101            'compartment_id': 'str',
102            'stream_pool_id': 'str',
103            'lifecycle_state': 'str',
104            'lifecycle_state_details': 'str',
105            'time_created': 'datetime',
106            'messages_endpoint': 'str',
107            'freeform_tags': 'dict(str, str)',
108            'defined_tags': 'dict(str, dict(str, object))'
109        }
110
111        self.attribute_map = {
112            'name': 'name',
113            'id': 'id',
114            'partitions': 'partitions',
115            'retention_in_hours': 'retentionInHours',
116            'compartment_id': 'compartmentId',
117            'stream_pool_id': 'streamPoolId',
118            'lifecycle_state': 'lifecycleState',
119            'lifecycle_state_details': 'lifecycleStateDetails',
120            'time_created': 'timeCreated',
121            'messages_endpoint': 'messagesEndpoint',
122            'freeform_tags': 'freeformTags',
123            'defined_tags': 'definedTags'
124        }
125
126        self._name = None
127        self._id = None
128        self._partitions = None
129        self._retention_in_hours = None
130        self._compartment_id = None
131        self._stream_pool_id = None
132        self._lifecycle_state = None
133        self._lifecycle_state_details = None
134        self._time_created = None
135        self._messages_endpoint = None
136        self._freeform_tags = None
137        self._defined_tags = None
138
139    @property
140    def name(self):
141        """
142        **[Required]** Gets the name of this Stream.
143        The name of the stream. Avoid entering confidential information.
144
145        Example: `TelemetryEvents`
146
147
148        :return: The name of this Stream.
149        :rtype: str
150        """
151        return self._name
152
153    @name.setter
154    def name(self, name):
155        """
156        Sets the name of this Stream.
157        The name of the stream. Avoid entering confidential information.
158
159        Example: `TelemetryEvents`
160
161
162        :param name: The name of this Stream.
163        :type: str
164        """
165        self._name = name
166
167    @property
168    def id(self):
169        """
170        **[Required]** Gets the id of this Stream.
171        The OCID of the stream.
172
173
174        :return: The id of this Stream.
175        :rtype: str
176        """
177        return self._id
178
179    @id.setter
180    def id(self, id):
181        """
182        Sets the id of this Stream.
183        The OCID of the stream.
184
185
186        :param id: The id of this Stream.
187        :type: str
188        """
189        self._id = id
190
191    @property
192    def partitions(self):
193        """
194        **[Required]** Gets the partitions of this Stream.
195        The number of partitions in the stream.
196
197
198        :return: The partitions of this Stream.
199        :rtype: int
200        """
201        return self._partitions
202
203    @partitions.setter
204    def partitions(self, partitions):
205        """
206        Sets the partitions of this Stream.
207        The number of partitions in the stream.
208
209
210        :param partitions: The partitions of this Stream.
211        :type: int
212        """
213        self._partitions = partitions
214
215    @property
216    def retention_in_hours(self):
217        """
218        **[Required]** Gets the retention_in_hours of this Stream.
219        The retention period of the stream, in hours. This property is read-only.
220
221
222        :return: The retention_in_hours of this Stream.
223        :rtype: int
224        """
225        return self._retention_in_hours
226
227    @retention_in_hours.setter
228    def retention_in_hours(self, retention_in_hours):
229        """
230        Sets the retention_in_hours of this Stream.
231        The retention period of the stream, in hours. This property is read-only.
232
233
234        :param retention_in_hours: The retention_in_hours of this Stream.
235        :type: int
236        """
237        self._retention_in_hours = retention_in_hours
238
239    @property
240    def compartment_id(self):
241        """
242        **[Required]** Gets the compartment_id of this Stream.
243        The OCID of the stream.
244
245
246        :return: The compartment_id of this Stream.
247        :rtype: str
248        """
249        return self._compartment_id
250
251    @compartment_id.setter
252    def compartment_id(self, compartment_id):
253        """
254        Sets the compartment_id of this Stream.
255        The OCID of the stream.
256
257
258        :param compartment_id: The compartment_id of this Stream.
259        :type: str
260        """
261        self._compartment_id = compartment_id
262
263    @property
264    def stream_pool_id(self):
265        """
266        **[Required]** Gets the stream_pool_id of this Stream.
267        The OCID of the stream pool that contains the stream.
268
269
270        :return: The stream_pool_id of this Stream.
271        :rtype: str
272        """
273        return self._stream_pool_id
274
275    @stream_pool_id.setter
276    def stream_pool_id(self, stream_pool_id):
277        """
278        Sets the stream_pool_id of this Stream.
279        The OCID of the stream pool that contains the stream.
280
281
282        :param stream_pool_id: The stream_pool_id of this Stream.
283        :type: str
284        """
285        self._stream_pool_id = stream_pool_id
286
287    @property
288    def lifecycle_state(self):
289        """
290        **[Required]** Gets the lifecycle_state of this Stream.
291        The current state of the stream.
292
293        Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "UPDATING", 'UNKNOWN_ENUM_VALUE'.
294        Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
295
296
297        :return: The lifecycle_state of this Stream.
298        :rtype: str
299        """
300        return self._lifecycle_state
301
302    @lifecycle_state.setter
303    def lifecycle_state(self, lifecycle_state):
304        """
305        Sets the lifecycle_state of this Stream.
306        The current state of the stream.
307
308
309        :param lifecycle_state: The lifecycle_state of this Stream.
310        :type: str
311        """
312        allowed_values = ["CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED", "UPDATING"]
313        if not value_allowed_none_or_none_sentinel(lifecycle_state, allowed_values):
314            lifecycle_state = 'UNKNOWN_ENUM_VALUE'
315        self._lifecycle_state = lifecycle_state
316
317    @property
318    def lifecycle_state_details(self):
319        """
320        Gets the lifecycle_state_details of this Stream.
321        Any additional details about the current state of the stream.
322
323
324        :return: The lifecycle_state_details of this Stream.
325        :rtype: str
326        """
327        return self._lifecycle_state_details
328
329    @lifecycle_state_details.setter
330    def lifecycle_state_details(self, lifecycle_state_details):
331        """
332        Sets the lifecycle_state_details of this Stream.
333        Any additional details about the current state of the stream.
334
335
336        :param lifecycle_state_details: The lifecycle_state_details of this Stream.
337        :type: str
338        """
339        self._lifecycle_state_details = lifecycle_state_details
340
341    @property
342    def time_created(self):
343        """
344        **[Required]** Gets the time_created of this Stream.
345        The date and time the stream was created, expressed in in `RFC 3339`__ timestamp format.
346
347        Example: `2018-04-20T00:00:07.405Z`
348
349        __ https://tools.ietf.org/rfc/rfc3339
350
351
352        :return: The time_created of this Stream.
353        :rtype: datetime
354        """
355        return self._time_created
356
357    @time_created.setter
358    def time_created(self, time_created):
359        """
360        Sets the time_created of this Stream.
361        The date and time the stream was created, expressed in in `RFC 3339`__ timestamp format.
362
363        Example: `2018-04-20T00:00:07.405Z`
364
365        __ https://tools.ietf.org/rfc/rfc3339
366
367
368        :param time_created: The time_created of this Stream.
369        :type: datetime
370        """
371        self._time_created = time_created
372
373    @property
374    def messages_endpoint(self):
375        """
376        **[Required]** Gets the messages_endpoint of this Stream.
377        The endpoint to use when creating the StreamClient to consume or publish messages in the stream.
378        If the associated stream pool is private, the endpoint is also private and can only be accessed from inside the stream pool's associated subnet.
379
380
381        :return: The messages_endpoint of this Stream.
382        :rtype: str
383        """
384        return self._messages_endpoint
385
386    @messages_endpoint.setter
387    def messages_endpoint(self, messages_endpoint):
388        """
389        Sets the messages_endpoint of this Stream.
390        The endpoint to use when creating the StreamClient to consume or publish messages in the stream.
391        If the associated stream pool is private, the endpoint is also private and can only be accessed from inside the stream pool's associated subnet.
392
393
394        :param messages_endpoint: The messages_endpoint of this Stream.
395        :type: str
396        """
397        self._messages_endpoint = messages_endpoint
398
399    @property
400    def freeform_tags(self):
401        """
402        Gets the freeform_tags of this Stream.
403        Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. Exists for cross-compatibility only.
404        For more information, see `Resource Tags`__.
405
406        Example: `{\"Department\": \"Finance\"}`
407
408        __ https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm
409
410
411        :return: The freeform_tags of this Stream.
412        :rtype: dict(str, str)
413        """
414        return self._freeform_tags
415
416    @freeform_tags.setter
417    def freeform_tags(self, freeform_tags):
418        """
419        Sets the freeform_tags of this Stream.
420        Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. Exists for cross-compatibility only.
421        For more information, see `Resource Tags`__.
422
423        Example: `{\"Department\": \"Finance\"}`
424
425        __ https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm
426
427
428        :param freeform_tags: The freeform_tags of this Stream.
429        :type: dict(str, str)
430        """
431        self._freeform_tags = freeform_tags
432
433    @property
434    def defined_tags(self):
435        """
436        Gets the defined_tags of this Stream.
437        Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see `Resource Tags`__.
438
439        Example: `{\"Operations\": {\"CostCenter\": \"42\"}}'
440
441        __ https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm
442
443
444        :return: The defined_tags of this Stream.
445        :rtype: dict(str, dict(str, object))
446        """
447        return self._defined_tags
448
449    @defined_tags.setter
450    def defined_tags(self, defined_tags):
451        """
452        Sets the defined_tags of this Stream.
453        Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see `Resource Tags`__.
454
455        Example: `{\"Operations\": {\"CostCenter\": \"42\"}}'
456
457        __ https://docs.cloud.oracle.com/Content/General/Concepts/resourcetags.htm
458
459
460        :param defined_tags: The defined_tags of this Stream.
461        :type: dict(str, dict(str, object))
462        """
463        self._defined_tags = defined_tags
464
465    def __repr__(self):
466        return formatted_flat_dict(self)
467
468    def __eq__(self, other):
469        if other is None:
470            return False
471
472        return self.__dict__ == other.__dict__
473
474    def __ne__(self, other):
475        return not self == other
476