Module: Google::Cloud::Run::V2::Services::Paths

Extended by:
Paths
Included in:
Client, Paths, Rest::Client
Defined in:
lib/google/cloud/run/v2/services/paths.rb

Overview

Path helper methods for the Services API.

Instance Method Summary collapse

Instance Method Details

#build_path(project:, location:, build:) ⇒ ::String

Create a fully-qualified Build resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/builds/{build}

Parameters:

  • project (String)
  • location (String)
  • build (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


39
40
41
42
43
44
# File 'lib/google/cloud/run/v2/services/paths.rb', line 39

def build_path project:, location:, build:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

  "projects/#{project}/locations/#{location}/builds/#{build}"
end

#build_worker_pool_path(project:, location:, worker_pool:) ⇒ ::String

Create a fully-qualified BuildWorkerPool resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/workerPools/{worker_pool}

Parameters:

  • project (String)
  • location (String)
  • worker_pool (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


58
59
60
61
62
63
# File 'lib/google/cloud/run/v2/services/paths.rb', line 58

def build_worker_pool_path project:, location:, worker_pool:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

  "projects/#{project}/locations/#{location}/workerPools/#{worker_pool}"
end

#connector_path(project:, location:, connector:) ⇒ ::String

Create a fully-qualified Connector resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/connectors/{connector}

Parameters:

  • project (String)
  • location (String)
  • connector (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


77
78
79
80
81
82
# File 'lib/google/cloud/run/v2/services/paths.rb', line 77

def connector_path project:, location:, connector:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

  "projects/#{project}/locations/#{location}/connectors/#{connector}"
end

#crypto_key_path(project:, location:, key_ring:, crypto_key:) ⇒ ::String

Create a fully-qualified CryptoKey resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}

Parameters:

  • project (String)
  • location (String)
  • key_ring (String)
  • crypto_key (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


97
98
99
100
101
102
103
# File 'lib/google/cloud/run/v2/services/paths.rb', line 97

def crypto_key_path project:, location:, key_ring:, crypto_key:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
  raise ::ArgumentError, "key_ring cannot contain /" if key_ring.to_s.include? "/"

  "projects/#{project}/locations/#{location}/keyRings/#{key_ring}/cryptoKeys/#{crypto_key}"
end

#location_path(project:, location:) ⇒ ::String

Create a fully-qualified Location resource string.

The resource will be in the following format:

projects/{project}/locations/{location}

Parameters:

  • project (String)
  • location (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


116
117
118
119
120
# File 'lib/google/cloud/run/v2/services/paths.rb', line 116

def location_path project:, location:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

  "projects/#{project}/locations/#{location}"
end

#mesh_path(project:, location:, mesh:) ⇒ ::String

Create a fully-qualified Mesh resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/meshes/{mesh}

Parameters:

  • project (String)
  • location (String)
  • mesh (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


134
135
136
137
138
139
# File 'lib/google/cloud/run/v2/services/paths.rb', line 134

def mesh_path project:, location:, mesh:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

  "projects/#{project}/locations/#{location}/meshes/#{mesh}"
end

#policy_path(project: ) ⇒ ::String #policy_path(location: ) ⇒ ::String

Create a fully-qualified Policy resource string.

Overloads:

  • #policy_path(project: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/policy

    Parameters:

    • project (String) (defaults to: )
  • #policy_path(location: ) ⇒ ::String

    The resource will be in the following format:

    locations/{location}/policy

    Parameters:

    • location (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/google/cloud/run/v2/services/paths.rb', line 159

def policy_path **args
  resources = {
    "project" => (proc do |project:|
      "projects/#{project}/policy"
    end),
    "location" => (proc do |location:|
      "locations/#{location}/policy"
    end)
  }

  resource = resources[args.keys.sort.join(":")]
  raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
  resource.call(**args)
end

#revision_path(project:, location:, service:, revision:) ⇒ ::String

Create a fully-qualified Revision resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/services/{service}/revisions/{revision}

Parameters:

  • project (String)
  • location (String)
  • service (String)
  • revision (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


187
188
189
190
191
192
193
# File 'lib/google/cloud/run/v2/services/paths.rb', line 187

def revision_path project:, location:, service:, revision:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
  raise ::ArgumentError, "service cannot contain /" if service.to_s.include? "/"

  "projects/#{project}/locations/#{location}/services/#{service}/revisions/#{revision}"
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)


206
207
208
209
210
# File 'lib/google/cloud/run/v2/services/paths.rb', line 206

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:, version:) ⇒ ::String

Create a fully-qualified SecretVersion resource string.

The resource will be in the following format:

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

Parameters:

  • project (String)
  • secret (String)
  • version (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


224
225
226
227
228
229
# File 'lib/google/cloud/run/v2/services/paths.rb', line 224

def secret_version_path project:, 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/#{version}"
end

#service_path(project:, location:, service:) ⇒ ::String

Create a fully-qualified Service resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/services/{service}

Parameters:

  • project (String)
  • location (String)
  • service (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


243
244
245
246
247
248
# File 'lib/google/cloud/run/v2/services/paths.rb', line 243

def service_path project:, location:, service:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

  "projects/#{project}/locations/#{location}/services/#{service}"
end