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 PartitionReservation(object):
12    """
13    Represents the state of a single partition reservation.
14    """
15
16    def __init__(self, **kwargs):
17        """
18        Initializes a new PartitionReservation object with values from keyword arguments.
19        The following keyword arguments are supported (corresponding to the getters/setters of this class):
20
21        :param partition:
22            The value to assign to the partition property of this PartitionReservation.
23        :type partition: str
24
25        :param committed_offset:
26            The value to assign to the committed_offset property of this PartitionReservation.
27        :type committed_offset: int
28
29        :param reserved_instance:
30            The value to assign to the reserved_instance property of this PartitionReservation.
31        :type reserved_instance: str
32
33        :param time_reserved_until:
34            The value to assign to the time_reserved_until property of this PartitionReservation.
35        :type time_reserved_until: datetime
36
37        """
38        self.swagger_types = {
39            'partition': 'str',
40            'committed_offset': 'int',
41            'reserved_instance': 'str',
42            'time_reserved_until': 'datetime'
43        }
44
45        self.attribute_map = {
46            'partition': 'partition',
47            'committed_offset': 'committedOffset',
48            'reserved_instance': 'reservedInstance',
49            'time_reserved_until': 'timeReservedUntil'
50        }
51
52        self._partition = None
53        self._committed_offset = None
54        self._reserved_instance = None
55        self._time_reserved_until = None
56
57    @property
58    def partition(self):
59        """
60        Gets the partition of this PartitionReservation.
61        The partition for which the reservation applies.
62
63
64        :return: The partition of this PartitionReservation.
65        :rtype: str
66        """
67        return self._partition
68
69    @partition.setter
70    def partition(self, partition):
71        """
72        Sets the partition of this PartitionReservation.
73        The partition for which the reservation applies.
74
75
76        :param partition: The partition of this PartitionReservation.
77        :type: str
78        """
79        self._partition = partition
80
81    @property
82    def committed_offset(self):
83        """
84        Gets the committed_offset of this PartitionReservation.
85        The latest offset which has been committed for this partition.
86
87
88        :return: The committed_offset of this PartitionReservation.
89        :rtype: int
90        """
91        return self._committed_offset
92
93    @committed_offset.setter
94    def committed_offset(self, committed_offset):
95        """
96        Sets the committed_offset of this PartitionReservation.
97        The latest offset which has been committed for this partition.
98
99
100        :param committed_offset: The committed_offset of this PartitionReservation.
101        :type: int
102        """
103        self._committed_offset = committed_offset
104
105    @property
106    def reserved_instance(self):
107        """
108        Gets the reserved_instance of this PartitionReservation.
109        The consumer instance which currently has the partition reserved.
110
111
112        :return: The reserved_instance of this PartitionReservation.
113        :rtype: str
114        """
115        return self._reserved_instance
116
117    @reserved_instance.setter
118    def reserved_instance(self, reserved_instance):
119        """
120        Sets the reserved_instance of this PartitionReservation.
121        The consumer instance which currently has the partition reserved.
122
123
124        :param reserved_instance: The reserved_instance of this PartitionReservation.
125        :type: str
126        """
127        self._reserved_instance = reserved_instance
128
129    @property
130    def time_reserved_until(self):
131        """
132        Gets the time_reserved_until of this PartitionReservation.
133        A timestamp when the current reservation expires.
134
135
136        :return: The time_reserved_until of this PartitionReservation.
137        :rtype: datetime
138        """
139        return self._time_reserved_until
140
141    @time_reserved_until.setter
142    def time_reserved_until(self, time_reserved_until):
143        """
144        Sets the time_reserved_until of this PartitionReservation.
145        A timestamp when the current reservation expires.
146
147
148        :param time_reserved_until: The time_reserved_until of this PartitionReservation.
149        :type: datetime
150        """
151        self._time_reserved_until = time_reserved_until
152
153    def __repr__(self):
154        return formatted_flat_dict(self)
155
156    def __eq__(self, other):
157        if other is None:
158            return False
159
160        return self.__dict__ == other.__dict__
161
162    def __ne__(self, other):
163        return not self == other
164