Module: Google::Cloud::Spanner::V1::Spanner::Paths
- Extended by:
- Paths
- Defined in:
- lib/google/cloud/spanner/v1/spanner/paths.rb
Overview
Path helper methods for the Spanner API.
Instance Method Summary collapse
-
#database_path(project:, instance:, database:) ⇒ ::String
Create a fully-qualified Database resource string.
-
#session_path(project:, instance:, database:, session:) ⇒ ::String
Create a fully-qualified Session resource string.
Instance Method Details
#database_path(project:, instance:, database:) ⇒ ::String
Create a fully-qualified Database resource string.
The resource will be in the following format:
projects/{project}/instances/{instance}/databases/{database}
39 40 41 42 43 44 |
# File 'lib/google/cloud/spanner/v1/spanner/paths.rb', line 39 def database_path project:, instance:, database: raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" raise ::ArgumentError, "instance cannot contain /" if instance.to_s.include? "/" "projects/#{project}/instances/#{instance}/databases/#{database}" end |
#session_path(project:, instance:, database:, session:) ⇒ ::String
Create a fully-qualified Session resource string.
The resource will be in the following format:
projects/{project}/instances/{instance}/databases/{database}/sessions/{session}
59 60 61 62 63 64 65 |
# File 'lib/google/cloud/spanner/v1/spanner/paths.rb', line 59 def session_path project:, instance:, database:, session: raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" raise ::ArgumentError, "instance cannot contain /" if instance.to_s.include? "/" raise ::ArgumentError, "database cannot contain /" if database.to_s.include? "/" "projects/#{project}/instances/#{instance}/databases/#{database}/sessions/#{session}" end |