google-cloud-build-v1 0.1.1

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