Todos os exemplos de código do IAM

This page contains code samples for Identity and Access Management. To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.

Add a new role binding

Demonstrates adding a new role binding to an IAM policy.

Add a principal to a role binding

Demonstrates adding a principal to an existing role binding in an IAM policy.

Create a custom role

Demonstrates creating a custom role.

View in documentation

Create a service account

Demonstrates creating a service account.

Create a service account key

Demonstrates creating a service account key.

Delete a custom role

Demonstrates deleting a custom role.

View in documentation

Delete a service account

Demonstrates deleting a service account.

Delete a service account key

Demonstrates deleting a service account key.

Disable a role

Demonstrates disabling a role.

Disable a service account

Demonstrates disabling a service account.

Edit a custom role

Demonstrates editing a custom role.

View in documentation

Enable a service account

Demonstrates enabling a service account.

Get a role

Demonstrates retrieving a role.

View in documentation

Get a service account

Demonstrates retrieving a service account.

Get a service account key

Demonstrates retrieving a service account key.

Get an IAM policy

Demonstrates retrieving an IAM policy.

List roles

Demonstrates listing roles.

View in documentation

List service account keys

Demonstrates listing service account keys.

List service accounts

Demonstrates listing service accounts.

Query testable permissions

Demonstrates listing the permissions that are valid for a resource.

View in documentation

Remove a member from a role binding

Demonstrates removing a member from a role binding in an IAM policy.

Rename a service account

Demonstrates renaming a service account.

Restore a deleted custom role

Demonstrates restoring a custom role.

View in documentation

Test permissions

Demonstrates testing whether the caller has specified permissions.

View in documentation

Update a policy

Demonstrates updating a policy.

View grantable roles

Demonstrates viewing the roles that you can grant on a specific resource.