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