File: //snap/google-cloud-cli/396/lib/surface/pubsub/subscriptions/set_iam_policy.yaml
- release_tracks: [ALPHA]
help_text:
brief: Set the IAM policy for a Cloud Pub/Sub Subscription.
description: |
This command replaces the existing IAM policy for a subscription, given a
subscription and a file encoded in JSON or YAML that contains the IAM
policy.
If the given policy file specifies an "etag" value, then the
replacement will succeed only if the policy already in place matches that
etag. (An etag obtained via `get-iam-policy` will prevent the replacement
if the policy for the subscription has been subsequently updated.) A
policy file that does not contain an etag value will replace any existing
policy for the subscription.
examples: |
The following command will read an IAM policy defined in 'policy.json'
and set it for a subscription 'my-sub'
$ {command} my-sub policy.json
See https://cloud.google.com/iam/docs/managing-policies for details of
the policy file format and contents.
request:
collection: pubsub.projects.subscriptions
arguments:
resource:
help_text: The subscription for which to set the IAM policy.
spec: !REF googlecloudsdk.command_lib.pubsub.resources:subscription