Secret Manager V1 API - Class Google::Cloud::SecretManager::V1::SecretManagerService::Client (v1.0.1)

Reference documentation and code samples for the Secret Manager V1 API class Google::Cloud::SecretManager::V1::SecretManagerService::Client.

Client for the SecretManagerService service.

Secret Manager Service

Manages secrets and operations using those secrets. Implements a REST model with the following objects:

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the SecretManagerService Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all SecretManagerService clients
::Google::Cloud::SecretManager::V1::SecretManagerService::Client.configure do |config|
  config.timeout = 10.0
end

#access_secret_version

def access_secret_version(request, options = nil) -> ::Google::Cloud::SecretManager::V1::AccessSecretVersionResponse
def access_secret_version(name: nil) -> ::Google::Cloud::SecretManager::V1::AccessSecretVersionResponse

Accesses a SecretVersion. This call returns the secret data.

projects//secrets//versions/latest is an alias to the most recently created SecretVersion.

Overloads
def access_secret_version(request, options = nil) -> ::Google::Cloud::SecretManager::V1::AccessSecretVersionResponse
Pass arguments to access_secret_version via a request object, either of type AccessSecretVersionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::SecretManager::V1::AccessSecretVersionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def access_secret_version(name: nil) -> ::Google::Cloud::SecretManager::V1::AccessSecretVersionResponse
Pass arguments to access_secret_version via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. The resource name of the SecretVersion in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

    projects/*/secrets/*/versions/latest or projects/*/locations/*/secrets/*/versions/latest is an alias to the most recently created SecretVersion.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/secret_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecretManager::V1::SecretManagerService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecretManager::V1::AccessSecretVersionRequest.new

# Call the access_secret_version method.
result = client.access_secret_version request

# The returned object is of type Google::Cloud::SecretManager::V1::AccessSecretVersionResponse.
p result

#add_secret_version

def add_secret_version(request, options = nil) -> ::Google::Cloud::SecretManager::V1::SecretVersion
def add_secret_version(parent: nil, payload: nil) -> ::Google::Cloud::SecretManager::V1::SecretVersion

Creates a new SecretVersion containing secret data and attaches it to an existing Secret.

Overloads
def add_secret_version(request, options = nil) -> ::Google::Cloud::SecretManager::V1::SecretVersion
Pass arguments to add_secret_version via a request object, either of type AddSecretVersionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::SecretManager::V1::AddSecretVersionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def add_secret_version(parent: nil, payload: nil) -> ::Google::Cloud::SecretManager::V1::SecretVersion
Pass arguments to add_secret_version via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/secret_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecretManager::V1::SecretManagerService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecretManager::V1::AddSecretVersionRequest.new

# Call the add_secret_version method.
result = client.add_secret_version request

# The returned object is of type Google::Cloud::SecretManager::V1::SecretVersion.
p result

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the SecretManagerService Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_secret

def create_secret(request, options = nil) -> ::Google::Cloud::SecretManager::V1::Secret
def create_secret(parent: nil, secret_id: nil, secret: nil) -> ::Google::Cloud::SecretManager::V1::Secret

Creates a new Secret containing no SecretVersions.

Overloads
def create_secret(request, options = nil) -> ::Google::Cloud::SecretManager::V1::Secret
Pass arguments to create_secret via a request object, either of type CreateSecretRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::SecretManager::V1::CreateSecretRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_secret(parent: nil, secret_id: nil, secret: nil) -> ::Google::Cloud::SecretManager::V1::Secret
Pass arguments to create_secret via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The resource name of the project to associate with the Secret, in the format projects/* or projects/*/locations/*.
  • secret_id (::String) — Required. This must be unique within the project.

    A secret ID is a string with a maximum length of 255 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore (_) characters.

  • secret (::Google::Cloud::SecretManager::V1::Secret, ::Hash) — Required. A Secret with initial field values.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/secret_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecretManager::V1::SecretManagerService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecretManager::V1::CreateSecretRequest.new

# Call the create_secret method.
result = client.create_secret request

# The returned object is of type Google::Cloud::SecretManager::V1::Secret.
p result

#delete_secret

def delete_secret(request, options = nil) -> ::Google::Protobuf::Empty
def delete_secret(name: nil, etag: nil) -> ::Google::Protobuf::Empty

Deletes a Secret.

Overloads
def delete_secret(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_secret via a request object, either of type DeleteSecretRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::SecretManager::V1::DeleteSecretRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_secret(name: nil, etag: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_secret via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The resource name of the Secret to delete in the format projects/*/secrets/*.
  • etag (::String) — Optional. Etag of the Secret. The request succeeds if it matches the etag of the currently stored secret object. If the etag is omitted, the request succeeds.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/secret_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecretManager::V1::SecretManagerService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecretManager::V1::DeleteSecretRequest.new

# Call the delete_secret method.
result = client.delete_secret request

# The returned object is of type Google::Protobuf::Empty.
p result

#destroy_secret_version

def destroy_secret_version(request, options = nil) -> ::Google::Cloud::SecretManager::V1::SecretVersion
def destroy_secret_version(name: nil, etag: nil) -> ::Google::Cloud::SecretManager::V1::SecretVersion

Destroys a SecretVersion.

Sets the state of the SecretVersion to DESTROYED and irrevocably destroys the secret data.

Overloads
def destroy_secret_version(request, options = nil) -> ::Google::Cloud::SecretManager::V1::SecretVersion
Pass arguments to destroy_secret_version via a request object, either of type DestroySecretVersionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::SecretManager::V1::DestroySecretVersionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def destroy_secret_version(name: nil, etag: nil) -> ::Google::Cloud::SecretManager::V1::SecretVersion
Pass arguments to destroy_secret_version via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The resource name of the SecretVersion to destroy in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.
  • etag (::String) — Optional. Etag of the SecretVersion. The request succeeds if it matches the etag of the currently stored secret version object. If the etag is omitted, the request succeeds.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/secret_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecretManager::V1::SecretManagerService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecretManager::V1::DestroySecretVersionRequest.new

# Call the destroy_secret_version method.
result = client.destroy_secret_version request

# The returned object is of type Google::Cloud::SecretManager::V1::SecretVersion.
p result

#disable_secret_version

def disable_secret_version(request, options = nil) -> ::Google::Cloud::SecretManager::V1::SecretVersion
def disable_secret_version(name: nil, etag: nil) -> ::Google::Cloud::SecretManager::V1::SecretVersion

Disables a SecretVersion.

Sets the state of the SecretVersion to DISABLED.

Overloads
def disable_secret_version(request, options = nil) -> ::Google::Cloud::SecretManager::V1::SecretVersion
Pass arguments to disable_secret_version via a request object, either of type DisableSecretVersionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::SecretManager::V1::DisableSecretVersionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def disable_secret_version(name: nil, etag: nil) -> ::Google::Cloud::SecretManager::V1::SecretVersion
Pass arguments to disable_secret_version via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The resource name of the SecretVersion to disable in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.
  • etag (::String) — Optional. Etag of the SecretVersion. The request succeeds if it matches the etag of the currently stored secret version object. If the etag is omitted, the request succeeds.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/secret_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecretManager::V1::SecretManagerService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecretManager::V1::DisableSecretVersionRequest.new

# Call the disable_secret_version method.
result = client.disable_secret_version request

# The returned object is of type Google::Cloud::SecretManager::V1::SecretVersion.
p result

#enable_secret_version

def enable_secret_version(request, options = nil) -> ::Google::Cloud::SecretManager::V1::SecretVersion
def enable_secret_version(name: nil, etag: nil) -> ::Google::Cloud::SecretManager::V1::SecretVersion

Enables a SecretVersion.

Sets the state of the SecretVersion to ENABLED.

Overloads
def enable_secret_version(request, options = nil) -> ::Google::Cloud::SecretManager::V1::SecretVersion
Pass arguments to enable_secret_version via a request object, either of type EnableSecretVersionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::SecretManager::V1::EnableSecretVersionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def enable_secret_version(name: nil, etag: nil) -> ::Google::Cloud::SecretManager::V1::SecretVersion
Pass arguments to enable_secret_version via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The resource name of the SecretVersion to enable in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.
  • etag (::String) — Optional. Etag of the SecretVersion. The request succeeds if it matches the etag of the currently stored secret version object. If the etag is omitted, the request succeeds.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/secret_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecretManager::V1::SecretManagerService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecretManager::V1::EnableSecretVersionRequest.new

# Call the enable_secret_version method.
result = client.enable_secret_version request

# The returned object is of type Google::Cloud::SecretManager::V1::SecretVersion.
p result

#get_iam_policy

def get_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy
def get_iam_policy(resource: nil, options: nil) -> ::Google::Iam::V1::Policy

Gets the access control policy for a secret. Returns empty policy if the secret exists and does not have a policy set.

Overloads
def get_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy
Pass arguments to get_iam_policy via a request object, either of type Iam::V1::GetIamPolicyRequest or an equivalent Hash.
Parameters
  • request (::Google::Iam::V1::GetIamPolicyRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_iam_policy(resource: nil, options: nil) -> ::Google::Iam::V1::Policy
Pass arguments to get_iam_policy via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • resource (::String) — REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.
  • options (::Google::Iam::V1::GetPolicyOptions, ::Hash) — OPTIONAL: A GetPolicyOptions object for specifying options to GetIamPolicy.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/secret_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecretManager::V1::SecretManagerService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::GetIamPolicyRequest.new

# Call the get_iam_policy method.
result = client.get_iam_policy request

# The returned object is of type Google::Iam::V1::Policy.
p result

#get_secret

def get_secret(request, options = nil) -> ::Google::Cloud::SecretManager::V1::Secret
def get_secret(name: nil) -> ::Google::Cloud::SecretManager::V1::Secret

Gets metadata for a given Secret.

Overloads
def get_secret(request, options = nil) -> ::Google::Cloud::SecretManager::V1::Secret
Pass arguments to get_secret via a request object, either of type GetSecretRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::SecretManager::V1::GetSecretRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_secret(name: nil) -> ::Google::Cloud::SecretManager::V1::Secret
Pass arguments to get_secret via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. The resource name of the Secret, in the format projects/*/secrets/* or projects/*/locations/*/secrets/*.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/secret_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecretManager::V1::SecretManagerService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecretManager::V1::GetSecretRequest.new

# Call the get_secret method.
result = client.get_secret request

# The returned object is of type Google::Cloud::SecretManager::V1::Secret.
p result

#get_secret_version

def get_secret_version(request, options = nil) -> ::Google::Cloud::SecretManager::V1::SecretVersion
def get_secret_version(name: nil) -> ::Google::Cloud::SecretManager::V1::SecretVersion

Gets metadata for a SecretVersion.

projects//secrets//versions/latest is an alias to the most recently created SecretVersion.

Overloads
def get_secret_version(request, options = nil) -> ::Google::Cloud::SecretManager::V1::SecretVersion
Pass arguments to get_secret_version via a request object, either of type GetSecretVersionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::SecretManager::V1::GetSecretVersionRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_secret_version(name: nil) -> ::Google::Cloud::SecretManager::V1::SecretVersion
Pass arguments to get_secret_version via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. The resource name of the SecretVersion in the format projects/*/secrets/*/versions/* or projects/*/locations/*/secrets/*/versions/*.

    projects/*/secrets/*/versions/latest or projects/*/locations/*/secrets/*/versions/latest is an alias to the most recently created SecretVersion.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/secret_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecretManager::V1::SecretManagerService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecretManager::V1::GetSecretVersionRequest.new

