Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7750b02

Browse files
feat: added VerifyConnectivity RPC (#388)
* feat: added VerifyConnectivity RPCPiperOrigin-RevId: 530991686Source-Link:googleapis/googleapis@be2600eSource-Link:googleapis/googleapis-gen@7eadc0eCopy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiN2VhZGMwZTBhYWVjZTJiY2NiNGU1NjFmM2IyOWIwNTg0ZmJjZjkwNiJ9* 🦉 Updates from OwlBot post-processorSeehttps://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 parentead3f69 commit7750b02

File tree

16 files changed

+1269
-1
lines changed

16 files changed

+1269
-1
lines changed

‎packages/google-cloud-kms/google/cloud/kms/__init__.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
ListEkmConnectionsResponse,
3838
UpdateEkmConfigRequest,
3939
UpdateEkmConnectionRequest,
40+
VerifyConnectivityRequest,
41+
VerifyConnectivityResponse,
4042
)
4143
fromgoogle.cloud.kms_v1.types.resourcesimport (
4244
CryptoKey,
@@ -106,6 +108,8 @@
106108
"ListEkmConnectionsResponse",
107109
"UpdateEkmConfigRequest",
108110
"UpdateEkmConnectionRequest",
111+
"VerifyConnectivityRequest",
112+
"VerifyConnectivityResponse",
109113
"CryptoKey",
110114
"CryptoKeyVersion",
111115
"CryptoKeyVersionTemplate",

‎packages/google-cloud-kms/google/cloud/kms_v1/__init__.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
ListEkmConnectionsResponse,
3535
UpdateEkmConfigRequest,
3636
UpdateEkmConnectionRequest,
37+
VerifyConnectivityRequest,
38+
VerifyConnectivityResponse,
3739
)
3840
from .types.resourcesimport (
3941
CryptoKey,
@@ -151,4 +153,6 @@
151153
"UpdateCryptoKeyVersionRequest",
152154
"UpdateEkmConfigRequest",
153155
"UpdateEkmConnectionRequest",
156+
"VerifyConnectivityRequest",
157+
"VerifyConnectivityResponse",
154158
)

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939
"methods": [
4040
"update_ekm_connection"
4141
]
42+
},
43+
"VerifyConnectivity": {
44+
"methods": [
45+
"verify_connectivity"
46+
]
4247
}
4348
}
4449
},
@@ -74,6 +79,11 @@
7479
"methods": [
7580
"update_ekm_connection"
7681
]
82+
},
83+
"VerifyConnectivity": {
84+
"methods": [
85+
"verify_connectivity"
86+
]
7787
}
7888
}
7989
},
@@ -109,6 +119,11 @@
109119
"methods": [
110120
"update_ekm_connection"
111121
]
122+
},
123+
"VerifyConnectivity": {
124+
"methods": [
125+
"verify_connectivity"
126+
]
112127
}
113128
}
114129
}

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

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,116 @@ async def sample_update_ekm_config():
990990
# Done; return the response.
991991
returnresponse
992992

