google-cloud-build-v1 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1773 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/devtools/cloudbuild/v1/cloudbuild_pb"
21
+ require "google/cloud/build/v1/cloud_build/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Build
26
+ module V1
27
+ module CloudBuild
28
+ module Rest
29
+ ##
30
+ # REST client for the CloudBuild service.
31
+ #
32
+ # Creates and manages builds on Google Cloud Platform.
33
+ #
34
+ # The main concept used by this API is a `Build`, which describes the location
35
+ # of the source to build, how to build the source, and where to store the
36
+ # built artifacts, if any.
37
+ #
38
+ # A user can list previously-requested builds or get builds by their ID to
39
+ # determine the status of the build.
40
+ #
41
+ class Client
42
+ include Paths
43
+
44
+ # @private
45
+ attr_reader :cloud_build_stub
46
+
47
+ ##
48
+ # Configure the CloudBuild Client class.
49
+ #
50
+ # See {::Google::Cloud::Build::V1::CloudBuild::Rest::Client::Configuration}
51
+ # for a description of the configuration fields.
52
+ #
53
+ # @example
54
+ #
55
+ # # Modify the configuration for all CloudBuild clients
56
+ # ::Google::Cloud::Build::V1::CloudBuild::Rest::Client.configure do |config|
57
+ # config.timeout = 10.0
58
+ # end
59
+ #
60
+ # @yield [config] Configure the Client client.
61
+ # @yieldparam config [Client::Configuration]
62
+ #
63
+ # @return [Client::Configuration]
64
+ #
65
+ def self.configure
66
+ @configure ||= begin
67
+ namespace = ["Google", "Cloud", "Build", "V1"]
68
+ parent_config = while namespace.any?
69
+ parent_name = namespace.join "::"
70
+ parent_const = const_get parent_name
71
+ break parent_const.configure if parent_const.respond_to? :configure
72
+ namespace.pop
73
+ end
74
+ default_config = Client::Configuration.new parent_config
75
+
76
+ default_config.rpcs.create_build.timeout = 600.0
77
+
78
+ default_config.rpcs.get_build.timeout = 600.0
79
+ default_config.rpcs.get_build.retry_policy = {
80
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
81
+ }
82
+
83
+ default_config.rpcs.list_builds.timeout = 600.0
84
+ default_config.rpcs.list_builds.retry_policy = {
85
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
86
+ }
87
+
88
+ default_config.rpcs.cancel_build.timeout = 600.0
89
+
90
+ default_config.rpcs.retry_build.timeout = 600.0
91
+
92
+ default_config.rpcs.create_build_trigger.timeout = 600.0
93
+
94
+ default_config.rpcs.get_build_trigger.timeout = 600.0
95
+ default_config.rpcs.get_build_trigger.retry_policy = {
96
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
97
+ }
98
+
99
+ default_config.rpcs.list_build_triggers.timeout = 600.0
100
+ default_config.rpcs.list_build_triggers.retry_policy = {
101
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
102
+ }
103
+
104
+ default_config.rpcs.delete_build_trigger.timeout = 600.0
105
+ default_config.rpcs.delete_build_trigger.retry_policy = {
106
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
107
+ }
108
+
109
+ default_config.rpcs.update_build_trigger.timeout = 600.0
110
+
111
+ default_config.rpcs.run_build_trigger.timeout = 600.0
112
+
113
+ default_config.rpcs.create_worker_pool.timeout = 600.0
114
+
115
+ default_config.rpcs.get_worker_pool.timeout = 600.0
116
+ default_config.rpcs.get_worker_pool.retry_policy = {
117
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
118
+ }
119
+
120
+ default_config.rpcs.delete_worker_pool.timeout = 600.0
121
+
122
+ default_config.rpcs.update_worker_pool.timeout = 600.0
123
+
124
+ default_config.rpcs.list_worker_pools.timeout = 600.0
125
+ default_config.rpcs.list_worker_pools.retry_policy = {
126
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
127
+ }
128
+
129
+ default_config
130
+ end
131
+ yield @configure if block_given?
132
+ @configure
133
+ end
134
+
135
+ ##
136
+ # Configure the CloudBuild Client instance.
137
+ #
138
+ # The configuration is set to the derived mode, meaning that values can be changed,
139
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
140
+ # should be made on {Client.configure}.
141
+ #
142
+ # See {::Google::Cloud::Build::V1::CloudBuild::Rest::Client::Configuration}
143
+ # for a description of the configuration fields.
144
+ #
145
+ # @yield [config] Configure the Client client.
146
+ # @yieldparam config [Client::Configuration]
147
+ #
148
+ # @return [Client::Configuration]
149
+ #
150
+ def configure
151
+ yield @config if block_given?
152
+ @config
153
+ end
154
+
155
+ ##
156
+ # Create a new CloudBuild REST client object.
157
+ #
158
+ # @example
159
+ #
160
+ # # Create a client using the default configuration
161
+ # client = ::Google::Cloud::Build::V1::CloudBuild::Rest::Client.new
162
+ #
163
+ # # Create a client using a custom configuration
164
+ # client = ::Google::Cloud::Build::V1::CloudBuild::Rest::Client.new do |config|
165
+ # config.timeout = 10.0
166
+ # end
167
+ #
168
+ # @yield [config] Configure the CloudBuild client.
169
+ # @yieldparam config [Client::Configuration]
170
+ #
171
+ def initialize
172
+ # Create the configuration object
173
+ @config = Configuration.new Client.configure
174
+
175
+ # Yield the configuration if needed
176
+ yield @config if block_given?
177
+
178
+ # Create credentials
179
+ credentials = @config.credentials
180
+ # Use self-signed JWT if the endpoint is unchanged from default,
181
+ # but only if the default endpoint does not have a region prefix.
182
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
183
+ !@config.endpoint.split(".").first.include?("-")
184
+ credentials ||= Credentials.default scope: @config.scope,
185
+ enable_self_signed_jwt: enable_self_signed_jwt
186
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
187
+ credentials = Credentials.new credentials, scope: @config.scope
188
+ end
189
+
190
+ @quota_project_id = @config.quota_project
191
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
192
+
193
+ @operations_client = ::Google::Cloud::Build::V1::CloudBuild::Rest::Operations.new do |config|
194
+ config.credentials = credentials
195
+ config.quota_project = @quota_project_id
196
+ config.endpoint = @config.endpoint
197
+ end
198
+
199
+ @cloud_build_stub = ::Google::Cloud::Build::V1::CloudBuild::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
200
+ end
201
+
202
+ ##
203
+ # Get the associated client for long-running operations.
204
+ #
205
+ # @return [::Google::Cloud::Build::V1::CloudBuild::Rest::Operations]
206
+ #
207
+ attr_reader :operations_client
208
+
209
+ # Service calls
210
+
211
+ ##
212
+ # Starts a build with the specified configuration.
213
+ #
214
+ # This method returns a long-running `Operation`, which includes the build
215
+ # ID. Pass the build ID to `GetBuild` to determine the build status (such as
216
+ # `SUCCESS` or `FAILURE`).
217
+ #
218
+ # @overload create_build(request, options = nil)
219
+ # Pass arguments to `create_build` via a request object, either of type
220
+ # {::Google::Cloud::Build::V1::CreateBuildRequest} or an equivalent Hash.
221
+ #
222
+ # @param request [::Google::Cloud::Build::V1::CreateBuildRequest, ::Hash]
223
+ # A request object representing the call parameters. Required. To specify no
224
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
225
+ # @param options [::Gapic::CallOptions, ::Hash]
226
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
227
+ #
228
+ # @overload create_build(parent: nil, project_id: nil, build: nil)
229
+ # Pass arguments to `create_build` via keyword arguments. Note that at
230
+ # least one keyword argument is required. To specify no parameters, or to keep all
231
+ # the default parameter values, pass an empty Hash as a request object (see above).
232
+ #
233
+ # @param parent [::String]
234
+ # The parent resource where this build will be created.
235
+ # Format: `projects/{project}/locations/{location}`
236
+ # @param project_id [::String]
237
+ # Required. ID of the project.
238
+ # @param build [::Google::Cloud::Build::V1::Build, ::Hash]
239
+ # Required. Build resource to create.
240
+ # @yield [result, operation] Access the result along with the TransportOperation object
241
+ # @yieldparam result [::Gapic::Operation]
242
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
243
+ #
244
+ # @return [::Gapic::Operation]
245
+ #
246
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
247
+ def create_build request, options = nil
248
+ raise ::ArgumentError, "request must be provided" if request.nil?
249
+
250
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::CreateBuildRequest
251
+
252
+ # Converts hash and nil to an options object
253
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
254
+
255
+ # Customize the options with defaults
256
+ call_metadata = @config.rpcs.create_build.metadata.to_h
257
+
258
+ # Set x-goog-api-client and x-goog-user-project headers
259
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
260
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
261
+ gapic_version: ::Google::Cloud::Build::V1::VERSION,
262
+ transports_version_send: [:rest]
263
+
264
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
265
+
266
+ options.apply_defaults timeout: @config.rpcs.create_build.timeout,
267
+ metadata: call_metadata,
268
+ retry_policy: @config.rpcs.create_build.retry_policy
269
+
270
+ options.apply_defaults timeout: @config.timeout,
271
+ metadata: @config.metadata,
272
+ retry_policy: @config.retry_policy
273
+
274
+ @cloud_build_stub.create_build request, options do |result, operation|
275
+ result = ::Gapic::Operation.new result, @operations_client, options: options
276
+ yield result, operation if block_given?
277
+ return result
278
+ end
279
+ rescue ::Gapic::Rest::Error => e
280
+ raise ::Google::Cloud::Error.from_error(e)
281
+ end
282
+
283
+ ##
284
+ # Returns information about a previously requested build.
285
+ #
286
+ # The `Build` that is returned includes its status (such as `SUCCESS`,
287
+ # `FAILURE`, or `WORKING`), and timing information.
288
+ #
289
+ # @overload get_build(request, options = nil)
290
+ # Pass arguments to `get_build` via a request object, either of type
291
+ # {::Google::Cloud::Build::V1::GetBuildRequest} or an equivalent Hash.
292
+ #
293
+ # @param request [::Google::Cloud::Build::V1::GetBuildRequest, ::Hash]
294
+ # A request object representing the call parameters. Required. To specify no
295
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
296
+ # @param options [::Gapic::CallOptions, ::Hash]
297
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
298
+ #
299
+ # @overload get_build(name: nil, project_id: nil, id: nil)
300
+ # Pass arguments to `get_build` via keyword arguments. Note that at
301
+ # least one keyword argument is required. To specify no parameters, or to keep all
302
+ # the default parameter values, pass an empty Hash as a request object (see above).
303
+ #
304
+ # @param name [::String]
305
+ # The name of the `Build` to retrieve.
306
+ # Format: `projects/{project}/locations/{location}/builds/{build}`
307
+ # @param project_id [::String]
308
+ # Required. ID of the project.
309
+ # @param id [::String]
310
+ # Required. ID of the build.
311
+ # @yield [result, operation] Access the result along with the TransportOperation object
312
+ # @yieldparam result [::Google::Cloud::Build::V1::Build]
313
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
314
+ #
315
+ # @return [::Google::Cloud::Build::V1::Build]
316
+ #
317
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
318
+ def get_build request, options = nil
319
+ raise ::ArgumentError, "request must be provided" if request.nil?
320
+
321
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::GetBuildRequest
322
+
323
+ # Converts hash and nil to an options object
324
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
325
+
326
+ # Customize the options with defaults
327
+ call_metadata = @config.rpcs.get_build.metadata.to_h
328
+
329
+ # Set x-goog-api-client and x-goog-user-project headers
330
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
331
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
332
+ gapic_version: ::Google::Cloud::Build::V1::VERSION,
333
+ transports_version_send: [:rest]
334
+
335
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
336
+
337
+ options.apply_defaults timeout: @config.rpcs.get_build.timeout,
338
+ metadata: call_metadata,
339
+ retry_policy: @config.rpcs.get_build.retry_policy
340
+
341
+ options.apply_defaults timeout: @config.timeout,
342
+ metadata: @config.metadata,
343
+ retry_policy: @config.retry_policy
344
+
345
+ @cloud_build_stub.get_build request, options do |result, operation|
346
+ yield result, operation if block_given?
347
+ return result
348
+ end
349
+ rescue ::Gapic::Rest::Error => e
350
+ raise ::Google::Cloud::Error.from_error(e)
351
+ end
352
+
353
+ ##
354
+ # Lists previously requested builds.
355
+ #
356
+ # Previously requested builds may still be in-progress, or may have finished
357
+ # successfully or unsuccessfully.
358
+ #
359
+ # @overload list_builds(request, options = nil)
360
+ # Pass arguments to `list_builds` via a request object, either of type
361
+ # {::Google::Cloud::Build::V1::ListBuildsRequest} or an equivalent Hash.
362
+ #
363
+ # @param request [::Google::Cloud::Build::V1::ListBuildsRequest, ::Hash]
364
+ # A request object representing the call parameters. Required. To specify no
365
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
366
+ # @param options [::Gapic::CallOptions, ::Hash]
367
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
368
+ #
369
+ # @overload list_builds(parent: nil, project_id: nil, page_size: nil, page_token: nil, filter: nil)
370
+ # Pass arguments to `list_builds` via keyword arguments. Note that at
371
+ # least one keyword argument is required. To specify no parameters, or to keep all
372
+ # the default parameter values, pass an empty Hash as a request object (see above).
373
+ #
374
+ # @param parent [::String]
375
+ # The parent of the collection of `Builds`.
376
+ # Format: `projects/{project}/locations/location`
377
+ # @param project_id [::String]
378
+ # Required. ID of the project.
379
+ # @param page_size [::Integer]
380
+ # Number of results to return in the list.
381
+ # @param page_token [::String]
382
+ # The page token for the next page of Builds.
383
+ #
384
+ # If unspecified, the first page of results is returned.
385
+ #
386
+ # If the token is rejected for any reason, INVALID_ARGUMENT will be thrown.
387
+ # In this case, the token should be discarded, and pagination should be
388
+ # restarted from the first page of results.
389
+ #
390
+ # See https://google.aip.dev/158 for more.
391
+ # @param filter [::String]
392
+ # The raw filter text to constrain the results.
393
+ # @yield [result, operation] Access the result along with the TransportOperation object
394
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Build::V1::Build>]
395
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
396
+ #
397
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Build::V1::Build>]
398
+ #
399
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
400
+ def list_builds request, options = nil
401
+ raise ::ArgumentError, "request must be provided" if request.nil?
402
+
403
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::ListBuildsRequest
404
+
405
+ # Converts hash and nil to an options object
406
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
407
+
408
+ # Customize the options with defaults
409
+ call_metadata = @config.rpcs.list_builds.metadata.to_h
410
+
411
+ # Set x-goog-api-client and x-goog-user-project headers
412
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
413
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
414
+ gapic_version: ::Google::Cloud::Build::V1::VERSION,
415
+ transports_version_send: [:rest]
416
+
417
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
418
+
419
+ options.apply_defaults timeout: @config.rpcs.list_builds.timeout,
420
+ metadata: call_metadata,
421
+ retry_policy: @config.rpcs.list_builds.retry_policy
422
+
423
+ options.apply_defaults timeout: @config.timeout,
424
+ metadata: @config.metadata,
425
+ retry_policy: @config.retry_policy
426
+
427
+ @cloud_build_stub.list_builds request, options do |result, operation|
428
+ result = ::Gapic::Rest::PagedEnumerable.new @cloud_build_stub, :list_builds, "builds", request, result, options
429
+ yield result, operation if block_given?
430
+ return result
431
+ end
432
+ rescue ::Gapic::Rest::Error => e
433
+ raise ::Google::Cloud::Error.from_error(e)
434
+ end
435
+
436
+ ##
437
+ # Cancels a build in progress.
438
+ #
439
+ # @overload cancel_build(request, options = nil)
440
+ # Pass arguments to `cancel_build` via a request object, either of type
441
+ # {::Google::Cloud::Build::V1::CancelBuildRequest} or an equivalent Hash.
442
+ #
443
+ # @param request [::Google::Cloud::Build::V1::CancelBuildRequest, ::Hash]
444
+ # A request object representing the call parameters. Required. To specify no
445
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
446
+ # @param options [::Gapic::CallOptions, ::Hash]
447
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
448
+ #
449
+ # @overload cancel_build(name: nil, project_id: nil, id: nil)
450
+ # Pass arguments to `cancel_build` via keyword arguments. Note that at
451
+ # least one keyword argument is required. To specify no parameters, or to keep all
452
+ # the default parameter values, pass an empty Hash as a request object (see above).
453
+ #
454
+ # @param name [::String]
455
+ # The name of the `Build` to cancel.
456
+ # Format: `projects/{project}/locations/{location}/builds/{build}`
457
+ # @param project_id [::String]
458
+ # Required. ID of the project.
459
+ # @param id [::String]
460
+ # Required. ID of the build.
461
+ # @yield [result, operation] Access the result along with the TransportOperation object
462
+ # @yieldparam result [::Google::Cloud::Build::V1::Build]
463
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
464
+ #
465
+ # @return [::Google::Cloud::Build::V1::Build]
466
+ #
467
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
468
+ def cancel_build request, options = nil
469
+ raise ::ArgumentError, "request must be provided" if request.nil?
470
+
471
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::CancelBuildRequest
472
+
473
+ # Converts hash and nil to an options object
474
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
475
+
476
+ # Customize the options with defaults
477
+ call_metadata = @config.rpcs.cancel_build.metadata.to_h
478
+
479
+ # Set x-goog-api-client and x-goog-user-project headers
480
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
481
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
482
+ gapic_version: ::Google::Cloud::Build::V1::VERSION,
483
+ transports_version_send: [:rest]
484
+
485
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
486
+
487
+ options.apply_defaults timeout: @config.rpcs.cancel_build.timeout,
488
+ metadata: call_metadata,
489
+ retry_policy: @config.rpcs.cancel_build.retry_policy
490
+
491
+ options.apply_defaults timeout: @config.timeout,
492
+ metadata: @config.metadata,
493
+ retry_policy: @config.retry_policy
494
+
495
+ @cloud_build_stub.cancel_build request, options do |result, operation|
496
+ yield result, operation if block_given?
497
+ return result
498
+ end
499
+ rescue ::Gapic::Rest::Error => e
500
+ raise ::Google::Cloud::Error.from_error(e)
501
+ end
502
+
503
+ ##
504
+ # Creates a new build based on the specified build.
505
+ #
506
+ # This method creates a new build using the original build request, which may
507
+ # or may not result in an identical build.
508
+ #
509
+ # For triggered builds:
510
+ #
511
+ # * Triggered builds resolve to a precise revision; therefore a retry of a
512
+ # triggered build will result in a build that uses the same revision.
513
+ #
514
+ # For non-triggered builds that specify `RepoSource`:
515
+ #
516
+ # * If the original build built from the tip of a branch, the retried build
517
+ # will build from the tip of that branch, which may not be the same revision
518
+ # as the original build.
519
+ # * If the original build specified a commit sha or revision ID, the retried
520
+ # build will use the identical source.
521
+ #
522
+ # For builds that specify `StorageSource`:
523
+ #
524
+ # * If the original build pulled source from Google Cloud Storage without
525
+ # specifying the generation of the object, the new build will use the current
526
+ # object, which may be different from the original build source.
527
+ # * If the original build pulled source from Cloud Storage and specified the
528
+ # generation of the object, the new build will attempt to use the same
529
+ # object, which may or may not be available depending on the bucket's
530
+ # lifecycle management settings.
531
+ #
532
+ # @overload retry_build(request, options = nil)
533
+ # Pass arguments to `retry_build` via a request object, either of type
534
+ # {::Google::Cloud::Build::V1::RetryBuildRequest} or an equivalent Hash.
535
+ #
536
+ # @param request [::Google::Cloud::Build::V1::RetryBuildRequest, ::Hash]
537
+ # A request object representing the call parameters. Required. To specify no
538
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
539
+ # @param options [::Gapic::CallOptions, ::Hash]
540
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
541
+ #
542
+ # @overload retry_build(name: nil, project_id: nil, id: nil)
543
+ # Pass arguments to `retry_build` via keyword arguments. Note that at
544
+ # least one keyword argument is required. To specify no parameters, or to keep all
545
+ # the default parameter values, pass an empty Hash as a request object (see above).
546
+ #
547
+ # @param name [::String]
548
+ # The name of the `Build` to retry.
549
+ # Format: `projects/{project}/locations/{location}/builds/{build}`
550
+ # @param project_id [::String]
551
+ # Required. ID of the project.
552
+ # @param id [::String]
553
+ # Required. Build ID of the original build.
554
+ # @yield [result, operation] Access the result along with the TransportOperation object
555
+ # @yieldparam result [::Gapic::Operation]
556
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
557
+ #
558
+ # @return [::Gapic::Operation]
559
+ #
560
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
561
+ def retry_build request, options = nil
562
+ raise ::ArgumentError, "request must be provided" if request.nil?
563
+
564
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::RetryBuildRequest
565
+
566
+ # Converts hash and nil to an options object
567
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
568
+
569
+ # Customize the options with defaults
570
+ call_metadata = @config.rpcs.retry_build.metadata.to_h
571
+
572
+ # Set x-goog-api-client and x-goog-user-project headers
573
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
574
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
575
+ gapic_version: ::Google::Cloud::Build::V1::VERSION,
576
+ transports_version_send: [:rest]
577
+
578
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
579
+
580
+ options.apply_defaults timeout: @config.rpcs.retry_build.timeout,
581
+ metadata: call_metadata,
582
+ retry_policy: @config.rpcs.retry_build.retry_policy
583
+
584
+ options.apply_defaults timeout: @config.timeout,
585
+ metadata: @config.metadata,
586
+ retry_policy: @config.retry_policy
587
+
588
+ @cloud_build_stub.retry_build request, options do |result, operation|
589
+ result = ::Gapic::Operation.new result, @operations_client, options: options
590
+ yield result, operation if block_given?
591
+ return result
592
+ end
593
+ rescue ::Gapic::Rest::Error => e
594
+ raise ::Google::Cloud::Error.from_error(e)
595
+ end
596
+
597
+ ##
598
+ # Approves or rejects a pending build.
599
+ #
600
+ # If approved, the returned LRO will be analogous to the LRO returned from
601
+ # a CreateBuild call.
602
+ #
603
+ # If rejected, the returned LRO will be immediately done.
604
+ #
605
+ # @overload approve_build(request, options = nil)
606
+ # Pass arguments to `approve_build` via a request object, either of type
607
+ # {::Google::Cloud::Build::V1::ApproveBuildRequest} or an equivalent Hash.
608
+ #
609
+ # @param request [::Google::Cloud::Build::V1::ApproveBuildRequest, ::Hash]
610
+ # A request object representing the call parameters. Required. To specify no
611
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
612
+ # @param options [::Gapic::CallOptions, ::Hash]
613
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
614
+ #
615
+ # @overload approve_build(name: nil, approval_result: nil)
616
+ # Pass arguments to `approve_build` via keyword arguments. Note that at
617
+ # least one keyword argument is required. To specify no parameters, or to keep all
618
+ # the default parameter values, pass an empty Hash as a request object (see above).
619
+ #
620
+ # @param name [::String]
621
+ # Required. Name of the target build.
622
+ # For example: "projects/\\{$project_id}/builds/\\{$build_id}"
623
+ # @param approval_result [::Google::Cloud::Build::V1::ApprovalResult, ::Hash]
624
+ # Approval decision and metadata.
625
+ # @yield [result, operation] Access the result along with the TransportOperation object
626
+ # @yieldparam result [::Gapic::Operation]
627
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
628
+ #
629
+ # @return [::Gapic::Operation]
630
+ #
631
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
632
+ def approve_build request, options = nil
633
+ raise ::ArgumentError, "request must be provided" if request.nil?
634
+
635
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::ApproveBuildRequest
636
+
637
+ # Converts hash and nil to an options object
638
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
639
+
640
+ # Customize the options with defaults
641
+ call_metadata = @config.rpcs.approve_build.metadata.to_h
642
+
643
+ # Set x-goog-api-client and x-goog-user-project headers
644
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
645
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
646
+ gapic_version: ::Google::Cloud::Build::V1::VERSION,
647
+ transports_version_send: [:rest]
648
+
649
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
650
+
651
+ options.apply_defaults timeout: @config.rpcs.approve_build.timeout,
652
+ metadata: call_metadata,
653
+ retry_policy: @config.rpcs.approve_build.retry_policy
654
+
655
+ options.apply_defaults timeout: @config.timeout,
656
+ metadata: @config.metadata,
657
+ retry_policy: @config.retry_policy
658
+
659
+ @cloud_build_stub.approve_build request, options do |result, operation|
660
+ result = ::Gapic::Operation.new result, @operations_client, options: options
661
+ yield result, operation if block_given?
662
+ return result
663
+ end
664
+ rescue ::Gapic::Rest::Error => e
665
+ raise ::Google::Cloud::Error.from_error(e)
666
+ end
667
+
668
+ ##
669
+ # Creates a new `BuildTrigger`.
670
+ #
671
+ # This API is experimental.
672
+ #
673
+ # @overload create_build_trigger(request, options = nil)
674
+ # Pass arguments to `create_build_trigger` via a request object, either of type
675
+ # {::Google::Cloud::Build::V1::CreateBuildTriggerRequest} or an equivalent Hash.
676
+ #
677
+ # @param request [::Google::Cloud::Build::V1::CreateBuildTriggerRequest, ::Hash]
678
+ # A request object representing the call parameters. Required. To specify no
679
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
680
+ # @param options [::Gapic::CallOptions, ::Hash]
681
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
682
+ #
683
+ # @overload create_build_trigger(parent: nil, project_id: nil, trigger: nil)
684
+ # Pass arguments to `create_build_trigger` via keyword arguments. Note that at
685
+ # least one keyword argument is required. To specify no parameters, or to keep all
686
+ # the default parameter values, pass an empty Hash as a request object (see above).
687
+ #
688
+ # @param parent [::String]
689
+ # The parent resource where this trigger will be created.
690
+ # Format: `projects/{project}/locations/{location}`
691
+ # @param project_id [::String]
692
+ # Required. ID of the project for which to configure automatic builds.
693
+ # @param trigger [::Google::Cloud::Build::V1::BuildTrigger, ::Hash]
694
+ # Required. `BuildTrigger` to create.
695
+ # @yield [result, operation] Access the result along with the TransportOperation object
696
+ # @yieldparam result [::Google::Cloud::Build::V1::BuildTrigger]
697
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
698
+ #
699
+ # @return [::Google::Cloud::Build::V1::BuildTrigger]
700
+ #
701
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
702
+ def create_build_trigger request, options = nil
703
+ raise ::ArgumentError, "request must be provided" if request.nil?
704
+
705
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::CreateBuildTriggerRequest
706
+
707
+ # Converts hash and nil to an options object
708
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
709
+
710
+ # Customize the options with defaults
711
+ call_metadata = @config.rpcs.create_build_trigger.metadata.to_h
712
+
713
+ # Set x-goog-api-client and x-goog-user-project headers
714
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
715
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
716
+ gapic_version: ::Google::Cloud::Build::V1::VERSION,
717
+ transports_version_send: [:rest]
718
+
719
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
720
+
721
+ options.apply_defaults timeout: @config.rpcs.create_build_trigger.timeout,
722
+ metadata: call_metadata,
723
+ retry_policy: @config.rpcs.create_build_trigger.retry_policy
724
+
725
+ options.apply_defaults timeout: @config.timeout,
726
+ metadata: @config.metadata,
727
+ retry_policy: @config.retry_policy
728
+
729
+ @cloud_build_stub.create_build_trigger request, options do |result, operation|
730
+ yield result, operation if block_given?
731
+ return result
732
+ end
733
+ rescue ::Gapic::Rest::Error => e
734
+ raise ::Google::Cloud::Error.from_error(e)
735
+ end
736
+
737
+ ##
738
+ # Returns information about a `BuildTrigger`.
739
+ #
740
+ # This API is experimental.
741
+ #
742
+ # @overload get_build_trigger(request, options = nil)
743
+ # Pass arguments to `get_build_trigger` via a request object, either of type
744
+ # {::Google::Cloud::Build::V1::GetBuildTriggerRequest} or an equivalent Hash.
745
+ #
746
+ # @param request [::Google::Cloud::Build::V1::GetBuildTriggerRequest, ::Hash]
747
+ # A request object representing the call parameters. Required. To specify no
748
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
749
+ # @param options [::Gapic::CallOptions, ::Hash]
750
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
751
+ #
752
+ # @overload get_build_trigger(name: nil, project_id: nil, trigger_id: nil)
753
+ # Pass arguments to `get_build_trigger` via keyword arguments. Note that at
754
+ # least one keyword argument is required. To specify no parameters, or to keep all
755
+ # the default parameter values, pass an empty Hash as a request object (see above).
756
+ #
757
+ # @param name [::String]
758
+ # The name of the `Trigger` to retrieve.
759
+ # Format: `projects/{project}/locations/{location}/triggers/{trigger}`
760
+ # @param project_id [::String]
761
+ # Required. ID of the project that owns the trigger.
762
+ # @param trigger_id [::String]
763
+ # Required. Identifier (`id` or `name`) of the `BuildTrigger` to get.
764
+ # @yield [result, operation] Access the result along with the TransportOperation object
765
+ # @yieldparam result [::Google::Cloud::Build::V1::BuildTrigger]
766
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
767
+ #
768
+ # @return [::Google::Cloud::Build::V1::BuildTrigger]
769
+ #
770
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
771
+ def get_build_trigger request, options = nil
772
+ raise ::ArgumentError, "request must be provided" if request.nil?
773
+
774
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::GetBuildTriggerRequest
775
+
776
+ # Converts hash and nil to an options object
777
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
778
+
779
+ # Customize the options with defaults
780
+ call_metadata = @config.rpcs.get_build_trigger.metadata.to_h
781
+
782
+ # Set x-goog-api-client and x-goog-user-project headers
783
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
784
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
785
+ gapic_version: ::Google::Cloud::Build::V1::VERSION,
786
+ transports_version_send: [:rest]
787
+
788
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
789
+
790
+ options.apply_defaults timeout: @config.rpcs.get_build_trigger.timeout,
791
+ metadata: call_metadata,
792
+ retry_policy: @config.rpcs.get_build_trigger.retry_policy
793
+
794
+ options.apply_defaults timeout: @config.timeout,
795
+ metadata: @config.metadata,
796
+ retry_policy: @config.retry_policy
797
+
798
+ @cloud_build_stub.get_build_trigger request, options do |result, operation|
799
+ yield result, operation if block_given?
800
+ return result
801
+ end
802
+ rescue ::Gapic::Rest::Error => e
803
+ raise ::Google::Cloud::Error.from_error(e)
804
+ end
805
+
806
+ ##
807
+ # Lists existing `BuildTrigger`s.
808
+ #
809
+ # This API is experimental.
810
+ #
811
+ # @overload list_build_triggers(request, options = nil)
812
+ # Pass arguments to `list_build_triggers` via a request object, either of type
813
+ # {::Google::Cloud::Build::V1::ListBuildTriggersRequest} or an equivalent Hash.
814
+ #
815
+ # @param request [::Google::Cloud::Build::V1::ListBuildTriggersRequest, ::Hash]
816
+ # A request object representing the call parameters. Required. To specify no
817
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
818
+ # @param options [::Gapic::CallOptions, ::Hash]
819
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
820
+ #
821
+ # @overload list_build_triggers(parent: nil, project_id: nil, page_size: nil, page_token: nil)
822
+ # Pass arguments to `list_build_triggers` via keyword arguments. Note that at
823
+ # least one keyword argument is required. To specify no parameters, or to keep all
824
+ # the default parameter values, pass an empty Hash as a request object (see above).
825
+ #
826
+ # @param parent [::String]
827
+ # The parent of the collection of `Triggers`.
828
+ # Format: `projects/{project}/locations/{location}`
829
+ # @param project_id [::String]
830
+ # Required. ID of the project for which to list BuildTriggers.
831
+ # @param page_size [::Integer]
832
+ # Number of results to return in the list.
833
+ # @param page_token [::String]
834
+ # Token to provide to skip to a particular spot in the list.
835
+ # @yield [result, operation] Access the result along with the TransportOperation object
836
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Build::V1::BuildTrigger>]
837
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
838
+ #
839
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Build::V1::BuildTrigger>]
840
+ #
841
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
842
+ def list_build_triggers request, options = nil
843
+ raise ::ArgumentError, "request must be provided" if request.nil?
844
+
845
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::ListBuildTriggersRequest
846
+
847
+ # Converts hash and nil to an options object
848
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
849
+
850
+ # Customize the options with defaults
851
+ call_metadata = @config.rpcs.list_build_triggers.metadata.to_h
852
+
853
+ # Set x-goog-api-client and x-goog-user-project headers
854
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
855
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
856
+ gapic_version: ::Google::Cloud::Build::V1::VERSION,
857
+ transports_version_send: [:rest]
858
+
859
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
860
+
861
+ options.apply_defaults timeout: @config.rpcs.list_build_triggers.timeout,
862
+ metadata: call_metadata,
863
+ retry_policy: @config.rpcs.list_build_triggers.retry_policy
864
+
865
+ options.apply_defaults timeout: @config.timeout,
866
+ metadata: @config.metadata,
867
+ retry_policy: @config.retry_policy
868
+
869
+ @cloud_build_stub.list_build_triggers request, options do |result, operation|
870
+ result = ::Gapic::Rest::PagedEnumerable.new @cloud_build_stub, :list_build_triggers, "triggers", request, result, options
871
+ yield result, operation if block_given?
872
+ return result
873
+ end
874
+ rescue ::Gapic::Rest::Error => e
875
+ raise ::Google::Cloud::Error.from_error(e)
876
+ end
877
+
878
+ ##
879
+ # Deletes a `BuildTrigger` by its project ID and trigger ID.
880
+ #
881
+ # This API is experimental.
882
+ #
883
+ # @overload delete_build_trigger(request, options = nil)
884
+ # Pass arguments to `delete_build_trigger` via a request object, either of type
885
+ # {::Google::Cloud::Build::V1::DeleteBuildTriggerRequest} or an equivalent Hash.
886
+ #
887
+ # @param request [::Google::Cloud::Build::V1::DeleteBuildTriggerRequest, ::Hash]
888
+ # A request object representing the call parameters. Required. To specify no
889
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
890
+ # @param options [::Gapic::CallOptions, ::Hash]
891
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
892
+ #
893
+ # @overload delete_build_trigger(name: nil, project_id: nil, trigger_id: nil)
894
+ # Pass arguments to `delete_build_trigger` via keyword arguments. Note that at
895
+ # least one keyword argument is required. To specify no parameters, or to keep all
896
+ # the default parameter values, pass an empty Hash as a request object (see above).
897
+ #
898
+ # @param name [::String]
899
+ # The name of the `Trigger` to delete.
900
+ # Format: `projects/{project}/locations/{location}/triggers/{trigger}`
901
+ # @param project_id [::String]
902
+ # Required. ID of the project that owns the trigger.
903
+ # @param trigger_id [::String]
904
+ # Required. ID of the `BuildTrigger` to delete.
905
+ # @yield [result, operation] Access the result along with the TransportOperation object
906
+ # @yieldparam result [::Google::Protobuf::Empty]
907
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
908
+ #
909
+ # @return [::Google::Protobuf::Empty]
910
+ #
911
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
912
+ def delete_build_trigger request, options = nil
913
+ raise ::ArgumentError, "request must be provided" if request.nil?
914
+
915
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::DeleteBuildTriggerRequest
916
+
917
+ # Converts hash and nil to an options object
918
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
919
+
920
+ # Customize the options with defaults
921
+ call_metadata = @config.rpcs.delete_build_trigger.metadata.to_h
922
+
923
+ # Set x-goog-api-client and x-goog-user-project headers
924
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
925
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
926
+ gapic_version: ::Google::Cloud::Build::V1::VERSION,
927
+ transports_version_send: [:rest]
928
+
929
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
930
+
931
+ options.apply_defaults timeout: @config.rpcs.delete_build_trigger.timeout,
932
+ metadata: call_metadata,
933
+ retry_policy: @config.rpcs.delete_build_trigger.retry_policy
934
+
935
+ options.apply_defaults timeout: @config.timeout,
936
+ metadata: @config.metadata,
937
+ retry_policy: @config.retry_policy
938
+
939
+ @cloud_build_stub.delete_build_trigger request, options do |result, operation|
940
+ yield result, operation if block_given?
941
+ return result
942
+ end
943
+ rescue ::Gapic::Rest::Error => e
944
+ raise ::Google::Cloud::Error.from_error(e)
945
+ end
946
+
947
+ ##
948
+ # Updates a `BuildTrigger` by its project ID and trigger ID.
949
+ #
950
+ # This API is experimental.
951
+ #
952
+ # @overload update_build_trigger(request, options = nil)
953
+ # Pass arguments to `update_build_trigger` via a request object, either of type
954
+ # {::Google::Cloud::Build::V1::UpdateBuildTriggerRequest} or an equivalent Hash.
955
+ #
956
+ # @param request [::Google::Cloud::Build::V1::UpdateBuildTriggerRequest, ::Hash]
957
+ # A request object representing the call parameters. Required. To specify no
958
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
959
+ # @param options [::Gapic::CallOptions, ::Hash]
960
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
961
+ #
962
+ # @overload update_build_trigger(project_id: nil, trigger_id: nil, trigger: nil)
963
+ # Pass arguments to `update_build_trigger` via keyword arguments. Note that at
964
+ # least one keyword argument is required. To specify no parameters, or to keep all
965
+ # the default parameter values, pass an empty Hash as a request object (see above).
966
+ #
967
+ # @param project_id [::String]
968
+ # Required. ID of the project that owns the trigger.
969
+ # @param trigger_id [::String]
970
+ # Required. ID of the `BuildTrigger` to update.
971
+ # @param trigger [::Google::Cloud::Build::V1::BuildTrigger, ::Hash]
972
+ # Required. `BuildTrigger` to update.
973
+ # @yield [result, operation] Access the result along with the TransportOperation object
974
+ # @yieldparam result [::Google::Cloud::Build::V1::BuildTrigger]
975
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
976
+ #
977
+ # @return [::Google::Cloud::Build::V1::BuildTrigger]
978
+ #
979
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
980
+ def update_build_trigger request, options = nil
981
+ raise ::ArgumentError, "request must be provided" if request.nil?
982
+
983
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::UpdateBuildTriggerRequest
984
+
985
+ # Converts hash and nil to an options object
986
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
987
+
988
+ # Customize the options with defaults
989
+ call_metadata = @config.rpcs.update_build_trigger.metadata.to_h
990
+
991
+ # Set x-goog-api-client and x-goog-user-project headers
992
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
993
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
994
+ gapic_version: ::Google::Cloud::Build::V1::VERSION,
995
+ transports_version_send: [:rest]
996
+
997
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
998
+
999
+ options.apply_defaults timeout: @config.rpcs.update_build_trigger.timeout,
1000
+ metadata: call_metadata,
1001
+ retry_policy: @config.rpcs.update_build_trigger.retry_policy
1002
+
1003
+ options.apply_defaults timeout: @config.timeout,
1004
+ metadata: @config.metadata,
1005
+ retry_policy: @config.retry_policy
1006
+
1007
+ @cloud_build_stub.update_build_trigger request, options do |result, operation|
1008
+ yield result, operation if block_given?
1009
+ return result
1010
+ end
1011
+ rescue ::Gapic::Rest::Error => e
1012
+ raise ::Google::Cloud::Error.from_error(e)
1013
+ end
1014
+
1015
+ ##
1016
+ # Runs a `BuildTrigger` at a particular source revision.
1017
+ #
1018
+ # @overload run_build_trigger(request, options = nil)
1019
+ # Pass arguments to `run_build_trigger` via a request object, either of type
1020
+ # {::Google::Cloud::Build::V1::RunBuildTriggerRequest} or an equivalent Hash.
1021
+ #
1022
+ # @param request [::Google::Cloud::Build::V1::RunBuildTriggerRequest, ::Hash]
1023
+ # A request object representing the call parameters. Required. To specify no
1024
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1025
+ # @param options [::Gapic::CallOptions, ::Hash]
1026
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1027
+ #
1028
+ # @overload run_build_trigger(name: nil, project_id: nil, trigger_id: nil, source: nil)
1029
+ # Pass arguments to `run_build_trigger` via keyword arguments. Note that at
1030
+ # least one keyword argument is required. To specify no parameters, or to keep all
1031
+ # the default parameter values, pass an empty Hash as a request object (see above).
1032
+ #
1033
+ # @param name [::String]
1034
+ # The name of the `Trigger` to run.
1035
+ # Format: `projects/{project}/locations/{location}/triggers/{trigger}`
1036
+ # @param project_id [::String]
1037
+ # Required. ID of the project.
1038
+ # @param trigger_id [::String]
1039
+ # Required. ID of the trigger.
1040
+ # @param source [::Google::Cloud::Build::V1::RepoSource, ::Hash]
1041
+ # Source to build against this trigger.
1042
+ # @yield [result, operation] Access the result along with the TransportOperation object
1043
+ # @yieldparam result [::Gapic::Operation]
1044
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1045
+ #
1046
+ # @return [::Gapic::Operation]
1047
+ #
1048
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1049
+ def run_build_trigger request, options = nil
1050
+ raise ::ArgumentError, "request must be provided" if request.nil?
1051
+
1052
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::RunBuildTriggerRequest
1053
+
1054
+ # Converts hash and nil to an options object
1055
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1056
+
1057
+ # Customize the options with defaults
1058
+ call_metadata = @config.rpcs.run_build_trigger.metadata.to_h
1059
+
1060
+ # Set x-goog-api-client and x-goog-user-project headers
1061
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1062
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1063
+ gapic_version: ::Google::Cloud::Build::V1::VERSION,
1064
+ transports_version_send: [:rest]
1065
+
1066
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1067
+
1068
+ options.apply_defaults timeout: @config.rpcs.run_build_trigger.timeout,
1069
+ metadata: call_metadata,
1070
+ retry_policy: @config.rpcs.run_build_trigger.retry_policy
1071
+
1072
+ options.apply_defaults timeout: @config.timeout,
1073
+ metadata: @config.metadata,
1074
+ retry_policy: @config.retry_policy
1075
+
1076
+ @cloud_build_stub.run_build_trigger request, options do |result, operation|
1077
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1078
+ yield result, operation if block_given?
1079
+ return result
1080
+ end
1081
+ rescue ::Gapic::Rest::Error => e
1082
+ raise ::Google::Cloud::Error.from_error(e)
1083
+ end
1084
+
1085
+ ##
1086
+ # ReceiveTriggerWebhook [Experimental] is called when the API receives a
1087
+ # webhook request targeted at a specific trigger.
1088
+ #
1089
+ # @overload receive_trigger_webhook(request, options = nil)
1090
+ # Pass arguments to `receive_trigger_webhook` via a request object, either of type
1091
+ # {::Google::Cloud::Build::V1::ReceiveTriggerWebhookRequest} or an equivalent Hash.
1092
+ #
1093
+ # @param request [::Google::Cloud::Build::V1::ReceiveTriggerWebhookRequest, ::Hash]
1094
+ # A request object representing the call parameters. Required. To specify no
1095
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1096
+ # @param options [::Gapic::CallOptions, ::Hash]
1097
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1098
+ #
1099
+ # @overload receive_trigger_webhook(name: nil, body: nil, project_id: nil, trigger: nil, secret: nil)
1100
+ # Pass arguments to `receive_trigger_webhook` via keyword arguments. Note that at
1101
+ # least one keyword argument is required. To specify no parameters, or to keep all
1102
+ # the default parameter values, pass an empty Hash as a request object (see above).
1103
+ #
1104
+ # @param name [::String]
1105
+ # The name of the `ReceiveTriggerWebhook` to retrieve.
1106
+ # Format: `projects/{project}/locations/{location}/triggers/{trigger}`
1107
+ # @param body [::Google::Api::HttpBody, ::Hash]
1108
+ # HTTP request body.
1109
+ # @param project_id [::String]
1110
+ # Project in which the specified trigger lives
1111
+ # @param trigger [::String]
1112
+ # Name of the trigger to run the payload against
1113
+ # @param secret [::String]
1114
+ # Secret token used for authorization if an OAuth token isn't provided.
1115
+ # @yield [result, operation] Access the result along with the TransportOperation object
1116
+ # @yieldparam result [::Google::Cloud::Build::V1::ReceiveTriggerWebhookResponse]
1117
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1118
+ #
1119
+ # @return [::Google::Cloud::Build::V1::ReceiveTriggerWebhookResponse]
1120
+ #
1121
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1122
+ def receive_trigger_webhook request, options = nil
1123
+ raise ::ArgumentError, "request must be provided" if request.nil?
1124
+
1125
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::ReceiveTriggerWebhookRequest
1126
+
1127
+ # Converts hash and nil to an options object
1128
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1129
+
1130
+ # Customize the options with defaults
1131
+ call_metadata = @config.rpcs.receive_trigger_webhook.metadata.to_h
1132
+
1133
+ # Set x-goog-api-client and x-goog-user-project headers
1134
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1135
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1136
+ gapic_version: ::Google::Cloud::Build::V1::VERSION,
1137
+ transports_version_send: [:rest]
1138
+
1139
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1140
+
1141
+ options.apply_defaults timeout: @config.rpcs.receive_trigger_webhook.timeout,
1142
+ metadata: call_metadata,
1143
+ retry_policy: @config.rpcs.receive_trigger_webhook.retry_policy
1144
+
1145
+ options.apply_defaults timeout: @config.timeout,
1146
+ metadata: @config.metadata,
1147
+ retry_policy: @config.retry_policy
1148
+
1149
+ @cloud_build_stub.receive_trigger_webhook request, options do |result, operation|
1150
+ yield result, operation if block_given?
1151
+ return result
1152
+ end
1153
+ rescue ::Gapic::Rest::Error => e
1154
+ raise ::Google::Cloud::Error.from_error(e)
1155
+ end
1156
+
1157
+ ##
1158
+ # Creates a `WorkerPool`.
1159
+ #
1160
+ # @overload create_worker_pool(request, options = nil)
1161
+ # Pass arguments to `create_worker_pool` via a request object, either of type
1162
+ # {::Google::Cloud::Build::V1::CreateWorkerPoolRequest} or an equivalent Hash.
1163
+ #
1164
+ # @param request [::Google::Cloud::Build::V1::CreateWorkerPoolRequest, ::Hash]
1165
+ # A request object representing the call parameters. Required. To specify no
1166
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1167
+ # @param options [::Gapic::CallOptions, ::Hash]
1168
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1169
+ #
1170
+ # @overload create_worker_pool(parent: nil, worker_pool: nil, worker_pool_id: nil, validate_only: nil)
1171
+ # Pass arguments to `create_worker_pool` via keyword arguments. Note that at
1172
+ # least one keyword argument is required. To specify no parameters, or to keep all
1173
+ # the default parameter values, pass an empty Hash as a request object (see above).
1174
+ #
1175
+ # @param parent [::String]
1176
+ # Required. The parent resource where this worker pool will be created.
1177
+ # Format: `projects/{project}/locations/{location}`.
1178
+ # @param worker_pool [::Google::Cloud::Build::V1::WorkerPool, ::Hash]
1179
+ # Required. `WorkerPool` resource to create.
1180
+ # @param worker_pool_id [::String]
1181
+ # Required. Immutable. The ID to use for the `WorkerPool`, which will become
1182
+ # the final component of the resource name.
1183
+ #
1184
+ # This value should be 1-63 characters, and valid characters
1185
+ # are /[a-z][0-9]-/.
1186
+ # @param validate_only [::Boolean]
1187
+ # If set, validate the request and preview the response, but do not actually
1188
+ # post it.
1189
+ # @yield [result, operation] Access the result along with the TransportOperation object
1190
+ # @yieldparam result [::Gapic::Operation]
1191
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1192
+ #
1193
+ # @return [::Gapic::Operation]
1194
+ #
1195
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1196
+ def create_worker_pool request, options = nil
1197
+ raise ::ArgumentError, "request must be provided" if request.nil?
1198
+
1199
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::CreateWorkerPoolRequest
1200
+
1201
+ # Converts hash and nil to an options object
1202
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1203
+
1204
+ # Customize the options with defaults
1205
+ call_metadata = @config.rpcs.create_worker_pool.metadata.to_h
1206
+
1207
+ # Set x-goog-api-client and x-goog-user-project headers
1208
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1209
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1210
+ gapic_version: ::Google::Cloud::Build::V1::VERSION,
1211
+ transports_version_send: [:rest]
1212
+
1213
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1214
+
1215
+ options.apply_defaults timeout: @config.rpcs.create_worker_pool.timeout,
1216
+ metadata: call_metadata,
1217
+ retry_policy: @config.rpcs.create_worker_pool.retry_policy
1218
+
1219
+ options.apply_defaults timeout: @config.timeout,
1220
+ metadata: @config.metadata,
1221
+ retry_policy: @config.retry_policy
1222
+
1223
+ @cloud_build_stub.create_worker_pool request, options do |result, operation|
1224
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1225
+ yield result, operation if block_given?
1226
+ return result
1227
+ end
1228
+ rescue ::Gapic::Rest::Error => e
1229
+ raise ::Google::Cloud::Error.from_error(e)
1230
+ end
1231
+
1232
+ ##
1233
+ # Returns details of a `WorkerPool`.
1234
+ #
1235
+ # @overload get_worker_pool(request, options = nil)
1236
+ # Pass arguments to `get_worker_pool` via a request object, either of type
1237
+ # {::Google::Cloud::Build::V1::GetWorkerPoolRequest} or an equivalent Hash.
1238
+ #
1239
+ # @param request [::Google::Cloud::Build::V1::GetWorkerPoolRequest, ::Hash]
1240
+ # A request object representing the call parameters. Required. To specify no
1241
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1242
+ # @param options [::Gapic::CallOptions, ::Hash]
1243
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1244
+ #
1245
+ # @overload get_worker_pool(name: nil)
1246
+ # Pass arguments to `get_worker_pool` via keyword arguments. Note that at
1247
+ # least one keyword argument is required. To specify no parameters, or to keep all
1248
+ # the default parameter values, pass an empty Hash as a request object (see above).
1249
+ #
1250
+ # @param name [::String]
1251
+ # Required. The name of the `WorkerPool` to retrieve.
1252
+ # Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.
1253
+ # @yield [result, operation] Access the result along with the TransportOperation object
1254
+ # @yieldparam result [::Google::Cloud::Build::V1::WorkerPool]
1255
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1256
+ #
1257
+ # @return [::Google::Cloud::Build::V1::WorkerPool]
1258
+ #
1259
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1260
+ def get_worker_pool request, options = nil
1261
+ raise ::ArgumentError, "request must be provided" if request.nil?
1262
+
1263
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::GetWorkerPoolRequest
1264
+
1265
+ # Converts hash and nil to an options object
1266
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1267
+
1268
+ # Customize the options with defaults
1269
+ call_metadata = @config.rpcs.get_worker_pool.metadata.to_h
1270
+
1271
+ # Set x-goog-api-client and x-goog-user-project headers
1272
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1273
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1274
+ gapic_version: ::Google::Cloud::Build::V1::VERSION,
1275
+ transports_version_send: [:rest]
1276
+
1277
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1278
+
1279
+ options.apply_defaults timeout: @config.rpcs.get_worker_pool.timeout,
1280
+ metadata: call_metadata,
1281
+ retry_policy: @config.rpcs.get_worker_pool.retry_policy
1282
+
1283
+ options.apply_defaults timeout: @config.timeout,
1284
+ metadata: @config.metadata,
1285
+ retry_policy: @config.retry_policy
1286
+
1287
+ @cloud_build_stub.get_worker_pool request, options do |result, operation|
1288
+ yield result, operation if block_given?
1289
+ return result
1290
+ end
1291
+ rescue ::Gapic::Rest::Error => e
1292
+ raise ::Google::Cloud::Error.from_error(e)
1293
+ end
1294
+
1295
+ ##
1296
+ # Deletes a `WorkerPool`.
1297
+ #
1298
+ # @overload delete_worker_pool(request, options = nil)
1299
+ # Pass arguments to `delete_worker_pool` via a request object, either of type
1300
+ # {::Google::Cloud::Build::V1::DeleteWorkerPoolRequest} or an equivalent Hash.
1301
+ #
1302
+ # @param request [::Google::Cloud::Build::V1::DeleteWorkerPoolRequest, ::Hash]
1303
+ # A request object representing the call parameters. Required. To specify no
1304
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1305
+ # @param options [::Gapic::CallOptions, ::Hash]
1306
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1307
+ #
1308
+ # @overload delete_worker_pool(name: nil, etag: nil, allow_missing: nil, validate_only: nil)
1309
+ # Pass arguments to `delete_worker_pool` via keyword arguments. Note that at
1310
+ # least one keyword argument is required. To specify no parameters, or to keep all
1311
+ # the default parameter values, pass an empty Hash as a request object (see above).
1312
+ #
1313
+ # @param name [::String]
1314
+ # Required. The name of the `WorkerPool` to delete.
1315
+ # Format:
1316
+ # `projects/{project}/locations/{workerPool}/workerPools/{workerPool}`.
1317
+ # @param etag [::String]
1318
+ # Optional. If this is provided, it must match the server's etag on the
1319
+ # workerpool for the request to be processed.
1320
+ # @param allow_missing [::Boolean]
1321
+ # If set to true, and the `WorkerPool` is not found, the request will succeed
1322
+ # but no action will be taken on the server.
1323
+ # @param validate_only [::Boolean]
1324
+ # If set, validate the request and preview the response, but do not actually
1325
+ # post it.
1326
+ # @yield [result, operation] Access the result along with the TransportOperation object
1327
+ # @yieldparam result [::Gapic::Operation]
1328
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1329
+ #
1330
+ # @return [::Gapic::Operation]
1331
+ #
1332
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1333
+ def delete_worker_pool request, options = nil
1334
+ raise ::ArgumentError, "request must be provided" if request.nil?
1335
+
1336
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::DeleteWorkerPoolRequest
1337
+
1338
+ # Converts hash and nil to an options object
1339
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1340
+
1341
+ # Customize the options with defaults
1342
+ call_metadata = @config.rpcs.delete_worker_pool.metadata.to_h
1343
+
1344
+ # Set x-goog-api-client and x-goog-user-project headers
1345
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1346
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1347
+ gapic_version: ::Google::Cloud::Build::V1::VERSION,
1348
+ transports_version_send: [:rest]
1349
+
1350
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1351
+
1352
+ options.apply_defaults timeout: @config.rpcs.delete_worker_pool.timeout,
1353
+ metadata: call_metadata,
1354
+ retry_policy: @config.rpcs.delete_worker_pool.retry_policy
1355
+
1356
+ options.apply_defaults timeout: @config.timeout,
1357
+ metadata: @config.metadata,
1358
+ retry_policy: @config.retry_policy
1359
+
1360
+ @cloud_build_stub.delete_worker_pool request, options do |result, operation|
1361
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1362
+ yield result, operation if block_given?
1363
+ return result
1364
+ end
1365
+ rescue ::Gapic::Rest::Error => e
1366
+ raise ::Google::Cloud::Error.from_error(e)
1367
+ end
1368
+
1369
+ ##
1370
+ # Updates a `WorkerPool`.
1371
+ #
1372
+ # @overload update_worker_pool(request, options = nil)
1373
+ # Pass arguments to `update_worker_pool` via a request object, either of type
1374
+ # {::Google::Cloud::Build::V1::UpdateWorkerPoolRequest} or an equivalent Hash.
1375
+ #
1376
+ # @param request [::Google::Cloud::Build::V1::UpdateWorkerPoolRequest, ::Hash]
1377
+ # A request object representing the call parameters. Required. To specify no
1378
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1379
+ # @param options [::Gapic::CallOptions, ::Hash]
1380
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1381
+ #
1382
+ # @overload update_worker_pool(worker_pool: nil, update_mask: nil, validate_only: nil)
1383
+ # Pass arguments to `update_worker_pool` via keyword arguments. Note that at
1384
+ # least one keyword argument is required. To specify no parameters, or to keep all
1385
+ # the default parameter values, pass an empty Hash as a request object (see above).
1386
+ #
1387
+ # @param worker_pool [::Google::Cloud::Build::V1::WorkerPool, ::Hash]
1388
+ # Required. The `WorkerPool` to update.
1389
+ #
1390
+ # The `name` field is used to identify the `WorkerPool` to update.
1391
+ # Format: `projects/{project}/locations/{location}/workerPools/{workerPool}`.
1392
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1393
+ # A mask specifying which fields in `worker_pool` to update.
1394
+ # @param validate_only [::Boolean]
1395
+ # If set, validate the request and preview the response, but do not actually
1396
+ # post it.
1397
+ # @yield [result, operation] Access the result along with the TransportOperation object
1398
+ # @yieldparam result [::Gapic::Operation]
1399
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1400
+ #
1401
+ # @return [::Gapic::Operation]
1402
+ #
1403
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1404
+ def update_worker_pool request, options = nil
1405
+ raise ::ArgumentError, "request must be provided" if request.nil?
1406
+
1407
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::UpdateWorkerPoolRequest
1408
+
1409
+ # Converts hash and nil to an options object
1410
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1411
+
1412
+ # Customize the options with defaults
1413
+ call_metadata = @config.rpcs.update_worker_pool.metadata.to_h
1414
+
1415
+ # Set x-goog-api-client and x-goog-user-project headers
1416
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1417
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1418
+ gapic_version: ::Google::Cloud::Build::V1::VERSION,
1419
+ transports_version_send: [:rest]
1420
+
1421
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1422
+
1423
+ options.apply_defaults timeout: @config.rpcs.update_worker_pool.timeout,
1424
+ metadata: call_metadata,
1425
+ retry_policy: @config.rpcs.update_worker_pool.retry_policy
1426
+
1427
+ options.apply_defaults timeout: @config.timeout,
1428
+ metadata: @config.metadata,
1429
+ retry_policy: @config.retry_policy
1430
+
1431
+ @cloud_build_stub.update_worker_pool request, options do |result, operation|
1432
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1433
+ yield result, operation if block_given?
1434
+ return result
1435
+ end
1436
+ rescue ::Gapic::Rest::Error => e
1437
+ raise ::Google::Cloud::Error.from_error(e)
1438
+ end
1439
+
1440
+ ##
1441
+ # Lists `WorkerPool`s.
1442
+ #
1443
+ # @overload list_worker_pools(request, options = nil)
1444
+ # Pass arguments to `list_worker_pools` via a request object, either of type
1445
+ # {::Google::Cloud::Build::V1::ListWorkerPoolsRequest} or an equivalent Hash.
1446
+ #
1447
+ # @param request [::Google::Cloud::Build::V1::ListWorkerPoolsRequest, ::Hash]
1448
+ # A request object representing the call parameters. Required. To specify no
1449
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1450
+ # @param options [::Gapic::CallOptions, ::Hash]
1451
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1452
+ #
1453
+ # @overload list_worker_pools(parent: nil, page_size: nil, page_token: nil)
1454
+ # Pass arguments to `list_worker_pools` via keyword arguments. Note that at
1455
+ # least one keyword argument is required. To specify no parameters, or to keep all
1456
+ # the default parameter values, pass an empty Hash as a request object (see above).
1457
+ #
1458
+ # @param parent [::String]
1459
+ # Required. The parent of the collection of `WorkerPools`.
1460
+ # Format: `projects/{project}/locations/{location}`.
1461
+ # @param page_size [::Integer]
1462
+ # The maximum number of `WorkerPool`s to return. The service may return
1463
+ # fewer than this value. If omitted, the server will use a sensible default.
1464
+ # @param page_token [::String]
1465
+ # A page token, received from a previous `ListWorkerPools` call. Provide this
1466
+ # to retrieve the subsequent page.
1467
+ # @yield [result, operation] Access the result along with the TransportOperation object
1468
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Build::V1::WorkerPool>]
1469
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1470
+ #
1471
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Build::V1::WorkerPool>]
1472
+ #
1473
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1474
+ def list_worker_pools request, options = nil
1475
+ raise ::ArgumentError, "request must be provided" if request.nil?
1476
+
1477
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::ListWorkerPoolsRequest
1478
+
1479
+ # Converts hash and nil to an options object
1480
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1481
+
1482
+ # Customize the options with defaults
1483
+ call_metadata = @config.rpcs.list_worker_pools.metadata.to_h
1484
+
1485
+ # Set x-goog-api-client and x-goog-user-project headers
1486
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1487
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1488
+ gapic_version: ::Google::Cloud::Build::V1::VERSION,
1489
+ transports_version_send: [:rest]
1490
+
1491
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1492
+
1493
+ options.apply_defaults timeout: @config.rpcs.list_worker_pools.timeout,
1494
+ metadata: call_metadata,
1495
+ retry_policy: @config.rpcs.list_worker_pools.retry_policy
1496
+
1497
+ options.apply_defaults timeout: @config.timeout,
1498
+ metadata: @config.metadata,
1499
+ retry_policy: @config.retry_policy
1500
+
1501
+ @cloud_build_stub.list_worker_pools request, options do |result, operation|
1502
+ result = ::Gapic::Rest::PagedEnumerable.new @cloud_build_stub, :list_worker_pools, "worker_pools", request, result, options
1503
+ yield result, operation if block_given?
1504
+ return result
1505
+ end
1506
+ rescue ::Gapic::Rest::Error => e
1507
+ raise ::Google::Cloud::Error.from_error(e)
1508
+ end
1509
+
1510
+ ##
1511
+ # Configuration class for the CloudBuild REST API.
1512
+ #
1513
+ # This class represents the configuration for CloudBuild REST,
1514
+ # providing control over timeouts, retry behavior, logging, transport
1515
+ # parameters, and other low-level controls. Certain parameters can also be
1516
+ # applied individually to specific RPCs. See
1517
+ # {::Google::Cloud::Build::V1::CloudBuild::Rest::Client::Configuration::Rpcs}
1518
+ # for a list of RPCs that can be configured independently.
1519
+ #
1520
+ # Configuration can be applied globally to all clients, or to a single client
1521
+ # on construction.
1522
+ #
1523
+ # @example
1524
+ #
1525
+ # # Modify the global config, setting the timeout for
1526
+ # # create_build to 20 seconds,
1527
+ # # and all remaining timeouts to 10 seconds.
1528
+ # ::Google::Cloud::Build::V1::CloudBuild::Rest::Client.configure do |config|
1529
+ # config.timeout = 10.0
1530
+ # config.rpcs.create_build.timeout = 20.0
1531
+ # end
1532
+ #
1533
+ # # Apply the above configuration only to a new client.
1534
+ # client = ::Google::Cloud::Build::V1::CloudBuild::Rest::Client.new do |config|
1535
+ # config.timeout = 10.0
1536
+ # config.rpcs.create_build.timeout = 20.0
1537
+ # end
1538
+ #
1539
+ # @!attribute [rw] endpoint
1540
+ # The hostname or hostname:port of the service endpoint.
1541
+ # Defaults to `"cloudbuild.googleapis.com"`.
1542
+ # @return [::String]
1543
+ # @!attribute [rw] credentials
1544
+ # Credentials to send with calls. You may provide any of the following types:
1545
+ # * (`String`) The path to a service account key file in JSON format
1546
+ # * (`Hash`) A service account key as a Hash
1547
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1548
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1549
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1550
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1551
+ # * (`nil`) indicating no credentials
1552
+ # @return [::Object]
1553
+ # @!attribute [rw] scope
1554
+ # The OAuth scopes
1555
+ # @return [::Array<::String>]
1556
+ # @!attribute [rw] lib_name
1557
+ # The library name as recorded in instrumentation and logging
1558
+ # @return [::String]
1559
+ # @!attribute [rw] lib_version
1560
+ # The library version as recorded in instrumentation and logging
1561
+ # @return [::String]
1562
+ # @!attribute [rw] timeout
1563
+ # The call timeout in seconds.
1564
+ # @return [::Numeric]
1565
+ # @!attribute [rw] metadata
1566
+ # Additional headers to be sent with the call.
1567
+ # @return [::Hash{::Symbol=>::String}]
1568
+ # @!attribute [rw] retry_policy
1569
+ # The retry policy. The value is a hash with the following keys:
1570
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1571
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1572
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1573
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1574
+ # trigger a retry.
1575
+ # @return [::Hash]
1576
+ # @!attribute [rw] quota_project
1577
+ # A separate project against which to charge quota.
1578
+ # @return [::String]
1579
+ #
1580
+ class Configuration
1581
+ extend ::Gapic::Config
1582
+
1583
+ config_attr :endpoint, "cloudbuild.googleapis.com", ::String
1584
+ config_attr :credentials, nil do |value|
1585
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1586
+ allowed.any? { |klass| klass === value }
1587
+ end
1588
+ config_attr :scope, nil, ::String, ::Array, nil
1589
+ config_attr :lib_name, nil, ::String, nil
1590
+ config_attr :lib_version, nil, ::String, nil
1591
+ config_attr :timeout, nil, ::Numeric, nil
1592
+ config_attr :metadata, nil, ::Hash, nil
1593
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1594
+ config_attr :quota_project, nil, ::String, nil
1595
+
1596
+ # @private
1597
+ def initialize parent_config = nil
1598
+ @parent_config = parent_config unless parent_config.nil?
1599
+
1600
+ yield self if block_given?
1601
+ end
1602
+
1603
+ ##
1604
+ # Configurations for individual RPCs
1605
+ # @return [Rpcs]
1606
+ #
1607
+ def rpcs
1608
+ @rpcs ||= begin
1609
+ parent_rpcs = nil
1610
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1611
+ Rpcs.new parent_rpcs
1612
+ end
1613
+ end
1614
+
1615
+ ##
1616
+ # Configuration RPC class for the CloudBuild API.
1617
+ #
1618
+ # Includes fields providing the configuration for each RPC in this service.
1619
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1620
+ # the following configuration fields:
1621
+ #
1622
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1623
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1624
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1625
+ # include the following keys:
1626
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1627
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1628
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1629
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1630
+ # trigger a retry.
1631
+ #
1632
+ class Rpcs
1633
+ ##
1634
+ # RPC-specific configuration for `create_build`
1635
+ # @return [::Gapic::Config::Method]
1636
+ #
1637
+ attr_reader :create_build
1638
+ ##
1639
+ # RPC-specific configuration for `get_build`
1640
+ # @return [::Gapic::Config::Method]
1641
+ #
1642
+ attr_reader :get_build
1643
+ ##
1644
+ # RPC-specific configuration for `list_builds`
1645
+ # @return [::Gapic::Config::Method]
1646
+ #
1647
+ attr_reader :list_builds
1648
+ ##
1649
+ # RPC-specific configuration for `cancel_build`
1650
+ # @return [::Gapic::Config::Method]
1651
+ #
1652
+ attr_reader :cancel_build
1653
+ ##
1654
+ # RPC-specific configuration for `retry_build`
1655
+ # @return [::Gapic::Config::Method]
1656
+ #
1657
+ attr_reader :retry_build
1658
+ ##
1659
+ # RPC-specific configuration for `approve_build`
1660
+ # @return [::Gapic::Config::Method]
1661
+ #
1662
+ attr_reader :approve_build
1663
+ ##
1664
+ # RPC-specific configuration for `create_build_trigger`
1665
+ # @return [::Gapic::Config::Method]
1666
+ #
1667
+ attr_reader :create_build_trigger
1668
+ ##
1669
+ # RPC-specific configuration for `get_build_trigger`
1670
+ # @return [::Gapic::Config::Method]
1671
+ #
1672
+ attr_reader :get_build_trigger
1673
+ ##
1674
+ # RPC-specific configuration for `list_build_triggers`
1675
+ # @return [::Gapic::Config::Method]
1676
+ #
1677
+ attr_reader :list_build_triggers
1678
+ ##
1679
+ # RPC-specific configuration for `delete_build_trigger`
1680
+ # @return [::Gapic::Config::Method]
1681
+ #
1682
+ attr_reader :delete_build_trigger
1683
+ ##
1684
+ # RPC-specific configuration for `update_build_trigger`
1685
+ # @return [::Gapic::Config::Method]
1686
+ #
1687
+ attr_reader :update_build_trigger
1688
+ ##
1689
+ # RPC-specific configuration for `run_build_trigger`
1690
+ # @return [::Gapic::Config::Method]
1691
+ #
1692
+ attr_reader :run_build_trigger
1693
+ ##
1694
+ # RPC-specific configuration for `receive_trigger_webhook`
1695
+ # @return [::Gapic::Config::Method]
1696
+ #
1697
+ attr_reader :receive_trigger_webhook
1698
+ ##
1699
+ # RPC-specific configuration for `create_worker_pool`
1700
+ # @return [::Gapic::Config::Method]
1701
+ #
1702
+ attr_reader :create_worker_pool
1703
+ ##
1704
+ # RPC-specific configuration for `get_worker_pool`
1705
+ # @return [::Gapic::Config::Method]
1706
+ #
1707
+ attr_reader :get_worker_pool
1708
+ ##
1709
+ # RPC-specific configuration for `delete_worker_pool`
1710
+ # @return [::Gapic::Config::Method]
1711
+ #
1712
+ attr_reader :delete_worker_pool
1713
+ ##
1714
+ # RPC-specific configuration for `update_worker_pool`
1715
+ # @return [::Gapic::Config::Method]
1716
+ #
1717
+ attr_reader :update_worker_pool
1718
+ ##
1719
+ # RPC-specific configuration for `list_worker_pools`
1720
+ # @return [::Gapic::Config::Method]
1721
+ #
1722
+ attr_reader :list_worker_pools
1723
+
1724
+ # @private
1725
+ def initialize parent_rpcs = nil
1726
+ create_build_config = parent_rpcs.create_build if parent_rpcs.respond_to? :create_build
1727
+ @create_build = ::Gapic::Config::Method.new create_build_config
1728
+ get_build_config = parent_rpcs.get_build if parent_rpcs.respond_to? :get_build
1729
+ @get_build = ::Gapic::Config::Method.new get_build_config
1730
+ list_builds_config = parent_rpcs.list_builds if parent_rpcs.respond_to? :list_builds
1731
+ @list_builds = ::Gapic::Config::Method.new list_builds_config
1732
+ cancel_build_config = parent_rpcs.cancel_build if parent_rpcs.respond_to? :cancel_build
1733
+ @cancel_build = ::Gapic::Config::Method.new cancel_build_config
1734
+ retry_build_config = parent_rpcs.retry_build if parent_rpcs.respond_to? :retry_build
1735
+ @retry_build = ::Gapic::Config::Method.new retry_build_config
1736
+ approve_build_config = parent_rpcs.approve_build if parent_rpcs.respond_to? :approve_build
1737
+ @approve_build = ::Gapic::Config::Method.new approve_build_config
1738
+ create_build_trigger_config = parent_rpcs.create_build_trigger if parent_rpcs.respond_to? :create_build_trigger
1739
+ @create_build_trigger = ::Gapic::Config::Method.new create_build_trigger_config
1740
+ get_build_trigger_config = parent_rpcs.get_build_trigger if parent_rpcs.respond_to? :get_build_trigger
1741
+ @get_build_trigger = ::Gapic::Config::Method.new get_build_trigger_config
1742
+ list_build_triggers_config = parent_rpcs.list_build_triggers if parent_rpcs.respond_to? :list_build_triggers
1743
+ @list_build_triggers = ::Gapic::Config::Method.new list_build_triggers_config
1744
+ delete_build_trigger_config = parent_rpcs.delete_build_trigger if parent_rpcs.respond_to? :delete_build_trigger
1745
+ @delete_build_trigger = ::Gapic::Config::Method.new delete_build_trigger_config
1746
+ update_build_trigger_config = parent_rpcs.update_build_trigger if parent_rpcs.respond_to? :update_build_trigger
1747
+ @update_build_trigger = ::Gapic::Config::Method.new update_build_trigger_config
1748
+ run_build_trigger_config = parent_rpcs.run_build_trigger if parent_rpcs.respond_to? :run_build_trigger
1749
+ @run_build_trigger = ::Gapic::Config::Method.new run_build_trigger_config
1750
+ receive_trigger_webhook_config = parent_rpcs.receive_trigger_webhook if parent_rpcs.respond_to? :receive_trigger_webhook
1751
+ @receive_trigger_webhook = ::Gapic::Config::Method.new receive_trigger_webhook_config
1752
+ create_worker_pool_config = parent_rpcs.create_worker_pool if parent_rpcs.respond_to? :create_worker_pool
1753
+ @create_worker_pool = ::Gapic::Config::Method.new create_worker_pool_config
1754
+ get_worker_pool_config = parent_rpcs.get_worker_pool if parent_rpcs.respond_to? :get_worker_pool
1755
+ @get_worker_pool = ::Gapic::Config::Method.new get_worker_pool_config
1756
+ delete_worker_pool_config = parent_rpcs.delete_worker_pool if parent_rpcs.respond_to? :delete_worker_pool
1757
+ @delete_worker_pool = ::Gapic::Config::Method.new delete_worker_pool_config
1758
+ update_worker_pool_config = parent_rpcs.update_worker_pool if parent_rpcs.respond_to? :update_worker_pool
1759
+ @update_worker_pool = ::Gapic::Config::Method.new update_worker_pool_config
1760
+ list_worker_pools_config = parent_rpcs.list_worker_pools if parent_rpcs.respond_to? :list_worker_pools
1761
+ @list_worker_pools = ::Gapic::Config::Method.new list_worker_pools_config
1762
+
1763
+ yield self if block_given?
1764
+ end
1765
+ end
1766
+ end
1767
+ end
1768
+ end
1769
+ end
1770
+ end
1771
+ end
1772
+ end
1773
+ end