Skip to content
This repository was archived by the owner on Dec 31, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions google/cloud/kms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
ListEkmConnectionsResponse,
UpdateEkmConfigRequest,
UpdateEkmConnectionRequest,
VerifyConnectivityRequest,
VerifyConnectivityResponse,
)
from google.cloud.kms_v1.types.resources import (
CryptoKey,
Expand Down Expand Up @@ -106,6 +108,8 @@
"ListEkmConnectionsResponse",
"UpdateEkmConfigRequest",
"UpdateEkmConnectionRequest",
"VerifyConnectivityRequest",
"VerifyConnectivityResponse",
"CryptoKey",
"CryptoKeyVersion",
"CryptoKeyVersionTemplate",
Expand Down
4 changes: 4 additions & 0 deletions google/cloud/kms_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
ListEkmConnectionsResponse,
UpdateEkmConfigRequest,
UpdateEkmConnectionRequest,
VerifyConnectivityRequest,
VerifyConnectivityResponse,
)
from .types.resources import (
CryptoKey,
Expand Down Expand Up @@ -151,4 +153,6 @@
"UpdateCryptoKeyVersionRequest",
"UpdateEkmConfigRequest",
"UpdateEkmConnectionRequest",
"VerifyConnectivityRequest",
"VerifyConnectivityResponse",
)
15 changes: 15 additions & 0 deletions google/cloud/kms_v1/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
"methods": [
"update_ekm_connection"
]
},
"VerifyConnectivity": {
"methods": [
"verify_connectivity"
]
}
}
},
Expand Down Expand Up @@ -74,6 +79,11 @@
"methods": [
"update_ekm_connection"
]
},
"VerifyConnectivity": {
"methods": [
"verify_connectivity"
]
}
}
},
Expand Down Expand Up @@ -109,6 +119,11 @@
"methods": [
"update_ekm_connection"
]
},
"VerifyConnectivity": {
"methods": [
"verify_connectivity"
]
}
}
}
Expand Down
110 changes: 110 additions & 0 deletions google/cloud/kms_v1/services/ekm_service/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,116 @@ async def sample_update_ekm_config():
# Done; return the response.
return response

