Open
Description
Determine this is the right repository
- I determined this is the correct repository in which to report this feature request.
Summary of the feature request
Currently, setting policy in a managed folder level requires manual REST API calls, and we need the same way to apply the policy like we applied to bucket level. Check this documentation
Desired code experience
file: main.py
storage_control_client = storage_control_v2.StorageControlClient(credentials=credential)
project_path = storage_control_client.common_project_path("_")
bucket_path = f"{project_path}/buckets/{bucket_name}"
# Check if the path is a managed folder
request = storage_control_v2.GetManagedFolderRequest(
name=f"{bucket_path}/managedFolders/{path}"
)
managed_folder = storage_control_client.get_managed_folder(request=request)
policy = managed_folder.get_iam_policy(requested_policy_version=3)
policy.bindings.append({
"role": "roles/storage.objectViewer",
"members": ["allUsers"]
})
managed_folder.set_iam_policy(policy)
Expected results
The result is the same as I do on the bucket level.
API client name and version
google-cloud-storage-control 1.6.0
Use case
This feature will be useful to alter the policy at the managed folder level
Additional context
No response