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 SecretVersion(object):
12    """
13    The details of the secret version, excluding the contents of the secret.
14    """
15
16    #: A constant which can be used with the content_type property of a SecretVersion.
17    #: This constant has a value of "BASE64"
18    CONTENT_TYPE_BASE64 = "BASE64"
19
20    #: A constant which can be used with the stages property of a SecretVersion.
21    #: This constant has a value of "CURRENT"
22    STAGES_CURRENT = "CURRENT"
23
24    #: A constant which can be used with the stages property of a SecretVersion.
25    #: This constant has a value of "PENDING"
26    STAGES_PENDING = "PENDING"
27
28    #: A constant which can be used with the stages property of a SecretVersion.
29    #: This constant has a value of "LATEST"
30    STAGES_LATEST = "LATEST"
31
32    #: A constant which can be used with the stages property of a SecretVersion.
33    #: This constant has a value of "PREVIOUS"
34    STAGES_PREVIOUS = "PREVIOUS"
35
36    #: A constant which can be used with the stages property of a SecretVersion.
37    #: This constant has a value of "DEPRECATED"
38    STAGES_DEPRECATED = "DEPRECATED"
39
40    def __init__(self, **kwargs):
41        """
42        Initializes a new SecretVersion object with values from keyword arguments.
43        The following keyword arguments are supported (corresponding to the getters/setters of this class):
44
45        :param content_type:
46            The value to assign to the content_type property of this SecretVersion.
47            Allowed values for this property are: "BASE64", 'UNKNOWN_ENUM_VALUE'.
48            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
49        :type content_type: str
50
51        :param name:
52            The value to assign to the name property of this SecretVersion.
53        :type name: str
54
55        :param secret_id:
56            The value to assign to the secret_id property of this SecretVersion.
57        :type secret_id: str
58
59        :param stages:
60            The value to assign to the stages property of this SecretVersion.
61            Allowed values for items in this list are: "CURRENT", "PENDING", "LATEST", "PREVIOUS", "DEPRECATED", 'UNKNOWN_ENUM_VALUE'.
62            Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
63        :type stages: list[str]
64
65        :param time_created:
66            The value to assign to the time_created property of this SecretVersion.
67        :type time_created: datetime
68
69        :param time_of_deletion:
70            The value to assign to the time_of_deletion property of this SecretVersion.
71        :type time_of_deletion: datetime
72
73        :param time_of_current_version_expiry:
74            The value to assign to the time_of_current_version_expiry property of this SecretVersion.
75        :type time_of_current_version_expiry: datetime
76
77        :param version_number:
78            The value to assign to the version_number property of this SecretVersion.
79        :type version_number: int
80
81        """
82        self.swagger_types = {
83            'content_type': 'str',
84            'name': 'str',
85            'secret_id': 'str',
86            'stages': 'list[str]',
87            'time_created': 'datetime',
88            'time_of_deletion': 'datetime',
89            'time_of_current_version_expiry': 'datetime',
90            'version_number': 'int'
91        }
92
93        self.attribute_map = {
94            'content_type': 'contentType',
95            'name': 'name',
96            'secret_id': 'secretId',
97            'stages': 'stages',
98            'time_created': 'timeCreated',
99            'time_of_deletion': 'timeOfDeletion',
100            'time_of_current_version_expiry': 'timeOfCurrentVersionExpiry',
101            'version_number': 'versionNumber'
102        }
103
104        self._content_type = None
105        self._name = None
106        self._secret_id = None
107        self._stages = None
108        self._time_created = None
109        self._time_of_deletion = None
110        self._time_of_current_version_expiry = None
111        self._version_number = None
112
113    @property
114    def content_type(self):
115        """
116        Gets the content_type of this SecretVersion.
117        The content type of the secret version's secret contents.
118
119        Allowed values for this property are: "BASE64", 'UNKNOWN_ENUM_VALUE'.
120        Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
121
122
123        :return: The content_type of this SecretVersion.
124        :rtype: str
125        """
126        return self._content_type
127
128    @content_type.setter
129    def content_type(self, content_type):
130        """
131        Sets the content_type of this SecretVersion.
132        The content type of the secret version's secret contents.
133
134
135        :param content_type: The content_type of this SecretVersion.
136        :type: str
137        """
138        allowed_values = ["BASE64"]
139        if not value_allowed_none_or_none_sentinel(content_type, allowed_values):
140            content_type = 'UNKNOWN_ENUM_VALUE'
141        self._content_type = content_type
142
143    @property
144    def name(self):
145        """
146        Gets the name of this SecretVersion.
147        The name of the secret version. A name is unique across versions of a secret.
148
149
150        :return: The name of this SecretVersion.
151        :rtype: str
152        """
153        return self._name
154
155    @name.setter
156    def name(self, name):
157        """
158        Sets the name of this SecretVersion.
159        The name of the secret version. A name is unique across versions of a secret.
160
161
162        :param name: The name of this SecretVersion.
163        :type: str
164        """
165        self._name = name
166
167    @property
168    def secret_id(self):
169        """
170        Gets the secret_id of this SecretVersion.
171        The OCID of the secret.
172
173
174        :return: The secret_id of this SecretVersion.
175        :rtype: str
176        """
177        return self._secret_id
178
179    @secret_id.setter
180    def secret_id(self, secret_id):
181        """
182        Sets the secret_id of this SecretVersion.
183        The OCID of the secret.
184
185
186        :param secret_id: The secret_id of this SecretVersion.
187        :type: str
188        """
189        self._secret_id = secret_id
190
191    @property
192    def stages(self):
193        """
194        Gets the stages of this SecretVersion.
195        A list of possible rotation states for the secret version. A secret version marked `CURRENT` is currently in use. A secret version
196        marked `PENDING` is staged and available for use, but has not been applied on the target system and, therefore, has not been rotated
197        into current, active use. The secret most recently uploaded to a vault is always marked `LATEST`. (The first version of a secret is
198        always marked as both `CURRENT` and `LATEST`.) A secret version marked `PREVIOUS` is the secret version that was most recently marked
199        `CURRENT`, before the last secret version rotation. A secret version marked `DEPRECATED` is neither current, pending, nor the previous
200        one in use. Only secret versions marked `DEPRECATED` can be scheduled for deletion.
201
202        Allowed values for items in this list are: "CURRENT", "PENDING", "LATEST", "PREVIOUS", "DEPRECATED", 'UNKNOWN_ENUM_VALUE'.
203        Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
204
205
206        :return: The stages of this SecretVersion.
207        :rtype: list[str]
208        """
209        return self._stages
210
211    @stages.setter
212    def stages(self, stages):
213        """
214        Sets the stages of this SecretVersion.
215        A list of possible rotation states for the secret version. A secret version marked `CURRENT` is currently in use. A secret version
216        marked `PENDING` is staged and available for use, but has not been applied on the target system and, therefore, has not been rotated
217        into current, active use. The secret most recently uploaded to a vault is always marked `LATEST`. (The first version of a secret is
218        always marked as both `CURRENT` and `LATEST`.) A secret version marked `PREVIOUS` is the secret version that was most recently marked
219        `CURRENT`, before the last secret version rotation. A secret version marked `DEPRECATED` is neither current, pending, nor the previous
220        one in use. Only secret versions marked `DEPRECATED` can be scheduled for deletion.
221
222
223        :param stages: The stages of this SecretVersion.
224        :type: list[str]
225        """
226        allowed_values = ["CURRENT", "PENDING", "LATEST", "PREVIOUS", "DEPRECATED"]
227        if stages:
228            stages[:] = ['UNKNOWN_ENUM_VALUE' if not value_allowed_none_or_none_sentinel(x, allowed_values) else x for x in stages]
229        self._stages = stages
230
231    @property
232    def time_created(self):
233        """
234        Gets the time_created of this SecretVersion.
235        A optional property indicating when the secret version was created, expressed in `RFC 3339`__ timestamp format.
236        Example: `2019-04-03T21:10:29.600Z`
237
238        __ https://tools.ietf.org/html/rfc3339
239
240
241        :return: The time_created of this SecretVersion.
242        :rtype: datetime
243        """
244        return self._time_created
245
246    @time_created.setter
247    def time_created(self, time_created):
248        """
249        Sets the time_created of this SecretVersion.
250        A optional property indicating when the secret version was created, expressed in `RFC 3339`__ timestamp format.
251        Example: `2019-04-03T21:10:29.600Z`
252
253        __ https://tools.ietf.org/html/rfc3339
254
255
256        :param time_created: The time_created of this SecretVersion.
257        :type: datetime
258        """
259        self._time_created = time_created
260
261    @property
262    def time_of_deletion(self):
263        """
264        Gets the time_of_deletion of this SecretVersion.
265        An optional property indicating when to delete the secret version, expressed in `RFC 3339`__ timestamp format.
266        Example: `2019-04-03T21:10:29.600Z`
267
268        __ https://tools.ietf.org/html/rfc3339
269
270
271        :return: The time_of_deletion of this SecretVersion.
272        :rtype: datetime
273        """
274        return self._time_of_deletion
275
276    @time_of_deletion.setter
277    def time_of_deletion(self, time_of_deletion):
278        """
279        Sets the time_of_deletion of this SecretVersion.
280        An optional property indicating when to delete the secret version, expressed in `RFC 3339`__ timestamp format.
281        Example: `2019-04-03T21:10:29.600Z`
282
283        __ https://tools.ietf.org/html/rfc3339
284
285
286        :param time_of_deletion: The time_of_deletion of this SecretVersion.
287        :type: datetime
288        """
289        self._time_of_deletion = time_of_deletion
290
291    @property
292    def time_of_current_version_expiry(self):
293        """
294        Gets the time_of_current_version_expiry of this SecretVersion.
295        An optional property indicating when the current secret version will expire, expressed in `RFC 3339`__ timestamp format.
296        Example: `2019-04-03T21:10:29.600Z`
297
298        __ https://tools.ietf.org/html/rfc3339
299
300
301        :return: The time_of_current_version_expiry of this SecretVersion.
302        :rtype: datetime
303        """
304        return self._time_of_current_version_expiry
305
306    @time_of_current_version_expiry.setter
307    def time_of_current_version_expiry(self, time_of_current_version_expiry):
308        """
309        Sets the time_of_current_version_expiry of this SecretVersion.
310        An optional property indicating when the current secret version will expire, expressed in `RFC 3339`__ timestamp format.
311        Example: `2019-04-03T21:10:29.600Z`
312
313        __ https://tools.ietf.org/html/rfc3339
314
315
316        :param time_of_current_version_expiry: The time_of_current_version_expiry of this SecretVersion.
317        :type: datetime
318        """
319        self._time_of_current_version_expiry = time_of_current_version_expiry
320
321    @property
322    def version_number(self):
323        """
324        Gets the version_number of this SecretVersion.
325        The version number of the secret.
326
327
328        :return: The version_number of this SecretVersion.
329        :rtype: int
330        """
331        return self._version_number
332
333    @version_number.setter
334    def version_number(self, version_number):
335        """
336        Sets the version_number of this SecretVersion.
337        The version number of the secret.
338
339
340        :param version_number: The version_number of this SecretVersion.
341        :type: int
342        """
343        self._version_number = version_number
344
345    def __repr__(self):
346        return formatted_flat_dict(self)
347
348    def __eq__(self, other):
349        if other is None:
350            return False
351
352        return self.__dict__ == other.__dict__
353
354    def __ne__(self, other):
355        return not self == other
356