All Secret Manager code samples
This page contains code samples for Secret Manager. To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.
Enable secret version
Makes a specific version of a secret accessible.
- Secret Manager
- Google Cloud
- Ruby
- JavaScript
- Node JS
- Python
- PHP
- C#
- Java
- Go
Enable regional secret version with Etag
Enable version of a regional secret with Etag
- Secret Manager
- Google Cloud
- Ruby
- Java
- Go
List secret versions
Lists all versions of a secret.
- Google Cloud
- Secret Manager
- JavaScript
- PHP
- Node JS
- Python
- Ruby
- Go
- Java
- C#
IAM revoke access with regional secret
Revokes access of an IAM for a regional secret
- Secret Manager
- Google Cloud
- Ruby
- Java
- Go
Regional quickstart
Quickstart for Secret manager for regional secrets
- Google Cloud
- Secret Manager
- Ruby
- Node JS
- Java
- Python
- Go
- JavaScript
Create regional secret
Creates a new regional secret
- Google Cloud
- Secret Manager
- JavaScript
- Node JS
- Java
- Ruby
- Go
- PHP
Destroy a secret with an ETag
Shows how to destroy the given secret version that contains an ETag, making the payload irrecoverable.
- Secret Manager
- Google Cloud
- Go
- Python
- Java
List secret versions containing a filter
Shows how to list all secret versions and metadata for a secret with a specified filter.
- Secret Manager
- Google Cloud
- Java
- Go
- Python
Delete regional secret
Deletes a regional secret
- Secret Manager
- Google Cloud
- PHP
- Java
- Go
- Ruby
- JavaScript
- Node JS
Destroy regional secret version with etag
Destroys a version of a regional secret with Etag
- Secret Manager
- Google Cloud
- Go
- Ruby
- Java
Create secret with label
Creates a new secret with label
- Secret Manager
- Google Cloud
- JavaScript
- Ruby
- Node JS
- Java
- Go
Enable regional secret version
Enables the version of a regional secret
- Google Cloud
- Secret Manager
- PHP
- JavaScript
- Ruby
- Node JS
- Go
- Python
- Java
Create or update secret label
Creates or updates the labels of a secret
- Google Cloud
- Secret Manager
- Node JS
- Python
- JavaScript
- Go
- Java
Disable regional secret version
Disable a version of regional secret
- Google Cloud
- Secret Manager
- JavaScript
- Java
- Ruby
- Go
- PHP
- Node JS
IAM grant access
Sets roles/secretmanager.secretAccessor policy.
- Secret Manager
- Google Cloud
- PHP
- JavaScript
- Ruby
- Java
- Go
- Python
- Node JS
- C#
List regional secret version with filter
Lists all the versions of a secret with filter
- Secret Manager
- Google Cloud
- Ruby
- Java
- Go
Update secret
Updates secret metadata.
- Google Cloud
- Secret Manager
- C#
- PHP
- Ruby
- JavaScript
- Java
- Python
- Node JS
- Go
Update regional secret with Etag
Updates the regional secret with Etag
- Google Cloud
- Secret Manager
- Go
- Java
- Ruby
Update regional secret with alias
Updates a regional secret with alias
- Google Cloud
- Secret Manager
- JavaScript
- PHP
- Java
- Ruby
- Node JS
- Go
Delete a secret with ETags
Shows how to delete a secret with a given name, ETag, and all of its versions.
- Secret Manager
- Google Cloud
- Go
- Python
- Java
IAM grant access with regional secret
Grants access to an Iam for a regional secret
- Google Cloud
- Secret Manager
- Java
- Ruby
- Go
List regional secret
Lists all the regional secret
- Secret Manager
- Google Cloud
- Java
- Node JS
- PHP
- JavaScript
- Ruby
- Go
Add regional secret version
Adds a new version of regional secret
- Google Cloud
- Secret Manager
- Java
- JavaScript
- Ruby
- Go
- PHP
- Node JS
Access regional secret version
Gets the version of a regional secret
- Secret Manager
- Google Cloud
- Node JS
- JavaScript
- Java
- Python
- PHP
- Go
- Ruby
Add secret version
Adds a new version of the secret.
- Secret Manager
- Google Cloud
- C#
- Go
- Java
- Ruby
- Node JS
- PHP
- Python
- JavaScript
Access secret version
Gets the version of a secret.
- Secret Manager
- Google Cloud
- Python
- JavaScript
- Ruby
- PHP
- C#
- Go
- Node JS
- Java
Disable a secret with ETags
Shows how to disable a given secret version that contains ETags.
- Google Cloud
- Secret Manager
- Java
- Python
- Go
IAM revoke access regional secret
Revokes the access for an iam for regional secret
- Google Cloud
- Secret Manager
- Node JS
- JavaScript
Quickstart
Quickstart for Secret Manager.
- Secret Manager
- Google Cloud
- PHP
- Go
- Python
- C#
- JavaScript
- Ruby
- Java
- Node JS
Disable regional secret version with Etag
Disables the version of a regional secret with Etag
- Secret Manager
- Google Cloud
- Go
- Java
- Ruby
Update secret with alias
Updates a secret with alias
- Google Cloud
- Secret Manager
- PHP
- Java
- Node JS
- Ruby
- Go
- Python
- JavaScript
- C#
List secrets with a filter
Shows how to list all secrets in a project that match a filter.
- Google Cloud
- Secret Manager
- Go
- Java
- Python
Get secret version
Gets a secret's version metadata.
- Secret Manager
- Google Cloud
- Python
- C#
- Ruby
- Node JS
- Java
- JavaScript
- PHP
- Go
Destroy secret version
Destroys one of the versions of a secret.
- Secret Manager
- Google Cloud
- Ruby
- JavaScript
- Node JS
- Python
- Java
- C#
- PHP
- Go
Disable secret version
Makes a specific version of a secret inaccessible.
- Secret Manager
- Google Cloud
- Go
- Python
- JavaScript
- C#
- PHP
- Node JS
- Java
- Ruby
List regional secret version
List all the versions of a regional secret
- Secret Manager
- Google Cloud
- Go
- JavaScript
- Node JS
- Ruby
- Java
- PHP
IAM revoke access
Revokes roles/secretmanager.secretAccessor policy.
- Google Cloud
- Secret Manager
- Java
- Go
- C#
- Ruby
- Node JS
- JavaScript
- PHP
- Python
Update a secret with ETags
Shows how to update a given secret version that contains ETags.
- Secret Manager
- Google Cloud
- Python
- Go
- Java
Delete regional secret with Etag
Deletes a regional secret with Etag
- Secret Manager
- Google Cloud
- Java
- Go
- Ruby
Enable a secret with ETags
Shows how to enable a given secret version that contains ETags.
- Secret Manager
- Google Cloud
- Python
- Java
- Go
IAM grant access regional secret
Grant access to an IAM for a regional secret
- Secret Manager
- Google Cloud
- JavaScript
- Node JS
View secret labels
View the labels of a secret
- Secret Manager
- Google Cloud
- Go
- Python
- Node JS
- Ruby
- JavaScript
- Java
List regional secrets with filter
Lists all the regional secret with filter
- Google Cloud
- Secret Manager
- Go
- Java
- Ruby
Update regional secret
Updates a regional secret
- Secret Manager
- Google Cloud
- Node JS
- Java
- Ruby
- JavaScript
- Go
- PHP
Destroy regional secret version
Destroy a version of regional secret
- Secret Manager
- Google Cloud
- Ruby
- JavaScript
- PHP
- Node JS
- Go
- Java
Delete secret label
Deletes a label of a secret
- Secret Manager
- Google Cloud
- Node JS
- Java
- JavaScript
- Python
- Go
Get Regional secret version
Gets the version of a regional secret
- Secret Manager
- Google Cloud
- Ruby
- JavaScript
- Node JS
- PHP
- Go
- Java