Content-Length: 1120937 | pFad | https://github.com/googleapis/python-kms/commit/3f681923dee66e30eed91bf5a19485dea19e524e

26 feat: add support for Coordinated External Keys (#382) · googleapis/python-kms@3f68192 · GitHub
Skip to content
This repository was archived by the owner on Dec 31, 2023. It is now read-only.

Commit 3f68192

Browse files
feat: add support for Coordinated External Keys (#382)
* feat: add support for Coordinated External Keys PiperOrigin-RevId: 514450927 Source-Link: googleapis/googleapis@de50ec6 Source-Link: https://github.com/googleapis/googleapis-gen/commit/8a0f354d4773e369028c8109a0533fc30386844b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOGEwZjM1NGQ0NzczZTM2OTAyOGM4MTA5YTA1MzNmYzMwMzg2ODQ0YiJ9 * 🦉 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 645da0f commit 3f68192

20 files changed

+3551
-574
lines changed

google/cloud/kms/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@
2929
from google.cloud.kms_v1.types.ekm_service import (
3030
Certificate,
3131
CreateEkmConnectionRequest,
32+
EkmConfig,
3233
EkmConnection,
34+
GetEkmConfigRequest,
3335
GetEkmConnectionRequest,
3436
ListEkmConnectionsRequest,
3537
ListEkmConnectionsResponse,
38+
UpdateEkmConfigRequest,
3639
UpdateEkmConnectionRequest,
3740
)
3841
from google.cloud.kms_v1.types.resources import (
@@ -95,10 +98,13 @@
9598
"KeyManagementServiceAsyncClient",
9699
"Certificate",
97100
"CreateEkmConnectionRequest",
101+
"EkmConfig",
98102
"EkmConnection",
103+
"GetEkmConfigRequest",
99104
"GetEkmConnectionRequest",
100105
"ListEkmConnectionsRequest",
101106
"ListEkmConnectionsResponse",
107+
"UpdateEkmConfigRequest",
102108
"UpdateEkmConnectionRequest",
103109
"CryptoKey",
104110
"CryptoKeyVersion",

google/cloud/kms_v1/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@
2626
from .types.ekm_service import (
2727
Certificate,
2828
CreateEkmConnectionRequest,
29+
EkmConfig,
2930
EkmConnection,
31+
GetEkmConfigRequest,
3032
GetEkmConnectionRequest,
3133
ListEkmConnectionsRequest,
3234
ListEkmConnectionsResponse,
35+
UpdateEkmConfigRequest,
3336
UpdateEkmConnectionRequest,
3437
)
3538
from .types.resources import (
@@ -105,6 +108,7 @@
105108
"DecryptResponse",
106109
"DestroyCryptoKeyVersionRequest",
107110
"Digest",
111+
"EkmConfig",
108112
"EkmConnection",
109113
"EkmServiceClient",
110114
"EncryptRequest",
@@ -114,6 +118,7 @@
114118
"GenerateRandomBytesResponse",
115119
"GetCryptoKeyRequest",
116120
"GetCryptoKeyVersionRequest",
121+
"GetEkmConfigRequest",
117122
"GetEkmConnectionRequest",
118123
"GetImportJobRequest",
119124
"GetKeyRingRequest",
@@ -144,5 +149,6 @@
144149
"UpdateCryptoKeyPrimaryVersionRequest",
145150
"UpdateCryptoKeyRequest",
146151
"UpdateCryptoKeyVersionRequest",
152+
"UpdateEkmConfigRequest",
147153
"UpdateEkmConnectionRequest",
148154
)

google/cloud/kms_v1/gapic_metadata.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
"create_ekm_connection"
1616
]
1717
},
18+
"GetEkmConfig": {
19+
"methods": [
20+
"get_ekm_config"
21+
]
22+
},
1823
"GetEkmConnection": {
1924
"methods": [
2025
"get_ekm_connection"
@@ -25,6 +30,11 @@
2530
"list_ekm_connections"
2631
]
2732
},
33+
"UpdateEkmConfig": {
34+
"methods": [
35+
"update_ekm_config"
36+
]
37+
},
2838
"UpdateEkmConnection": {
2939
"methods": [
3040
"update_ekm_connection"
@@ -40,6 +50,11 @@
4050
"create_ekm_connection"
4151
]
4252
},
53+
"GetEkmConfig": {
54+
"methods": [
55+
"get_ekm_config"
56+
]
57+
},
4358
"GetEkmConnection": {
4459
"methods": [
4560
"get_ekm_connection"
@@ -50,6 +65,11 @@
5065
"list_ekm_connections"
5166
]
5267
},
68+
"UpdateEkmConfig": {
69+
"methods": [
70+
"update_ekm_config"
71+
]
72+
},
5373
"UpdateEkmConnection": {
5474
"methods": [
5575
"update_ekm_connection"
@@ -65,6 +85,11 @@
6585
"create_ekm_connection"
6686
]
6787
},
88+
"GetEkmConfig": {
89+
"methods": [
90+
"get_ekm_config"
91+
]
92+
},
6893
"GetEkmConnection": {
6994
"methods": [
7095
"get_ekm_connection"
@@ -75,6 +100,11 @@
75100
"list_ekm_connections"
76101
]
77102
},
103+
"UpdateEkmConfig": {
104+
"methods": [
105+
"update_ekm_config"
106+
]
107+
},
78108
"UpdateEkmConnection": {
79109
"methods": [
80110
"update_ekm_connection"

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

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ class EkmServiceAsyncClient:
7070
DEFAULT_ENDPOINT = EkmServiceClient.DEFAULT_ENDPOINT
7171
DEFAULT_MTLS_ENDPOINT = EkmServiceClient.DEFAULT_MTLS_ENDPOINT
7272

73+
ekm_config_path = staticmethod(EkmServiceClient.ekm_config_path)
74+
parse_ekm_config_path = staticmethod(EkmServiceClient.parse_ekm_config_path)
7375
ekm_connection_path = staticmethod(EkmServiceClient.ekm_connection_path)
7476
parse_ekm_connection_path = staticmethod(EkmServiceClient.parse_ekm_connection_path)
7577
service_path = staticmethod(EkmServiceClient.service_path)
@@ -756,6 +758,238 @@ async def sample_update_ekm_connection():
756758
# Done; return the response.
757759
return response
758760

761+
async def get_ekm_config(
762+
self,
763+
request: Optional[Union[ekm_service.GetEkmConfigRequest, dict]] = None,
764+
*,
765+
name: Optional[str] = None,
766+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
767+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
768+
metadata: Sequence[Tuple[str, str]] = (),
769+
) -> ekm_service.EkmConfig:
770+
r"""Returns the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton
771+
resource for a given project and location.
772+
773+
.. code-block:: python
774+
775+
# This snippet has been automatically generated and should be regarded as a
776+
# code template only.
777+
# It will require modifications to work:
778+
# - It may require correct/in-range values for request initialization.
779+
# - It may require specifying regional endpoints when creating the service
780+
# client as shown in:
781+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
782+
from google.cloud import kms_v1
783+
784+
async def sample_get_ekm_config():
785+
# Create a client
786+
client = kms_v1.EkmServiceAsyncClient()
787+
788+
# Initialize request argument(s)
789+
request = kms_v1.GetEkmConfigRequest(
790+
name="name_value",
791+
)
792+
793+
# Make the request
794+
response = await client.get_ekm_config(request=request)
795+
796+
# Handle the response
797+
print(response)
798+
799+
Args:
800+
request (Optional[Union[google.cloud.kms_v1.types.GetEkmConfigRequest, dict]]):
801+
The request object. Request message for
802+
[EkmService.GetEkmConfig][google.cloud.kms.v1.EkmService.GetEkmConfig].
803+
name (:class:`str`):
804+
Required. The [name][google.cloud.kms.v1.EkmConfig.name]
805+
of the [EkmConfig][google.cloud.kms.v1.EkmConfig] to
806+
get.
807+
808+
This corresponds to the ``name`` field
809+
on the ``request`` instance; if ``request`` is provided, this
810+
should not be set.
811+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
812+
should be retried.
813+
timeout (float): The timeout for this request.
814+
metadata (Sequence[Tuple[str, str]]): Strings which should be
815+
sent along with the request as metadata.
816+
817+
Returns:
818+
google.cloud.kms_v1.types.EkmConfig:
819+
An [EkmConfig][google.cloud.kms.v1.EkmConfig] is a singleton resource that
820+
represents configuration parameters that apply to all
821+
[CryptoKeys][google.cloud.kms.v1.CryptoKey] and
822+
[CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
823+
with a
824+
[ProtectionLevel][google.cloud.kms.v1.ProtectionLevel]
825+
of
826+
[EXTERNAL_VPC][CryptoKeyVersion.ProtectionLevel.EXTERNAL_VPC]
827+
in a given project and location.
828+
829+
"""
830+
# Create or coerce a protobuf request object.
831+
# Quick check: If we got a request object, we should *not* have
832+
# gotten any keyword arguments that map to the request.
833+
has_flattened_params = any([name])
834+
if request is not None and has_flattened_params:
835+
raise ValueError(
836+
"If the `request` argument is set, then none of "
837+
"the individual field arguments should be set."
838+
)
839+
840+
request = ekm_service.GetEkmConfigRequest(request)
841+
842+
# If we have keyword arguments corresponding to fields on the
843+
# request, apply these.
844+
if name is not None:
845+
request.name = name
846+
847+
# Wrap the RPC method; this adds retry and timeout information,
848+
# and friendly error handling.
849+
rpc = gapic_v1.method_async.wrap_method(
850+
self._client._transport.get_ekm_config,
851+
default_timeout=None,
852+
client_info=DEFAULT_CLIENT_INFO,
853+
)
854+
855+
# Certain fields should be provided within the metadata header;
856+
# add these here.
857+
metadata = tuple(metadata) + (
858+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
859+
)
860+
861+
# Send the request.
862+
response = await rpc(
863+
request,
864+
retry=retry,
865+
timeout=timeout,
866+
metadata=metadata,
867+
)
868+
869+
# Done; return the response.
870+
return response
871+
872+
async def update_ekm_config(
873+
self,
874+
request: Optional[Union[ekm_service.UpdateEkmConfigRequest, dict]] = None,
875+
*,
876+
ekm_config: Optional[ekm_service.EkmConfig] = None,
877+
update_mask: Optional[field_mask_pb2.FieldMask] = None,
878+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
879+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
880+
metadata: Sequence[Tuple[str, str]] = (),
881+
) -> ekm_service.EkmConfig:
882+
r"""Updates the [EkmConfig][google.cloud.kms.v1.EkmConfig] singleton
883+
resource for a given project and location.
884+
885+
.. code-block:: python
886+
887+
# This snippet has been automatically generated and should be regarded as a
888+
# code template only.
889+
# It will require modifications to work:
890+
# - It may require correct/in-range values for request initialization.
891+
# - It may require specifying regional endpoints when creating the service
892+
# client as shown in:
893+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
894+
from google.cloud import kms_v1
895+
896+
async def sample_update_ekm_config():
897+
# Create a client
898+
client = kms_v1.EkmServiceAsyncClient()
899+
900+
# Initialize request argument(s)
901+
request = kms_v1.UpdateEkmConfigRequest(
902+
)
903+
904+
# Make the request
905+
response = await client.update_ekm_config(request=request)
906+
907+
# Handle the response
908+
print(response)
909+
910+
Args:
911+
request (Optional[Union[google.cloud.kms_v1.types.UpdateEkmConfigRequest, dict]]):
912+
The request object. Request message for
913+
[EkmService.UpdateEkmConfig][google.cloud.kms.v1.EkmService.UpdateEkmConfig].
914+
ekm_config (:class:`google.cloud.kms_v1.types.EkmConfig`):
915+
Required. [EkmConfig][google.cloud.kms.v1.EkmConfig]
916+
with updated values.
917+
918+
This corresponds to the ``ekm_config`` field
919+
on the ``request`` instance; if ``request`` is provided, this
920+
should not be set.
921+
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
922+
Required. List of fields to be
923+
updated in this request.
924+
925+
This corresponds to the ``update_mask`` field
926+
on the ``request`` instance; if ``request`` is provided, this
927+
should not be set.
928+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
929+
should be retried.
930+
timeout (float): The timeout for this request.
931+
metadata (Sequence[Tuple[str, str]]): Strings which should be
932+
sent along with the request as metadata.
933+
934+
Returns:
935+
google.cloud.kms_v1.types.EkmConfig:
936+
An [EkmConfig][google.cloud.kms.v1.EkmConfig] is a singleton resource that
937+
represents configuration parameters that apply to all
938+
[CryptoKeys][google.cloud.kms.v1.CryptoKey] and
939+
[CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
940+
with a
941+
[ProtectionLevel][google.cloud.kms.v1.ProtectionLevel]
942+
of
943+
[EXTERNAL_VPC][CryptoKeyVersion.ProtectionLevel.EXTERNAL_VPC]
944+
in a given project and location.
945+
946+
"""
947+
# Create or coerce a protobuf request object.
948+
# Quick check: If we got a request object, we should *not* have
949+
# gotten any keyword arguments that map to the request.
950+
has_flattened_params = any([ekm_config, update_mask])
951+
if request is not None and has_flattened_params:
952+
raise ValueError(
953+
"If the `request` argument is set, then none of "
954+
"the individual field arguments should be set."
955+
)
956+
957+
request = ekm_service.UpdateEkmConfigRequest(request)
958+
959+
# If we have keyword arguments corresponding to fields on the
960+
# request, apply these.
961+
if ekm_config is not None:
962+
request.ekm_config = ekm_config
963+
if update_mask is not None:
964+
request.update_mask = update_mask
965+
966+
# Wrap the RPC method; this adds retry and timeout information,
967+
# and friendly error handling.
968+
rpc = gapic_v1.method_async.wrap_method(
969+
self._client._transport.update_ekm_config,
970+
default_timeout=None,
971+
client_info=DEFAULT_CLIENT_INFO,
972+
)
973+
974+
# Certain fields should be provided within the metadata header;
975+
# add these here.
976+
metadata = tuple(metadata) + (
977+
gapic_v1.routing_header.to_grpc_metadata(
978+
(("ekm_config.name", request.ekm_config.name),)
979+
),
980+
)
981+
982+
# Send the request.
983+
response = await rpc(
984+
request,
985+
retry=retry,
986+
timeout=timeout,
987+
metadata=metadata,
988+
)
989+
990+
# Done; return the response.
991+
return response
992+
759993
async def get_location(
760994
self,
761995
request: Optional[locations_pb2.GetLocationRequest] = None,

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/googleapis/python-kms/commit/3f681923dee66e30eed91bf5a19485dea19e524e

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy