Skip to content

Commit

Permalink
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#41)
Browse files Browse the repository at this point in the history
* fix(deps): Require google-api-core >=1.34.0, >=2.11.0

fix: Drop usage of pkg_resources

fix: Fix timeout default values

docs(samples): Snippetgen should call await on the operation coroutine before calling result

PiperOrigin-RevId: 493260409

Source-Link: googleapis/googleapis@fea4387

Source-Link: googleapis/googleapis-gen@387b734
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzg3YjczNDRjNzUyOWVlNDRiZTg0ZTYxM2IxOWE4MjA1MDhjNjEyYiJ9

* 🦉 Updates from OwlBot post-processor

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

* add gapic_version.py

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 Dec 7, 2022
1 parent 2b80be4 commit a9930b6
Show file tree
Hide file tree
Showing 21 changed files with 106 additions and 106 deletions.
5 changes: 0 additions & 5 deletions packages/google-cloud-gke-backup/.coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,3 @@ exclude_lines =
pragma: NO COVER
# Ignore debug-only repr
def __repr__
# Ignore pkg_resources exceptions.
# This is added at the module level as a safeguard for if someone
# generates the code and tries to run it without pip installing. This
# makes it virtually impossible to test properly.
except pkg_resources.DistributionNotFound
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.2.2" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
from google.api_core.client_options import ClientOptions
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore
import pkg_resources

from google.cloud.gke_backup_v1 import gapic_version as package_version

try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
Expand Down Expand Up @@ -251,7 +252,7 @@ async def create_backup_plan(
backup_plan: Optional[gcg_backup_plan.BackupPlan] = None,
backup_plan_id: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Creates a new BackupPlan in a given location.
Expand Down Expand Up @@ -286,7 +287,7 @@ async def sample_create_backup_plan():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -400,7 +401,7 @@ async def list_backup_plans(
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListBackupPlansAsyncPager:
r"""Lists BackupPlans in a given location.
Expand Down Expand Up @@ -522,7 +523,7 @@ async def get_backup_plan(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> backup_plan.BackupPlan:
r"""Retrieve the details of a single BackupPlan.
Expand Down Expand Up @@ -633,7 +634,7 @@ async def update_backup_plan(
backup_plan: Optional[gcg_backup_plan.BackupPlan] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Update a BackupPlan.
Expand Down Expand Up @@ -666,7 +667,7 @@ async def sample_update_backup_plan():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -775,7 +776,7 @@ async def delete_backup_plan(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Deletes an existing BackupPlan.
Expand Down Expand Up @@ -805,7 +806,7 @@ async def sample_delete_backup_plan():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -901,7 +902,7 @@ async def create_backup(
backup: Optional[gcg_backup.Backup] = None,
backup_id: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Creates a Backup for the given BackupPlan.
Expand Down Expand Up @@ -931,7 +932,7 @@ async def sample_create_backup():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -1041,7 +1042,7 @@ async def list_backups(
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListBackupsAsyncPager:
r"""Lists the Backups for a given BackupPlan.
Expand Down Expand Up @@ -1163,7 +1164,7 @@ async def get_backup(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> backup.Backup:
r"""Retrieve the details of a single Backup.
Expand Down Expand Up @@ -1280,7 +1281,7 @@ async def update_backup(
backup: Optional[gcg_backup.Backup] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Update a Backup.
Expand Down Expand Up @@ -1313,7 +1314,7 @@ async def sample_update_backup():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -1420,7 +1421,7 @@ async def delete_backup(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Deletes an existing Backup.
Expand Down Expand Up @@ -1450,7 +1451,7 @@ async def sample_delete_backup():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -1543,7 +1544,7 @@ async def list_volume_backups(
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListVolumeBackupsAsyncPager:
r"""Lists the VolumeBackups for a given Backup.
Expand Down Expand Up @@ -1668,7 +1669,7 @@ async def get_volume_backup(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> volume.VolumeBackup:
r"""Retrieve the details of a single VolumeBackup.
Expand Down Expand Up @@ -1785,7 +1786,7 @@ async def create_restore_plan(
restore_plan: Optional[gcg_restore_plan.RestorePlan] = None,
restore_plan_id: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Creates a new RestorePlan in a given location.
Expand Down Expand Up @@ -1822,7 +1823,7 @@ async def sample_create_restore_plan():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -1934,7 +1935,7 @@ async def list_restore_plans(
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListRestorePlansAsyncPager:
r"""Lists RestorePlans in a given location.
Expand Down Expand Up @@ -2058,7 +2059,7 @@ async def get_restore_plan(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> restore_plan.RestorePlan:
r"""Retrieve the details of a single RestorePlan.
Expand Down Expand Up @@ -2171,7 +2172,7 @@ async def update_restore_plan(
restore_plan: Optional[gcg_restore_plan.RestorePlan] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Update a RestorePlan.
Expand Down Expand Up @@ -2206,7 +2207,7 @@ async def sample_update_restore_plan():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -2313,7 +2314,7 @@ async def delete_restore_plan(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Deletes an existing RestorePlan.
Expand Down Expand Up @@ -2343,7 +2344,7 @@ async def sample_delete_restore_plan():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -2439,7 +2440,7 @@ async def create_restore(
restore: Optional[gcg_restore.Restore] = None,
restore_id: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Creates a new Restore for the given RestorePlan.
Expand Down Expand Up @@ -2474,7 +2475,7 @@ async def sample_create_restore():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -2586,7 +2587,7 @@ async def list_restores(
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListRestoresAsyncPager:
r"""Lists the Restores for a given RestorePlan.
Expand Down Expand Up @@ -2708,7 +2709,7 @@ async def get_restore(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> restore.Restore:
r"""Retrieves the details of a single Restore.
Expand Down Expand Up @@ -2821,7 +2822,7 @@ async def update_restore(
restore: Optional[gcg_restore.Restore] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Update a Restore.
Expand Down Expand Up @@ -2854,7 +2855,7 @@ async def sample_update_restore():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -2959,7 +2960,7 @@ async def delete_restore(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Deletes an existing Restore.
Expand Down Expand Up @@ -2989,7 +2990,7 @@ async def sample_delete_restore():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -3082,7 +3083,7 @@ async def list_volume_restores(
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListVolumeRestoresAsyncPager:
r"""Lists the VolumeRestores for a given Restore.
Expand Down Expand Up @@ -3207,7 +3208,7 @@ async def get_volume_restore(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> volume.VolumeRestore:
r"""Retrieve the details of a single VolumeRestore.
Expand Down Expand Up @@ -3321,14 +3322,9 @@ async def __aexit__(self, exc_type, exc, tb):
await self.transport.close()


try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-gke-backup",
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)


__all__ = ("BackupForGKEAsyncClient",)
Loading

0 comments on commit a9930b6

Please sign in to comment.