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 PutMessagesResultEntry(object):
12    """
13    Represents the result of a :func:`put_messages` request, whether it was successful or not.
14    If a message was successfully appended to the stream, the entry includes the `offset`, `partition`, and `timestamp`.
15    If the message failed to be appended to the stream, the entry includes the `error` and `errorMessage`.
16    """
17
18    def __init__(self, **kwargs):
19        """
20        Initializes a new PutMessagesResultEntry object with values from keyword arguments.
21        The following keyword arguments are supported (corresponding to the getters/setters of this class):
22
23        :param partition:
24            The value to assign to the partition property of this PutMessagesResultEntry.
25        :type partition: str
26
27        :param offset:
28            The value to assign to the offset property of this PutMessagesResultEntry.
29        :type offset: int
30
31        :param timestamp:
32            The value to assign to the timestamp property of this PutMessagesResultEntry.
33        :type timestamp: datetime
34
35        :param error:
36            The value to assign to the error property of this PutMessagesResultEntry.
37        :type error: str
38
39        :param error_message:
40            The value to assign to the error_message property of this PutMessagesResultEntry.
41        :type error_message: str
42
43        """
44        self.swagger_types = {
45            'partition': 'str',
46            'offset': 'int',
47            'timestamp': 'datetime',
48            'error': 'str',
49            'error_message': 'str'
50        }
51
52        self.attribute_map = {
53            'partition': 'partition',
54            'offset': 'offset',
55            'timestamp': 'timestamp',
56            'error': 'error',
57            'error_message': 'errorMessage'
58        }
59
60        self._partition = None
61        self._offset = None
62        self._timestamp = None
63        self._error = None
64        self._error_message = None
65
66    @property
67    def partition(self):
68        """
69        Gets the partition of this PutMessagesResultEntry.
70        The ID of the partition where the message was stored.
71
72
73        :return: The partition of this PutMessagesResultEntry.
74        :rtype: str
75        """
76        return self._partition
77
78    @partition.setter
79    def partition(self, partition):
80        """
81        Sets the partition of this PutMessagesResultEntry.
82        The ID of the partition where the message was stored.
83
84
85        :param partition: The partition of this PutMessagesResultEntry.
86        :type: str
87        """
88        self._partition = partition
89
90    @property
91    def offset(self):
92        """
93        Gets the offset of this PutMessagesResultEntry.
94        The offset of the message in the partition.
95
96
97        :return: The offset of this PutMessagesResultEntry.
98        :rtype: int
99        """
100        return self._offset
101
102    @offset.setter
103    def offset(self, offset):
104        """
105        Sets the offset of this PutMessagesResultEntry.
106        The offset of the message in the partition.
107
108
109        :param offset: The offset of this PutMessagesResultEntry.
110        :type: int
111        """
112        self._offset = offset
113
114    @property
115    def timestamp(self):
116        """
117        Gets the timestamp of this PutMessagesResultEntry.
118        The timestamp indicating when the server appended the message to the stream.
119
120
121        :return: The timestamp of this PutMessagesResultEntry.
122        :rtype: datetime
123        """
124        return self._timestamp
125
126    @timestamp.setter
127    def timestamp(self, timestamp):
128        """
129        Sets the timestamp of this PutMessagesResultEntry.
130        The timestamp indicating when the server appended the message to the stream.
131
132
133        :param timestamp: The timestamp of this PutMessagesResultEntry.
134        :type: datetime
135        """
136        self._timestamp = timestamp
137
138    @property
139    def error(self):
140        """
141        Gets the error of this PutMessagesResultEntry.
142        The error code, in case the message was not successfully appended to the stream.
143
144
145        :return: The error of this PutMessagesResultEntry.
146        :rtype: str
147        """
148        return self._error
149
150    @error.setter
151    def error(self, error):
152        """
153        Sets the error of this PutMessagesResultEntry.
154        The error code, in case the message was not successfully appended to the stream.
155
156
157        :param error: The error of this PutMessagesResultEntry.
158        :type: str
159        """
160        self._error = error
161
162    @property
163    def error_message(self):
164        """
165        Gets the error_message of this PutMessagesResultEntry.
166        A human-readable error message associated with the error code.
167
168
169        :return: The error_message of this PutMessagesResultEntry.
170        :rtype: str
171        """
172        return self._error_message
173
174    @error_message.setter
175    def error_message(self, error_message):
176        """
177        Sets the error_message of this PutMessagesResultEntry.
178        A human-readable error message associated with the error code.
179
180
181        :param error_message: The error_message of this PutMessagesResultEntry.
182        :type: str
183        """
184        self._error_message = error_message
185
186    def __repr__(self):
187        return formatted_flat_dict(self)
188
189    def __eq__(self, other):
190        if other is None:
191            return False
192
193        return self.__dict__ == other.__dict__
194
195    def __ne__(self, other):
196        return not self == other
197