Skip to content
This repository was archived by the owner on Oct 31, 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 @@ -299,7 +299,7 @@ async def update_policy(
self,
request: service.UpdatePolicyRequest = None,
*,
policy: resources.Policy = None,
policy_: resources.Policy = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
Expand All @@ -317,15 +317,15 @@ async def update_policy(
request (:class:`google.cloud.binaryauthorization_v1beta1.types.UpdatePolicyRequest`):
The request object. Request message for
[BinauthzManagementService.UpdatePolicy][].
policy (:class:`google.cloud.binaryauthorization_v1beta1.types.Policy`):
policy_ (:class:`google.cloud.binaryauthorization_v1beta1.types.Policy`):
Required. A new or updated
[policy][google.cloud.binaryauthorization.v1beta1.Policy]
value. The service will overwrite the [policy
name][google.cloud.binaryauthorization.v1beta1.Policy.name]
field with the resource name in the request URL, in the
format ``projects/*/policy``.

This corresponds to the ``policy`` field
This corresponds to the ``policy_`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.

Expand All @@ -344,7 +344,7 @@ async def update_policy(
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([policy])
has_flattened_params = any([policy_])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
Expand All @@ -356,8 +356,8 @@ async def update_policy(
# If we have keyword arguments corresponding to fields on the
# request, apply these.

if policy is not None:
request.policy = policy
if policy_ is not None:
request.policy_ = policy_

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def update_policy(
self,
request: service.UpdatePolicyRequest = None,
*,
policy: resources.Policy = None,
policy_: resources.Policy = None,
retry: retries.Retry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
Expand All @@ -482,15 +482,15 @@ def update_policy(
request (google.cloud.binaryauthorization_v1beta1.types.UpdatePolicyRequest):
The request object. Request message for
[BinauthzManagementService.UpdatePolicy][].
policy (google.cloud.binaryauthorization_v1beta1.types.Policy):
policy_ (google.cloud.binaryauthorization_v1beta1.types.Policy):
Required. A new or updated
[policy][google.cloud.binaryauthorization.v1beta1.Policy]
value. The service will overwrite the [policy
name][google.cloud.binaryauthorization.v1beta1.Policy.name]
field with the resource name in the request URL, in the
format ``projects/*/policy``.

This corresponds to the ``policy`` field
This corresponds to the ``policy_`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.

Expand All @@ -509,7 +509,7 @@ def update_policy(
# Create or coerce a protobuf request object.
# Sanity check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([policy])
has_flattened_params = any([policy_])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
Expand All @@ -526,8 +526,8 @@ def update_policy(
# If we have keyword arguments corresponding to fields on the
# request, apply these.

if policy is not None:
request.policy = policy
if policy_ is not None:
request.policy_ = policy_

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/binaryauthorization_v1beta1/types/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class UpdatePolicyRequest(proto.Message):
r"""Request message for [BinauthzManagementService.UpdatePolicy][].

Attributes:
policy (google.cloud.binaryauthorization_v1beta1.types.Policy):
policy_ (google.cloud.binaryauthorization_v1beta1.types.Policy):
Required. A new or updated
[policy][google.cloud.binaryauthorization.v1beta1.Policy]
value. The service will overwrite the [policy
Expand All @@ -62,7 +62,7 @@ class UpdatePolicyRequest(proto.Message):
format ``projects/*/policy``.
"""

policy = proto.Field(proto.MESSAGE, number=1, message=resources.Policy,)
policy_ = proto.Field(proto.MESSAGE, number=1, message=resources.Policy,)


class CreateAttestorRequest(proto.Message):
Expand Down
2 changes: 1 addition & 1 deletion scripts/fixup_binaryauthorization_v1beta1_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class binaryauthorizationCallTransformer(cst.CSTTransformer):
'get_policy': ('name', ),
'list_attestors': ('parent', 'page_size', 'page_token', ),
'update_attestor': ('attestor', ),
'update_policy': ('policy', ),
'update_policy': ('policy_', ),

}

Expand Down
4 changes: 2 additions & 2 deletions synth.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "56fc6d43fed71188d7e18f3ca003544646c4ab35",
"internalRef": "366346972"
"sha": "2490be32f08cccc870862ea86920f58325795c89",
"internalRef": "366826395"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -910,14 +910,14 @@ def test_update_policy_flattened():

# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
client.update_policy(policy=resources.Policy(name="name_value"),)
client.update_policy(policy_=resources.Policy(name="name_value"),)

# Establish that the underlying call was made with the expected
# request object values.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]

assert args[0].policy == resources.Policy(name="name_value")
assert args[0].policy_ == resources.Policy(name="name_value")


def test_update_policy_flattened_error():
Expand All @@ -929,7 +929,7 @@ def test_update_policy_flattened_error():
# fields is an error.
with pytest.raises(ValueError):
client.update_policy(
service.UpdatePolicyRequest(), policy=resources.Policy(name="name_value"),
service.UpdatePolicyRequest(), policy_=resources.Policy(name="name_value"),
)


Expand All @@ -948,15 +948,15 @@ async def test_update_policy_flattened_async():
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
response = await client.update_policy(
policy=resources.Policy(name="name_value"),
policy_=resources.Policy(name="name_value"),
)

# Establish that the underlying call was made with the expected
# request object values.
assert len(call.mock_calls)
_, args, _ = call.mock_calls[0]

assert args[0].policy == resources.Policy(name="name_value")
assert args[0].policy_ == resources.Policy(name="name_value")


@pytest.mark.asyncio
Expand All @@ -969,7 +969,7 @@ async def test_update_policy_flattened_error_async():
# fields is an error.
with pytest.raises(ValueError):
await client.update_policy(
service.UpdatePolicyRequest(), policy=resources.Policy(name="name_value"),
service.UpdatePolicyRequest(), policy_=resources.Policy(name="name_value"),
)


Expand Down