diff --git a/packages/google-cloud-filestore/.coveragerc b/packages/google-cloud-filestore/.coveragerc index 33198273c119..8484639d7385 100644 --- a/packages/google-cloud-filestore/.coveragerc +++ b/packages/google-cloud-filestore/.coveragerc @@ -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 diff --git a/packages/google-cloud-filestore/google/cloud/filestore_v1/gapic_version.py b/packages/google-cloud-filestore/google/cloud/filestore_v1/gapic_version.py new file mode 100644 index 000000000000..d92b8a9f0926 --- /dev/null +++ b/packages/google-cloud-filestore/google/cloud/filestore_v1/gapic_version.py @@ -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__ = "1.2.3" # {x-release-please-version} diff --git a/packages/google-cloud-filestore/google/cloud/filestore_v1/services/cloud_filestore_manager/async_client.py b/packages/google-cloud-filestore/google/cloud/filestore_v1/services/cloud_filestore_manager/async_client.py index c19dd9d9d6cc..cbd6b7a0fc7e 100644 --- a/packages/google-cloud-filestore/google/cloud/filestore_v1/services/cloud_filestore_manager/async_client.py +++ b/packages/google-cloud-filestore/google/cloud/filestore_v1/services/cloud_filestore_manager/async_client.py @@ -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.filestore_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -259,7 +260,7 @@ async def list_instances( *, 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.ListInstancesAsyncPager: r"""Lists all instances in a project for either a @@ -390,7 +391,7 @@ async def get_instance( *, 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]] = (), ) -> cloud_filestore_service.Instance: r"""Gets the details of a specific instance. @@ -503,7 +504,7 @@ async def create_instance( instance: Optional[cloud_filestore_service.Instance] = None, instance_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 an instance. @@ -538,7 +539,7 @@ async def sample_create_instance(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -649,7 +650,7 @@ async def update_instance( instance: Optional[cloud_filestore_service.Instance] = 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"""Updates the settings of a specific instance. @@ -678,7 +679,7 @@ async def sample_update_instance(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -780,7 +781,7 @@ async def restore_instance( ] = 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"""Restores an existing instance's file share from a @@ -816,7 +817,7 @@ async def sample_restore_instance(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -884,7 +885,7 @@ async def delete_instance( *, 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 instance. @@ -914,7 +915,7 @@ async def sample_delete_instance(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -1010,7 +1011,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 all backups in a project for either a specified @@ -1138,7 +1139,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]] = (), ) -> cloud_filestore_service.Backup: r"""Gets the details of a specific backup. @@ -1251,7 +1252,7 @@ async def create_backup( backup: Optional[cloud_filestore_service.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. @@ -1282,7 +1283,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) @@ -1397,7 +1398,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 a backup. @@ -1427,7 +1428,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) @@ -1524,7 +1525,7 @@ async def update_backup( backup: Optional[cloud_filestore_service.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"""Updates the settings of a specific backup. @@ -1553,7 +1554,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) @@ -1653,14 +1654,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-filestore", - ).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__ = ("CloudFilestoreManagerAsyncClient",) diff --git a/packages/google-cloud-filestore/google/cloud/filestore_v1/services/cloud_filestore_manager/client.py b/packages/google-cloud-filestore/google/cloud/filestore_v1/services/cloud_filestore_manager/client.py index 8f3de8d3f28a..5d0bbf2c2c0d 100644 --- a/packages/google-cloud-filestore/google/cloud/filestore_v1/services/cloud_filestore_manager/client.py +++ b/packages/google-cloud-filestore/google/cloud/filestore_v1/services/cloud_filestore_manager/client.py @@ -38,7 +38,8 @@ from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.filestore_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -503,7 +504,7 @@ def list_instances( *, 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.ListInstancesPager: r"""Lists all instances in a project for either a @@ -625,7 +626,7 @@ def get_instance( *, 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]] = (), ) -> cloud_filestore_service.Instance: r"""Gets the details of a specific instance. @@ -729,7 +730,7 @@ def create_instance( instance: Optional[cloud_filestore_service.Instance] = None, instance_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.Operation: r"""Creates an instance. @@ -875,7 +876,7 @@ def update_instance( instance: Optional[cloud_filestore_service.Instance] = 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.Operation: r"""Updates the settings of a specific instance. @@ -1006,7 +1007,7 @@ def restore_instance( ] = 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.Operation: r"""Restores an existing instance's file share from a @@ -1111,7 +1112,7 @@ def delete_instance( *, 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.Operation: r"""Deletes an instance. @@ -1237,7 +1238,7 @@ 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.ListBackupsPager: r"""Lists all backups in a project for either a specified @@ -1356,7 +1357,7 @@ 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]] = (), ) -> cloud_filestore_service.Backup: r"""Gets the details of a specific backup. @@ -1460,7 +1461,7 @@ def create_backup( backup: Optional[cloud_filestore_service.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.Operation: r"""Creates a backup. @@ -1606,7 +1607,7 @@ 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.Operation: r"""Deletes a backup. @@ -1733,7 +1734,7 @@ def update_backup( backup: Optional[cloud_filestore_service.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.Operation: r"""Updates the settings of a specific backup. @@ -1869,14 +1870,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-filestore", - ).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__ = ("CloudFilestoreManagerClient",) diff --git a/packages/google-cloud-filestore/google/cloud/filestore_v1/services/cloud_filestore_manager/transports/base.py b/packages/google-cloud-filestore/google/cloud/filestore_v1/services/cloud_filestore_manager/transports/base.py index b721d610544e..9c7ae5cfa1ab 100644 --- a/packages/google-cloud-filestore/google/cloud/filestore_v1/services/cloud_filestore_manager/transports/base.py +++ b/packages/google-cloud-filestore/google/cloud/filestore_v1/services/cloud_filestore_manager/transports/base.py @@ -24,18 +24,13 @@ from google.auth import credentials as ga_credentials # type: ignore from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources +from google.cloud.filestore_v1 import gapic_version as package_version from google.cloud.filestore_v1.types import cloud_filestore_service -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-filestore", - ).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__ +) class CloudFilestoreManagerTransport(abc.ABC): diff --git a/packages/google-cloud-filestore/release-please-config.json b/packages/google-cloud-filestore/release-please-config.json index 647c20289a8c..ea25bd358cb9 100644 --- a/packages/google-cloud-filestore/release-please-config.json +++ b/packages/google-cloud-filestore/release-please-config.json @@ -5,6 +5,7 @@ "release-type": "python", "extra-files": [ "google/cloud/filestore/gapic_version.py", + "google/cloud/filestore_v1/gapic_version.py", { "type": "json", "path": "samples/generated_samples/snippet_metadata_google.cloud.filestore.v1.json", diff --git a/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_create_backup_async.py b/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_create_backup_async.py index a5cd8f99ac7d..d2ad1373f9e4 100644 --- a/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_create_backup_async.py +++ b/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_create_backup_async.py @@ -49,7 +49,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) diff --git a/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_create_instance_async.py b/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_create_instance_async.py index 5b19bf87b8fe..d586fa1980a4 100644 --- a/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_create_instance_async.py +++ b/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_create_instance_async.py @@ -49,7 +49,7 @@ async def sample_create_instance(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_delete_backup_async.py b/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_delete_backup_async.py index 4095e5849336..5f033c7e8bc8 100644 --- a/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_delete_backup_async.py +++ b/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_delete_backup_async.py @@ -48,7 +48,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) diff --git a/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_delete_instance_async.py b/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_delete_instance_async.py index 14270ce3ebaf..f3287723945a 100644 --- a/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_delete_instance_async.py +++ b/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_delete_instance_async.py @@ -48,7 +48,7 @@ async def sample_delete_instance(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_restore_instance_async.py b/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_restore_instance_async.py index 0f515b8dd74b..5c2eb1e18962 100644 --- a/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_restore_instance_async.py +++ b/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_restore_instance_async.py @@ -50,7 +50,7 @@ async def sample_restore_instance(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_update_backup_async.py b/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_update_backup_async.py index fdbf0c2ce03b..2503a44e18e0 100644 --- a/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_update_backup_async.py +++ b/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_update_backup_async.py @@ -47,7 +47,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) diff --git a/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_update_instance_async.py b/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_update_instance_async.py index d18d11c86894..75529c18e810 100644 --- a/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_update_instance_async.py +++ b/packages/google-cloud-filestore/samples/generated_samples/file_v1_generated_cloud_filestore_manager_update_instance_async.py @@ -47,7 +47,7 @@ async def sample_update_instance(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/packages/google-cloud-filestore/setup.py b/packages/google-cloud-filestore/setup.py index 2f0a5a9a8449..700177922f0b 100644 --- a/packages/google-cloud-filestore/setup.py +++ b/packages/google-cloud-filestore/setup.py @@ -36,7 +36,7 @@ release_status = "Development Status :: 5 - Production/Stable" dependencies = [ - "google-api-core[grpc] >= 1.33.2, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", + "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", "proto-plus >= 1.22.0, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", "google-cloud-common >= 1.0.0, <2.0.0dev", diff --git a/packages/google-cloud-filestore/testing/constraints-3.7.txt b/packages/google-cloud-filestore/testing/constraints-3.7.txt index e0b44d1b83b0..f84318fc9bf2 100644 --- a/packages/google-cloud-filestore/testing/constraints-3.7.txt +++ b/packages/google-cloud-filestore/testing/constraints-3.7.txt @@ -4,7 +4,7 @@ # Pin the version to the lower bound. # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 -google-api-core==1.33.2 +google-api-core==1.34.0 proto-plus==1.22.0 protobuf==3.19.5 google-cloud-common==1.0.0