Skip to content

Commit

Permalink
fix(deps): require google-api-core>=1.32.0,>=2.8.0 (#608)
Browse files Browse the repository at this point in the history
feat: add audience parameter
feat: Add storage_utilization_gib_per_node to Autoscaling target
feat: Cloud Bigtable Undelete Table service and message proto files

* feat: add audience parameter

PiperOrigin-RevId: 456827138

Source-Link: googleapis/googleapis@23f1a15

Source-Link: googleapis/googleapis-gen@4075a85
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDA3NWE4NTE0ZjY3NjY5MWVjMTU2Njg4YTViYmYxODNhYTk4OTNjZSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: Add storage_utilization_gib_per_node to Autoscaling target

PiperOrigin-RevId: 457776307

Source-Link: googleapis/googleapis@982bb69

Source-Link: googleapis/googleapis-gen@0aff3eb
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGFmZjNlYmNjOGZiM2MxMGI2NzFlZTM4NmI0ZDI2MzAxMmQzZDAxMyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: Cloud Bigtable Undelete Table service and message proto files

PiperOrigin-RevId: 457778403

Source-Link: googleapis/googleapis@2b0fe3b

Source-Link: googleapis/googleapis-gen@ca2a2c5
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2EyYTJjNTVjYWZjYTRiODc2MzA1YjBiMTJmNzZjZTBmMTY2ZGRjYyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore: use gapic-generator-python 1.1.1

PiperOrigin-RevId: 459095142

Source-Link: googleapis/googleapis@4f1be99

Source-Link: googleapis/googleapis-gen@ae686d9
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWU2ODZkOWNkZTRmYzNlMzZkMGFjMDJlZmI4NjQzYjE1ODkwYzFlZCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* Synchronize new proto/yaml changes.

PiperOrigin-RevId: 459539123

Source-Link: googleapis/googleapis@2e0497d

Source-Link: googleapis/googleapis-gen@d56d71b
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDU2ZDcxYmVkOGY4ZDdiYzk3NzEwNTZmOGM1ZjI2NzFlN2YxMTRhMyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix(deps): require google-api-core>=1.32.0,>=2.8.0

* trigger ci

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
3 people authored Jul 24, 2022
1 parent 2363e4d commit a7a7699
Show file tree
Hide file tree
Showing 28 changed files with 828 additions and 36 deletions.
4 changes: 4 additions & 0 deletions google/cloud/bigtable_admin_v2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
from .types.bigtable_table_admin import RestoreTableRequest
from .types.bigtable_table_admin import SnapshotTableMetadata
from .types.bigtable_table_admin import SnapshotTableRequest
from .types.bigtable_table_admin import UndeleteTableMetadata
from .types.bigtable_table_admin import UndeleteTableRequest
from .types.bigtable_table_admin import UpdateBackupRequest
from .types.common import OperationProgress
from .types.common import StorageType
Expand Down Expand Up @@ -164,6 +166,8 @@
"SnapshotTableRequest",
"StorageType",
"Table",
"UndeleteTableMetadata",
"UndeleteTableRequest",
"UpdateAppProfileMetadata",
"UpdateAppProfileRequest",
"UpdateBackupRequest",
Expand Down
10 changes: 10 additions & 0 deletions google/cloud/bigtable_admin_v2/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@
"test_iam_permissions"
]
},
"UndeleteTable": {
"methods": [
"undelete_table"
]
},
"UpdateBackup": {
"methods": [
"update_backup"
Expand Down Expand Up @@ -454,6 +459,11 @@
"test_iam_permissions"
]
},
"UndeleteTable": {
"methods": [
"undelete_table"
]
},
"UpdateBackup": {
"methods": [
"update_backup"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ def __init__(
quota_project_id=client_options.quota_project_id,
client_info=client_info,
always_use_jwt_access=True,
api_audience=client_options.api_audience,
)

def create_instance(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def __init__(
quota_project_id: Optional[str] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
always_use_jwt_access: Optional[bool] = False,
api_audience: Optional[str] = None,
**kwargs,
) -> None:
"""Instantiate the transport.
Expand Down Expand Up @@ -95,11 +96,6 @@ def __init__(
be used for service account credentials.
"""

# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
host += ":443"
self._host = host

scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
Expand All @@ -120,6 +116,11 @@ def __init__(
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
)
# Don't apply audience if the credentials file passed from user.
if hasattr(credentials, "with_gdch_audience"):
credentials = credentials.with_gdch_audience(
api_audience if api_audience else host
)

# If the credentials are service account credentials, then always try to use self signed JWT.
if (
Expand All @@ -132,6 +133,11 @@ def __init__(
# Save the credentials.
self._credentials = credentials

# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
host += ":443"
self._host = host

def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def __init__(
quota_project_id: Optional[str] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
always_use_jwt_access: Optional[bool] = False,
api_audience: Optional[str] = None,
) -> None:
"""Instantiate the transport.
Expand Down Expand Up @@ -163,6 +164,7 @@ def __init__(
quota_project_id=quota_project_id,
client_info=client_info,
always_use_jwt_access=always_use_jwt_access,
api_audience=api_audience,
)

if not self._grpc_channel:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def __init__(
quota_project_id=None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
always_use_jwt_access: Optional[bool] = False,
api_audience: Optional[str] = None,
) -> None:
"""Instantiate the transport.
Expand Down Expand Up @@ -208,6 +209,7 @@ def __init__(
quota_project_id=quota_project_id,
client_info=client_info,
always_use_jwt_access=always_use_jwt_access,
api_audience=api_audience,
)

if not self._grpc_channel:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,95 @@ async def delete_table(
metadata=metadata,
)

async def undelete_table(
self,
request: Union[bigtable_table_admin.UndeleteTableRequest, dict] = None,
*,
name: str = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Restores a specified table which was accidentally
deleted.
Args:
request (Union[google.cloud.bigtable_admin_v2.types.UndeleteTableRequest, dict]):
The request object. Request message for
[google.bigtable.admin.v2.BigtableTableAdmin.UndeleteTable][google.bigtable.admin.v2.BigtableTableAdmin.UndeleteTable]
name (:class:`str`):
Required. The unique name of the table to be restored.
Values are of the form
``projects/{project}/instances/{instance}/tables/{table}``.
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.api_core.operation_async.AsyncOperation:
An object representing a long-running operation.
The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Table` A collection of user data indexed by row, column, and timestamp.
Each table is served using the resources of its
parent cluster.
"""
# 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 = bigtable_table_admin.UndeleteTableRequest(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.undelete_table,
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,
)

# Wrap the response in an operation future.
response = operation_async.from_gapic(
response,
self._client._transport.operations_client,
table.Table,
metadata_type=bigtable_table_admin.UndeleteTableMetadata,
)

# Done; return the response.
return response

async def modify_column_families(
self,
request: Union[bigtable_table_admin.ModifyColumnFamiliesRequest, dict] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ def __init__(
quota_project_id=client_options.quota_project_id,
client_info=client_info,
always_use_jwt_access=True,
api_audience=client_options.api_audience,
)

def create_table(
Expand Down Expand Up @@ -1019,6 +1020,95 @@ def delete_table(
metadata=metadata,
)

def undelete_table(
self,
request: Union[bigtable_table_admin.UndeleteTableRequest, dict] = None,
*,
name: str = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
r"""Restores a specified table which was accidentally
deleted.
Args:
request (Union[google.cloud.bigtable_admin_v2.types.UndeleteTableRequest, dict]):
The request object. Request message for
[google.bigtable.admin.v2.BigtableTableAdmin.UndeleteTable][google.bigtable.admin.v2.BigtableTableAdmin.UndeleteTable]
name (str):
Required. The unique name of the table to be restored.
Values are of the form
``projects/{project}/instances/{instance}/tables/{table}``.
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.api_core.operation.Operation:
An object representing a long-running operation.
The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Table` A collection of user data indexed by row, column, and timestamp.
Each table is served using the resources of its
parent cluster.
"""
# 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 bigtable_table_admin.UndeleteTableRequest.
# There's no risk of modifying the input as we've already verified
# there are no flattened fields.
if not isinstance(request, bigtable_table_admin.UndeleteTableRequest):
request = bigtable_table_admin.UndeleteTableRequest(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.undelete_table]

# 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,
)

# Wrap the response in an operation future.
response = operation.from_gapic(
response,
self._transport.operations_client,
table.Table,
metadata_type=bigtable_table_admin.UndeleteTableMetadata,
)

# Done; return the response.
return response

def modify_column_families(
self,
request: Union[bigtable_table_admin.ModifyColumnFamiliesRequest, dict] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def __init__(
quota_project_id: Optional[str] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
always_use_jwt_access: Optional[bool] = False,
api_audience: Optional[str] = None,
**kwargs,
) -> None:
"""Instantiate the transport.
Expand Down Expand Up @@ -95,11 +96,6 @@ def __init__(
be used for service account credentials.
"""

# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
host += ":443"
self._host = host

scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
Expand All @@ -120,6 +116,11 @@ def __init__(
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
)
# Don't apply audience if the credentials file passed from user.
if hasattr(credentials, "with_gdch_audience"):
credentials = credentials.with_gdch_audience(
api_audience if api_audience else host
)

# If the credentials are service account credentials, then always try to use self signed JWT.
if (
Expand All @@ -132,6 +133,11 @@ def __init__(
# Save the credentials.
self._credentials = credentials

# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
host += ":443"
self._host = host

def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
Expand Down Expand Up @@ -180,6 +186,11 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=60.0,
client_info=client_info,
),
self.undelete_table: gapic_v1.method.wrap_method(
self.undelete_table,
default_timeout=None,
client_info=client_info,
),
self.modify_column_families: gapic_v1.method.wrap_method(
self.modify_column_families,
default_timeout=300.0,
Expand Down Expand Up @@ -409,6 +420,15 @@ def delete_table(
]:
raise NotImplementedError()

@property
def undelete_table(
self,
) -> Callable[
[bigtable_table_admin.UndeleteTableRequest],
Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
]:
raise NotImplementedError()

@property
def modify_column_families(
self,
Expand Down
Loading

0 comments on commit a7a7699

Please sign in to comment.