Module: Google::Cloud::SecretManager::V1::SecretManagerService::Paths

Extended by:
Paths
Included in:
Client, Paths
Defined in:
lib/google/cloud/secret_manager/v1/secret_manager_service/paths.rb

Overview

Path helper methods for the SecretManagerService API.

Instance Method Summary collapse

Instance Method Details

#project_path(project:) ⇒ ::String

Create a fully-qualified Project resource string.

The resource will be in the following format:

projects/{project}

Parameters:

  • project (String)

Returns:

  • (::String)


37
38
39
# File 'lib/google/cloud/secret_manager/v1/secret_manager_service/paths.rb', line 37

def project_path project:
  "projects/#{project}"
end

#secret_path(project:, secret:) ⇒ ::String

Create a fully-qualified Secret resource string.

The resource will be in the following format:

projects/{project}/secrets/{secret}

Parameters:

  • project (String)
  • secret (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


52
53
54
55
56
# File 'lib/google/cloud/secret_manager/v1/secret_manager_service/paths.rb', line 52

def secret_path project:, secret:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

  "projects/#{project}/secrets/#{secret}"
end

#secret_version_path(project:, secret:, secret_version:) ⇒ ::String

Create a fully-qualified SecretVersion resource string.

The resource will be in the following format:

projects/{project}/secrets/{secret}/versions/{secret_version}

Parameters:

  • project (String)
  • secret (String)
  • secret_version (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


70
71
72
73
74
75
# File 'lib/google/cloud/secret_manager/v1/secret_manager_service/paths.rb', line 70

def secret_version_path project:, secret:, secret_version:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "secret cannot contain /" if secret.to_s.include? "/"

  "projects/#{project}/secrets/#{secret}/versions/#{secret_version}"
end