From 7c94fa26626032ee52ff2e69e45ecf35d1da5632 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 6 Apr 2021 02:45:31 -0700 Subject: [PATCH] chore: upgrade gapic-generator-python to 0.43.2 PiperOrigin-RevId: 366826395 Source-Author: Google APIs Source-Date: Mon Apr 5 10:39:44 2021 -0700 Source-Repo: googleapis/googleapis Source-Sha: 2490be32f08cccc870862ea86920f58325795c89 Source-Link: https://github.com/googleapis/googleapis/commit/2490be32f08cccc870862ea86920f58325795c89 --- .../cloud_functions_service/async_client.py | 6 ++-- .../cloud_functions_service/client.py | 6 ++-- .../transports/base.py | 6 ++-- .../transports/grpc.py | 10 +++--- .../transports/grpc_asyncio.py | 10 +++--- scripts/fixup_functions_v1_keywords.py | 4 +-- synth.metadata | 6 ++-- .../test_cloud_functions_service.py | 36 +++++++++---------- 8 files changed, 42 insertions(+), 42 deletions(-) diff --git a/google/cloud/functions_v1/services/cloud_functions_service/async_client.py b/google/cloud/functions_v1/services/cloud_functions_service/async_client.py index 5e05ca3..0dbbbf4 100644 --- a/google/cloud/functions_v1/services/cloud_functions_service/async_client.py +++ b/google/cloud/functions_v1/services/cloud_functions_service/async_client.py @@ -34,7 +34,7 @@ from google.cloud.functions_v1.types import functions from google.cloud.functions_v1.types import operations from google.iam.v1 import iam_policy_pb2 as iam_policy # type: ignore -from google.iam.v1 import policy_pb2 as policy # type: ignore +from google.iam.v1 import policy_pb2 as gi_policy # type: ignore from google.protobuf import duration_pb2 as duration # type: ignore from google.protobuf import empty_pb2 as empty # type: ignore from google.protobuf import timestamp_pb2 as timestamp # type: ignore @@ -856,7 +856,7 @@ async def set_iam_policy( retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> policy.Policy: + ) -> gi_policy.Policy: r"""Sets the IAM access control policy on the specified function. Replaces any existing policy. @@ -964,7 +964,7 @@ async def get_iam_policy( retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> policy.Policy: + ) -> gi_policy.Policy: r"""Gets the IAM access control policy for a function. Returns an empty policy if the function exists and does not have a policy set. diff --git a/google/cloud/functions_v1/services/cloud_functions_service/client.py b/google/cloud/functions_v1/services/cloud_functions_service/client.py index 3202d24..f6e4dab 100644 --- a/google/cloud/functions_v1/services/cloud_functions_service/client.py +++ b/google/cloud/functions_v1/services/cloud_functions_service/client.py @@ -38,7 +38,7 @@ from google.cloud.functions_v1.types import functions from google.cloud.functions_v1.types import operations from google.iam.v1 import iam_policy_pb2 as iam_policy # type: ignore -from google.iam.v1 import policy_pb2 as policy # type: ignore +from google.iam.v1 import policy_pb2 as gi_policy # type: ignore from google.protobuf import duration_pb2 as duration # type: ignore from google.protobuf import empty_pb2 as empty # type: ignore from google.protobuf import timestamp_pb2 as timestamp # type: ignore @@ -999,7 +999,7 @@ def set_iam_policy( retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> policy.Policy: + ) -> gi_policy.Policy: r"""Sets the IAM access control policy on the specified function. Replaces any existing policy. @@ -1106,7 +1106,7 @@ def get_iam_policy( retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> policy.Policy: + ) -> gi_policy.Policy: r"""Gets the IAM access control policy for a function. Returns an empty policy if the function exists and does not have a policy set. diff --git a/google/cloud/functions_v1/services/cloud_functions_service/transports/base.py b/google/cloud/functions_v1/services/cloud_functions_service/transports/base.py index eb6c359..50b7c58 100644 --- a/google/cloud/functions_v1/services/cloud_functions_service/transports/base.py +++ b/google/cloud/functions_v1/services/cloud_functions_service/transports/base.py @@ -28,7 +28,7 @@ from google.cloud.functions_v1.types import functions from google.iam.v1 import iam_policy_pb2 as iam_policy # type: ignore -from google.iam.v1 import policy_pb2 as policy # type: ignore +from google.iam.v1 import policy_pb2 as gi_policy # type: ignore from google.longrunning import operations_pb2 as operations # type: ignore @@ -287,7 +287,7 @@ def set_iam_policy( self, ) -> typing.Callable[ [iam_policy.SetIamPolicyRequest], - typing.Union[policy.Policy, typing.Awaitable[policy.Policy]], + typing.Union[gi_policy.Policy, typing.Awaitable[gi_policy.Policy]], ]: raise NotImplementedError() @@ -296,7 +296,7 @@ def get_iam_policy( self, ) -> typing.Callable[ [iam_policy.GetIamPolicyRequest], - typing.Union[policy.Policy, typing.Awaitable[policy.Policy]], + typing.Union[gi_policy.Policy, typing.Awaitable[gi_policy.Policy]], ]: raise NotImplementedError() diff --git a/google/cloud/functions_v1/services/cloud_functions_service/transports/grpc.py b/google/cloud/functions_v1/services/cloud_functions_service/transports/grpc.py index c299fcb..6d6c281 100644 --- a/google/cloud/functions_v1/services/cloud_functions_service/transports/grpc.py +++ b/google/cloud/functions_v1/services/cloud_functions_service/transports/grpc.py @@ -29,7 +29,7 @@ from google.cloud.functions_v1.types import functions from google.iam.v1 import iam_policy_pb2 as iam_policy # type: ignore -from google.iam.v1 import policy_pb2 as policy # type: ignore +from google.iam.v1 import policy_pb2 as gi_policy # type: ignore from google.longrunning import operations_pb2 as operations # type: ignore from .base import CloudFunctionsServiceTransport, DEFAULT_CLIENT_INFO @@ -499,7 +499,7 @@ def generate_download_url( @property def set_iam_policy( self, - ) -> Callable[[iam_policy.SetIamPolicyRequest], policy.Policy]: + ) -> Callable[[iam_policy.SetIamPolicyRequest], gi_policy.Policy]: r"""Return a callable for the set iam policy method over gRPC. Sets the IAM access control policy on the specified @@ -519,14 +519,14 @@ def set_iam_policy( self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( "/google.cloud.functions.v1.CloudFunctionsService/SetIamPolicy", request_serializer=iam_policy.SetIamPolicyRequest.SerializeToString, - response_deserializer=policy.Policy.FromString, + response_deserializer=gi_policy.Policy.FromString, ) return self._stubs["set_iam_policy"] @property def get_iam_policy( self, - ) -> Callable[[iam_policy.GetIamPolicyRequest], policy.Policy]: + ) -> Callable[[iam_policy.GetIamPolicyRequest], gi_policy.Policy]: r"""Return a callable for the get iam policy method over gRPC. Gets the IAM access control policy for a function. @@ -547,7 +547,7 @@ def get_iam_policy( self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( "/google.cloud.functions.v1.CloudFunctionsService/GetIamPolicy", request_serializer=iam_policy.GetIamPolicyRequest.SerializeToString, - response_deserializer=policy.Policy.FromString, + response_deserializer=gi_policy.Policy.FromString, ) return self._stubs["get_iam_policy"] diff --git a/google/cloud/functions_v1/services/cloud_functions_service/transports/grpc_asyncio.py b/google/cloud/functions_v1/services/cloud_functions_service/transports/grpc_asyncio.py index 28ddfae..96cce52 100644 --- a/google/cloud/functions_v1/services/cloud_functions_service/transports/grpc_asyncio.py +++ b/google/cloud/functions_v1/services/cloud_functions_service/transports/grpc_asyncio.py @@ -30,7 +30,7 @@ from google.cloud.functions_v1.types import functions from google.iam.v1 import iam_policy_pb2 as iam_policy # type: ignore -from google.iam.v1 import policy_pb2 as policy # type: ignore +from google.iam.v1 import policy_pb2 as gi_policy # type: ignore from google.longrunning import operations_pb2 as operations # type: ignore from .base import CloudFunctionsServiceTransport, DEFAULT_CLIENT_INFO @@ -511,7 +511,7 @@ def generate_download_url( @property def set_iam_policy( self, - ) -> Callable[[iam_policy.SetIamPolicyRequest], Awaitable[policy.Policy]]: + ) -> Callable[[iam_policy.SetIamPolicyRequest], Awaitable[gi_policy.Policy]]: r"""Return a callable for the set iam policy method over gRPC. Sets the IAM access control policy on the specified @@ -531,14 +531,14 @@ def set_iam_policy( self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( "/google.cloud.functions.v1.CloudFunctionsService/SetIamPolicy", request_serializer=iam_policy.SetIamPolicyRequest.SerializeToString, - response_deserializer=policy.Policy.FromString, + response_deserializer=gi_policy.Policy.FromString, ) return self._stubs["set_iam_policy"] @property def get_iam_policy( self, - ) -> Callable[[iam_policy.GetIamPolicyRequest], Awaitable[policy.Policy]]: + ) -> Callable[[iam_policy.GetIamPolicyRequest], Awaitable[gi_policy.Policy]]: r"""Return a callable for the get iam policy method over gRPC. Gets the IAM access control policy for a function. @@ -559,7 +559,7 @@ def get_iam_policy( self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( "/google.cloud.functions.v1.CloudFunctionsService/GetIamPolicy", request_serializer=iam_policy.GetIamPolicyRequest.SerializeToString, - response_deserializer=policy.Policy.FromString, + response_deserializer=gi_policy.Policy.FromString, ) return self._stubs["get_iam_policy"] diff --git a/scripts/fixup_functions_v1_keywords.py b/scripts/fixup_functions_v1_keywords.py index 78b0502..8fde45c 100644 --- a/scripts/fixup_functions_v1_keywords.py +++ b/scripts/fixup_functions_v1_keywords.py @@ -47,9 +47,9 @@ class functionsCallTransformer(cst.CSTTransformer): 'generate_download_url': ('name', 'version_id', ), 'generate_upload_url': ('parent', ), 'get_function': ('name', ), - 'get_iam_policy': ('resource', 'options', ), + 'get_iam_policy': ('resource', 'options_', ), 'list_functions': ('parent', 'page_size', 'page_token', ), - 'set_iam_policy': ('resource', 'policy', ), + 'set_iam_policy': ('resource', 'policy_', ), 'test_iam_permissions': ('resource', 'permissions', ), 'update_function': ('function', 'update_mask', ), diff --git a/synth.metadata b/synth.metadata index 58e6d65..485ca0e 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-functions.git", - "sha": "8c7db919535193151ed52465a3038d3ac72d701e" + "sha": "0ea4d16d9efbc593c06123d519d37ff23352b608" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "56fc6d43fed71188d7e18f3ca003544646c4ab35", - "internalRef": "366346972" + "sha": "2490be32f08cccc870862ea86920f58325795c89", + "internalRef": "366826395" } }, { diff --git a/tests/unit/gapic/functions_v1/test_cloud_functions_service.py b/tests/unit/gapic/functions_v1/test_cloud_functions_service.py index d328a0e..1ab2f43 100644 --- a/tests/unit/gapic/functions_v1/test_cloud_functions_service.py +++ b/tests/unit/gapic/functions_v1/test_cloud_functions_service.py @@ -46,8 +46,8 @@ from google.cloud.functions_v1.types import functions from google.cloud.functions_v1.types import operations from google.iam.v1 import iam_policy_pb2 as iam_policy # type: ignore -from google.iam.v1 import options_pb2 as options # type: ignore -from google.iam.v1 import policy_pb2 as policy # type: ignore +from google.iam.v1 import options_pb2 as gi_options # type: ignore +from google.iam.v1 import policy_pb2 as gi_policy # type: ignore from google.longrunning import operations_pb2 from google.oauth2 import service_account from google.protobuf import duration_pb2 as duration # type: ignore @@ -2320,7 +2320,7 @@ def test_set_iam_policy( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = policy.Policy(version=774, etag=b"etag_blob",) + call.return_value = gi_policy.Policy(version=774, etag=b"etag_blob",) response = client.set_iam_policy(request) @@ -2332,7 +2332,7 @@ def test_set_iam_policy( # Establish that the response is the type that we expect. - assert isinstance(response, policy.Policy) + assert isinstance(response, gi_policy.Policy) assert response.version == 774 @@ -2375,7 +2375,7 @@ async def test_set_iam_policy_async( with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy.Policy(version=774, etag=b"etag_blob",) + gi_policy.Policy(version=774, etag=b"etag_blob",) ) response = await client.set_iam_policy(request) @@ -2387,7 +2387,7 @@ async def test_set_iam_policy_async( assert args[0] == iam_policy.SetIamPolicyRequest() # Establish that the response is the type that we expect. - assert isinstance(response, policy.Policy) + assert isinstance(response, gi_policy.Policy) assert response.version == 774 @@ -2411,7 +2411,7 @@ def test_set_iam_policy_field_headers(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: - call.return_value = policy.Policy() + call.return_value = gi_policy.Policy() client.set_iam_policy(request) @@ -2438,7 +2438,7 @@ async def test_set_iam_policy_field_headers_async(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy.Policy()) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gi_policy.Policy()) await client.set_iam_policy(request) @@ -2459,12 +2459,12 @@ def test_set_iam_policy_from_dict_foreign(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = policy.Policy() + call.return_value = gi_policy.Policy() response = client.set_iam_policy( request={ "resource": "resource_value", - "policy": policy.Policy(version=774), + "policy_": gi_policy.Policy(version=774), } ) call.assert_called() @@ -2484,7 +2484,7 @@ def test_get_iam_policy( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = policy.Policy(version=774, etag=b"etag_blob",) + call.return_value = gi_policy.Policy(version=774, etag=b"etag_blob",) response = client.get_iam_policy(request) @@ -2496,7 +2496,7 @@ def test_get_iam_policy( # Establish that the response is the type that we expect. - assert isinstance(response, policy.Policy) + assert isinstance(response, gi_policy.Policy) assert response.version == 774 @@ -2539,7 +2539,7 @@ async def test_get_iam_policy_async( with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy.Policy(version=774, etag=b"etag_blob",) + gi_policy.Policy(version=774, etag=b"etag_blob",) ) response = await client.get_iam_policy(request) @@ -2551,7 +2551,7 @@ async def test_get_iam_policy_async( assert args[0] == iam_policy.GetIamPolicyRequest() # Establish that the response is the type that we expect. - assert isinstance(response, policy.Policy) + assert isinstance(response, gi_policy.Policy) assert response.version == 774 @@ -2575,7 +2575,7 @@ def test_get_iam_policy_field_headers(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: - call.return_value = policy.Policy() + call.return_value = gi_policy.Policy() client.get_iam_policy(request) @@ -2602,7 +2602,7 @@ async def test_get_iam_policy_field_headers_async(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy.Policy()) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gi_policy.Policy()) await client.get_iam_policy(request) @@ -2623,12 +2623,12 @@ def test_get_iam_policy_from_dict_foreign(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = policy.Policy() + call.return_value = gi_policy.Policy() response = client.get_iam_policy( request={ "resource": "resource_value", - "options": options.GetPolicyOptions(requested_policy_version=2598), + "options_": gi_options.GetPolicyOptions(requested_policy_version=2598), } ) call.assert_called()