async def verify_connectivity(
self,
request: Optional[Union[ekm_service.VerifyConnectivityRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> ekm_service.VerifyConnectivityResponse:
r"""Verifies that Cloud KMS can successfully connect to the external
key manager specified by an
[EkmConnection][google.cloud.kms.v1.EkmConnection]. If there is
an error connecting to the EKM, this method returns a
FAILED_PRECONDITION status containing structured information as
described at
https://cloud.google.com/kms/docs/reference/ekm_errors.

.. code-block:: python

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import kms_v1

async def sample_verify_connectivity():
# Create a client
client = kms_v1.EkmServiceAsyncClient()

# Initialize request argument(s)
request = kms_v1.VerifyConnectivityRequest(
name="name_value",
)

# Make the request
response = await client.verify_connectivity(request=request)

# Handle the response
print(response)

Args:
request (Optional[Union[google.cloud.kms_v1.types.VerifyConnectivityRequest, dict]]):
The request object. Request message for
[EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
name (:class:`str`):
Required. The
[name][google.cloud.kms.v1.EkmConnection.name] of the
[EkmConnection][google.cloud.kms.v1.EkmConnection] to
verify.

This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.

Returns:
google.cloud.kms_v1.types.VerifyConnectivityResponse:
Response message for
[EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].

"""
# Create or coerce a protobuf request object.
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

request = ekm_service.VerifyConnectivityRequest(request)

# If we have keyword arguments corresponding to fields on the
# request, apply these.
if name is not None:
request.name = name

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.verify_connectivity,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response

async def get_location(
self,
request: Optional[locations_pb2.GetLocationRequest] = None,
Expand Down
110 changes: 110 additions & 0 deletions google/cloud/kms_v1/services/ekm_service/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,116 @@ def sample_update_ekm_config():
# Done; return the response.
return response

def verify_connectivity(
self,
request: Optional[Union[ekm_service.VerifyConnectivityRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> ekm_service.VerifyConnectivityResponse:
r"""Verifies that Cloud KMS can successfully connect to the external
key manager specified by an
[EkmConnection][google.cloud.kms.v1.EkmConnection]. If there is
an error connecting to the EKM, this method returns a
FAILED_PRECONDITION status containing structured information as
described at
https://cloud.google.com/kms/docs/reference/ekm_errors.

.. code-block:: python

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import kms_v1

def sample_verify_connectivity():
# Create a client
client = kms_v1.EkmServiceClient()

# Initialize request argument(s)
request = kms_v1.VerifyConnectivityRequest(
name="name_value",
)

# Make the request
response = client.verify_connectivity(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.kms_v1.types.VerifyConnectivityRequest, dict]):
The request object. Request message for
[EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
name (str):
Required. The
[name][google.cloud.kms.v1.EkmConnection.name] of the
[EkmConnection][google.cloud.kms.v1.EkmConnection] to
verify.

This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.

Returns:
google.cloud.kms_v1.types.VerifyConnectivityResponse:
Response message for
[EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].

"""
# Create or coerce a protobuf request object.
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

# Minor optimization to avoid making a copy if the user passes
# in a ekm_service.VerifyConnectivityRequest.
# There's no risk of modifying the input as we've already verified
# there are no flattened fields.
if not isinstance(request, ekm_service.VerifyConnectivityRequest):
request = ekm_service.VerifyConnectivityRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if name is not None:
request.name = name

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._transport._wrapped_methods[self._transport.verify_connectivity]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response

def __enter__(self) -> "EkmServiceClient":
return self

Expand Down
17 changes: 17 additions & 0 deletions google/cloud/kms_v1/services/ekm_service/transports/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=None,
client_info=client_info,
),
self.verify_connectivity: gapic_v1.method.wrap_method(
self.verify_connectivity,
default_timeout=None,
client_info=client_info,
),
}

def close(self):
Expand Down Expand Up @@ -266,6 +271,18 @@ def update_ekm_config(
]:
raise NotImplementedError()

@property
def verify_connectivity(
self,
) -> Callable[
[ekm_service.VerifyConnectivityRequest],
Union[
ekm_service.VerifyConnectivityResponse,
Awaitable[ekm_service.VerifyConnectivityResponse],
],
]:
raise NotImplementedError()

@property
def get_location(
self,
Expand Down
34 changes: 34 additions & 0 deletions google/cloud/kms_v1/services/ekm_service/transports/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,40 @@ def update_ekm_config(
)
return self._stubs["update_ekm_config"]

@property
def verify_connectivity(
self,
) -> Callable[
[ekm_service.VerifyConnectivityRequest], ekm_service.VerifyConnectivityResponse
]:
r"""Return a callable for the verify connectivity method over gRPC.

Verifies that Cloud KMS can successfully connect to the external
key manager specified by an
[EkmConnection][google.cloud.kms.v1.EkmConnection]. If there is
an error connecting to the EKM, this method returns a
FAILED_PRECONDITION status containing structured information as
described at
https://cloud.google.com/kms/docs/reference/ekm_errors.

Returns:
Callable[[~.VerifyConnectivityRequest],
~.VerifyConnectivityResponse]:
A function that, when called, will call the underlying RPC
on the server.
"""
# Generate a "stub function" on-the-fly which will actually make
# the request.
# gRPC handles serialization and deserialization, so we just need
# to pass in the functions for each.
if "verify_connectivity" not in self._stubs:
self._stubs["verify_connectivity"] = self.grpc_channel.unary_unary(
"/google.cloud.kms.v1.EkmService/VerifyConnectivity",
request_serializer=ekm_service.VerifyConnectivityRequest.serialize,
response_deserializer=ekm_service.VerifyConnectivityResponse.deserialize,
)
return self._stubs["verify_connectivity"]

@property
def set_iam_policy(
self,
Expand Down
Loading