This repository has been archived by the owner on Sep 5, 2023. It is now read-only.
/
resources.py
465 lines (387 loc) · 18.7 KB
/
resources.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import proto # type: ignore
from google.protobuf import duration_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
__protobuf__ = proto.module(
package="google.cloud.secretmanager.v1",
manifest={
"Secret",
"SecretVersion",
"Replication",
"CustomerManagedEncryption",
"ReplicationStatus",
"CustomerManagedEncryptionStatus",
"Topic",
"Rotation",
"SecretPayload",
},
)
class Secret(proto.Message):
r"""A [Secret][google.cloud.secretmanager.v1.Secret] is a logical secret
whose value and versions can be accessed.
A [Secret][google.cloud.secretmanager.v1.Secret] is made up of zero
or more
[SecretVersions][google.cloud.secretmanager.v1.SecretVersion] that
represent the secret data.
Attributes:
name (str):
Output only. The resource name of the
[Secret][google.cloud.secretmanager.v1.Secret] in the format
``projects/*/secrets/*``.
replication (google.cloud.secretmanager_v1.types.Replication):
Required. Immutable. The replication policy of the secret
data attached to the
[Secret][google.cloud.secretmanager.v1.Secret].
The replication policy cannot be changed after the Secret
has been created.
create_time (google.protobuf.timestamp_pb2.Timestamp):
Output only. The time at which the
[Secret][google.cloud.secretmanager.v1.Secret] was created.
labels (Sequence[google.cloud.secretmanager_v1.types.Secret.LabelsEntry]):
The labels assigned to this Secret.
Label keys must be between 1 and 63 characters long, have a
UTF-8 encoding of maximum 128 bytes, and must conform to the
following PCRE regular expression:
``[\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}``
Label values must be between 0 and 63 characters long, have
a UTF-8 encoding of maximum 128 bytes, and must conform to
the following PCRE regular expression:
``[\p{Ll}\p{Lo}\p{N}_-]{0,63}``
No more than 64 labels can be assigned to a given resource.
topics (Sequence[google.cloud.secretmanager_v1.types.Topic]):
Optional. A list of up to 10 Pub/Sub topics
to which messages are published when control
plane operations are called on the secret or its
versions.
expire_time (google.protobuf.timestamp_pb2.Timestamp):
Optional. Timestamp in UTC when the
[Secret][google.cloud.secretmanager.v1.Secret] is scheduled
to expire. This is always provided on output, regardless of
what was sent on input.
ttl (google.protobuf.duration_pb2.Duration):
Input only. The TTL for the
[Secret][google.cloud.secretmanager.v1.Secret].
etag (str):
Optional. Etag of the currently stored
[Secret][google.cloud.secretmanager.v1.Secret].
rotation (google.cloud.secretmanager_v1.types.Rotation):
Optional. Rotation policy attached to the
[Secret][google.cloud.secretmanager.v1.Secret]. May be
excluded if there is no rotation policy.
"""
name = proto.Field(proto.STRING, number=1,)
replication = proto.Field(proto.MESSAGE, number=2, message="Replication",)
create_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,)
labels = proto.MapField(proto.STRING, proto.STRING, number=4,)
topics = proto.RepeatedField(proto.MESSAGE, number=5, message="Topic",)
expire_time = proto.Field(
proto.MESSAGE, number=6, oneof="expiration", message=timestamp_pb2.Timestamp,
)
ttl = proto.Field(
proto.MESSAGE, number=7, oneof="expiration", message=duration_pb2.Duration,
)
etag = proto.Field(proto.STRING, number=8,)
rotation = proto.Field(proto.MESSAGE, number=9, message="Rotation",)
class SecretVersion(proto.Message):
r"""A secret version resource in the Secret Manager API.
Attributes:
name (str):
Output only. The resource name of the
[SecretVersion][google.cloud.secretmanager.v1.SecretVersion]
in the format ``projects/*/secrets/*/versions/*``.
[SecretVersion][google.cloud.secretmanager.v1.SecretVersion]
IDs in a [Secret][google.cloud.secretmanager.v1.Secret]
start at 1 and are incremented for each subsequent version
of the secret.
create_time (google.protobuf.timestamp_pb2.Timestamp):
Output only. The time at which the
[SecretVersion][google.cloud.secretmanager.v1.SecretVersion]
was created.
destroy_time (google.protobuf.timestamp_pb2.Timestamp):
Output only. The time this
[SecretVersion][google.cloud.secretmanager.v1.SecretVersion]
was destroyed. Only present if
[state][google.cloud.secretmanager.v1.SecretVersion.state]
is
[DESTROYED][google.cloud.secretmanager.v1.SecretVersion.State.DESTROYED].
state (google.cloud.secretmanager_v1.types.SecretVersion.State):
Output only. The current state of the
[SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
replication_status (google.cloud.secretmanager_v1.types.ReplicationStatus):
The replication status of the
[SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
etag (str):
Output only. Etag of the currently stored
[SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
"""
class State(proto.Enum):
r"""The state of a
[SecretVersion][google.cloud.secretmanager.v1.SecretVersion],
indicating if it can be accessed.
"""
STATE_UNSPECIFIED = 0
ENABLED = 1
DISABLED = 2
DESTROYED = 3
name = proto.Field(proto.STRING, number=1,)
create_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,)
destroy_time = proto.Field(
proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,
)
state = proto.Field(proto.ENUM, number=4, enum=State,)
replication_status = proto.Field(
proto.MESSAGE, number=5, message="ReplicationStatus",
)
etag = proto.Field(proto.STRING, number=6,)
class Replication(proto.Message):
r"""A policy that defines the replication and encryption
configuration of data.
Attributes:
automatic (google.cloud.secretmanager_v1.types.Replication.Automatic):
The [Secret][google.cloud.secretmanager.v1.Secret] will
automatically be replicated without any restrictions.
user_managed (google.cloud.secretmanager_v1.types.Replication.UserManaged):
The [Secret][google.cloud.secretmanager.v1.Secret] will only
be replicated into the locations specified.
"""
class Automatic(proto.Message):
r"""A replication policy that replicates the
[Secret][google.cloud.secretmanager.v1.Secret] payload without any
restrictions.
Attributes:
customer_managed_encryption (google.cloud.secretmanager_v1.types.CustomerManagedEncryption):
Optional. The customer-managed encryption configuration of
the [Secret][google.cloud.secretmanager.v1.Secret]. If no
configuration is provided, Google-managed default encryption
is used.
Updates to the
[Secret][google.cloud.secretmanager.v1.Secret] encryption
configuration only apply to
[SecretVersions][google.cloud.secretmanager.v1.SecretVersion]
added afterwards. They do not apply retroactively to
existing
[SecretVersions][google.cloud.secretmanager.v1.SecretVersion].
"""
customer_managed_encryption = proto.Field(
proto.MESSAGE, number=1, message="CustomerManagedEncryption",
)
class UserManaged(proto.Message):
r"""A replication policy that replicates the
[Secret][google.cloud.secretmanager.v1.Secret] payload into the
locations specified in [Secret.replication.user_managed.replicas][]
Attributes:
replicas (Sequence[google.cloud.secretmanager_v1.types.Replication.UserManaged.Replica]):
Required. The list of Replicas for this
[Secret][google.cloud.secretmanager.v1.Secret].
Cannot be empty.
"""
class Replica(proto.Message):
r"""Represents a Replica for this
[Secret][google.cloud.secretmanager.v1.Secret].
Attributes:
location (str):
The canonical IDs of the location to replicate data. For
example: ``"us-east1"``.
customer_managed_encryption (google.cloud.secretmanager_v1.types.CustomerManagedEncryption):
Optional. The customer-managed encryption configuration of
the [User-Managed Replica][Replication.UserManaged.Replica].
If no configuration is provided, Google-managed default
encryption is used.
Updates to the
[Secret][google.cloud.secretmanager.v1.Secret] encryption
configuration only apply to
[SecretVersions][google.cloud.secretmanager.v1.SecretVersion]
added afterwards. They do not apply retroactively to
existing
[SecretVersions][google.cloud.secretmanager.v1.SecretVersion].
"""
location = proto.Field(proto.STRING, number=1,)
customer_managed_encryption = proto.Field(
proto.MESSAGE, number=2, message="CustomerManagedEncryption",
)
replicas = proto.RepeatedField(
proto.MESSAGE, number=1, message="Replication.UserManaged.Replica",
)
automatic = proto.Field(
proto.MESSAGE, number=1, oneof="replication", message=Automatic,
)
user_managed = proto.Field(
proto.MESSAGE, number=2, oneof="replication", message=UserManaged,
)
class CustomerManagedEncryption(proto.Message):
r"""Configuration for encrypting secret payloads using customer-
anaged encryption keys (CMEK).
Attributes:
kms_key_name (str):
Required. The resource name of the Cloud KMS CryptoKey used
to encrypt secret payloads.
For secrets using the
[UserManaged][google.cloud.secretmanager.v1.Replication.UserManaged]
replication policy type, Cloud KMS CryptoKeys must reside in
the same location as the [replica
location][Secret.UserManaged.Replica.location].
For secrets using the
[Automatic][google.cloud.secretmanager.v1.Replication.Automatic]
replication policy type, Cloud KMS CryptoKeys must reside in
``global``.
The expected format is
``projects/*/locations/*/keyRings/*/cryptoKeys/*``.
"""
kms_key_name = proto.Field(proto.STRING, number=1,)
class ReplicationStatus(proto.Message):
r"""The replication status of a
[SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
Attributes:
automatic (google.cloud.secretmanager_v1.types.ReplicationStatus.AutomaticStatus):
Describes the replication status of a
[SecretVersion][google.cloud.secretmanager.v1.SecretVersion]
with automatic replication.
Only populated if the parent
[Secret][google.cloud.secretmanager.v1.Secret] has an
automatic replication policy.
user_managed (google.cloud.secretmanager_v1.types.ReplicationStatus.UserManagedStatus):
Describes the replication status of a
[SecretVersion][google.cloud.secretmanager.v1.SecretVersion]
with user-managed replication.
Only populated if the parent
[Secret][google.cloud.secretmanager.v1.Secret] has a
user-managed replication policy.
"""
class AutomaticStatus(proto.Message):
r"""The replication status of a
[SecretVersion][google.cloud.secretmanager.v1.SecretVersion] using
automatic replication.
Only populated if the parent
[Secret][google.cloud.secretmanager.v1.Secret] has an automatic
replication policy.
Attributes:
customer_managed_encryption (google.cloud.secretmanager_v1.types.CustomerManagedEncryptionStatus):
Output only. The customer-managed encryption status of the
[SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
Only populated if customer-managed encryption is used.
"""
customer_managed_encryption = proto.Field(
proto.MESSAGE, number=1, message="CustomerManagedEncryptionStatus",
)
class UserManagedStatus(proto.Message):
r"""The replication status of a
[SecretVersion][google.cloud.secretmanager.v1.SecretVersion] using
user-managed replication.
Only populated if the parent
[Secret][google.cloud.secretmanager.v1.Secret] has a user-managed
replication policy.
Attributes:
replicas (Sequence[google.cloud.secretmanager_v1.types.ReplicationStatus.UserManagedStatus.ReplicaStatus]):
Output only. The list of replica statuses for the
[SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
"""
class ReplicaStatus(proto.Message):
r"""Describes the status of a user-managed replica for the
[SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
Attributes:
location (str):
Output only. The canonical ID of the replica location. For
example: ``"us-east1"``.
customer_managed_encryption (google.cloud.secretmanager_v1.types.CustomerManagedEncryptionStatus):
Output only. The customer-managed encryption status of the
[SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
Only populated if customer-managed encryption is used.
"""
location = proto.Field(proto.STRING, number=1,)
customer_managed_encryption = proto.Field(
proto.MESSAGE, number=2, message="CustomerManagedEncryptionStatus",
)
replicas = proto.RepeatedField(
proto.MESSAGE,
number=1,
message="ReplicationStatus.UserManagedStatus.ReplicaStatus",
)
automatic = proto.Field(
proto.MESSAGE, number=1, oneof="replication_status", message=AutomaticStatus,
)
user_managed = proto.Field(
proto.MESSAGE, number=2, oneof="replication_status", message=UserManagedStatus,
)
class CustomerManagedEncryptionStatus(proto.Message):
r"""Describes the status of customer-managed encryption.
Attributes:
kms_key_version_name (str):
Required. The resource name of the Cloud KMS
CryptoKeyVersion used to encrypt the secret payload, in the
following format:
``projects/*/locations/*/keyRings/*/cryptoKeys/*/versions/*``.
"""
kms_key_version_name = proto.Field(proto.STRING, number=1,)
class Topic(proto.Message):
r"""A Pub/Sub topic which Secret Manager will publish to when
control plane events occur on this secret.
Attributes:
name (str):
Required. The resource name of the Pub/Sub topic that will
be published to, in the following format:
``projects/*/topics/*``. For publication to succeed, the
Secret Manager P4SA must have ``pubsub.publisher``
permissions on the topic.
"""
name = proto.Field(proto.STRING, number=1,)
class Rotation(proto.Message):
r"""The rotation time and period for a
[Secret][google.cloud.secretmanager.v1.Secret]. At
next_rotation_time, Secret Manager will send a Pub/Sub notification
to the topics configured on the Secret.
[Secret.topics][google.cloud.secretmanager.v1.Secret.topics] must be
set to configure rotation.
Attributes:
next_rotation_time (google.protobuf.timestamp_pb2.Timestamp):
Optional. Timestamp in UTC at which the
[Secret][google.cloud.secretmanager.v1.Secret] is scheduled
to rotate. Cannot be set to less than 300s (5 min) in the
future and at most 3153600000s (100 years).
[next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time]
MUST be set if
[rotation_period][google.cloud.secretmanager.v1.Rotation.rotation_period]
is set.
rotation_period (google.protobuf.duration_pb2.Duration):
Input only. The Duration between rotation notifications.
Must be in seconds and at least 3600s (1h) and at most
3153600000s (100 years).
If
[rotation_period][google.cloud.secretmanager.v1.Rotation.rotation_period]
is set,
[next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time]
must be set.
[next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time]
will be advanced by this period when the service
automatically sends rotation notifications.
"""
next_rotation_time = proto.Field(
proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,
)
rotation_period = proto.Field(
proto.MESSAGE, number=2, message=duration_pb2.Duration,
)
class SecretPayload(proto.Message):
r"""A secret payload resource in the Secret Manager API. This contains
the sensitive secret payload that is associated with a
[SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
Attributes:
data (bytes):
The secret data. Must be no larger than
64KiB.
"""
data = proto.Field(proto.BYTES, number=1,)
__all__ = tuple(sorted(__protobuf__.manifest))