Groups: setIamPolicy

Requires authorization

Sets the access control policy on the specified resource. Replaces any existing policy. Try it now.

Request

HTTP request

POST https://www.googleapis.com/clouduseraccounts/alpha/projects/project/global/groups/resource/setIamPolicy

Parameters

Parameter name Value Description
Path parameters
project string Project ID for this request.
resource string Name of the resource for this request.

Authorization

This request requires authorization with at least one of the following scopes (read more about authentication and authorization).

Scope
https://www.googleapis.com/auth/cloud.useraccounts.readonly
https://www.googleapis.com/auth/cloud.useraccounts
https://www.googleapis.com/auth/cloud-platform.read-only
https://www.googleapis.com/auth/cloud-platform

Request body

In the request body, supply data with the following structure:

{
  "version": integer,
  "bindings": [
    {
      "role": string,
      "members": [
        string
      ]
    }
  ],
  "rules": [
    {
      "description": string,
      "permissions": [
        string
      ],
      "action": string,
      "ins": [
        string
      ],
      "notIns": [
        string
      ],
      "conditions": [
        {
          "iam": string,
          "sys": string,
          "svc": string,
          "op": string,
          "value": string,
          "values": [
            string
          ]
        }
      ],
      "logConfigs": [
        {
          "counter": {
            "metric": string,
            "field": string
          }
        }
      ]
    }
  ],
  "etag": bytes
}
Property name Value Description Notes
version integer Version of the `Policy`. The default version is 0.
bindings[] list Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error.
bindings[].role string Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
bindings[].members[] list Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following formats:

* `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account.

* `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account.

* `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`.

* `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`.

* `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`.

* `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`.
rules[] list

rules[].description string Human-readable description of the rule.
rules[].permissions[] list A permission is a string of form '..' (e.g., 'storage.buckets.list'). A value of '*' matches all permissions, and a verb part of '*' (e.g., 'storage.buckets.*') matches all verbs.

rules[].action string Required
rules[].ins[] list The rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is in this set of entries.
rules[].notIns[] list The rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is not in this set of entries.
rules[].conditions[] list Additional restrictions that must be met
rules[].conditions[].iam string Trusted attributes supplied by the IAM system.
rules[].conditions[].sys string Trusted attributes supplied by any service that owns resources and uses the IAM system for access control.
rules[].conditions[].svc string Trusted attributes discharged by the service.
rules[].conditions[].op string An operator to apply the subject with.
rules[].conditions[].value string The object of the condition. Exactly one of these must be set.
rules[].conditions[].values[] list The objects of the condition. This is mutually exclusive with 'value'.
rules[].logConfigs[] list The config returned to callers of tech.iam.IAM.CheckPolicy for any entries that match the LOG action.
rules[].logConfigs[].counter nested object Counter options.
rules[].logConfigs[].counter.metric string The metric to update.
rules[].logConfigs[].counter.field string The field value to attribute.
etag bytes Can be used to perform a read-modify-write.

Response

If successful, this method returns a response body with the following structure:

{
  "version": integer,
  "bindings": [
    {
      "role": string,
      "members": [
        string
      ]
    }
  ],
  "rules": [
    {
      "description": string,
      "permissions": [
        string
      ],
      "action": string,
      "ins": [
        string
      ],
      "notIns": [
        string
      ],
      "conditions": [
        {
          "iam": string,
          "sys": string,
          "svc": string,
          "op": string,
          "value": string,
          "values": [
            string
          ]
        }
      ],
      "logConfigs": [
        {
          "counter": {
            "metric": string,
            "field": string
          }
        }
      ]
    }
  ],
  "etag": bytes
}
Property name Value Description Notes
version integer Version of the `Policy`. The default version is 0.
bindings[] list Associates a list of `members` to a `role`. Multiple `bindings` must not be specified for the same `role`. `bindings` with no members will result in an error.
bindings[].role string Role that is assigned to `members`. For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
bindings[].members[] list Specifies the identities requesting access for a Cloud Platform resource. `members` can have the following formats:

* `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account.

* `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account.

* `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@gmail.com` or `joe@example.com`.

* `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`.

* `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`.

* `domain:{domain}`: A Google Apps domain name that represents all the users of that domain. For example, `google.com` or `example.com`.
rules[] list

rules[].description string Human-readable description of the rule.
rules[].permissions[] list A permission is a string of form '..' (e.g., 'storage.buckets.list'). A value of '*' matches all permissions, and a verb part of '*' (e.g., 'storage.buckets.*') matches all verbs.

rules[].action string Required
rules[].ins[] list The rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is in this set of entries.
rules[].notIns[] list The rule matches if the PRINCIPAL/AUTHORITY_SELECTOR is not in this set of entries.
rules[].conditions[] list Additional restrictions that must be met
rules[].conditions[].iam string Trusted attributes supplied by the IAM system.
rules[].conditions[].sys string Trusted attributes supplied by any service that owns resources and uses the IAM system for access control.
rules[].conditions[].svc string Trusted attributes discharged by the service.
rules[].conditions[].op string An operator to apply the subject with.
rules[].conditions[].value string The object of the condition. Exactly one of these must be set.
rules[].conditions[].values[] list The objects of the condition. This is mutually exclusive with 'value'.
rules[].logConfigs[] list The config returned to callers of tech.iam.IAM.CheckPolicy for any entries that match the LOG action.
rules[].logConfigs[].counter nested object Counter options.
rules[].logConfigs[].counter.metric string The metric to update.
rules[].logConfigs[].counter.field string The field value to attribute.
etag bytes Can be used to perform a read-modify-write.

Try it!

Use the APIs Explorer below to call this method on live data and see the response.

Send feedback about...

Compute Engine Documentation