Google Cloud samples
Search for samples demonstrating the usage of Google Cloud products.
For Terraform samples, see Resource samples and Blueprints.
Quickstart
Demonstrates basic usage of IAM.
- Google Cloud
- Identity and Access Management
- Go
- Python
- Java
- C#
- C++
- Sample
Delete a service account
Demonstrates deleting a service account.
- Identity and Access Management
- Google Cloud
- C++
- Java
- Python
- C#
- Go
- Sample
Query testable permissions
Demonstrates listing the permissions that are valid for a resource.
- Google Cloud
- Identity and Access Management
- C++
- C#
- Go
- Python
- Java
- Sample
Add a new role binding
Demonstrates adding a new role binding to an IAM policy.
- Identity and Access Management
- Google Cloud
- Python
- Java
- C#
- Sample
Create a deny policy
Creates a deny policy based on the configuration provided.
- Google Cloud
- Identity and Access Management
- Java
- Go
- Terraform
- Node JS
- JavaScript
- Python
- Sample
Test permissions
Demonstrates testing whether the caller has specified permissions.
- Identity and Access Management
- Google Cloud
- Python
- Java
- C++
- C#
- Sample
Delete a deny policy
Delete the policy if you no longer want to enforce the rules in a deny policy.
- Identity and Access Management
- Google Cloud
- Java
- Node JS
- JavaScript
- Python
- Go
- Sample
Create a service account key
Demonstrates creating a service account key.
- Identity and Access Management
- Google Cloud
- C#
- Java
- C++
- Go
- Python
- Sample
Remove a member from a role binding
Demonstrates removing a member from a role binding in an IAM policy.
- Identity and Access Management
- Google Cloud
- Java
- Go
- C#
- Python
- Sample
Update a deny policy
Update the deny rules and/ or its display name after policy creation.
- Google Cloud
- Identity and Access Management
- Java
- Python
- JavaScript
- Go
- Node JS
- Sample
Disable a service account key
Demonstrates disabling an IAM service account key.
- Google Cloud
- Identity and Access Management
- Java
- Sample
Get an IAM policy
Demonstrates retrieving an IAM policy.
- Identity and Access Management
- Google Cloud
- Python
- C++
- C#
- Java
- Sample
List roles
Demonstrates listing roles.
- Identity and Access Management
- Google Cloud
- Python
- C#
- Go
- Java
- C++
- Sample
Delete a custom role
Demonstrates deleting a custom role.
- Google Cloud
- Identity and Access Management
- C#
- Java
- Go
- C++
- Python
- Sample
Get a service account
Demonstrates retrieving a service account.
- Google Cloud
- Identity and Access Management
- C++
- Sample
List service account keys
Demonstrates listing service account keys.
- Google Cloud
- Identity and Access Management
- Java
- Go
- C#
- C++
- Python
- Sample
Delete a service account key
Demonstrates deleting a service account key.
- Identity and Access Management
- Google Cloud
- C#
- Python
- Go
- C++
- Java
- Sample
Disable a service account
Demonstrates disabling a service account.
- Identity and Access Management
- Google Cloud
- Go
- Python
- Java
- C++
- C#
- Sample
List deny policies
List the deny policies in the resource provided.
- Google Cloud
- Identity and Access Management
- Node JS
- Go
- Java
- JavaScript
- Python
- Sample
Enable a service account key
Demonstrates enabling a disabled IAM service account key.
- Google Cloud
- Identity and Access Management
- Java
- Sample
Update a policy
Demonstrates updating a policy.
- Google Cloud
- Identity and Access Management
- C++
- Python
- C#
- Java
- Sample
Enable a service account
Demonstrates enabling a service account.
- Identity and Access Management
- Google Cloud
- Python
- C#
- Java
- C++
- Go
- Sample
Create project-level service agents
Create all project-level service agents for an API.
- Google Cloud
- Identity and Access Management
- Terraform
- Sample
Get a deny policy
Retrieve information about a deny policy.
- Google Cloud
- Identity and Access Management
- Java
- Python
- JavaScript
- Node JS
- Go
- Sample
Get a service account key
Demonstrates retrieving a service account key.
- Identity and Access Management
- Google Cloud
- C++
- Sample
Restore a deleted custom role
Demonstrates restoring a custom role.
- Google Cloud
- Identity and Access Management
- Java
- C#
- C++
- Python
- Go
- Sample
View grantable roles
Demonstrates viewing the roles that you can grant on a specific resource.
- Identity and Access Management
- Google Cloud
- C#
- Python
- Go
- C++
- Java
- Sample
Disable a custom role
Demonstrates disabling a custom role.
- Identity and Access Management
- Google Cloud
- Java
- Python
- Sample
List service accounts
Demonstrates listing service accounts.
- Google Cloud
- Identity and Access Management
- C#
- Java
- Python
- Go
- C++
- Sample
Edit a custom role
Demonstrates editing a custom role.
- Google Cloud
- Identity and Access Management
- Python
- C++
- Java
- Go
- C#
- Sample
Create a custom role
Demonstrates creating a custom role.
- Google Cloud
- Identity and Access Management
- Java
- Python
- C#
- C++
- Go
- Sample
Add a principal to a role binding
Demonstrates adding a principal to an existing role binding in an IAM policy.
- Identity and Access Management
- Google Cloud
- Go
- Java
- Python
- C#
- Sample
Create a token for Workload Identity Federation with AWS
Creates a token that IAM Workload Identity Federation can verify without revealing the AWS secret access key.
- Google Cloud
- Identity and Access Management
- Python
- Sample
Rename a service account
Demonstrates renaming a service account.
- Identity and Access Management
- Google Cloud
- Java
- C#
- C++
- Go
- Python
- Sample
Create a service account
Demonstrates creating a service account.
- Identity and Access Management
- Google Cloud
- C#
- Java
- Go
- Python
- C++
- Sample
Get a role
Demonstrates retrieving a role.
- Identity and Access Management
- Google Cloud
- Python
- Go
- C#
- Java
- C++
- Sample