Module: Google::Cloud::Run::V2::Jobs::Paths

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

Overview

Path helper methods for the Jobs API.

Instance Method Summary collapse

Instance Method Details

#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)


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

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)


59
60
61
62
63
64
65
# File 'lib/google/cloud/run/v2/jobs/paths.rb', line 59

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

#execution_path(project:, location:, job:, execution:) ⇒ ::String

Create a fully-qualified Execution resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/jobs/{job}/executions/{execution}

Parameters:

  • project (String)
  • location (String)
  • job (String)
  • execution (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


80
81
82
83
84
85
86
# File 'lib/google/cloud/run/v2/jobs/paths.rb', line 80

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

  "projects/#{project}/locations/#{location}/jobs/#{job}/executions/#{execution}"
end

#job_path(project:, location:, job:) ⇒ ::String

Create a fully-qualified Job resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/jobs/{job}

Parameters:

  • project (String)
  • location (String)
  • job (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


100
101
102
103
104
105
# File 'lib/google/cloud/run/v2/jobs/paths.rb', line 100

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

  "projects/#{project}/locations/#{location}/jobs/#{job}"
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)


118
119
120
121
122
# File 'lib/google/cloud/run/v2/jobs/paths.rb', line 118

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

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


142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/google/cloud/run/v2/jobs/paths.rb', line 142

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

#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)


168
169
170
171
172
# File 'lib/google/cloud/run/v2/jobs/paths.rb', line 168

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)


186
187
188
189
190
191
# File 'lib/google/cloud/run/v2/jobs/paths.rb', line 186

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