Skip to content

Commit 1111f8c

Browse files
feat: [google-cloud-storage-control] Add new GetIamPolicy, SetIamPolicy, and TestIamPermissions RPCs (googleapis#14372)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 804559167 Source-Link: googleapis/googleapis@712043c Source-Link: https://github.com/googleapis/googleapis-gen/commit/ee97ec7932536e788221bac1fdeca3694820bcb4 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXN0b3JhZ2UtY29udHJvbC8uT3dsQm90LnlhbWwiLCJoIjoiZWU5N2VjNzkzMjUzNmU3ODgyMjFiYWMxZmRlY2EzNjk0ODIwYmNiNCJ9 --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 81cda1e commit 1111f8c

25 files changed

+4070
-78
lines changed

packages/google-cloud-storage-control/google/cloud/storage_control_v2/gapic_metadata.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@
5555
"get_folder_intelligence_config"
5656
]
5757
},
58+
"GetIamPolicy": {
59+
"methods": [
60+
"get_iam_policy"
61+
]
62+
},
5863
"GetManagedFolder": {
5964
"methods": [
6065
"get_managed_folder"
@@ -105,6 +110,16 @@
105110
"resume_anywhere_cache"
106111
]
107112
},
113+
"SetIamPolicy": {
114+
"methods": [
115+
"set_iam_policy"
116+
]
117+
},
118+
"TestIamPermissions": {
119+
"methods": [
120+
"test_iam_permissions"
121+
]
122+
},
108123
"UpdateAnywhereCache": {
109124
"methods": [
110125
"update_anywhere_cache"
@@ -175,6 +190,11 @@
175190
"get_folder_intelligence_config"
176191
]
177192
},
193+
"GetIamPolicy": {
194+
"methods": [
195+
"get_iam_policy"
196+
]
197+
},
178198
"GetManagedFolder": {
179199
"methods": [
180200
"get_managed_folder"
@@ -225,6 +245,16 @@
225245
"resume_anywhere_cache"
226246
]
227247
},
248+
"SetIamPolicy": {
249+
"methods": [
250+
"set_iam_policy"
251+
]
252+
},
253+
"TestIamPermissions": {
254+
"methods": [
255+
"test_iam_permissions"
256+
]
257+
},
228258
"UpdateAnywhereCache": {
229259
"methods": [
230260
"update_anywhere_cache"
@@ -295,6 +325,11 @@
295325
"get_folder_intelligence_config"
296326
]
297327
},
328+
"GetIamPolicy": {
329+
"methods": [
330+
"get_iam_policy"
331+
]
332+
},
298333
"GetManagedFolder": {
299334
"methods": [
300335
"get_managed_folder"
@@ -345,6 +380,16 @@
345380
"resume_anywhere_cache"
346381
]
347382
},
383+
"SetIamPolicy": {
384+
"methods": [
385+
"set_iam_policy"
386+
]
387+
},
388+
"TestIamPermissions": {
389+
"methods": [
390+
"test_iam_permissions"
391+
]
392+
},
348393
"UpdateAnywhereCache": {
349394
"methods": [
350395
"update_anywhere_cache"

packages/google-cloud-storage-control/google/cloud/storage_control_v2/services/storage_control/async_client.py

Lines changed: 460 additions & 0 deletions
Large diffs are not rendered by default.

packages/google-cloud-storage-control/google/cloud/storage_control_v2/services/storage_control/client.py

Lines changed: 463 additions & 0 deletions
Large diffs are not rendered by default.

packages/google-cloud-storage-control/google/cloud/storage_control_v2/services/storage_control/transports/base.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
from google.api_core import retry as retries
2323
import google.auth # type: ignore
2424
from google.auth import credentials as ga_credentials # type: ignore
25+
from google.iam.v1 import iam_policy_pb2 # type: ignore
26+
from google.iam.v1 import policy_pb2 # type: ignore
2527
from google.longrunning import operations_pb2 # type: ignore
2628
from google.oauth2 import service_account # type: ignore
2729
import google.protobuf
@@ -515,6 +517,21 @@ def _prep_wrapped_messages(self, client_info):
515517
default_timeout=60.0,
516518
client_info=client_info,
517519
),
520+
self.get_iam_policy: gapic_v1.method.wrap_method(
521+
self.get_iam_policy,
522+
default_timeout=None,
523+
client_info=client_info,
524+
),
525+
self.set_iam_policy: gapic_v1.method.wrap_method(
526+
self.set_iam_policy,
527+
default_timeout=None,
528+
client_info=client_info,
529+
),
530+
self.test_iam_permissions: gapic_v1.method.wrap_method(
531+
self.test_iam_permissions,
532+
default_timeout=None,
533+
client_info=client_info,
534+
),
518535
}
519536

520537
def close(self):
@@ -765,6 +782,36 @@ def update_organization_intelligence_config(
765782
]:
766783
raise NotImplementedError()
767784

785+
@property
786+
def get_iam_policy(
787+
self,
788+
) -> Callable[
789+
[iam_policy_pb2.GetIamPolicyRequest],
790+
Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]],
791+
]:
792+
raise NotImplementedError()
793+
794+
@property
795+
def set_iam_policy(
796+
self,
797+
) -> Callable[
798+
[iam_policy_pb2.SetIamPolicyRequest],
799+
Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]],
800+
]:
801+
raise NotImplementedError()
802+
803+
@property
804+
def test_iam_permissions(
805+
self,
806+
) -> Callable[
807+
[iam_policy_pb2.TestIamPermissionsRequest],
808+
Union[
809+
iam_policy_pb2.TestIamPermissionsResponse,
810+
Awaitable[iam_policy_pb2.TestIamPermissionsResponse],
811+
],
812+
]:
813+
raise NotImplementedError()
814+
768815
@property
769816
def kind(self) -> str:
770817
raise NotImplementedError()

