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

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


151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 151

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)


182
183
184
185
186
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 182

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

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


199
200
201
202
203
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 199

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)


215
216
217
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 215

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)


232
233
234
235
236
237
238
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 232

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)


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

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)


270
271
272
273
274
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 270

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)


287
288
289
290
291
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 287

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)


304
305
306
307
308
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 304

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)


322
323
324
325
326
327
# File 'lib/google/cloud/build/v1/cloud_build/paths.rb', line 322

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