Skip to content

Commit 9ca82a6

Browse files
feat: enable "rest" transport in Python for services supporting numeric enums (#377)
* feat: enable "rest" transport in Python for services supporting numeric enums PiperOrigin-RevId: 508143576 Source-Link: googleapis/googleapis@7a702a9 Source-Link: googleapis/googleapis-gen@6ad1279 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmFkMTI3OWMwZTdhYTc4N2FjNmI2NmM5ZmQ0YTIxMDY5MmVkZmZjZCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update replacement in owlbot.py * fix: Add service_yaml_parameters to py_gapic_library BUILD.bazel targets PiperOrigin-RevId: 510187992 Source-Link: googleapis/googleapis@5edc235 Source-Link: googleapis/googleapis-gen@b0bedb7 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjBiZWRiNzJlNDc2NWEzZTBiNjc0YTI4YzUwZWEwZjlhOWIyNmE4OSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update system test to use REST * 🦉 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> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent 0c7ecd1 commit 9ca82a6

File tree

19 files changed

+18391
-1149
lines changed

19 files changed

+18391
-1149
lines changed

packages/google-cloud-kms/google/cloud/kms_v1/gapic_metadata.json

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,31 @@
5656
]
5757
}
5858
}
59+
},
60+
"rest": {
61+
"libraryClient": "EkmServiceClient",
62+
"rpcs": {
63+
"CreateEkmConnection": {
64+
"methods": [
65+
"create_ekm_connection"
66+
]
67+
},
68+
"GetEkmConnection": {
69+
"methods": [
70+
"get_ekm_connection"
71+
]
72+
},
73+
"ListEkmConnections": {
74+
"methods": [
75+
"list_ekm_connections"
76+
]
77+
},
78+
"UpdateEkmConnection": {
79+
"methods": [
80+
"update_ekm_connection"
81+
]
82+
}
83+
}
5984
}
6085
}
6186
},
@@ -330,6 +355,141 @@
330355
]
331356
}
332357
}
358+
},
359+
"rest": {
360+
"libraryClient": "KeyManagementServiceClient",
361+
"rpcs": {
362+
"AsymmetricDecrypt": {
363+
"methods": [
364+
"asymmetric_decrypt"
365+
]
366+
},
367+
"AsymmetricSign": {
368+
"methods": [
369+
"asymmetric_sign"
370+
]
371+
},
372+
"CreateCryptoKey": {
373+
"methods": [
374+
"create_crypto_key"
375+
]
376+
},
377+
"CreateCryptoKeyVersion": {
378+
"methods": [
379+
"create_crypto_key_version"
380+
]
381+
},
382+
"CreateImportJob": {
383+
"methods": [
384+
"create_import_job"
385+
]
386+
},
387+
"CreateKeyRing": {
388+
"methods": [
389+
"create_key_ring"
390+
]
391+
},
392+
"Decrypt": {
393+
"methods": [
394+
"decrypt"
395+
]
396+
},
397+
"DestroyCryptoKeyVersion": {
398+
"methods": [
399+
"destroy_crypto_key_version"
400+
]
401+
},
402+
"Encrypt": {
403+
"methods": [
404+
"encrypt"
405+
]
406+
},
407+
"GenerateRandomBytes": {
408+
"methods": [
409+
"generate_random_bytes"
410+
]
411+
},
412+
"GetCryptoKey": {
413+
"methods": [
414+
"get_crypto_key"
415+
]
416+
},
417+
"GetCryptoKeyVersion": {
418+
"methods": [
419+
"get_crypto_key_version"
420+
]
421+
},
422+
"GetImportJob": {
423+
"methods": [
424+
"get_import_job"
425+
]
426+
},
427+
"GetKeyRing": {
428+
"methods": [
429+
"get_key_ring"
430+
]
431+
},
432+
"GetPublicKey": {
433+
"methods": [
434+
"get_public_key"
435+
]
436+
},
437+
"ImportCryptoKeyVersion": {
438+
"methods": [
439+
"import_crypto_key_version"
440+
]
441+
},
442+
"ListCryptoKeyVersions": {
443+
"methods": [
444+
"list_crypto_key_versions"
445+
]
446+
},
447+
"ListCryptoKeys": {
448+
"methods": [
449+
"list_crypto_keys"
450+
]
451+
},
452+
"ListImportJobs": {
453+
"methods": [
454+
"list_import_jobs"
455+
]
456+
},
457+
"ListKeyRings": {
458+
"methods": [
459+
"list_key_rings"
460+
]
461+
},
462+
"MacSign": {
463+
"methods": [
464+
"mac_sign"
465+
]
466+
},
467+
"MacVerify": {
468+
"methods": [
469+
"mac_verify"
470+
]
471+
},
472+
"RestoreCryptoKeyVersion": {
473+
"methods": [
474+
"restore_crypto_key_version"
475+
]
476+
},
477+
"UpdateCryptoKey": {
478+
"methods": [
479+
"update_crypto_key"
480+
]
481+
},
482+
"UpdateCryptoKeyPrimaryVersion": {
483+
"methods": [
484+
"update_crypto_key_primary_version"
485+
]
486+
},
487+
"UpdateCryptoKeyVersion": {
488+
"methods": [
489+
"update_crypto_key_version"
490+
]
491+
}
492+
}
333493
}
334494
}
335495
}

packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/async_client.py

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
except AttributeError: # pragma: NO COVER
4343
OptionalRetry = Union[retries.Retry, object] # type: ignore
4444

45+
from google.cloud.location import locations_pb2 # type: ignore
4546
from google.iam.v1 import iam_policy_pb2 # type: ignore
4647
from google.iam.v1 import policy_pb2 # type: ignore
4748
from google.protobuf import field_mask_pb2 # type: ignore
@@ -755,6 +756,114 @@ async def sample_update_ekm_connection():
755756
# Done; return the response.
756757
return response
757758

759+
async def get_location(
760+
self,
761+
request: Optional[locations_pb2.GetLocationRequest] = None,
762+
*,
763+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
764+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
765+
metadata: Sequence[Tuple[str, str]] = (),
766+
) -> locations_pb2.Location:
767+
r"""Gets information about a location.
768+
769+
Args:
770+
request (:class:`~.location_pb2.GetLocationRequest`):
771+
The request object. Request message for
772+
`GetLocation` method.
773+
retry (google.api_core.retry.Retry): Designation of what errors,
774+
if any, should be retried.
775+
timeout (float): The timeout for this request.
776+
metadata (Sequence[Tuple[str, str]]): Strings which should be
777+
sent along with the request as metadata.
778+
Returns:
779+
~.location_pb2.Location:
780+
Location object.
781+
"""
782+
# Create or coerce a protobuf request object.
783+
# The request isn't a proto-plus wrapped type,
784+
# so it must be constructed via keyword expansion.
785+
if isinstance(request, dict):
786+
request = locations_pb2.GetLocationRequest(**request)
787+
788+
# Wrap the RPC method; this adds retry and timeout information,
789+
# and friendly error handling.
790+
rpc = gapic_v1.method.wrap_method(
791+
self._client._transport.get_location,
792+
default_timeout=None,
793+
client_info=DEFAULT_CLIENT_INFO,
794+
)
795+
796+
# Certain fields should be provided within the metadata header;
797+
# add these here.
798+
metadata = tuple(metadata) + (
799+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
800+
)
801+
802+
# Send the request.
803+
response = await rpc(
804+
request,
805+
retry=retry,
806+
timeout=timeout,
807+
metadata=metadata,
808+
)
809+
810+
# Done; return the response.
811+
return response
812+
813+
async def list_locations(
814+
self,
815+
request: Optional[locations_pb2.ListLocationsRequest] = None,
816+
*,
817+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
818+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
819+
metadata: Sequence[Tuple[str, str]] = (),
820+
) -> locations_pb2.ListLocationsResponse:
821+
r"""Lists information about the supported locations for this service.
822+
823+
Args:
824+
request (:class:`~.location_pb2.ListLocationsRequest`):
825+
The request object. Request message for
826+
`ListLocations` method.
827+
retry (google.api_core.retry.Retry): Designation of what errors,
828+
if any, should be retried.
829+
timeout (float): The timeout for this request.
830+
metadata (Sequence[Tuple[str, str]]): Strings which should be
831+
sent along with the request as metadata.
832+
Returns:
833+
~.location_pb2.ListLocationsResponse:
834+
Response message for ``ListLocations`` method.
835+
"""
836+
# Create or coerce a protobuf request object.
837+
# The request isn't a proto-plus wrapped type,
838+
# so it must be constructed via keyword expansion.
839+
if isinstance(request, dict):
840+
request = locations_pb2.ListLocationsRequest(**request)
841+
842+
# Wrap the RPC method; this adds retry and timeout information,
843+
# and friendly error handling.
844+
rpc = gapic_v1.method.wrap_method(
845+
self._client._transport.list_locations,
846+
default_timeout=None,
847+
client_info=DEFAULT_CLIENT_INFO,
848+
)
849+
850+
# Certain fields should be provided within the metadata header;
851+
# add these here.
852+
metadata = tuple(metadata) + (
853+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
854+
)
855+
856+
# Send the request.
857+
response = await rpc(
858+
request,
859+
retry=retry,
860+
timeout=timeout,
861+
metadata=metadata,
862+
)
863+
864+
# Done; return the response.
865+
return response
866+
758867
async def set_iam_policy(
759868
self,
760869
request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None,

0 commit comments

Comments
 (0)