packages/google-cloud-storage-control/google/cloud/storage_control_v2/services/storage_control/transports/grpc.py

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import google.auth # type: ignore
2424
from google.auth import credentials as ga_credentials # type: ignore
2525
from google.auth.transport.grpc import SslCredentials # type: ignore
26+
from google.iam.v1 import iam_policy_pb2 # type: ignore
27+
from google.iam.v1 import policy_pb2 # type: ignore
2628
from google.longrunning import operations_pb2 # type: ignore
2729
from google.protobuf import empty_pb2 # type: ignore
2830
from google.protobuf.json_format import MessageToJson
@@ -1021,6 +1023,102 @@ def update_organization_intelligence_config(
10211023
)
10221024
return self._stubs["update_organization_intelligence_config"]
10231025

1026+
@property
1027+
def get_iam_policy(
1028+
self,
1029+
) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]:
1030+
r"""Return a callable for the get iam policy method over gRPC.
1031+
1032+
Gets the IAM policy for a specified bucket. The ``resource``
1033+
field in the request should be ``projects/_/buckets/{bucket}``
1034+
for a bucket, or
1035+
``projects/_/buckets/{bucket}/managedFolders/{managedFolder}``
1036+
for a managed folder.
1037+
1038+
Returns:
1039+
Callable[[~.GetIamPolicyRequest],
1040+
~.Policy]:
1041+
A function that, when called, will call the underlying RPC
1042+
on the server.
1043+
"""
1044+
# Generate a "stub function" on-the-fly which will actually make
1045+
# the request.
1046+
# gRPC handles serialization and deserialization, so we just need
1047+
# to pass in the functions for each.
1048+
if "get_iam_policy" not in self._stubs:
1049+
self._stubs["get_iam_policy"] = self._logged_channel.unary_unary(
1050+
"/google.storage.control.v2.StorageControl/GetIamPolicy",
1051+
request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString,
1052+
response_deserializer=policy_pb2.Policy.FromString,
1053+
)
1054+
return self._stubs["get_iam_policy"]
1055+
1056+
@property
1057+
def set_iam_policy(
1058+
self,
1059+
) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]:
1060+
r"""Return a callable for the set iam policy method over gRPC.
1061+
1062+
Updates an IAM policy for the specified bucket. The ``resource``
1063+
field in the request should be ``projects/_/buckets/{bucket}``
1064+
for a bucket, or
1065+
``projects/_/buckets/{bucket}/managedFolders/{managedFolder}``
1066+
for a managed folder.
1067+
1068+
Returns:
1069+
Callable[[~.SetIamPolicyRequest],
1070+
~.Policy]:
1071+
A function that, when called, will call the underlying RPC
1072+
on the server.
1073+
"""
1074+
# Generate a "stub function" on-the-fly which will actually make
1075+
# the request.
1076+
# gRPC handles serialization and deserialization, so we just need
1077+
# to pass in the functions for each.
1078+
if "set_iam_policy" not in self._stubs:
1079+
self._stubs["set_iam_policy"] = self._logged_channel.unary_unary(
1080+
"/google.storage.control.v2.StorageControl/SetIamPolicy",
1081+
request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString,
1082+
response_deserializer=policy_pb2.Policy.FromString,
1083+
)
1084+
return self._stubs["set_iam_policy"]
1085+
1086+
@property
1087+
def test_iam_permissions(
1088+
self,
1089+
) -> Callable[
1090+
[iam_policy_pb2.TestIamPermissionsRequest],
1091+
iam_policy_pb2.TestIamPermissionsResponse,
1092+
]:
1093+
r"""Return a callable for the test iam permissions method over gRPC.
1094+
1095+
Tests a set of permissions on the given bucket, object, or
1096+
managed folder to see which, if any, are held by the caller. The
1097+
``resource`` field in the request should be
1098+
``projects/_/buckets/{bucket}`` for a bucket,
1099+
``projects/_/buckets/{bucket}/objects/{object}`` for an object,
1100+
or
1101+
``projects/_/buckets/{bucket}/managedFolders/{managedFolder}``
1102+
for a managed folder.
1103+
1104+
Returns:
1105+
Callable[[~.TestIamPermissionsRequest],
1106+
~.TestIamPermissionsResponse]:
1107+
A function that, when called, will call the underlying RPC
1108+
on the server.
1109+
"""
1110+
# Generate a "stub function" on-the-fly which will actually make
1111+
# the request.
1112+
# gRPC handles serialization and deserialization, so we just need
1113+
# to pass in the functions for each.
1114+
if "test_iam_permissions" not in self._stubs:
1115+
self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary(
1116+
"/google.storage.control.v2.StorageControl/TestIamPermissions",
1117+
request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString,
1118+
response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString,
1119+
)
1120+
return self._stubs["test_iam_permissions"]
1121+
10241122
def close(self):
10251123
self._logged_channel.close()
10261124

0 commit comments

Comments
 (0)