Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

feat: added ScalingConfig (v1) #214

Merged
merged 2 commits into from Apr 15, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions google/cloud/metastore/__init__.py
Expand Up @@ -31,6 +31,7 @@
DataprocMetastoreFederationClient,
)
from google.cloud.metastore_v1.types.metastore import (
AuxiliaryVersionConfig,
Backup,
CreateBackupRequest,
CreateMetadataImportRequest,
Expand Down Expand Up @@ -60,6 +61,7 @@
OperationMetadata,
Restore,
RestoreServiceRequest,
ScalingConfig,
Secret,
Service,
TelemetryConfig,
Expand All @@ -82,6 +84,7 @@
"DataprocMetastoreAsyncClient",
"DataprocMetastoreFederationClient",
"DataprocMetastoreFederationAsyncClient",
"AuxiliaryVersionConfig",
"Backup",
"CreateBackupRequest",
"CreateMetadataImportRequest",
Expand Down Expand Up @@ -111,6 +114,7 @@
"OperationMetadata",
"Restore",
"RestoreServiceRequest",
"ScalingConfig",
"Secret",
"Service",
"TelemetryConfig",
Expand Down
4 changes: 4 additions & 0 deletions google/cloud/metastore_v1/__init__.py
Expand Up @@ -27,6 +27,7 @@
DataprocMetastoreFederationClient,
)
from .types.metastore import (
AuxiliaryVersionConfig,
Backup,
CreateBackupRequest,
CreateMetadataImportRequest,
Expand Down Expand Up @@ -56,6 +57,7 @@
OperationMetadata,
Restore,
RestoreServiceRequest,
ScalingConfig,
Secret,
Service,
TelemetryConfig,
Expand All @@ -76,6 +78,7 @@
__all__ = (
"DataprocMetastoreAsyncClient",
"DataprocMetastoreFederationAsyncClient",
"AuxiliaryVersionConfig",
"BackendMetastore",
"Backup",
"CreateBackupRequest",
Expand Down Expand Up @@ -114,6 +117,7 @@
"OperationMetadata",
"Restore",
"RestoreServiceRequest",
"ScalingConfig",
"Secret",
"Service",
"TelemetryConfig",
Expand Down
Expand Up @@ -316,7 +316,7 @@ async def sample_list_services():
Returns:
google.cloud.metastore_v1.services.dataproc_metastore.pagers.ListServicesAsyncPager:
Response message for
[DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices].
[DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices].

Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down Expand Up @@ -949,7 +949,7 @@ async def sample_list_metadata_imports():
Returns:
google.cloud.metastore_v1.services.dataproc_metastore.pagers.ListMetadataImportsAsyncPager:
Response message for
[DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1.DataprocMetastore.ListMetadataImports].
[DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1.DataprocMetastore.ListMetadataImports].

Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down Expand Up @@ -1684,7 +1684,7 @@ async def sample_list_backups():
Returns:
google.cloud.metastore_v1.services.dataproc_metastore.pagers.ListBackupsAsyncPager:
Response message for
[DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups].
[DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups].

Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down Expand Up @@ -2279,6 +2279,60 @@ async def delete_operation(
metadata=metadata,
)

async def cancel_operation(
self,
request: Optional[operations_pb2.CancelOperationRequest] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
r"""Starts asynchronous cancellation on a long-running operation.

The server makes a best effort to cancel the operation, but success
is not guaranteed. If the server doesn't support this method, it returns
`google.rpc.Code.UNIMPLEMENTED`.

Args:
request (:class:`~.operations_pb2.CancelOperationRequest`):
The request object. Request message for
`CancelOperation` method.
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:
None
"""
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = operations_pb2.CancelOperationRequest(**request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method.wrap_method(
self._client._transport.cancel_operation,
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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

async def set_iam_policy(
self,
request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None,
Expand Down
60 changes: 57 additions & 3 deletions google/cloud/metastore_v1/services/dataproc_metastore/client.py
Expand Up @@ -624,7 +624,7 @@ def sample_list_services():
Returns:
google.cloud.metastore_v1.services.dataproc_metastore.pagers.ListServicesPager:
Response message for
[DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices].
[DataprocMetastore.ListServices][google.cloud.metastore.v1.DataprocMetastore.ListServices].

Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down Expand Up @@ -1257,7 +1257,7 @@ def sample_list_metadata_imports():
Returns:
google.cloud.metastore_v1.services.dataproc_metastore.pagers.ListMetadataImportsPager:
Response message for
[DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1.DataprocMetastore.ListMetadataImports].
[DataprocMetastore.ListMetadataImports][google.cloud.metastore.v1.DataprocMetastore.ListMetadataImports].

Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down Expand Up @@ -1993,7 +1993,7 @@ def sample_list_backups():
Returns:
google.cloud.metastore_v1.services.dataproc_metastore.pagers.ListBackupsPager:
Response message for
[DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups].
[DataprocMetastore.ListBackups][google.cloud.metastore.v1.DataprocMetastore.ListBackups].

Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down Expand Up @@ -2601,6 +2601,60 @@ def delete_operation(
metadata=metadata,
)

def cancel_operation(
self,
request: Optional[operations_pb2.CancelOperationRequest] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
r"""Starts asynchronous cancellation on a long-running operation.

The server makes a best effort to cancel the operation, but success
is not guaranteed. If the server doesn't support this method, it returns
`google.rpc.Code.UNIMPLEMENTED`.

Args:
request (:class:`~.operations_pb2.CancelOperationRequest`):
The request object. Request message for
`CancelOperation` method.
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:
None
"""
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = operations_pb2.CancelOperationRequest(**request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method.wrap_method(
self._transport.cancel_operation,
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.
rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

def set_iam_policy(
self,
request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None,
Expand Down
Expand Up @@ -378,6 +378,12 @@ def get_operation(
]:
raise NotImplementedError()

@property
def cancel_operation(
self,
) -> Callable[[operations_pb2.CancelOperationRequest], None,]:
raise NotImplementedError()

@property
def delete_operation(
self,
Expand Down
Expand Up @@ -680,6 +680,23 @@ def delete_operation(
)
return self._stubs["delete_operation"]

@property
def cancel_operation(
self,
) -> Callable[[operations_pb2.CancelOperationRequest], None]:
r"""Return a callable for the cancel_operation method over gRPC."""
# 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 "cancel_operation" not in self._stubs:
self._stubs["cancel_operation"] = self.grpc_channel.unary_unary(
"/google.longrunning.Operations/CancelOperation",
request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
response_deserializer=None,
)
return self._stubs["cancel_operation"]

@property
def get_operation(
self,
Expand Down
Expand Up @@ -710,6 +710,23 @@ def delete_operation(
)
return self._stubs["delete_operation"]

@property
def cancel_operation(
self,
) -> Callable[[operations_pb2.CancelOperationRequest], None]:
r"""Return a callable for the cancel_operation method over gRPC."""
# 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 "cancel_operation" not in self._stubs:
self._stubs["cancel_operation"] = self.grpc_channel.unary_unary(
"/google.longrunning.Operations/CancelOperation",
request_serializer=operations_pb2.CancelOperationRequest.SerializeToString,
response_deserializer=None,
)
return self._stubs["cancel_operation"]

@property
def get_operation(
self,
Expand Down