# Call the get_secret_version method.
result = client.get_secret_version request

# The returned object is of type Google::Cloud::SecretManager::V1::SecretVersion.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new SecretManagerService client object.

Yields
  • (config) — Configure the SecretManagerService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::SecretManager::V1::SecretManagerService::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::SecretManager::V1::SecretManagerService::Client.new do |config|
  config.timeout = 10.0
end

#list_secret_versions

def list_secret_versions(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::SecretManager::V1::SecretVersion>
def list_secret_versions(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::SecretManager::V1::SecretVersion>

Lists SecretVersions. This call does not return secret data.

Overloads
def list_secret_versions(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::SecretManager::V1::SecretVersion>
Pass arguments to list_secret_versions via a request object, either of type ListSecretVersionsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::SecretManager::V1::ListSecretVersionsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_secret_versions(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::SecretManager::V1::SecretVersion>
Pass arguments to list_secret_versions via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The resource name of the Secret associated with the SecretVersions to list, in the format projects/*/secrets/* or projects/*/locations/*/secrets/*.
  • page_size (::Integer) — Optional. The maximum number of results to be returned in a single page. If set to 0, the server decides the number of results to return. If the number is greater than 25000, it is capped at 25000.
  • page_token (::String) — Optional. Pagination token, returned earlier via ListSecretVersionsResponse.next_page_token][].
  • filter (::String) — Optional. Filter string, adhering to the rules in List-operation filtering. List only secret versions matching the filter. If filter is empty, all secret versions are listed.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/secret_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecretManager::V1::SecretManagerService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecretManager::V1::ListSecretVersionsRequest.new

# Call the list_secret_versions method.
result = client.list_secret_versions request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::SecretManager::V1::SecretVersion.
  p item
end

#list_secrets

def list_secrets(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::SecretManager::V1::Secret>
def list_secrets(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::SecretManager::V1::Secret>

Lists Secrets.

Overloads
def list_secrets(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::SecretManager::V1::Secret>
Pass arguments to list_secrets via a request object, either of type ListSecretsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::SecretManager::V1::ListSecretsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_secrets(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::SecretManager::V1::Secret>
Pass arguments to list_secrets via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The resource name of the project associated with the Secrets, in the format projects/* or projects/*/locations/*
  • page_size (::Integer) — Optional. The maximum number of results to be returned in a single page. If set to 0, the server decides the number of results to return. If the number is greater than 25000, it is capped at 25000.
  • page_token (::String) — Optional. Pagination token, returned earlier via ListSecretsResponse.next_page_token.
  • filter (::String) — Optional. Filter string, adhering to the rules in List-operation filtering. List only secrets matching the filter. If filter is empty, all secrets are listed.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/secret_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecretManager::V1::SecretManagerService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecretManager::V1::ListSecretsRequest.new

# Call the list_secrets method.
result = client.list_secrets request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::SecretManager::V1::Secret.
  p item
end

#location_client

def location_client() -> Google::Cloud::Location::Locations::Client

Get the associated client for mix-in of the Locations.

Returns
  • (Google::Cloud::Location::Locations::Client)

#set_iam_policy

def set_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy
def set_iam_policy(resource: nil, policy: nil, update_mask: nil) -> ::Google::Iam::V1::Policy

Sets the access control policy on the specified secret. Replaces any existing policy.

Permissions on SecretVersions are enforced according to the policy set on the associated Secret.

Overloads
def set_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy
Pass arguments to set_iam_policy via a request object, either of type Iam::V1::SetIamPolicyRequest or an equivalent Hash.
Parameters
  • request (::Google::Iam::V1::SetIamPolicyRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def set_iam_policy(resource: nil, policy: nil, update_mask: nil) -> ::Google::Iam::V1::Policy
Pass arguments to set_iam_policy via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • resource (::String) — REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.
  • policy (::Google::Iam::V1::Policy, ::Hash) — REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.
  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used:

    paths: "bindings, etag"

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/secret_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecretManager::V1::SecretManagerService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::SetIamPolicyRequest.new

# Call the set_iam_policy method.
result = client.set_iam_policy request

# The returned object is of type Google::Iam::V1::Policy.
p result

#test_iam_permissions

def test_iam_permissions(request, options = nil) -> ::Google::Iam::V1::TestIamPermissionsResponse
def test_iam_permissions(resource: nil, permissions: nil) -> ::Google::Iam::V1::TestIamPermissionsResponse

Returns permissions that a caller has for the specified secret. If the secret does not exist, this call returns an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Overloads
def test_iam_permissions(request, options = nil) -> ::Google::Iam::V1::TestIamPermissionsResponse
Pass arguments to test_iam_permissions via a request object, either of type Iam::V1::TestIamPermissionsRequest or an equivalent Hash.
Parameters
  • request (::Google::Iam::V1::TestIamPermissionsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def test_iam_permissions(resource: nil, permissions: nil) -> ::Google::Iam::V1::TestIamPermissionsResponse
Pass arguments to test_iam_permissions via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • resource (::String) — REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.
  • permissions (::Array<::String>) — The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/secret_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecretManager::V1::SecretManagerService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::TestIamPermissionsRequest.new

# Call the test_iam_permissions method.
result = client.test_iam_permissions request

# The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
p result

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update_secret

def update_secret(request, options = nil) -> ::Google::Cloud::SecretManager::V1::Secret
def update_secret(secret: nil, update_mask: nil) -> ::Google::Cloud::SecretManager::V1::Secret

Updates metadata of an existing Secret.

Overloads
def update_secret(request, options = nil) -> ::Google::Cloud::SecretManager::V1::Secret
Pass arguments to update_secret via a request object, either of type UpdateSecretRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::SecretManager::V1::UpdateSecretRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def update_secret(secret: nil, update_mask: nil) -> ::Google::Cloud::SecretManager::V1::Secret
Pass arguments to update_secret via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/secret_manager/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecretManager::V1::SecretManagerService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecretManager::V1::UpdateSecretRequest.new

# Call the update_secret method.
result = client.update_secret request

# The returned object is of type Google::Cloud::SecretManager::V1::Secret.
p result