Module: Google::Cloud::SecretManager::V1beta2::SecretManagerService::Paths
- Extended by:
- Paths
- Included in:
- Client, Paths, Rest::Client
- Defined in:
- lib/google/cloud/secret_manager/v1beta2/secret_manager_service/paths.rb
Overview
Path helper methods for the SecretManagerService API.
Instance Method Summary collapse
-
#location_path(project:, location:) ⇒ ::String
Create a fully-qualified Location resource string.
-
#project_path(project:) ⇒ ::String
Create a fully-qualified Project resource string.
-
#secret_path(**args) ⇒ ::String
Create a fully-qualified Secret resource string.
-
#secret_version_path(**args) ⇒ ::String
Create a fully-qualified SecretVersion resource string.
-
#topic_path(project:, topic:) ⇒ ::String
Create a fully-qualified Topic resource string.
Instance Method Details
#location_path(project:, location:) ⇒ ::String
Create a fully-qualified Location resource string.
The resource will be in the following format:
projects/{project}/locations/{location}
38 39 40 41 42 |
# File 'lib/google/cloud/secret_manager/v1beta2/secret_manager_service/paths.rb', line 38 def location_path project:, location: raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" "projects/#{project}/locations/#{location}" end |
#project_path(project:) ⇒ ::String
Create a fully-qualified Project resource string.
The resource will be in the following format:
projects/{project}
54 55 56 |
# File 'lib/google/cloud/secret_manager/v1beta2/secret_manager_service/paths.rb', line 54 def project_path project: "projects/#{project}" end |
#secret_path(project: , secret: ) ⇒ ::String #secret_path(project: , location: , secret: ) ⇒ ::String
Create a fully-qualified Secret resource string.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/google/cloud/secret_manager/v1beta2/secret_manager_service/paths.rb', line 79 def secret_path **args resources = { "project:secret" => (proc do |project:, secret:| raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" "projects/#{project}/secrets/#{secret}" end), "location:project:secret" => (proc do |project:, location:, secret:| raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" "projects/#{project}/locations/#{location}/secrets/#{secret}" end) } resource = resources[args.keys.sort.join(":")] raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil? resource.call(**args) end |
#secret_version_path(project: , secret: , secret_version: ) ⇒ ::String #secret_version_path(project: , location: , secret: , secret_version: ) ⇒ ::String
Create a fully-qualified SecretVersion resource string.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/google/cloud/secret_manager/v1beta2/secret_manager_service/paths.rb', line 122 def secret_version_path **args resources = { "project:secret:secret_version" => (proc do |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), "location:project:secret:secret_version" => (proc do |project:, location:, secret:, secret_version:| raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" raise ::ArgumentError, "secret cannot contain /" if secret.to_s.include? "/" "projects/#{project}/locations/#{location}/secrets/#{secret}/versions/#{secret_version}" end) } resource = resources[args.keys.sort.join(":")] raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil? resource.call(**args) end |
#topic_path(project:, topic:) ⇒ ::String
Create a fully-qualified Topic resource string.
The resource will be in the following format:
projects/{project}/topics/{topic}
155 156 157 158 159 |
# File 'lib/google/cloud/secret_manager/v1beta2/secret_manager_service/paths.rb', line 155 def topic_path project:, topic: raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" "projects/#{project}/topics/#{topic}" end |