Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.
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 @@ -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
Expand Down Expand Up @@ -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.

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

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


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

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

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

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

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

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-functions.git",
"sha": "8c7db919535193151ed52465a3038d3ac72d701e"
"sha": "0ea4d16d9efbc593c06123d519d37ff23352b608"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "56fc6d43fed71188d7e18f3ca003544646c4ab35",
"internalRef": "366346972"
"sha": "2490be32f08cccc870862ea86920f58325795c89",
"internalRef": "366826395"
}
},
{
Expand Down
36 changes: 18 additions & 18 deletions tests/unit/gapic/functions_v1/test_cloud_functions_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

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

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

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

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

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

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

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

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

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

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