993+
asyncdefverify_connectivity(
994+
self,
995+
request:Optional[Union[ekm_service.VerifyConnectivityRequest,dict]]=None,
996+
*,
997+
name:Optional[str]=None,
998+
retry:OptionalRetry=gapic_v1.method.DEFAULT,
999+
timeout:Union[float,object]=gapic_v1.method.DEFAULT,
1000+
metadata:Sequence[Tuple[str,str]]= (),
1001+
)->ekm_service.VerifyConnectivityResponse:
1002+
r"""Verifies that Cloud KMS can successfully connect to the external
1003+
key manager specified by an
1004+
[EkmConnection][google.cloud.kms.v1.EkmConnection]. If there is
1005+
an error connecting to the EKM, this method returns a
1006+
FAILED_PRECONDITION status containing structured information as
1007+
described at
1008+
https://cloud.google.com/kms/docs/reference/ekm_errors.
1009+
1010+
.. code-block:: python
1011+
1012+
# This snippet has been automatically generated and should be regarded as a
1013+
# code template only.
1014+
# It will require modifications to work:
1015+
# - It may require correct/in-range values for request initialization.
1016+
# - It may require specifying regional endpoints when creating the service
1017+
# client as shown in:
1018+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
1019+
from google.cloud import kms_v1
1020+
1021+
async def sample_verify_connectivity():
1022+
# Create a client
1023+
client = kms_v1.EkmServiceAsyncClient()
1024+
1025+
# Initialize request argument(s)
1026+
request = kms_v1.VerifyConnectivityRequest(
1027+
name="name_value",
1028+
)
1029+
1030+
# Make the request
1031+
response = await client.verify_connectivity(request=request)
1032+
1033+
# Handle the response
1034+
print(response)
1035+
1036+
Args:
1037+
request (Optional[Union[google.cloud.kms_v1.types.VerifyConnectivityRequest, dict]]):
1038+
The request object. Request message for
1039+
[EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
1040+
name (:class:`str`):
1041+
Required. The
1042+
[name][google.cloud.kms.v1.EkmConnection.name] of the
1043+
[EkmConnection][google.cloud.kms.v1.EkmConnection] to
1044+
verify.
1045+
1046+
This corresponds to the ``name`` field
1047+
on the ``request`` instance; if ``request`` is provided, this
1048+
should not be set.
1049+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1050+
should be retried.
1051+
timeout (float): The timeout for this request.
1052+
metadata (Sequence[Tuple[str, str]]): Strings which should be
1053+
sent along with the request as metadata.
1054+
1055+
Returns:
1056+
google.cloud.kms_v1.types.VerifyConnectivityResponse:
1057+
Response message for
1058+
[EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
1059+
1060+
"""
1061+
# Create or coerce a protobuf request object.
1062+
# Quick check: If we got a request object, we should *not* have
1063+
# gotten any keyword arguments that map to the request.
1064+
has_flattened_params=any([name])
1065+
ifrequestisnotNoneandhas_flattened_params:
1066+
raiseValueError(
1067+
"If the `request` argument is set, then none of "
1068+
"the individual field arguments should be set."
1069+
)
1070+
1071+
request=ekm_service.VerifyConnectivityRequest(request)
1072+
1073+
# If we have keyword arguments corresponding to fields on the
1074+
# request, apply these.
1075+
ifnameisnotNone:
1076+
request.name=name
1077+
1078+
# Wrap the RPC method; this adds retry and timeout information,
1079+
# and friendly error handling.
1080+
rpc=gapic_v1.method_async.wrap_method(
1081+
self._client._transport.verify_connectivity,
1082+
default_timeout=None,
1083+
client_info=DEFAULT_CLIENT_INFO,
1084+
)
1085+
1086+
# Certain fields should be provided within the metadata header;
1087+
# add these here.
1088+
metadata=tuple(metadata)+ (
1089+
gapic_v1.routing_header.to_grpc_metadata((("name",request.name),)),
1090+
)
1091+
1092+
# Send the request.
1093+
response=awaitrpc(
1094+
request,
1095+
retry=retry,
1096+
timeout=timeout,
1097+
metadata=metadata,
1098+
)
1099+
1100+
# Done; return the response.
1101+
returnresponse
1102+
9931103
asyncdefget_location(
9941104
self,
9951105
request:Optional[locations_pb2.GetLocationRequest]=None,

‎packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/client.py‎

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,6 +1222,116 @@ def sample_update_ekm_config():
12221222
# Done; return the response.
12231223
returnresponse
12241224

1225+
defverify_connectivity(
1226+
self,
1227+
request:Optional[Union[ekm_service.VerifyConnectivityRequest,dict]]=None,
1228+
*,
1229+
name:Optional[str]=None,
1230+
retry:OptionalRetry=gapic_v1.method.DEFAULT,
1231+
timeout:Union[float,object]=gapic_v1.method.DEFAULT,
1232+
metadata:Sequence[Tuple[str,str]]= (),
1233+
)->ekm_service.VerifyConnectivityResponse:
1234+
r"""Verifies that Cloud KMS can successfully connect to the external
1235+
key manager specified by an
1236+
[EkmConnection][google.cloud.kms.v1.EkmConnection]. If there is
1237+
an error connecting to the EKM, this method returns a
1238+
FAILED_PRECONDITION status containing structured information as
1239+
described at
1240+
https://cloud.google.com/kms/docs/reference/ekm_errors.
1241+
1242+
.. code-block:: python
1243+
1244+
# This snippet has been automatically generated and should be regarded as a
1245+
# code template only.
1246+
# It will require modifications to work:
1247+
# - It may require correct/in-range values for request initialization.
1248+
# - It may require specifying regional endpoints when creating the service
1249+
# client as shown in:
1250+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
1251+
from google.cloud import kms_v1
1252+
1253+
def sample_verify_connectivity():
1254+
# Create a client
1255+
client = kms_v1.EkmServiceClient()
1256+
1257+
# Initialize request argument(s)
1258+
request = kms_v1.VerifyConnectivityRequest(
1259+
name="name_value",
1260+
)
1261+
1262+
# Make the request
1263+
response = client.verify_connectivity(request=request)
1264+
1265+
# Handle the response
1266+
print(response)
1267+
1268+
Args:
1269+
request (Union[google.cloud.kms_v1.types.VerifyConnectivityRequest, dict]):
1270+
The request object. Request message for
1271+
[EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
1272+
name (str):
1273+
Required. The
1274+
[name][google.cloud.kms.v1.EkmConnection.name] of the
1275+
[EkmConnection][google.cloud.kms.v1.EkmConnection] to
1276+
verify.
1277+
1278+
This corresponds to the ``name`` field
1279+
on the ``request`` instance; if ``request`` is provided, this
1280+
should not be set.
1281+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1282+
should be retried.
1283+
timeout (float): The timeout for this request.
1284+
metadata (Sequence[Tuple[str, str]]): Strings which should be
1285+
sent along with the request as metadata.
1286+
1287+
Returns:
1288+
google.cloud.kms_v1.types.VerifyConnectivityResponse:
1289+
Response message for
1290+
[EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
1291+
1292+
"""
1293+
# Create or coerce a protobuf request object.
1294+
# Quick check: If we got a request object, we should *not* have
1295+
# gotten any keyword arguments that map to the request.
1296+
has_flattened_params=any([name])
1297+
ifrequestisnotNoneandhas_flattened_params:
1298+
raiseValueError(
1299+
"If the `request` argument is set, then none of "
1300+
"the individual field arguments should be set."
1301+
)
1302+
1303+
# Minor optimization to avoid making a copy if the user passes
1304+
# in a ekm_service.VerifyConnectivityRequest.
1305+
# There's no risk of modifying the input as we've already verified
1306+
# there are no flattened fields.
1307+
ifnotisinstance(request,ekm_service.VerifyConnectivityRequest):
1308+
request=ekm_service.VerifyConnectivityRequest(request)
1309+
# If we have keyword arguments corresponding to fields on the
1310+
# request, apply these.
1311+
ifnameisnotNone:
1312+
request.name=name
1313+
1314+
# Wrap the RPC method; this adds retry and timeout information,
1315+
# and friendly error handling.
1316+
rpc=self._transport._wrapped_methods[self._transport.verify_connectivity]
1317+
1318+
# Certain fields should be provided within the metadata header;
1319+
# add these here.
1320+
metadata=tuple(metadata)+ (
1321+
gapic_v1.routing_header.to_grpc_metadata((("name",request.name),)),
1322+
)
1323+
1324+
# Send the request.
1325+
response=rpc(
1326+
request,
1327+
retry=retry,
1328+
timeout=timeout,
1329+
metadata=metadata,
1330+
)
1331+
1332+
# Done; return the response.
1333+
returnresponse
1334+
12251335
def__enter__(self)->"EkmServiceClient":
12261336
returnself
12271337

‎packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/base.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ def _prep_wrapped_messages(self, client_info):
198198
default_timeout=None,
199199
client_info=client_info,
200200
),
201+
self.verify_connectivity:gapic_v1.method.wrap_method(
202+
self.verify_connectivity,
203+
default_timeout=None,
204+
client_info=client_info,
205+
),
201206
}
202207

