From dfa120e7bd43de40fbc937196766138ae08f87b3 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 7 Dec 2022 11:32:53 -0500 Subject: [PATCH] fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#234) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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: https://github.com/googleapis/googleapis/commit/fea43879f83a8d0dacc9353b3f75f8f46d37162f Source-Link: https://github.com/googleapis/googleapis-gen/commit/387b7344c7529ee44be84e613b19a820508c612b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzg3YjczNDRjNzUyOWVlNDRiZTg0ZTYxM2IxOWE4MjA1MDhjNjEyYiJ9 * 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: https://github.com/googleapis/googleapis/commit/fea43879f83a8d0dacc9353b3f75f8f46d37162f Source-Link: https://github.com/googleapis/googleapis-gen/commit/387b7344c7529ee44be84e613b19a820508c612b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzg3YjczNDRjNzUyOWVlNDRiZTg0ZTYxM2IxOWE4MjA1MDhjNjEyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 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 Co-authored-by: Anthonios Partheniou --- packages/google-cloud-functions/.coveragerc | 5 -- .../cloud/functions_v1/gapic_version.py | 16 +++++++ .../cloud_functions_service/async_client.py | 42 ++++++++-------- .../cloud_functions_service/client.py | 36 +++++++------- .../transports/base.py | 13 ++--- .../cloud/functions_v2/gapic_version.py | 16 +++++++ .../services/function_service/async_client.py | 48 +++++++++---------- .../services/function_service/client.py | 42 ++++++++-------- .../function_service/transports/base.py | 13 ++--- .../release-please-config.json | 2 + ...functions_service_create_function_async.py | 2 +- ...functions_service_delete_function_async.py | 2 +- ...functions_service_update_function_async.py | 2 +- ..._function_service_create_function_async.py | 2 +- ..._function_service_delete_function_async.py | 2 +- ..._function_service_update_function_async.py | 2 +- packages/google-cloud-functions/setup.py | 2 +- .../testing/constraints-3.7.txt | 2 +- 18 files changed, 126 insertions(+), 123 deletions(-) create mode 100644 packages/google-cloud-functions/google/cloud/functions_v1/gapic_version.py create mode 100644 packages/google-cloud-functions/google/cloud/functions_v2/gapic_version.py diff --git a/packages/google-cloud-functions/.coveragerc b/packages/google-cloud-functions/.coveragerc index ca93bdfe15d8..d4e667fe926c 100644 --- a/packages/google-cloud-functions/.coveragerc +++ b/packages/google-cloud-functions/.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-functions/google/cloud/functions_v1/gapic_version.py b/packages/google-cloud-functions/google/cloud/functions_v1/gapic_version.py new file mode 100644 index 000000000000..91ef154c2080 --- /dev/null +++ b/packages/google-cloud-functions/google/cloud/functions_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.8.3" # {x-release-please-version} diff --git a/packages/google-cloud-functions/google/cloud/functions_v1/services/cloud_functions_service/async_client.py b/packages/google-cloud-functions/google/cloud/functions_v1/services/cloud_functions_service/async_client.py index 7d864a663e77..50106eab72c6 100644 --- a/packages/google-cloud-functions/google/cloud/functions_v1/services/cloud_functions_service/async_client.py +++ b/packages/google-cloud-functions/google/cloud/functions_v1/services/cloud_functions_service/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.functions_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -241,7 +242,7 @@ async def list_functions( request: Optional[Union[functions.ListFunctionsRequest, dict]] = 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.ListFunctionsAsyncPager: r"""Returns a list of functions that belong to the @@ -344,7 +345,7 @@ async def get_function( *, 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]] = (), ) -> functions.CloudFunction: r"""Returns a function with the given name from the @@ -460,7 +461,7 @@ async def create_function( location: Optional[str] = None, function: Optional[functions.CloudFunction] = 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 function. If a function with the given name @@ -496,7 +497,7 @@ async def sample_create_function(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -591,7 +592,7 @@ async def update_function( *, function: Optional[functions.CloudFunction] = 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 existing function. @@ -624,7 +625,7 @@ async def sample_update_function(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -723,7 +724,7 @@ async def delete_function( *, 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 function with the given name from the @@ -756,7 +757,7 @@ async def sample_delete_function(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -861,7 +862,7 @@ async def call_function( name: Optional[str] = None, data: 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]] = (), ) -> functions.CallFunctionResponse: r"""Synchronously invokes a deployed Cloud Function. To be used for @@ -973,7 +974,7 @@ async def generate_upload_url( request: Optional[Union[functions.GenerateUploadUrlRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> functions.GenerateUploadUrlResponse: r"""Returns a signed URL for uploading a function source code. For @@ -1077,7 +1078,7 @@ async def generate_download_url( request: Optional[Union[functions.GenerateDownloadUrlRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> functions.GenerateDownloadUrlResponse: r"""Returns a signed URL for downloading deployed @@ -1159,7 +1160,7 @@ async def set_iam_policy( request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified @@ -1303,7 +1304,7 @@ async def get_iam_policy( request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1448,7 +1449,7 @@ async def test_iam_permissions( request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified permissions against the IAM access control @@ -1535,14 +1536,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-functions", - ).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__ = ("CloudFunctionsServiceAsyncClient",) diff --git a/packages/google-cloud-functions/google/cloud/functions_v1/services/cloud_functions_service/client.py b/packages/google-cloud-functions/google/cloud/functions_v1/services/cloud_functions_service/client.py index 52bf942be988..cdc4dbd14fc2 100644 --- a/packages/google-cloud-functions/google/cloud/functions_v1/services/cloud_functions_service/client.py +++ b/packages/google-cloud-functions/google/cloud/functions_v1/services/cloud_functions_service/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.functions_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -503,7 +504,7 @@ def list_functions( request: Optional[Union[functions.ListFunctionsRequest, dict]] = 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.ListFunctionsPager: r"""Returns a list of functions that belong to the @@ -597,7 +598,7 @@ def get_function( *, 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]] = (), ) -> functions.CloudFunction: r"""Returns a function with the given name from the @@ -703,7 +704,7 @@ def create_function( location: Optional[str] = None, function: Optional[functions.CloudFunction] = 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 new function. If a function with the given name @@ -834,7 +835,7 @@ def update_function( *, function: Optional[functions.CloudFunction] = 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 existing function. @@ -956,7 +957,7 @@ def delete_function( *, 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 function with the given name from the @@ -1084,7 +1085,7 @@ def call_function( name: Optional[str] = None, data: 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]] = (), ) -> functions.CallFunctionResponse: r"""Synchronously invokes a deployed Cloud Function. To be used for @@ -1196,7 +1197,7 @@ def generate_upload_url( request: Optional[Union[functions.GenerateUploadUrlRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> functions.GenerateUploadUrlResponse: r"""Returns a signed URL for uploading a function source code. For @@ -1301,7 +1302,7 @@ def generate_download_url( request: Optional[Union[functions.GenerateDownloadUrlRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> functions.GenerateDownloadUrlResponse: r"""Returns a signed URL for downloading deployed @@ -1384,7 +1385,7 @@ def set_iam_policy( request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified @@ -1527,7 +1528,7 @@ def get_iam_policy( request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1671,7 +1672,7 @@ def test_iam_permissions( request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified permissions against the IAM access control @@ -1764,14 +1765,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-functions", - ).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__ = ("CloudFunctionsServiceClient",) diff --git a/packages/google-cloud-functions/google/cloud/functions_v1/services/cloud_functions_service/transports/base.py b/packages/google-cloud-functions/google/cloud/functions_v1/services/cloud_functions_service/transports/base.py index 65550a95880f..1c135dfd5a8f 100644 --- a/packages/google-cloud-functions/google/cloud/functions_v1/services/cloud_functions_service/transports/base.py +++ b/packages/google-cloud-functions/google/cloud/functions_v1/services/cloud_functions_service/transports/base.py @@ -26,18 +26,13 @@ from google.iam.v1 import policy_pb2 # type: ignore from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources +from google.cloud.functions_v1 import gapic_version as package_version from google.cloud.functions_v1.types import functions -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-functions", - ).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 CloudFunctionsServiceTransport(abc.ABC): diff --git a/packages/google-cloud-functions/google/cloud/functions_v2/gapic_version.py b/packages/google-cloud-functions/google/cloud/functions_v2/gapic_version.py new file mode 100644 index 000000000000..91ef154c2080 --- /dev/null +++ b/packages/google-cloud-functions/google/cloud/functions_v2/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.8.3" # {x-release-please-version} diff --git a/packages/google-cloud-functions/google/cloud/functions_v2/services/function_service/async_client.py b/packages/google-cloud-functions/google/cloud/functions_v2/services/function_service/async_client.py index 7d3fb75096d4..de1b41117b8e 100644 --- a/packages/google-cloud-functions/google/cloud/functions_v2/services/function_service/async_client.py +++ b/packages/google-cloud-functions/google/cloud/functions_v2/services/function_service/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.functions_v2 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -251,7 +252,7 @@ async def get_function( *, 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]] = (), ) -> functions.Function: r"""Returns a function with the given name from the @@ -356,7 +357,7 @@ async def list_functions( *, 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.ListFunctionsAsyncPager: r"""Returns a list of functions that belong to the @@ -479,7 +480,7 @@ async def create_function( function: Optional[functions.Function] = None, function_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 function. If a function with the given name @@ -511,7 +512,7 @@ async def sample_create_function(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -619,7 +620,7 @@ async def update_function( function: Optional[functions.Function] = 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 existing function. @@ -648,7 +649,7 @@ async def sample_update_function(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -748,7 +749,7 @@ async def delete_function( *, 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 function with the given name from the @@ -781,7 +782,7 @@ async def sample_delete_function(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -874,7 +875,7 @@ async def generate_upload_url( request: Optional[Union[functions.GenerateUploadUrlRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> functions.GenerateUploadUrlResponse: r"""Returns a signed URL for uploading a function source code. For @@ -977,7 +978,7 @@ async def generate_download_url( request: Optional[Union[functions.GenerateDownloadUrlRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> functions.GenerateDownloadUrlResponse: r"""Returns a signed URL for downloading deployed @@ -1061,7 +1062,7 @@ async def list_runtimes( *, 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]] = (), ) -> functions.ListRuntimesResponse: r"""Returns a list of runtimes that are supported for the @@ -1162,7 +1163,7 @@ async def list_operations( request: Optional[operations_pb2.ListOperationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -1216,7 +1217,7 @@ async def get_operation( request: Optional[operations_pb2.GetOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -1270,7 +1271,7 @@ async def set_iam_policy( request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1390,7 +1391,7 @@ async def get_iam_policy( request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1511,7 +1512,7 @@ async def test_iam_permissions( request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control @@ -1570,7 +1571,7 @@ async def list_locations( request: Optional[locations_pb2.ListLocationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -1626,14 +1627,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-functions", - ).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__ = ("FunctionServiceAsyncClient",) diff --git a/packages/google-cloud-functions/google/cloud/functions_v2/services/function_service/client.py b/packages/google-cloud-functions/google/cloud/functions_v2/services/function_service/client.py index 4f0dbbfc3fdd..45cc2f6d1d4b 100644 --- a/packages/google-cloud-functions/google/cloud/functions_v2/services/function_service/client.py +++ b/packages/google-cloud-functions/google/cloud/functions_v2/services/function_service/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.functions_v2 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -637,7 +638,7 @@ def get_function( *, 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]] = (), ) -> functions.Function: r"""Returns a function with the given name from the @@ -742,7 +743,7 @@ def list_functions( *, 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.ListFunctionsPager: r"""Returns a list of functions that belong to the @@ -865,7 +866,7 @@ def create_function( function: Optional[functions.Function] = None, function_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 new function. If a function with the given name @@ -1005,7 +1006,7 @@ def update_function( function: Optional[functions.Function] = 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 existing function. @@ -1134,7 +1135,7 @@ def delete_function( *, 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 function with the given name from the @@ -1260,7 +1261,7 @@ def generate_upload_url( request: Optional[Union[functions.GenerateUploadUrlRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> functions.GenerateUploadUrlResponse: r"""Returns a signed URL for uploading a function source code. For @@ -1364,7 +1365,7 @@ def generate_download_url( request: Optional[Union[functions.GenerateDownloadUrlRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> functions.GenerateDownloadUrlResponse: r"""Returns a signed URL for downloading deployed @@ -1449,7 +1450,7 @@ def list_runtimes( *, 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]] = (), ) -> functions.ListRuntimesResponse: r"""Returns a list of runtimes that are supported for the @@ -1563,7 +1564,7 @@ def list_operations( request: Optional[operations_pb2.ListOperationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -1617,7 +1618,7 @@ def get_operation( request: Optional[operations_pb2.GetOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -1671,7 +1672,7 @@ def set_iam_policy( request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1791,7 +1792,7 @@ def get_iam_policy( request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1912,7 +1913,7 @@ def test_iam_permissions( request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control @@ -1971,7 +1972,7 @@ def list_locations( request: Optional[locations_pb2.ListLocationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. @@ -2021,14 +2022,9 @@ def list_locations( return response -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-functions", - ).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__ = ("FunctionServiceClient",) diff --git a/packages/google-cloud-functions/google/cloud/functions_v2/services/function_service/transports/base.py b/packages/google-cloud-functions/google/cloud/functions_v2/services/function_service/transports/base.py index 1330b03fdcf8..6c44fc8827ad 100644 --- a/packages/google-cloud-functions/google/cloud/functions_v2/services/function_service/transports/base.py +++ b/packages/google-cloud-functions/google/cloud/functions_v2/services/function_service/transports/base.py @@ -27,18 +27,13 @@ from google.iam.v1 import policy_pb2 # type: ignore from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources +from google.cloud.functions_v2 import gapic_version as package_version from google.cloud.functions_v2.types import functions -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-functions", - ).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 FunctionServiceTransport(abc.ABC): diff --git a/packages/google-cloud-functions/release-please-config.json b/packages/google-cloud-functions/release-please-config.json index 1110cd16712d..7d0628e876ba 100644 --- a/packages/google-cloud-functions/release-please-config.json +++ b/packages/google-cloud-functions/release-please-config.json @@ -4,7 +4,9 @@ ".": { "release-type": "python", "extra-files": [ + "google/cloud/functions_v1/gapic_version.py", "google/cloud/functions/gapic_version.py", + "google/cloud/functions_v2/gapic_version.py", { "type": "json", "path": "samples/generated_samples/snippet_metadata_google.cloud.functions.v2.json", diff --git a/packages/google-cloud-functions/samples/generated_samples/cloudfunctions_v1_generated_cloud_functions_service_create_function_async.py b/packages/google-cloud-functions/samples/generated_samples/cloudfunctions_v1_generated_cloud_functions_service_create_function_async.py index 8cbb17f3e22c..2f1f649b6cae 100644 --- a/packages/google-cloud-functions/samples/generated_samples/cloudfunctions_v1_generated_cloud_functions_service_create_function_async.py +++ b/packages/google-cloud-functions/samples/generated_samples/cloudfunctions_v1_generated_cloud_functions_service_create_function_async.py @@ -52,7 +52,7 @@ async def sample_create_function(): 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-functions/samples/generated_samples/cloudfunctions_v1_generated_cloud_functions_service_delete_function_async.py b/packages/google-cloud-functions/samples/generated_samples/cloudfunctions_v1_generated_cloud_functions_service_delete_function_async.py index 7c7cc5ac7317..41b37c73e78a 100644 --- a/packages/google-cloud-functions/samples/generated_samples/cloudfunctions_v1_generated_cloud_functions_service_delete_function_async.py +++ b/packages/google-cloud-functions/samples/generated_samples/cloudfunctions_v1_generated_cloud_functions_service_delete_function_async.py @@ -48,7 +48,7 @@ async def sample_delete_function(): 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-functions/samples/generated_samples/cloudfunctions_v1_generated_cloud_functions_service_update_function_async.py b/packages/google-cloud-functions/samples/generated_samples/cloudfunctions_v1_generated_cloud_functions_service_update_function_async.py index db9a1ffa8e85..c9ae9e7238d9 100644 --- a/packages/google-cloud-functions/samples/generated_samples/cloudfunctions_v1_generated_cloud_functions_service_update_function_async.py +++ b/packages/google-cloud-functions/samples/generated_samples/cloudfunctions_v1_generated_cloud_functions_service_update_function_async.py @@ -51,7 +51,7 @@ async def sample_update_function(): 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-functions/samples/generated_samples/cloudfunctions_v2_generated_function_service_create_function_async.py b/packages/google-cloud-functions/samples/generated_samples/cloudfunctions_v2_generated_function_service_create_function_async.py index 7154e04e44ae..e0845061a073 100644 --- a/packages/google-cloud-functions/samples/generated_samples/cloudfunctions_v2_generated_function_service_create_function_async.py +++ b/packages/google-cloud-functions/samples/generated_samples/cloudfunctions_v2_generated_function_service_create_function_async.py @@ -48,7 +48,7 @@ async def sample_create_function(): 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-functions/samples/generated_samples/cloudfunctions_v2_generated_function_service_delete_function_async.py b/packages/google-cloud-functions/samples/generated_samples/cloudfunctions_v2_generated_function_service_delete_function_async.py index 03b42d07582c..03d669665907 100644 --- a/packages/google-cloud-functions/samples/generated_samples/cloudfunctions_v2_generated_function_service_delete_function_async.py +++ b/packages/google-cloud-functions/samples/generated_samples/cloudfunctions_v2_generated_function_service_delete_function_async.py @@ -48,7 +48,7 @@ async def sample_delete_function(): 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-functions/samples/generated_samples/cloudfunctions_v2_generated_function_service_update_function_async.py b/packages/google-cloud-functions/samples/generated_samples/cloudfunctions_v2_generated_function_service_update_function_async.py index 409c82db25ff..1b913e70d184 100644 --- a/packages/google-cloud-functions/samples/generated_samples/cloudfunctions_v2_generated_function_service_update_function_async.py +++ b/packages/google-cloud-functions/samples/generated_samples/cloudfunctions_v2_generated_function_service_update_function_async.py @@ -47,7 +47,7 @@ async def sample_update_function(): 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-functions/setup.py b/packages/google-cloud-functions/setup.py index df2f46a0848c..34de427d556d 100644 --- a/packages/google-cloud-functions/setup.py +++ b/packages/google-cloud-functions/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", "grpc-google-iam-v1 >= 0.12.4, < 1.0.0dev", diff --git a/packages/google-cloud-functions/testing/constraints-3.7.txt b/packages/google-cloud-functions/testing/constraints-3.7.txt index 883a87aefd06..2beecf99e0be 100644 --- a/packages/google-cloud-functions/testing/constraints-3.7.txt +++ b/packages/google-cloud-functions/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 grpc-google-iam-v1==0.12.4