Skip to content
This repository was archived by the owner on Dec 31, 2023. It is now read-only.

Commit 8137467

Browse files
docs: Add documentation for enums (#370)
* docs: Add documentation for enums fix: Add context manager return types chore: Update gapic-generator-python to v1.8.1 PiperOrigin-RevId: 503210727 Source-Link: googleapis/googleapis@a391fd1 Source-Link: https://github.com/googleapis/googleapis-gen/commit/0080f830dec37c3384157082bce279e37079ea58 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDA4MGY4MzBkZWMzN2MzMzg0MTU3MDgyYmNlMjc5ZTM3MDc5ZWE1OCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent be7c439 commit 8137467

File tree

4 files changed

+251
-4
lines changed

4 files changed

+251
-4
lines changed

google/cloud/kms_v1/services/ekm_service/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ def sample_update_ekm_connection():
968968
# Done; return the response.
969969
return response
970970

971-
def __enter__(self):
971+
def __enter__(self) -> "EkmServiceClient":
972972
return self
973973

974974
def __exit__(self, type, value, traceback):

google/cloud/kms_v1/services/key_management_service/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3828,7 +3828,7 @@ def sample_generate_random_bytes():
38283828
# Done; return the response.
38293829
return response
38303830

3831-
def __enter__(self):
3831+
def __enter__(self) -> "KeyManagementServiceClient":
38323832
return self
38333833

38343834
def __exit__(self, type, value, traceback):

google/cloud/kms_v1/types/resources.py

Lines changed: 248 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,21 @@ class ProtectionLevel(proto.Enum):
4141
cryptographic operations are performed. For more information, see
4242
[Protection levels]
4343
(https://cloud.google.com/kms/docs/algorithms#protection_levels).
44+
45+
Values:
46+
PROTECTION_LEVEL_UNSPECIFIED (0):
47+
Not specified.
48+
SOFTWARE (1):
49+
Crypto operations are performed in software.
50+
HSM (2):
51+
Crypto operations are performed in a Hardware
52+
Security Module.
53+
EXTERNAL (3):
54+
Crypto operations are performed by an
55+
external key manager.
56+
EXTERNAL_VPC (4):
57+
Crypto operations are performed in an
58+
EKM-over-VPC backend.
4459
"""
4560
PROTECTION_LEVEL_UNSPECIFIED = 0
4661
SOFTWARE = 1
@@ -200,6 +215,32 @@ class CryptoKeyPurpose(proto.Enum):
200215
used for the operations allowed by its purpose. For more
201216
information, see `Key
202217
purposes <https://cloud.google.com/kms/docs/algorithms#key_purposes>`__.
218+
219+
Values:
220+
CRYPTO_KEY_PURPOSE_UNSPECIFIED (0):
221+
Not specified.
222+
ENCRYPT_DECRYPT (1):
223+
[CryptoKeys][google.cloud.kms.v1.CryptoKey] with this
224+
purpose may be used with
225+
[Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]
226+
and
227+
[Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
228+
ASYMMETRIC_SIGN (5):
229+
[CryptoKeys][google.cloud.kms.v1.CryptoKey] with this
230+
purpose may be used with
231+
[AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]
232+
and
233+
[GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
234+
ASYMMETRIC_DECRYPT (6):
235+
[CryptoKeys][google.cloud.kms.v1.CryptoKey] with this
236+
purpose may be used with
237+
[AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]
238+
and
239+
[GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
240+
MAC (9):
241+
[CryptoKeys][google.cloud.kms.v1.CryptoKey] with this
242+
purpose may be used with
243+
[MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
203244
"""
204245
CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0
205246
ENCRYPT_DECRYPT = 1
@@ -322,7 +363,22 @@ class KeyOperationAttestation(proto.Message):
322363
"""
323364

324365
class AttestationFormat(proto.Enum):
325-
r"""Attestation formats provided by the HSM."""
366+
r"""Attestation formats provided by the HSM.
367+
368+
Values:
369+
ATTESTATION_FORMAT_UNSPECIFIED (0):
370+
Not specified.
371+
CAVIUM_V1_COMPRESSED (3):
372+
Cavium HSM attestation compressed with gzip.
373+
Note that this format is defined by Cavium and
374+
subject to change at any time.
375+
See
376+
https://www.marvell.com/products/security-solutions/nitrox-hs-adapters/software-key-attestation.html.
377+
CAVIUM_V2_COMPRESSED (4):
378+
Cavium HSM attestation V2 compressed with
379+
gzip. This is a new format introduced in
380+
Cavium's version 3.2-08.
381+
"""
326382
ATTESTATION_FORMAT_UNSPECIFIED = 0
327383
CAVIUM_V1_COMPRESSED = 3
328384
CAVIUM_V2_COMPRESSED = 4
@@ -512,6 +568,74 @@ class CryptoKeyVersionAlgorithm(proto.Enum):
512568
513569
For more information, see [Key purposes and algorithms]
514570
(https://cloud.google.com/kms/docs/algorithms).
571+
572+
Values:
573+
CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED (0):
574+
Not specified.
575+
GOOGLE_SYMMETRIC_ENCRYPTION (1):
576+
Creates symmetric encryption keys.
577+
RSA_SIGN_PSS_2048_SHA256 (2):
578+
RSASSA-PSS 2048 bit key with a SHA256 digest.
579+
RSA_SIGN_PSS_3072_SHA256 (3):
580+
RSASSA-PSS 3072 bit key with a SHA256 digest.
581+
RSA_SIGN_PSS_4096_SHA256 (4):
582+
RSASSA-PSS 4096 bit key with a SHA256 digest.
583+
RSA_SIGN_PSS_4096_SHA512 (15):
584+
RSASSA-PSS 4096 bit key with a SHA512 digest.
585+
RSA_SIGN_PKCS1_2048_SHA256 (5):
586+
RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest.
587+
RSA_SIGN_PKCS1_3072_SHA256 (6):
588+
RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest.
589+
RSA_SIGN_PKCS1_4096_SHA256 (7):
590+
RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest.
591+
RSA_SIGN_PKCS1_4096_SHA512 (16):
592+
RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA512 digest.
593+
RSA_SIGN_RAW_PKCS1_2048 (28):
594+
RSASSA-PKCS1-v1_5 signing without encoding, with a 2048 bit
595+
key.
596+
RSA_SIGN_RAW_PKCS1_3072 (29):
597+
RSASSA-PKCS1-v1_5 signing without encoding, with a 3072 bit
598+
key.
599+
RSA_SIGN_RAW_PKCS1_4096 (30):
600+
RSASSA-PKCS1-v1_5 signing without encoding, with a 4096 bit
601+
key.
602+
RSA_DECRYPT_OAEP_2048_SHA256 (8):
603+
RSAES-OAEP 2048 bit key with a SHA256 digest.
604+
RSA_DECRYPT_OAEP_3072_SHA256 (9):
605+
RSAES-OAEP 3072 bit key with a SHA256 digest.
606+
RSA_DECRYPT_OAEP_4096_SHA256 (10):
607+
RSAES-OAEP 4096 bit key with a SHA256 digest.
608+
RSA_DECRYPT_OAEP_4096_SHA512 (17):
609+
RSAES-OAEP 4096 bit key with a SHA512 digest.
610+
RSA_DECRYPT_OAEP_2048_SHA1 (37):
611+
RSAES-OAEP 2048 bit key with a SHA1 digest.
612+
RSA_DECRYPT_OAEP_3072_SHA1 (38):
613+
RSAES-OAEP 3072 bit key with a SHA1 digest.
614+
RSA_DECRYPT_OAEP_4096_SHA1 (39):
615+
RSAES-OAEP 4096 bit key with a SHA1 digest.
616+
EC_SIGN_P256_SHA256 (12):
617+
ECDSA on the NIST P-256 curve with a SHA256
618+
digest.
619+
EC_SIGN_P384_SHA384 (13):
620+
ECDSA on the NIST P-384 curve with a SHA384
621+
digest.
622+
EC_SIGN_SECP256K1_SHA256 (31):
623+
ECDSA on the non-NIST secp256k1 curve. This
624+
curve is only supported for HSM protection
625+
level.
626+
HMAC_SHA256 (32):
627+
HMAC-SHA256 signing with a 256 bit key.
628+
HMAC_SHA1 (33):
629+
HMAC-SHA1 signing with a 160 bit key.
630+
HMAC_SHA384 (34):
631+
HMAC-SHA384 signing with a 384 bit key.
632+
HMAC_SHA512 (35):
633+
HMAC-SHA512 signing with a 512 bit key.
634+
HMAC_SHA224 (36):
635+
HMAC-SHA224 signing with a 224 bit key.
636+
EXTERNAL_SYMMETRIC_ENCRYPTION (18):
637+
Algorithm representing symmetric encryption
638+
by an external key manager.
515639
"""
516640
CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED = 0
517641
GOOGLE_SYMMETRIC_ENCRYPTION = 1
@@ -547,6 +671,51 @@ class CryptoKeyVersionState(proto.Enum):
547671
r"""The state of a
548672
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating
549673
if it can be used.
674+
675+
Values:
676+
CRYPTO_KEY_VERSION_STATE_UNSPECIFIED (0):
677+
Not specified.
678+
PENDING_GENERATION (5):
679+
This version is still being generated. It may not be used,
680+
enabled, disabled, or destroyed yet. Cloud KMS will
681+
automatically mark this version
682+
[ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
683+
as soon as the version is ready.
684+
ENABLED (1):
685+
This version may be used for cryptographic
686+
operations.
687+
DISABLED (2):
688+
This version may not be used, but the key material is still
689+
available, and the version can be placed back into the
690+
[ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
691+
state.
692+
DESTROYED (3):
693+
This version is destroyed, and the key material is no longer
694+
stored. This version may only become
695+
[ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
696+
again if this version is
697+
[reimport_eligible][google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]
698+
and the original key material is reimported with a call to
699+
[KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
700+
DESTROY_SCHEDULED (4):
701+
This version is scheduled for destruction, and will be
702+
destroyed soon. Call
703+
[RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]
704+
to put it back into the
705+
[DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]
706+
state.
707+
PENDING_IMPORT (6):
708+
This version is still being imported. It may not be used,
709+
enabled, disabled, or destroyed yet. Cloud KMS will
710+
automatically mark this version
711+
[ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
712+
as soon as the version is ready.
713+
IMPORT_FAILED (7):
714+
This version was not imported successfully. It may not be
715+
used, enabled, disabled, or destroyed. The submitted key
716+
material has been discarded. Additional details can be found
717+
in
718+
[CryptoKeyVersion.import_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason].
550719
"""
551720
CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0
552721
PENDING_GENERATION = 5
@@ -565,6 +734,19 @@ class CryptoKeyVersionView(proto.Enum):
565734
[KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]
566735
and
567736
[KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
737+
738+
Values:
739+
CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED (0):
740+
Default view for each
741+
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
742+
Does not include the
743+
[attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation]
744+
field.
745+
FULL (1):
746+
Provides all fields in each
747+
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion],
748+
including the
749+
[attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation].
568750
"""
569751
CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED = 0
570752
FULL = 1
@@ -804,6 +986,52 @@ class ImportMethod(proto.Enum):
804986
r"""[ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] describes
805987
the key wrapping method chosen for this
806988
[ImportJob][google.cloud.kms.v1.ImportJob].
989+
990+
Values:
991+
IMPORT_METHOD_UNSPECIFIED (0):
992+
Not specified.
993+
RSA_OAEP_3072_SHA1_AES_256 (1):
994+
This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key
995+
wrapping scheme defined in the PKCS #11 standard. In
996+
summary, this involves wrapping the raw key with an
997+
ephemeral AES key, and wrapping the ephemeral AES key with a
998+
3072 bit RSA key. For more details, see `RSA AES key wrap
999+
mechanism <http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908>`__.
1000+
RSA_OAEP_4096_SHA1_AES_256 (2):
1001+
This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key
1002+
wrapping scheme defined in the PKCS #11 standard. In
1003+
summary, this involves wrapping the raw key with an
1004+
ephemeral AES key, and wrapping the ephemeral AES key with a
1005+
4096 bit RSA key. For more details, see `RSA AES key wrap
1006+
mechanism <http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908>`__.
1007+
RSA_OAEP_3072_SHA256_AES_256 (3):
1008+
This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key
1009+
wrapping scheme defined in the PKCS #11 standard. In
1010+
summary, this involves wrapping the raw key with an
1011+
ephemeral AES key, and wrapping the ephemeral AES key with a
1012+
3072 bit RSA key. For more details, see `RSA AES key wrap
1013+
mechanism <http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908>`__.
1014+
RSA_OAEP_4096_SHA256_AES_256 (4):
1015+
This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key
1016+
wrapping scheme defined in the PKCS #11 standard. In
1017+
summary, this involves wrapping the raw key with an
1018+
ephemeral AES key, and wrapping the ephemeral AES key with a
1019+
4096 bit RSA key. For more details, see `RSA AES key wrap
1020+
mechanism <http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908>`__.
1021+
RSA_OAEP_3072_SHA256 (5):
1022+
This ImportMethod represents RSAES-OAEP with
1023+
a 3072 bit RSA key. The key material to be
1024+
imported is wrapped directly with the RSA key.
1025+
Due to technical limitations of RSA wrapping,
1026+
this method cannot be used to wrap RSA keys for
1027+
import.
1028+
RSA_OAEP_4096_SHA256 (6):
1029+
This ImportMethod represents RSAES-OAEP with
1030+
a 4096 bit RSA key. The key material to be
1031+
imported is wrapped directly with the RSA key.
1032+
Due to technical limitations of RSA wrapping,
1033+
this method cannot be used to wrap RSA keys for
1034+
import.
8071035
"""
8081036
IMPORT_METHOD_UNSPECIFIED = 0
8091037
RSA_OAEP_3072_SHA1_AES_256 = 1
@@ -816,6 +1044,25 @@ class ImportMethod(proto.Enum):
8161044
class ImportJobState(proto.Enum):
8171045
r"""The state of the [ImportJob][google.cloud.kms.v1.ImportJob],
8181046
indicating if it can be used.
1047+
1048+
Values:
1049+
IMPORT_JOB_STATE_UNSPECIFIED (0):
1050+
Not specified.
1051+
PENDING_GENERATION (1):
1052+
The wrapping key for this job is still being generated. It
1053+
may not be used. Cloud KMS will automatically mark this job
1054+
as
1055+
[ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]
1056+
as soon as the wrapping key is generated.
1057+
ACTIVE (2):
1058+
This job may be used in
1059+
[CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]
1060+
and
1061+
[CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
1062+
requests.
1063+
EXPIRED (3):
1064+
This job can no longer be used and may not
1065+
leave this state once entered.
8191066
"""
8201067
IMPORT_JOB_STATE_UNSPECIFIED = 0
8211068
PENDING_GENERATION = 1

samples/generated_samples/snippet_metadata_google.cloud.kms.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-kms",
11-
"version": "2.14.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

0 commit comments

Comments
 (0)