203208
defclose(self):
@@ -266,6 +271,18 @@ def update_ekm_config(
266271
]:
267272
raiseNotImplementedError()
268273

274+
@property
275+
defverify_connectivity(
276+
self,
277+
)->Callable[
278+
[ekm_service.VerifyConnectivityRequest],
279+
Union[
280+
ekm_service.VerifyConnectivityResponse,
281+
Awaitable[ekm_service.VerifyConnectivityResponse],
282+
],
283+
]:
284+
raiseNotImplementedError()
285+
269286
@property
270287
defget_location(
271288
self,

‎packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/grpc.py‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,40 @@ def update_ekm_config(
399399
)
400400
returnself._stubs["update_ekm_config"]
401401

402+
@property
403+
defverify_connectivity(
404+
self,
405+
)->Callable[
406+
[ekm_service.VerifyConnectivityRequest],ekm_service.VerifyConnectivityResponse
407+
]:
408+
r"""Return a callable for the verify connectivity method over gRPC.
409+
410+
Verifies that Cloud KMS can successfully connect to the external
411+
key manager specified by an
412+
[EkmConnection][google.cloud.kms.v1.EkmConnection]. If there is
413+
an error connecting to the EKM, this method returns a
414+
FAILED_PRECONDITION status containing structured information as
415+
described at
416+
https://cloud.google.com/kms/docs/reference/ekm_errors.
417+
418+
Returns:
419+
Callable[[~.VerifyConnectivityRequest],
420+
~.VerifyConnectivityResponse]:
421+
A function that, when called, will call the underlying RPC
422+
on the server.
423+
"""
424+
# Generate a "stub function" on-the-fly which will actually make
425+
# the request.
426+
# gRPC handles serialization and deserialization, so we just need
427+
# to pass in the functions for each.
428+
if"verify_connectivity"notinself._stubs:
429+
self._stubs["verify_connectivity"]=self.grpc_channel.unary_unary(
430+
"/google.cloud.kms.v1.EkmService/VerifyConnectivity",
431+
request_serializer=ekm_service.VerifyConnectivityRequest.serialize,
432+
response_deserializer=ekm_service.VerifyConnectivityResponse.deserialize,
433+
)
434+
returnself._stubs["verify_connectivity"]
435+
402436
@property
403437
defset_iam_policy(
404438
self,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp