From e08c79cd2023770b8bbc70d4b9d5cc057c83acbd Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 6 Apr 2021 04:25:43 -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 --- .../container_analysis/async_client.py | 6 +-- .../services/container_analysis/client.py | 6 +-- .../container_analysis/transports/base.py | 6 +-- .../container_analysis/transports/grpc.py | 10 ++-- .../transports/grpc_asyncio.py | 10 ++-- .../fixup_containeranalysis_v1_keywords.py | 4 +- synth.metadata | 6 +-- .../test_container_analysis.py | 48 +++++++++---------- 8 files changed, 48 insertions(+), 48 deletions(-) diff --git a/google/cloud/devtools/containeranalysis_v1/services/container_analysis/async_client.py b/google/cloud/devtools/containeranalysis_v1/services/container_analysis/async_client.py index 37ce8f5..1fb919b 100644 --- a/google/cloud/devtools/containeranalysis_v1/services/container_analysis/async_client.py +++ b/google/cloud/devtools/containeranalysis_v1/services/container_analysis/async_client.py @@ -30,7 +30,7 @@ from google.cloud.devtools.containeranalysis_v1.types import containeranalysis 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 .transports.base import ContainerAnalysisTransport, DEFAULT_CLIENT_INFO from .transports.grpc_asyncio import ContainerAnalysisGrpcAsyncIOTransport @@ -203,7 +203,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 access control policy on the specified note or occurrence. Requires ``containeranalysis.notes.setIamPolicy`` or ``containeranalysis.occurrences.setIamPolicy`` permission if the @@ -339,7 +339,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 access control policy for a note or an occurrence resource. Requires ``containeranalysis.notes.setIamPolicy`` or ``containeranalysis.occurrences.setIamPolicy`` permission if the diff --git a/google/cloud/devtools/containeranalysis_v1/services/container_analysis/client.py b/google/cloud/devtools/containeranalysis_v1/services/container_analysis/client.py index f222066..6e96cbf 100644 --- a/google/cloud/devtools/containeranalysis_v1/services/container_analysis/client.py +++ b/google/cloud/devtools/containeranalysis_v1/services/container_analysis/client.py @@ -34,7 +34,7 @@ from google.cloud.devtools.containeranalysis_v1.types import containeranalysis 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 .transports.base import ContainerAnalysisTransport, DEFAULT_CLIENT_INFO from .transports.grpc import ContainerAnalysisGrpcTransport @@ -366,7 +366,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 access control policy on the specified note or occurrence. Requires ``containeranalysis.notes.setIamPolicy`` or ``containeranalysis.occurrences.setIamPolicy`` permission if the @@ -501,7 +501,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 access control policy for a note or an occurrence resource. Requires ``containeranalysis.notes.setIamPolicy`` or ``containeranalysis.occurrences.setIamPolicy`` permission if the diff --git a/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/base.py b/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/base.py index c90adb0..08a5448 100644 --- a/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/base.py +++ b/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/base.py @@ -27,7 +27,7 @@ from google.cloud.devtools.containeranalysis_v1.types import containeranalysis 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 try: @@ -131,7 +131,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() @@ -140,7 +140,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/devtools/containeranalysis_v1/services/container_analysis/transports/grpc.py b/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/grpc.py index 4749f2e..10c6101 100644 --- a/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/grpc.py +++ b/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/grpc.py @@ -28,7 +28,7 @@ from google.cloud.devtools.containeranalysis_v1.types import containeranalysis 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 .base import ContainerAnalysisTransport, DEFAULT_CLIENT_INFO @@ -240,7 +240,7 @@ def grpc_channel(self) -> grpc.Channel: @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 access control policy on the specified note or @@ -267,14 +267,14 @@ def set_iam_policy( self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( "/google.devtools.containeranalysis.v1.ContainerAnalysis/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 access control policy for a note or an occurrence @@ -301,7 +301,7 @@ def get_iam_policy( self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( "/google.devtools.containeranalysis.v1.ContainerAnalysis/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/devtools/containeranalysis_v1/services/container_analysis/transports/grpc_asyncio.py b/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/grpc_asyncio.py index b7d41cd..ad2b399 100644 --- a/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/grpc_asyncio.py +++ b/google/cloud/devtools/containeranalysis_v1/services/container_analysis/transports/grpc_asyncio.py @@ -29,7 +29,7 @@ from google.cloud.devtools.containeranalysis_v1.types import containeranalysis 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 .base import ContainerAnalysisTransport, DEFAULT_CLIENT_INFO from .grpc import ContainerAnalysisGrpcTransport @@ -244,7 +244,7 @@ def grpc_channel(self) -> aio.Channel: @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 access control policy on the specified note or @@ -271,14 +271,14 @@ def set_iam_policy( self._stubs["set_iam_policy"] = self.grpc_channel.unary_unary( "/google.devtools.containeranalysis.v1.ContainerAnalysis/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 access control policy for a note or an occurrence @@ -305,7 +305,7 @@ def get_iam_policy( self._stubs["get_iam_policy"] = self.grpc_channel.unary_unary( "/google.devtools.containeranalysis.v1.ContainerAnalysis/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_containeranalysis_v1_keywords.py b/scripts/fixup_containeranalysis_v1_keywords.py index f5bb70f..9c8ab4a 100644 --- a/scripts/fixup_containeranalysis_v1_keywords.py +++ b/scripts/fixup_containeranalysis_v1_keywords.py @@ -41,9 +41,9 @@ def partition( class containeranalysisCallTransformer(cst.CSTTransformer): CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { - 'get_iam_policy': ('resource', 'options', ), + 'get_iam_policy': ('resource', 'options_', ), 'get_vulnerability_occurrences_summary': ('parent', 'filter', ), - 'set_iam_policy': ('resource', 'policy', ), + 'set_iam_policy': ('resource', 'policy_', ), 'test_iam_permissions': ('resource', 'permissions', ), } diff --git a/synth.metadata b/synth.metadata index 80b50c3..f0e542b 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-containeranalysis.git", - "sha": "74be8869363254d3551a58634c299abcfb18e682" + "sha": "7dc8fdb02ea5c0ede345ba19939ff8bdc4118c77" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "56fc6d43fed71188d7e18f3ca003544646c4ab35", - "internalRef": "366346972" + "sha": "2490be32f08cccc870862ea86920f58325795c89", + "internalRef": "366826395" } }, { diff --git a/tests/unit/gapic/containeranalysis_v1/test_container_analysis.py b/tests/unit/gapic/containeranalysis_v1/test_container_analysis.py index f444187..1107689 100644 --- a/tests/unit/gapic/containeranalysis_v1/test_container_analysis.py +++ b/tests/unit/gapic/containeranalysis_v1/test_container_analysis.py @@ -43,8 +43,8 @@ ) from google.cloud.devtools.containeranalysis_v1.types import containeranalysis 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.oauth2 import service_account from google.type import expr_pb2 as expr # type: ignore @@ -476,7 +476,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) @@ -488,7 +488,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 @@ -531,7 +531,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) @@ -543,7 +543,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 @@ -565,7 +565,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) @@ -592,7 +592,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) @@ -611,12 +611,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() @@ -628,7 +628,7 @@ def test_set_iam_policy_flattened(): # 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() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. @@ -662,9 +662,9 @@ async def test_set_iam_policy_flattened_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: # Designate an appropriate return value for the call. - call.return_value = policy.Policy() + call.return_value = gi_policy.Policy() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy.Policy()) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gi_policy.Policy()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.set_iam_policy(resource="resource_value",) @@ -705,7 +705,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) @@ -717,7 +717,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 @@ -760,7 +760,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) @@ -772,7 +772,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 @@ -794,7 +794,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) @@ -821,7 +821,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) @@ -840,12 +840,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() @@ -857,7 +857,7 @@ def test_get_iam_policy_flattened(): # 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() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. @@ -891,9 +891,9 @@ async def test_get_iam_policy_flattened_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: # Designate an appropriate return value for the call. - call.return_value = policy.Policy() + call.return_value = gi_policy.Policy() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy.Policy()) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gi_policy.Policy()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.get_iam_policy(resource="resource_value",)