Skip to content
This repository was archived by the owner on Oct 16, 2023. It is now read-only.

Commit bbe8e3d

Browse files
feat(v2beta): Update the public IAM Deny v2beta API (#226)
- [ ] Regenerate this pull request now. fix(v2beta): remove google.api.resource_reference annotations PiperOrigin-RevId: 468493946 Source-Link: googleapis/googleapis@fb22ccd Source-Link: https://github.com/googleapis/googleapis-gen/commit/fd818d2d7b17ade74aa84d7384e13cbe40ba320d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZmQ4MThkMmQ3YjE3YWRlNzRhYTg0ZDczODRlMTNjYmU0MGJhMzIwZCJ9
1 parent 7b30d08 commit bbe8e3d

File tree

7 files changed

+314
-51
lines changed

7 files changed

+314
-51
lines changed

google/cloud/iam_v2beta/services/policies/async_client.py

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
from google.api_core import operation # type: ignore
3535
from google.api_core import operation_async # type: ignore
36+
from google.longrunning import operations_pb2
3637
from google.protobuf import timestamp_pb2 # type: ignore
3738

3839
from google.cloud.iam_v2beta.services.policies import pagers
@@ -54,8 +55,6 @@ class PoliciesAsyncClient:
5455
DEFAULT_ENDPOINT = PoliciesClient.DEFAULT_ENDPOINT
5556
DEFAULT_MTLS_ENDPOINT = PoliciesClient.DEFAULT_MTLS_ENDPOINT
5657

57-
policy_path = staticmethod(PoliciesClient.policy_path)
58-
parse_policy_path = staticmethod(PoliciesClient.parse_policy_path)
5958
common_billing_account_path = staticmethod(
6059
PoliciesClient.common_billing_account_path
6160
)
@@ -831,6 +830,60 @@ async def sample_delete_policy():
831830
# Done; return the response.
832831
return response
833832

833+
async def get_operation(
834+
self,
835+
request: operations_pb2.GetOperationRequest = None,
836+
*,
837+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
838+
timeout: float = None,
839+
metadata: Sequence[Tuple[str, str]] = (),
840+
) -> operations_pb2.Operation:
841+
r"""Gets the latest state of a long-running operation.
842+
843+
Args:
844+
request (:class:`~.operations_pb2.GetOperationRequest`):
845+
The request object. Request message for
846+
`GetOperation` method.
847+
retry (google.api_core.retry.Retry): Designation of what errors,
848+
if any, should be retried.
849+
timeout (float): The timeout for this request.
850+
metadata (Sequence[Tuple[str, str]]): Strings which should be
851+
sent along with the request as metadata.
852+
Returns:
853+
~.operations_pb2.Operation:
854+
An ``Operation`` object.
855+
"""
856+
# Create or coerce a protobuf request object.
857+
# The request isn't a proto-plus wrapped type,
858+
# so it must be constructed via keyword expansion.
859+
if isinstance(request, dict):
860+
request = operations_pb2.GetOperationRequest(**request)
861+
862+
# Wrap the RPC method; this adds retry and timeout information,
863+
# and friendly error handling.
864+
rpc = gapic_v1.method.wrap_method(
865+
self._client._transport.get_operation,
866+
default_timeout=None,
867+
client_info=DEFAULT_CLIENT_INFO,
868+
)
869+
870+
# Certain fields should be provided within the metadata header;
871+
# add these here.
872+
metadata = tuple(metadata) + (
873+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
874+
)
875+
876+
# Send the request.
877+
response = await rpc(
878+
request,
879+
retry=retry,
880+
timeout=timeout,
881+
metadata=metadata,
882+
)
883+
884+
# Done; return the response.
885+
return response
886+
834887
async def __aenter__(self):
835888
return self
836889

google/cloud/iam_v2beta/services/policies/client.py

Lines changed: 55 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
from google.api_core import operation # type: ignore
3838
from google.api_core import operation_async # type: ignore
39+
from google.longrunning import operations_pb2
3940
from google.protobuf import timestamp_pb2 # type: ignore
4041

4142
from google.cloud.iam_v2beta.services.policies import pagers
@@ -168,21 +169,6 @@ def transport(self) -> PoliciesTransport:
168169
"""
169170
return self._transport
170171

171-
@staticmethod
172-
def policy_path(
173-
policy: str,
174-
) -> str:
175-
"""Returns a fully-qualified policy string."""
176-
return "policies/{policy}".format(
177-
policy=policy,
178-
)
179-
180-
@staticmethod
181-
def parse_policy_path(path: str) -> Dict[str, str]:
182-
"""Parses a policy path into its component segments."""
183-
m = re.match(r"^policies/(?P<policy>.+?)$", path)
184-
return m.groupdict() if m else {}
185-
186172
@staticmethod
187173
def common_billing_account_path(
188174
billing_account: str,
@@ -1024,6 +1010,60 @@ def __exit__(self, type, value, traceback):
10241010
"""
10251011
self.transport.close()
10261012

1013+
def get_operation(
1014+
self,
1015+
request: operations_pb2.GetOperationRequest = None,
1016+
*,
1017+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1018+
timeout: float = None,
1019+
metadata: Sequence[Tuple[str, str]] = (),
1020+
) -> operations_pb2.Operation:
1021+
r"""Gets the latest state of a long-running operation.
1022+
1023+
Args:
1024+
request (:class:`~.operations_pb2.GetOperationRequest`):
1025+
The request object. Request message for
1026+
`GetOperation` method.
1027+
retry (google.api_core.retry.Retry): Designation of what errors,
1028+
if any, should be retried.
1029+
timeout (float): The timeout for this request.
1030+
metadata (Sequence[Tuple[str, str]]): Strings which should be
1031+
sent along with the request as metadata.
1032+
Returns:
1033+
~.operations_pb2.Operation:
1034+
An ``Operation`` object.
1035+
"""
1036+
# Create or coerce a protobuf request object.
1037+
# The request isn't a proto-plus wrapped type,
1038+
# so it must be constructed via keyword expansion.
1039+
if isinstance(request, dict):
1040+
request = operations_pb2.GetOperationRequest(**request)
1041+
1042+
# Wrap the RPC method; this adds retry and timeout information,
1043+
# and friendly error handling.
1044+
rpc = gapic_v1.method.wrap_method(
1045+
self._transport.get_operation,
1046+
default_timeout=None,
1047+
client_info=DEFAULT_CLIENT_INFO,
1048+
)
1049+
1050+
# Certain fields should be provided within the metadata header;
1051+
# add these here.
1052+
metadata = tuple(metadata) + (
1053+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1054+
)
1055+
1056+
# Send the request.
1057+
response = rpc(
1058+
request,
1059+
retry=retry,
1060+
timeout=timeout,
1061+
metadata=metadata,
1062+
)
1063+
1064+
# Done; return the response.
1065+
return response
1066+
10271067

10281068
try:
10291069
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(

google/cloud/iam_v2beta/services/policies/transports/base.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,15 @@ def delete_policy(
259259
]:
260260
raise NotImplementedError()
261261

262+
@property
263+
def get_operation(
264+
self,
265+
) -> Callable[
266+
[operations_pb2.GetOperationRequest],
267+
Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
268+
]:
269+
raise NotImplementedError()
270+
262271
@property
263272
def kind(self) -> str:
264273
raise NotImplementedError()

google/cloud/iam_v2beta/services/policies/transports/grpc.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,23 @@ def delete_policy(
393393
def close(self):
394394
self.grpc_channel.close()
395395

396+
@property
397+
def get_operation(
398+
self,
399+
) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
400+
r"""Return a callable for the get_operation method over gRPC."""
401+
# Generate a "stub function" on-the-fly which will actually make
402+
# the request.
403+
# gRPC handles serialization and deserialization, so we just need
404+
# to pass in the functions for each.
405+
if "get_operation" not in self._stubs:
406+
self._stubs["get_operation"] = self.grpc_channel.unary_unary(
407+
"/google.longrunning.Operations/GetOperation",
408+
request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
409+
response_deserializer=operations_pb2.Operation.FromString,
410+
)
411+
return self._stubs["get_operation"]
412+
396413
@property
397414
def kind(self) -> str:
398415
return "grpc"

google/cloud/iam_v2beta/services/policies/transports/grpc_asyncio.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,5 +400,22 @@ def delete_policy(
400400
def close(self):
401401
return self.grpc_channel.close()
402402

403+
@property
404+
def get_operation(
405+
self,
406+
) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
407+
r"""Return a callable for the get_operation method over gRPC."""
408+
# Generate a "stub function" on-the-fly which will actually make
409+
# the request.
410+
# gRPC handles serialization and deserialization, so we just need
411+
# to pass in the functions for each.
412+
if "get_operation" not in self._stubs:
413+
self._stubs["get_operation"] = self.grpc_channel.unary_unary(
414+
"/google.longrunning.Operations/GetOperation",
415+
request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
416+
response_deserializer=operations_pb2.Operation.FromString,
417+
)
418+
return self._stubs["get_operation"]
419+
403420

404421
__all__ = ("PoliciesGrpcAsyncIOTransport",)

google/cloud/iam_v2beta/types/deny.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ class DenyRule(proto.Message):
3434
contain the following values:
3535
3636
- ``principalSet://goog/public:all``: A special identifier
37-
that represents any user who is on the internet, even if
38-
they do not have a Google Account or are not logged in.
37+
that represents any principal that is on the internet,
38+
even if they do not have a Google Account or are not
39+
logged in.
3940
4041
- ``principal://goog/subject/{email_id}``: A specific
4142
Google Account. Includes Gmail, Cloud Identity, and

0 commit comments

Comments
 (0)