Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

chore: upgrade gapic-generator-python to 0.43.2 #112

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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()

Expand All @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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"]

Expand Down
4 changes: 2 additions & 2 deletions scripts/fixup_containeranalysis_v1_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -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', ),

}
Expand Down
6 changes: 3 additions & 3 deletions synth.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
{
Expand Down
48 changes: 24 additions & 24 deletions tests/unit/gapic/containeranalysis_v1/test_container_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)

Expand All @@ -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

Expand Down Expand Up @@ -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)
Expand All @@ -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

Expand All @@ -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)

Expand All @@ -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)

Expand All @@ -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()
Expand All @@ -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.
Expand Down Expand Up @@ -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",)
Expand Down Expand Up @@ -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)

Expand All @@ -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

Expand Down Expand Up @@ -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)
Expand All @@ -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

Expand All @@ -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)

Expand All @@ -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)

Expand All @@ -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()
Expand All @@ -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.
Expand Down Expand Up @@ -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",)
Expand Down