Skip to content

Commit 211f8c7

Browse files
feat(kms): add ProtectionLevel.External enum; standardize use of 'optional' and 'required' in docstrings (via synth) (#10070)
1 parent ccbec02 commit 211f8c7

9 files changed

+856
-3874
lines changed

kms/google/cloud/kms_v1/gapic/enums.py

+2
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ class ProtectionLevel(enum.IntEnum):
2929
PROTECTION_LEVEL_UNSPECIFIED (int): Not specified.
3030
SOFTWARE (int): Crypto operations are performed in software.
3131
HSM (int): Crypto operations are performed in a Hardware Security Module.
32+
EXTERNAL (int): Crypto operations are performed by an external key manager.
3233
"""
3334

3435
PROTECTION_LEVEL_UNSPECIFIED = 0
3536
SOFTWARE = 1
3637
HSM = 2
38+
EXTERNAL = 3
3739

3840

3941
class CryptoKey(object):

kms/google/cloud/kms_v1/gapic/key_management_service_client.py

+51-26
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class KeyManagementServiceClient(object):
5858
- ``KeyRing``
5959
- ``CryptoKey``
6060
- ``CryptoKeyVersion``
61+
- ``ImportJob``
6162
6263
If you are using manual gRPC libraries, see `Using gRPC with Cloud
6364
KMS <https://cloud.google.com/kms/docs/grpc>`__.
@@ -312,8 +313,12 @@ def list_key_rings(
312313
streaming is performed per-page, this determines the maximum number
313314
of resources in a page.
314315
filter_ (str): Optional. Only include resources that match the filter in the response.
315-
order_by (str): Optional. Specify how the results should be sorted. If not specified, the
316-
results will be sorted in the default order.
316+
For more information, see `Sorting and filtering list
317+
results <https://cloud.google.com/kms/docs/sorting-and-filtering>`__.
318+
order_by (str): Optional. Specify how the results should be sorted. If not specified,
319+
the results will be sorted in the default order. For more information,
320+
see `Sorting and filtering list
321+
results <https://cloud.google.com/kms/docs/sorting-and-filtering>`__.
317322
retry (Optional[google.api_core.retry.Retry]): A retry object used
318323
to retry requests. If ``None`` is specified, requests will
319324
be retried using a default configuration.
@@ -421,8 +426,12 @@ def list_import_jobs(
421426
streaming is performed per-page, this determines the maximum number
422427
of resources in a page.
423428
filter_ (str): Optional. Only include resources that match the filter in the response.
424-
order_by (str): Optional. Specify how the results should be sorted. If not specified, the
425-
results will be sorted in the default order.
429+
For more information, see `Sorting and filtering list
430+
results <https://cloud.google.com/kms/docs/sorting-and-filtering>`__.
431+
order_by (str): Optional. Specify how the results should be sorted. If not specified,
432+
the results will be sorted in the default order. For more information,
433+
see `Sorting and filtering list
434+
results <https://cloud.google.com/kms/docs/sorting-and-filtering>`__.
426435
retry (Optional[google.api_core.retry.Retry]): A retry object used
427436
to retry requests. If ``None`` is specified, requests will
428437
be retried using a default configuration.
@@ -532,8 +541,12 @@ def list_crypto_keys(
532541
of resources in a page.
533542
version_view (~google.cloud.kms_v1.types.CryptoKeyVersionView): The fields of the primary version to include in the response.
534543
filter_ (str): Optional. Only include resources that match the filter in the response.
535-
order_by (str): Optional. Specify how the results should be sorted. If not specified, the
536-
results will be sorted in the default order.
544+
For more information, see `Sorting and filtering list
545+
results <https://cloud.google.com/kms/docs/sorting-and-filtering>`__.
546+
order_by (str): Optional. Specify how the results should be sorted. If not specified,
547+
the results will be sorted in the default order. For more information,
548+
see `Sorting and filtering list
549+
results <https://cloud.google.com/kms/docs/sorting-and-filtering>`__.
537550
retry (Optional[google.api_core.retry.Retry]): A retry object used
538551
to retry requests. If ``None`` is specified, requests will
539552
be retried using a default configuration.
@@ -647,8 +660,12 @@ def list_crypto_key_versions(
647660
of resources in a page.
648661
view (~google.cloud.kms_v1.types.CryptoKeyVersionView): The fields to include in the response.
649662
filter_ (str): Optional. Only include resources that match the filter in the response.
650-
order_by (str): Optional. Specify how the results should be sorted. If not specified, the
651-
results will be sorted in the default order.
663+
For more information, see `Sorting and filtering list
664+
results <https://cloud.google.com/kms/docs/sorting-and-filtering>`__.
665+
order_by (str): Optional. Specify how the results should be sorted. If not specified,
666+
the results will be sorted in the default order. For more information,
667+
see `Sorting and filtering list
668+
results <https://cloud.google.com/kms/docs/sorting-and-filtering>`__.
652669
retry (Optional[google.api_core.retry.Retry]): A retry object used
653670
to retry requests. If ``None`` is specified, requests will
654671
be retried using a default configuration.
@@ -737,7 +754,7 @@ def get_key_ring(
737754
>>> response = client.get_key_ring(name)
738755
739756
Args:
740-
name (str): The ``name`` of the ``KeyRing`` to get.
757+
name (str): Required. The ``name`` of the ``KeyRing`` to get.
741758
retry (Optional[google.api_core.retry.Retry]): A retry object used
742759
to retry requests. If ``None`` is specified, requests will
743760
be retried using a default configuration.
@@ -806,7 +823,7 @@ def get_import_job(
806823
>>> response = client.get_import_job(name)
807824
808825
Args:
809-
name (str): The ``name`` of the ``ImportJob`` to get.
826+
name (str): Required. The ``name`` of the ``ImportJob`` to get.
810827
retry (Optional[google.api_core.retry.Retry]): A retry object used
811828
to retry requests. If ``None`` is specified, requests will
812829
be retried using a default configuration.
@@ -876,7 +893,7 @@ def get_crypto_key(
876893
>>> response = client.get_crypto_key(name)
877894
878895
Args:
879-
name (str): The ``name`` of the ``CryptoKey`` to get.
896+
name (str): Required. The ``name`` of the ``CryptoKey`` to get.
880897
retry (Optional[google.api_core.retry.Retry]): A retry object used
881898
to retry requests. If ``None`` is specified, requests will
882899
be retried using a default configuration.
@@ -945,7 +962,7 @@ def get_crypto_key_version(
945962
>>> response = client.get_crypto_key_version(name)
946963
947964
Args:
948-
name (str): The ``name`` of the ``CryptoKeyVersion`` to get.
965+
name (str): Required. The ``name`` of the ``CryptoKeyVersion`` to get.
949966
retry (Optional[google.api_core.retry.Retry]): A retry object used
950967
to retry requests. If ``None`` is specified, requests will
951968
be retried using a default configuration.
@@ -1026,7 +1043,7 @@ def create_key_ring(
10261043
``KeyRings``, in the format ``projects/*/locations/*``.
10271044
key_ring_id (str): Required. It must be unique within a location and match the regular
10281045
expression ``[a-zA-Z0-9_-]{1,63}``
1029-
key_ring (Union[dict, ~google.cloud.kms_v1.types.KeyRing]): A ``KeyRing`` with initial field values.
1046+
key_ring (Union[dict, ~google.cloud.kms_v1.types.KeyRing]): Required. A ``KeyRing`` with initial field values.
10301047
10311048
If a dict is provided, it must be of the same form as the protobuf
10321049
message :class:`~google.cloud.kms_v1.types.KeyRing`
@@ -1205,7 +1222,7 @@ def create_crypto_key(
12051222
``CryptoKeys``.
12061223
crypto_key_id (str): Required. It must be unique within a KeyRing and match the regular
12071224
expression ``[a-zA-Z0-9_-]{1,63}``
1208-
crypto_key (Union[dict, ~google.cloud.kms_v1.types.CryptoKey]): A ``CryptoKey`` with initial field values.
1225+
crypto_key (Union[dict, ~google.cloud.kms_v1.types.CryptoKey]): Required. A ``CryptoKey`` with initial field values.
12091226
12101227
If a dict is provided, it must be of the same form as the protobuf
12111228
message :class:`~google.cloud.kms_v1.types.CryptoKey`
@@ -1294,7 +1311,7 @@ def create_crypto_key_version(
12941311
Args:
12951312
parent (str): Required. The ``name`` of the ``CryptoKey`` associated with the
12961313
``CryptoKeyVersions``.
1297-
crypto_key_version (Union[dict, ~google.cloud.kms_v1.types.CryptoKeyVersion]): A ``CryptoKeyVersion`` with initial field values.
1314+
crypto_key_version (Union[dict, ~google.cloud.kms_v1.types.CryptoKeyVersion]): Required. A ``CryptoKeyVersion`` with initial field values.
12981315
12991316
If a dict is provided, it must be of the same form as the protobuf
13001317
message :class:`~google.cloud.kms_v1.types.CryptoKeyVersion`
@@ -1405,6 +1422,11 @@ def import_crypto_key_version(
14051422
</li>
14061423
</ol>
14071424
1425+
If importing symmetric key material, it is expected that the unwrapped
1426+
key contains plain bytes. If importing asymmetric key material, it is
1427+
expected that the unwrapped key is in PKCS#8-encoded DER format (the
1428+
PrivateKeyInfo structure from RFC 5208).
1429+
14081430
This format is the same as the format produced by PKCS#11 mechanism
14091431
CKM\_RSA\_AES\_KEY\_WRAP.
14101432
retry (Optional[google.api_core.retry.Retry]): A retry object used
@@ -1491,11 +1513,11 @@ def update_crypto_key(
14911513
>>> response = client.update_crypto_key(crypto_key, update_mask)
14921514
14931515
Args:
1494-
crypto_key (Union[dict, ~google.cloud.kms_v1.types.CryptoKey]): ``CryptoKey`` with updated values.
1516+
crypto_key (Union[dict, ~google.cloud.kms_v1.types.CryptoKey]): Required. ``CryptoKey`` with updated values.
14951517
14961518
If a dict is provided, it must be of the same form as the protobuf
14971519
message :class:`~google.cloud.kms_v1.types.CryptoKey`
1498-
update_mask (Union[dict, ~google.cloud.kms_v1.types.FieldMask]): Required list of fields to be updated in this request.
1520+
update_mask (Union[dict, ~google.cloud.kms_v1.types.FieldMask]): Required. List of fields to be updated in this request.
14991521
15001522
If a dict is provided, it must be of the same form as the protobuf
15011523
message :class:`~google.cloud.kms_v1.types.FieldMask`
@@ -1578,11 +1600,11 @@ def update_crypto_key_version(
15781600
>>> response = client.update_crypto_key_version(crypto_key_version, update_mask)
15791601
15801602
Args:
1581-
crypto_key_version (Union[dict, ~google.cloud.kms_v1.types.CryptoKeyVersion]): ``CryptoKeyVersion`` with updated values.
1603+
crypto_key_version (Union[dict, ~google.cloud.kms_v1.types.CryptoKeyVersion]): Required. ``CryptoKeyVersion`` with updated values.
15821604
15831605
If a dict is provided, it must be of the same form as the protobuf
15841606
message :class:`~google.cloud.kms_v1.types.CryptoKeyVersion`
1585-
update_mask (Union[dict, ~google.cloud.kms_v1.types.FieldMask]): Required list of fields to be updated in this request.
1607+
update_mask (Union[dict, ~google.cloud.kms_v1.types.FieldMask]): Required. List of fields to be updated in this request.
15861608
15871609
If a dict is provided, it must be of the same form as the protobuf
15881610
message :class:`~google.cloud.kms_v1.types.FieldMask`
@@ -1673,7 +1695,7 @@ def encrypt(
16731695
``SOFTWARE`` keys, the plaintext must be no larger than 64KiB. For
16741696
``HSM`` keys, the combined length of the plaintext and
16751697
additional\_authenticated\_data fields must be no larger than 8KiB.
1676-
additional_authenticated_data (bytes): Optional data that, if specified, must also be provided during
1698+
additional_authenticated_data (bytes): Optional. Optional data that, if specified, must also be provided during
16771699
decryption through ``DecryptRequest.additional_authenticated_data``.
16781700
16791701
The maximum size depends on the key version's ``protection_level``. For
@@ -1762,7 +1784,7 @@ def decrypt(
17621784
The server will choose the appropriate version.
17631785
ciphertext (bytes): Required. The encrypted data originally returned in
17641786
``EncryptResponse.ciphertext``.
1765-
additional_authenticated_data (bytes): Optional data that must match the data originally supplied in
1787+
additional_authenticated_data (bytes): Optional. Optional data that must match the data originally supplied in
17661788
``EncryptRequest.additional_authenticated_data``.
17671789
retry (Optional[google.api_core.retry.Retry]): A retry object used
17681790
to retry requests. If ``None`` is specified, requests will
@@ -1842,8 +1864,8 @@ def update_crypto_key_primary_version(
18421864
>>> response = client.update_crypto_key_primary_version(name, crypto_key_version_id)
18431865
18441866
Args:
1845-
name (str): The resource name of the ``CryptoKey`` to update.
1846-
crypto_key_version_id (str): The id of the child ``CryptoKeyVersion`` to use as primary.
1867+
name (str): Required. The resource name of the ``CryptoKey`` to update.
1868+
crypto_key_version_id (str): Required. The id of the child ``CryptoKeyVersion`` to use as primary.
18471869
retry (Optional[google.api_core.retry.Retry]): A retry object used
18481870
to retry requests. If ``None`` is specified, requests will
18491871
be retried using a default configuration.
@@ -1926,7 +1948,7 @@ def destroy_crypto_key_version(
19261948
>>> response = client.destroy_crypto_key_version(name)
19271949
19281950
Args:
1929-
name (str): The resource name of the ``CryptoKeyVersion`` to destroy.
1951+
name (str): Required. The resource name of the ``CryptoKeyVersion`` to destroy.
19301952
retry (Optional[google.api_core.retry.Retry]): A retry object used
19311953
to retry requests. If ``None`` is specified, requests will
19321954
be retried using a default configuration.
@@ -1998,7 +2020,7 @@ def restore_crypto_key_version(
19982020
>>> response = client.restore_crypto_key_version(name)
19992021
20002022
Args:
2001-
name (str): The resource name of the ``CryptoKeyVersion`` to restore.
2023+
name (str): Required. The resource name of the ``CryptoKeyVersion`` to restore.
20022024
retry (Optional[google.api_core.retry.Retry]): A retry object used
20032025
to retry requests. If ``None`` is specified, requests will
20042026
be retried using a default configuration.
@@ -2069,7 +2091,7 @@ def get_public_key(
20692091
>>> response = client.get_public_key(name)
20702092
20712093
Args:
2072-
name (str): The ``name`` of the ``CryptoKeyVersion`` public key to get.
2094+
name (str): Required. The ``name`` of the ``CryptoKeyVersion`` public key to get.
20732095
retry (Optional[google.api_core.retry.Retry]): A retry object used
20742096
to retry requests. If ``None`` is specified, requests will
20752097
be retried using a default configuration.
@@ -2290,6 +2312,9 @@ def set_iam_policy(
22902312
Sets the access control policy on the specified resource. Replaces
22912313
any existing policy.
22922314
2315+
Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and
2316+
PERMISSION_DENIED
2317+
22932318
Example:
22942319
>>> from google.cloud import kms_v1
22952320
>>>

kms/google/cloud/kms_v1/gapic/transports/key_management_service_grpc_transport.py

+3
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,9 @@ def set_iam_policy(self):
458458
Sets the access control policy on the specified resource. Replaces
459459
any existing policy.
460460
461+
Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and
462+
PERMISSION_DENIED
463+
461464
Returns:
462465
Callable: A callable which accepts the appropriate
463466
deserialized request object and returns a

0 commit comments

Comments
 (0)