Module: Google::Cloud::Build::V1::CloudBuild::Paths

Extended by:
Paths
Included in:
Client, Paths, Rest::Client
Defined in:
lib/google/cloud/build/v1/cloud_build/paths.rb

Overview

Path helper methods for the CloudBuild API.

Instance Method Summary collapse

Instance Method Details

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

Create a fully-qualified Build resource string.

Overloads:

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

    The resource will be in the following format:

    projects/{project}/builds/{build}

    Parameters:

    • project (String) (defaults to: )
    • build (String) (defaults to: )
  • #build_path(project: , location: , build: ) ⇒ ::String

    The resource will be in the following format:

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

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • build (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 48

def build_path **args
  resources = {
    "build:project" => (proc do |project:, build:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

      "projects/#{project}/builds/#{build}"
    end),
    "build:location:project" => (proc do |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)
  }

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

#build_trigger_path(project: , trigger: ) ⇒ ::String #build_trigger_path(project: , location: , trigger: ) ⇒ ::String

Create a fully-qualified BuildTrigger resource string.

Overloads:

  • #build_trigger_path(project: , trigger: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/triggers/{trigger}

    Parameters:

    • project (String) (defaults to: )
    • trigger (String) (defaults to: )
  • #build_trigger_path(project: , location: , trigger: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/triggers/{trigger}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • trigger (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 89

def build_trigger_path **args
  resources = {
    "project:trigger" => (proc do |project:, trigger:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

      "projects/#{project}/triggers/#{trigger}"
    end),
    "location:project:trigger" => (proc do |project:, location:, trigger:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

      "projects/#{project}/locations/#{location}/triggers/#{trigger}"
    end)
  }

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

#crypto_key_path(project:, location:, keyring:, key:) ⇒ ::String

Create a fully-qualified CryptoKey resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}

Parameters:

  • project (String)
  • location (String)
  • keyring (String)
  • key (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


122
123
124
125
126
127
128
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 122

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

  "projects/#{project}/locations/#{location}/keyRings/#{keyring}/cryptoKeys/#{key}"
end

Create a fully-qualified GitRepositoryLink resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/connections/{connection}/gitRepositoryLinks/{git_repository_link}

Parameters:

  • project (String)
  • location (String)
  • connection (String)
  • git_repository_link (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


143
144
145
146
147
148
149
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 143

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

  "projects/#{project}/locations/#{location}/connections/#{connection}/gitRepositoryLinks/#{git_repository_link}"
end

#github_enterprise_config_path(project: , config: ) ⇒ ::String #github_enterprise_config_path(project: , location: , config: ) ⇒ ::String

Create a fully-qualified GithubEnterpriseConfig resource string.

Overloads:

  • #github_enterprise_config_path(project: , config: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/githubEnterpriseConfigs/{config}

    Parameters:

    • project (String) (defaults to: )
    • config (String) (defaults to: )
  • #github_enterprise_config_path(project: , location: , config: ) ⇒ ::String

    The resource will be in the following format:

    projects/{project}/locations/{location}/githubEnterpriseConfigs/{config}

    Parameters:

    • project (String) (defaults to: )
    • location (String) (defaults to: )
    • config (String) (defaults to: )

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 172

def github_enterprise_config_path **args
  resources = {
    "config:project" => (proc do |project:, config:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

      "projects/#{project}/githubEnterpriseConfigs/#{config}"
    end),
    "config:location:project" => (proc do |project:, location:, config:|
      raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
      raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"

      "projects/#{project}/locations/#{location}/githubEnterpriseConfigs/#{config}"
    end)
  }

  resource = resources[args.keys.sort.join(":")]
  raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
  resource.call(**args)
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)


203
204
205
206
207
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 203

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

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

#network_attachment_path(project:, region:, networkattachment:) ⇒ ::String

Create a fully-qualified NetworkAttachment resource string.

The resource will be in the following format:

projects/{project}/regions/{region}/networkAttachments/{networkattachment}

Parameters:

  • project (String)
  • region (String)
  • networkattachment (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


238
239
240
241
242
243
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 238

def network_attachment_path project:, region:, networkattachment:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
  raise ::ArgumentError, "region cannot contain /" if region.to_s.include? "/"

  "projects/#{project}/regions/#{region}/networkAttachments/#{networkattachment}"
end

#network_path(project:, network:) ⇒ ::String

Create a fully-qualified Network resource string.

The resource will be in the following format:

projects/{project}/global/networks/{network}

Parameters:

  • project (String)
  • network (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


220
221
222
223
224
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 220

def network_path project:, network:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

  "projects/#{project}/global/networks/#{network}"
end

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


255
256
257
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 255

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

#repository_path(project:, location:, connection:, repository:) ⇒ ::String

Create a fully-qualified Repository resource string.

The resource will be in the following format:

projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}

Parameters:

  • project (String)
  • location (String)
  • connection (String)
  • repository (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


272
273
274
275
276
277
278
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 272

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

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


292
293
294
295
296
297
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 292

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_account_path(project:, service_account:) ⇒ ::String

Create a fully-qualified ServiceAccount resource string.

The resource will be in the following format:

projects/{project}/serviceAccounts/{service_account}

Parameters:

  • project (String)
  • service_account (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


310
311
312
313
314
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 310

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

  "projects/#{project}/serviceAccounts/#{}"
end

#subscription_path(project:, subscription:) ⇒ ::String

Create a fully-qualified Subscription resource string.

The resource will be in the following format:

projects/{project}/subscriptions/{subscription}

Parameters:

  • project (String)
  • subscription (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


327
328
329
330
331
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 327

def subscription_path project:, subscription:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

  "projects/#{project}/subscriptions/#{subscription}"
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}

Parameters:

  • project (String)
  • topic (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


344
345
346
347
348
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 344

def topic_path project:, topic:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

  "projects/#{project}/topics/#{topic}"
end

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

Create a fully-qualified WorkerPool 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)


362
363
364
365
366
367
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 362

def 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