google-apis-cloudbuild_v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,834 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module CloudbuildV1
23
+ # Cloud Build API
24
+ #
25
+ # Creates and manages builds on Google Cloud Platform.
26
+ #
27
+ # @example
28
+ # require 'google/apis/cloudbuild_v1'
29
+ #
30
+ # Cloudbuild = Google::Apis::CloudbuildV1 # Alias the module
31
+ # service = Cloudbuild::CloudBuildService.new
32
+ #
33
+ # @see https://cloud.google.com/cloud-build/docs/
34
+ class CloudBuildService < Google::Apis::Core::BaseService
35
+ # @return [String]
36
+ # API key. Your API key identifies your project and provides you with API access,
37
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
38
+ attr_accessor :key
39
+
40
+ # @return [String]
41
+ # Available to use for quota purposes for server-side applications. Can be any
42
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
43
+ attr_accessor :quota_user
44
+
45
+ def initialize
46
+ super('https://cloudbuild.googleapis.com/', '',
47
+ client_name: 'google-apis-cloudbuild_v1',
48
+ client_version: Google::Apis::CloudbuildV1::GEM_VERSION)
49
+ @batch_path = 'batch'
50
+ end
51
+
52
+ # Starts asynchronous cancellation on a long-running operation. The server makes
53
+ # a best effort to cancel the operation, but success is not guaranteed. If the
54
+ # server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
55
+ # Clients can use Operations.GetOperation or other methods to check whether the
56
+ # cancellation succeeded or whether the operation completed despite cancellation.
57
+ # On successful cancellation, the operation is not deleted; instead, it becomes
58
+ # an operation with an Operation.error value with a google.rpc.Status.code of 1,
59
+ # corresponding to `Code.CANCELLED`.
60
+ # @param [String] name
61
+ # The name of the operation resource to be cancelled.
62
+ # @param [Google::Apis::CloudbuildV1::CancelOperationRequest] cancel_operation_request_object
63
+ # @param [String] fields
64
+ # Selector specifying which fields to include in a partial response.
65
+ # @param [String] quota_user
66
+ # Available to use for quota purposes for server-side applications. Can be any
67
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
68
+ # @param [Google::Apis::RequestOptions] options
69
+ # Request-specific options
70
+ #
71
+ # @yield [result, err] Result & error if block supplied
72
+ # @yieldparam result [Google::Apis::CloudbuildV1::Empty] parsed result object
73
+ # @yieldparam err [StandardError] error object if request failed
74
+ #
75
+ # @return [Google::Apis::CloudbuildV1::Empty]
76
+ #
77
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
78
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
79
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
80
+ def cancel_operation(name, cancel_operation_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
81
+ command = make_simple_command(:post, 'v1/{+name}:cancel', options)
82
+ command.request_representation = Google::Apis::CloudbuildV1::CancelOperationRequest::Representation
83
+ command.request_object = cancel_operation_request_object
84
+ command.response_representation = Google::Apis::CloudbuildV1::Empty::Representation
85
+ command.response_class = Google::Apis::CloudbuildV1::Empty
86
+ command.params['name'] = name unless name.nil?
87
+ command.query['fields'] = fields unless fields.nil?
88
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
89
+ execute_or_queue_command(command, &block)
90
+ end
91
+
92
+ # Gets the latest state of a long-running operation. Clients can use this method
93
+ # to poll the operation result at intervals as recommended by the API service.
94
+ # @param [String] name
95
+ # The name of the operation resource.
96
+ # @param [String] fields
97
+ # Selector specifying which fields to include in a partial response.
98
+ # @param [String] quota_user
99
+ # Available to use for quota purposes for server-side applications. Can be any
100
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
101
+ # @param [Google::Apis::RequestOptions] options
102
+ # Request-specific options
103
+ #
104
+ # @yield [result, err] Result & error if block supplied
105
+ # @yieldparam result [Google::Apis::CloudbuildV1::Operation] parsed result object
106
+ # @yieldparam err [StandardError] error object if request failed
107
+ #
108
+ # @return [Google::Apis::CloudbuildV1::Operation]
109
+ #
110
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
111
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
112
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
113
+ def get_operation(name, fields: nil, quota_user: nil, options: nil, &block)
114
+ command = make_simple_command(:get, 'v1/{+name}', options)
115
+ command.response_representation = Google::Apis::CloudbuildV1::Operation::Representation
116
+ command.response_class = Google::Apis::CloudbuildV1::Operation
117
+ command.params['name'] = name unless name.nil?
118
+ command.query['fields'] = fields unless fields.nil?
119
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
120
+ execute_or_queue_command(command, &block)
121
+ end
122
+
123
+ # Cancels a build in progress.
124
+ # @param [String] project_id
125
+ # Required. ID of the project.
126
+ # @param [String] id
127
+ # Required. ID of the build.
128
+ # @param [Google::Apis::CloudbuildV1::CancelBuildRequest] cancel_build_request_object
129
+ # @param [String] fields
130
+ # Selector specifying which fields to include in a partial response.
131
+ # @param [String] quota_user
132
+ # Available to use for quota purposes for server-side applications. Can be any
133
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
134
+ # @param [Google::Apis::RequestOptions] options
135
+ # Request-specific options
136
+ #
137
+ # @yield [result, err] Result & error if block supplied
138
+ # @yieldparam result [Google::Apis::CloudbuildV1::Build] parsed result object
139
+ # @yieldparam err [StandardError] error object if request failed
140
+ #
141
+ # @return [Google::Apis::CloudbuildV1::Build]
142
+ #
143
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
144
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
145
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
146
+ def cancel_build(project_id, id, cancel_build_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
147
+ command = make_simple_command(:post, 'v1/projects/{projectId}/builds/{id}:cancel', options)
148
+ command.request_representation = Google::Apis::CloudbuildV1::CancelBuildRequest::Representation
149
+ command.request_object = cancel_build_request_object
150
+ command.response_representation = Google::Apis::CloudbuildV1::Build::Representation
151
+ command.response_class = Google::Apis::CloudbuildV1::Build
152
+ command.params['projectId'] = project_id unless project_id.nil?
153
+ command.params['id'] = id unless id.nil?
154
+ command.query['fields'] = fields unless fields.nil?
155
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
156
+ execute_or_queue_command(command, &block)
157
+ end
158
+
159
+ # Starts a build with the specified configuration. This method returns a long-
160
+ # running `Operation`, which includes the build ID. Pass the build ID to `
161
+ # GetBuild` to determine the build status (such as `SUCCESS` or `FAILURE`).
162
+ # @param [String] project_id
163
+ # Required. ID of the project.
164
+ # @param [Google::Apis::CloudbuildV1::Build] build_object
165
+ # @param [String] parent
166
+ # The parent resource where this build will be created. Format: `projects/`
167
+ # project`/locations/`location``
168
+ # @param [String] fields
169
+ # Selector specifying which fields to include in a partial response.
170
+ # @param [String] quota_user
171
+ # Available to use for quota purposes for server-side applications. Can be any
172
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
173
+ # @param [Google::Apis::RequestOptions] options
174
+ # Request-specific options
175
+ #
176
+ # @yield [result, err] Result & error if block supplied
177
+ # @yieldparam result [Google::Apis::CloudbuildV1::Operation] parsed result object
178
+ # @yieldparam err [StandardError] error object if request failed
179
+ #
180
+ # @return [Google::Apis::CloudbuildV1::Operation]
181
+ #
182
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
183
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
184
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
185
+ def create_project_build(project_id, build_object = nil, parent: nil, fields: nil, quota_user: nil, options: nil, &block)
186
+ command = make_simple_command(:post, 'v1/projects/{projectId}/builds', options)
187
+ command.request_representation = Google::Apis::CloudbuildV1::Build::Representation
188
+ command.request_object = build_object
189
+ command.response_representation = Google::Apis::CloudbuildV1::Operation::Representation
190
+ command.response_class = Google::Apis::CloudbuildV1::Operation
191
+ command.params['projectId'] = project_id unless project_id.nil?
192
+ command.query['parent'] = parent unless parent.nil?
193
+ command.query['fields'] = fields unless fields.nil?
194
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
195
+ execute_or_queue_command(command, &block)
196
+ end
197
+
198
+ # Returns information about a previously requested build. The `Build` that is
199
+ # returned includes its status (such as `SUCCESS`, `FAILURE`, or `WORKING`), and
200
+ # timing information.
201
+ # @param [String] project_id
202
+ # Required. ID of the project.
203
+ # @param [String] id
204
+ # Required. ID of the build.
205
+ # @param [String] name
206
+ # The name of the `Build` to retrieve. Format: `projects/`project`/locations/`
207
+ # location`/builds/`build``
208
+ # @param [String] fields
209
+ # Selector specifying which fields to include in a partial response.
210
+ # @param [String] quota_user
211
+ # Available to use for quota purposes for server-side applications. Can be any
212
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
213
+ # @param [Google::Apis::RequestOptions] options
214
+ # Request-specific options
215
+ #
216
+ # @yield [result, err] Result & error if block supplied
217
+ # @yieldparam result [Google::Apis::CloudbuildV1::Build] parsed result object
218
+ # @yieldparam err [StandardError] error object if request failed
219
+ #
220
+ # @return [Google::Apis::CloudbuildV1::Build]
221
+ #
222
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
223
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
224
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
225
+ def get_project_build(project_id, id, name: nil, fields: nil, quota_user: nil, options: nil, &block)
226
+ command = make_simple_command(:get, 'v1/projects/{projectId}/builds/{id}', options)
227
+ command.response_representation = Google::Apis::CloudbuildV1::Build::Representation
228
+ command.response_class = Google::Apis::CloudbuildV1::Build
229
+ command.params['projectId'] = project_id unless project_id.nil?
230
+ command.params['id'] = id unless id.nil?
231
+ command.query['name'] = name unless name.nil?
232
+ command.query['fields'] = fields unless fields.nil?
233
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
234
+ execute_or_queue_command(command, &block)
235
+ end
236
+
237
+ # Lists previously requested builds. Previously requested builds may still be in-
238
+ # progress, or may have finished successfully or unsuccessfully.
239
+ # @param [String] project_id
240
+ # Required. ID of the project.
241
+ # @param [String] filter
242
+ # The raw filter text to constrain the results.
243
+ # @param [Fixnum] page_size
244
+ # Number of results to return in the list.
245
+ # @param [String] page_token
246
+ # The page token for the next page of Builds. If unspecified, the first page of
247
+ # results is returned. If the token is rejected for any reason, INVALID_ARGUMENT
248
+ # will be thrown. In this case, the token should be discarded, and pagination
249
+ # should be restarted from the first page of results. See https://google.aip.dev/
250
+ # 158 for more.
251
+ # @param [String] parent
252
+ # The parent of the collection of `Builds`. Format: `projects/`project`/
253
+ # locations/location`
254
+ # @param [String] fields
255
+ # Selector specifying which fields to include in a partial response.
256
+ # @param [String] quota_user
257
+ # Available to use for quota purposes for server-side applications. Can be any
258
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
259
+ # @param [Google::Apis::RequestOptions] options
260
+ # Request-specific options
261
+ #
262
+ # @yield [result, err] Result & error if block supplied
263
+ # @yieldparam result [Google::Apis::CloudbuildV1::ListBuildsResponse] parsed result object
264
+ # @yieldparam err [StandardError] error object if request failed
265
+ #
266
+ # @return [Google::Apis::CloudbuildV1::ListBuildsResponse]
267
+ #
268
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
269
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
270
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
271
+ def list_project_builds(project_id, filter: nil, page_size: nil, page_token: nil, parent: nil, fields: nil, quota_user: nil, options: nil, &block)
272
+ command = make_simple_command(:get, 'v1/projects/{projectId}/builds', options)
273
+ command.response_representation = Google::Apis::CloudbuildV1::ListBuildsResponse::Representation
274
+ command.response_class = Google::Apis::CloudbuildV1::ListBuildsResponse
275
+ command.params['projectId'] = project_id unless project_id.nil?
276
+ command.query['filter'] = filter unless filter.nil?
277
+ command.query['pageSize'] = page_size unless page_size.nil?
278
+ command.query['pageToken'] = page_token unless page_token.nil?
279
+ command.query['parent'] = parent unless parent.nil?
280
+ command.query['fields'] = fields unless fields.nil?
281
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
282
+ execute_or_queue_command(command, &block)
283
+ end
284
+
285
+ # Creates a new build based on the specified build. This method creates a new
286
+ # build using the original build request, which may or may not result in an
287
+ # identical build. For triggered builds: * Triggered builds resolve to a precise
288
+ # revision; therefore a retry of a triggered build will result in a build that
289
+ # uses the same revision. For non-triggered builds that specify `RepoSource`: *
290
+ # If the original build built from the tip of a branch, the retried build will
291
+ # build from the tip of that branch, which may not be the same revision as the
292
+ # original build. * If the original build specified a commit sha or revision ID,
293
+ # the retried build will use the identical source. For builds that specify `
294
+ # StorageSource`: * If the original build pulled source from Google Cloud
295
+ # Storage without specifying the generation of the object, the new build will
296
+ # use the current object, which may be different from the original build source.
297
+ # * If the original build pulled source from Cloud Storage and specified the
298
+ # generation of the object, the new build will attempt to use the same object,
299
+ # which may or may not be available depending on the bucket's lifecycle
300
+ # management settings.
301
+ # @param [String] project_id
302
+ # Required. ID of the project.
303
+ # @param [String] id
304
+ # Required. Build ID of the original build.
305
+ # @param [Google::Apis::CloudbuildV1::RetryBuildRequest] retry_build_request_object
306
+ # @param [String] fields
307
+ # Selector specifying which fields to include in a partial response.
308
+ # @param [String] quota_user
309
+ # Available to use for quota purposes for server-side applications. Can be any
310
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
311
+ # @param [Google::Apis::RequestOptions] options
312
+ # Request-specific options
313
+ #
314
+ # @yield [result, err] Result & error if block supplied
315
+ # @yieldparam result [Google::Apis::CloudbuildV1::Operation] parsed result object
316
+ # @yieldparam err [StandardError] error object if request failed
317
+ #
318
+ # @return [Google::Apis::CloudbuildV1::Operation]
319
+ #
320
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
321
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
322
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
323
+ def retry_build(project_id, id, retry_build_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
324
+ command = make_simple_command(:post, 'v1/projects/{projectId}/builds/{id}:retry', options)
325
+ command.request_representation = Google::Apis::CloudbuildV1::RetryBuildRequest::Representation
326
+ command.request_object = retry_build_request_object
327
+ command.response_representation = Google::Apis::CloudbuildV1::Operation::Representation
328
+ command.response_class = Google::Apis::CloudbuildV1::Operation
329
+ command.params['projectId'] = project_id unless project_id.nil?
330
+ command.params['id'] = id unless id.nil?
331
+ command.query['fields'] = fields unless fields.nil?
332
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
333
+ execute_or_queue_command(command, &block)
334
+ end
335
+
336
+ # Cancels a build in progress.
337
+ # @param [String] name
338
+ # The name of the `Build` to cancel. Format: `projects/`project`/locations/`
339
+ # location`/builds/`build``
340
+ # @param [Google::Apis::CloudbuildV1::CancelBuildRequest] cancel_build_request_object
341
+ # @param [String] fields
342
+ # Selector specifying which fields to include in a partial response.
343
+ # @param [String] quota_user
344
+ # Available to use for quota purposes for server-side applications. Can be any
345
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
346
+ # @param [Google::Apis::RequestOptions] options
347
+ # Request-specific options
348
+ #
349
+ # @yield [result, err] Result & error if block supplied
350
+ # @yieldparam result [Google::Apis::CloudbuildV1::Build] parsed result object
351
+ # @yieldparam err [StandardError] error object if request failed
352
+ #
353
+ # @return [Google::Apis::CloudbuildV1::Build]
354
+ #
355
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
356
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
357
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
358
+ def cancel_project_location_build(name, cancel_build_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
359
+ command = make_simple_command(:post, 'v1/{+name}:cancel', options)
360
+ command.request_representation = Google::Apis::CloudbuildV1::CancelBuildRequest::Representation
361
+ command.request_object = cancel_build_request_object
362
+ command.response_representation = Google::Apis::CloudbuildV1::Build::Representation
363
+ command.response_class = Google::Apis::CloudbuildV1::Build
364
+ command.params['name'] = name unless name.nil?
365
+ command.query['fields'] = fields unless fields.nil?
366
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
367
+ execute_or_queue_command(command, &block)
368
+ end
369
+
370
+ # Starts a build with the specified configuration. This method returns a long-
371
+ # running `Operation`, which includes the build ID. Pass the build ID to `
372
+ # GetBuild` to determine the build status (such as `SUCCESS` or `FAILURE`).
373
+ # @param [String] parent
374
+ # The parent resource where this build will be created. Format: `projects/`
375
+ # project`/locations/`location``
376
+ # @param [Google::Apis::CloudbuildV1::Build] build_object
377
+ # @param [String] project_id
378
+ # Required. ID of the project.
379
+ # @param [String] fields
380
+ # Selector specifying which fields to include in a partial response.
381
+ # @param [String] quota_user
382
+ # Available to use for quota purposes for server-side applications. Can be any
383
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
384
+ # @param [Google::Apis::RequestOptions] options
385
+ # Request-specific options
386
+ #
387
+ # @yield [result, err] Result & error if block supplied
388
+ # @yieldparam result [Google::Apis::CloudbuildV1::Operation] parsed result object
389
+ # @yieldparam err [StandardError] error object if request failed
390
+ #
391
+ # @return [Google::Apis::CloudbuildV1::Operation]
392
+ #
393
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
394
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
395
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
396
+ def create_build(parent, build_object = nil, project_id: nil, fields: nil, quota_user: nil, options: nil, &block)
397
+ command = make_simple_command(:post, 'v1/{+parent}/builds', options)
398
+ command.request_representation = Google::Apis::CloudbuildV1::Build::Representation
399
+ command.request_object = build_object
400
+ command.response_representation = Google::Apis::CloudbuildV1::Operation::Representation
401
+ command.response_class = Google::Apis::CloudbuildV1::Operation
402
+ command.params['parent'] = parent unless parent.nil?
403
+ command.query['projectId'] = project_id unless project_id.nil?
404
+ command.query['fields'] = fields unless fields.nil?
405
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
406
+ execute_or_queue_command(command, &block)
407
+ end
408
+
409
+ # Returns information about a previously requested build. The `Build` that is
410
+ # returned includes its status (such as `SUCCESS`, `FAILURE`, or `WORKING`), and
411
+ # timing information.
412
+ # @param [String] name
413
+ # The name of the `Build` to retrieve. Format: `projects/`project`/locations/`
414
+ # location`/builds/`build``
415
+ # @param [String] id
416
+ # Required. ID of the build.
417
+ # @param [String] project_id
418
+ # Required. ID of the project.
419
+ # @param [String] fields
420
+ # Selector specifying which fields to include in a partial response.
421
+ # @param [String] quota_user
422
+ # Available to use for quota purposes for server-side applications. Can be any
423
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
424
+ # @param [Google::Apis::RequestOptions] options
425
+ # Request-specific options
426
+ #
427
+ # @yield [result, err] Result & error if block supplied
428
+ # @yieldparam result [Google::Apis::CloudbuildV1::Build] parsed result object
429
+ # @yieldparam err [StandardError] error object if request failed
430
+ #
431
+ # @return [Google::Apis::CloudbuildV1::Build]
432
+ #
433
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
434
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
435
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
436
+ def get_project_location_build(name, id: nil, project_id: nil, fields: nil, quota_user: nil, options: nil, &block)
437
+ command = make_simple_command(:get, 'v1/{+name}', options)
438
+ command.response_representation = Google::Apis::CloudbuildV1::Build::Representation
439
+ command.response_class = Google::Apis::CloudbuildV1::Build
440
+ command.params['name'] = name unless name.nil?
441
+ command.query['id'] = id unless id.nil?
442
+ command.query['projectId'] = project_id unless project_id.nil?
443
+ command.query['fields'] = fields unless fields.nil?
444
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
445
+ execute_or_queue_command(command, &block)
446
+ end
447
+
448
+ # Lists previously requested builds. Previously requested builds may still be in-
449
+ # progress, or may have finished successfully or unsuccessfully.
450
+ # @param [String] parent
451
+ # The parent of the collection of `Builds`. Format: `projects/`project`/
452
+ # locations/location`
453
+ # @param [String] filter
454
+ # The raw filter text to constrain the results.
455
+ # @param [Fixnum] page_size
456
+ # Number of results to return in the list.
457
+ # @param [String] page_token
458
+ # The page token for the next page of Builds. If unspecified, the first page of
459
+ # results is returned. If the token is rejected for any reason, INVALID_ARGUMENT
460
+ # will be thrown. In this case, the token should be discarded, and pagination
461
+ # should be restarted from the first page of results. See https://google.aip.dev/
462
+ # 158 for more.
463
+ # @param [String] project_id
464
+ # Required. ID of the project.
465
+ # @param [String] fields
466
+ # Selector specifying which fields to include in a partial response.
467
+ # @param [String] quota_user
468
+ # Available to use for quota purposes for server-side applications. Can be any
469
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
470
+ # @param [Google::Apis::RequestOptions] options
471
+ # Request-specific options
472
+ #
473
+ # @yield [result, err] Result & error if block supplied
474
+ # @yieldparam result [Google::Apis::CloudbuildV1::ListBuildsResponse] parsed result object
475
+ # @yieldparam err [StandardError] error object if request failed
476
+ #
477
+ # @return [Google::Apis::CloudbuildV1::ListBuildsResponse]
478
+ #
479
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
480
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
481
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
482
+ def list_project_location_builds(parent, filter: nil, page_size: nil, page_token: nil, project_id: nil, fields: nil, quota_user: nil, options: nil, &block)
483
+ command = make_simple_command(:get, 'v1/{+parent}/builds', options)
484
+ command.response_representation = Google::Apis::CloudbuildV1::ListBuildsResponse::Representation
485
+ command.response_class = Google::Apis::CloudbuildV1::ListBuildsResponse
486
+ command.params['parent'] = parent unless parent.nil?
487
+ command.query['filter'] = filter unless filter.nil?
488
+ command.query['pageSize'] = page_size unless page_size.nil?
489
+ command.query['pageToken'] = page_token unless page_token.nil?
490
+ command.query['projectId'] = project_id unless project_id.nil?
491
+ command.query['fields'] = fields unless fields.nil?
492
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
493
+ execute_or_queue_command(command, &block)
494
+ end
495
+
496
+ # Creates a new build based on the specified build. This method creates a new
497
+ # build using the original build request, which may or may not result in an
498
+ # identical build. For triggered builds: * Triggered builds resolve to a precise
499
+ # revision; therefore a retry of a triggered build will result in a build that
500
+ # uses the same revision. For non-triggered builds that specify `RepoSource`: *
501
+ # If the original build built from the tip of a branch, the retried build will
502
+ # build from the tip of that branch, which may not be the same revision as the
503
+ # original build. * If the original build specified a commit sha or revision ID,
504
+ # the retried build will use the identical source. For builds that specify `
505
+ # StorageSource`: * If the original build pulled source from Google Cloud
506
+ # Storage without specifying the generation of the object, the new build will
507
+ # use the current object, which may be different from the original build source.
508
+ # * If the original build pulled source from Cloud Storage and specified the
509
+ # generation of the object, the new build will attempt to use the same object,
510
+ # which may or may not be available depending on the bucket's lifecycle
511
+ # management settings.
512
+ # @param [String] name
513
+ # The name of the `Build` to retry. Format: `projects/`project`/locations/`
514
+ # location`/builds/`build``
515
+ # @param [Google::Apis::CloudbuildV1::RetryBuildRequest] retry_build_request_object
516
+ # @param [String] fields
517
+ # Selector specifying which fields to include in a partial response.
518
+ # @param [String] quota_user
519
+ # Available to use for quota purposes for server-side applications. Can be any
520
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
521
+ # @param [Google::Apis::RequestOptions] options
522
+ # Request-specific options
523
+ #
524
+ # @yield [result, err] Result & error if block supplied
525
+ # @yieldparam result [Google::Apis::CloudbuildV1::Operation] parsed result object
526
+ # @yieldparam err [StandardError] error object if request failed
527
+ #
528
+ # @return [Google::Apis::CloudbuildV1::Operation]
529
+ #
530
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
531
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
532
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
533
+ def retry_project_location_build(name, retry_build_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
534
+ command = make_simple_command(:post, 'v1/{+name}:retry', options)
535
+ command.request_representation = Google::Apis::CloudbuildV1::RetryBuildRequest::Representation
536
+ command.request_object = retry_build_request_object
537
+ command.response_representation = Google::Apis::CloudbuildV1::Operation::Representation
538
+ command.response_class = Google::Apis::CloudbuildV1::Operation
539
+ command.params['name'] = name unless name.nil?
540
+ command.query['fields'] = fields unless fields.nil?
541
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
542
+ execute_or_queue_command(command, &block)
543
+ end
544
+
545
+ # Starts asynchronous cancellation on a long-running operation. The server makes
546
+ # a best effort to cancel the operation, but success is not guaranteed. If the
547
+ # server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
548
+ # Clients can use Operations.GetOperation or other methods to check whether the
549
+ # cancellation succeeded or whether the operation completed despite cancellation.
550
+ # On successful cancellation, the operation is not deleted; instead, it becomes
551
+ # an operation with an Operation.error value with a google.rpc.Status.code of 1,
552
+ # corresponding to `Code.CANCELLED`.
553
+ # @param [String] name
554
+ # The name of the operation resource to be cancelled.
555
+ # @param [Google::Apis::CloudbuildV1::CancelOperationRequest] cancel_operation_request_object
556
+ # @param [String] fields
557
+ # Selector specifying which fields to include in a partial response.
558
+ # @param [String] quota_user
559
+ # Available to use for quota purposes for server-side applications. Can be any
560
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
561
+ # @param [Google::Apis::RequestOptions] options
562
+ # Request-specific options
563
+ #
564
+ # @yield [result, err] Result & error if block supplied
565
+ # @yieldparam result [Google::Apis::CloudbuildV1::Empty] parsed result object
566
+ # @yieldparam err [StandardError] error object if request failed
567
+ #
568
+ # @return [Google::Apis::CloudbuildV1::Empty]
569
+ #
570
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
571
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
572
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
573
+ def cancel_project_location_operation(name, cancel_operation_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
574
+ command = make_simple_command(:post, 'v1/{+name}:cancel', options)
575
+ command.request_representation = Google::Apis::CloudbuildV1::CancelOperationRequest::Representation
576
+ command.request_object = cancel_operation_request_object
577
+ command.response_representation = Google::Apis::CloudbuildV1::Empty::Representation
578
+ command.response_class = Google::Apis::CloudbuildV1::Empty
579
+ command.params['name'] = name unless name.nil?
580
+ command.query['fields'] = fields unless fields.nil?
581
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
582
+ execute_or_queue_command(command, &block)
583
+ end
584
+
585
+ # Gets the latest state of a long-running operation. Clients can use this method
586
+ # to poll the operation result at intervals as recommended by the API service.
587
+ # @param [String] name
588
+ # The name of the operation resource.
589
+ # @param [String] fields
590
+ # Selector specifying which fields to include in a partial response.
591
+ # @param [String] quota_user
592
+ # Available to use for quota purposes for server-side applications. Can be any
593
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
594
+ # @param [Google::Apis::RequestOptions] options
595
+ # Request-specific options
596
+ #
597
+ # @yield [result, err] Result & error if block supplied
598
+ # @yieldparam result [Google::Apis::CloudbuildV1::Operation] parsed result object
599
+ # @yieldparam err [StandardError] error object if request failed
600
+ #
601
+ # @return [Google::Apis::CloudbuildV1::Operation]
602
+ #
603
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
604
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
605
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
606
+ def get_project_location_operation(name, fields: nil, quota_user: nil, options: nil, &block)
607
+ command = make_simple_command(:get, 'v1/{+name}', options)
608
+ command.response_representation = Google::Apis::CloudbuildV1::Operation::Representation
609
+ command.response_class = Google::Apis::CloudbuildV1::Operation
610
+ command.params['name'] = name unless name.nil?
611
+ command.query['fields'] = fields unless fields.nil?
612
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
613
+ execute_or_queue_command(command, &block)
614
+ end
615
+
616
+ # Creates a new `BuildTrigger`. This API is experimental.
617
+ # @param [String] project_id
618
+ # Required. ID of the project for which to configure automatic builds.
619
+ # @param [Google::Apis::CloudbuildV1::BuildTrigger] build_trigger_object
620
+ # @param [String] fields
621
+ # Selector specifying which fields to include in a partial response.
622
+ # @param [String] quota_user
623
+ # Available to use for quota purposes for server-side applications. Can be any
624
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
625
+ # @param [Google::Apis::RequestOptions] options
626
+ # Request-specific options
627
+ #
628
+ # @yield [result, err] Result & error if block supplied
629
+ # @yieldparam result [Google::Apis::CloudbuildV1::BuildTrigger] parsed result object
630
+ # @yieldparam err [StandardError] error object if request failed
631
+ #
632
+ # @return [Google::Apis::CloudbuildV1::BuildTrigger]
633
+ #
634
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
635
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
636
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
637
+ def create_project_trigger(project_id, build_trigger_object = nil, fields: nil, quota_user: nil, options: nil, &block)
638
+ command = make_simple_command(:post, 'v1/projects/{projectId}/triggers', options)
639
+ command.request_representation = Google::Apis::CloudbuildV1::BuildTrigger::Representation
640
+ command.request_object = build_trigger_object
641
+ command.response_representation = Google::Apis::CloudbuildV1::BuildTrigger::Representation
642
+ command.response_class = Google::Apis::CloudbuildV1::BuildTrigger
643
+ command.params['projectId'] = project_id unless project_id.nil?
644
+ command.query['fields'] = fields unless fields.nil?
645
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
646
+ execute_or_queue_command(command, &block)
647
+ end
648
+
649
+ # Deletes a `BuildTrigger` by its project ID and trigger ID. This API is
650
+ # experimental.
651
+ # @param [String] project_id
652
+ # Required. ID of the project that owns the trigger.
653
+ # @param [String] trigger_id
654
+ # Required. ID of the `BuildTrigger` to delete.
655
+ # @param [String] fields
656
+ # Selector specifying which fields to include in a partial response.
657
+ # @param [String] quota_user
658
+ # Available to use for quota purposes for server-side applications. Can be any
659
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
660
+ # @param [Google::Apis::RequestOptions] options
661
+ # Request-specific options
662
+ #
663
+ # @yield [result, err] Result & error if block supplied
664
+ # @yieldparam result [Google::Apis::CloudbuildV1::Empty] parsed result object
665
+ # @yieldparam err [StandardError] error object if request failed
666
+ #
667
+ # @return [Google::Apis::CloudbuildV1::Empty]
668
+ #
669
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
670
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
671
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
672
+ def delete_project_trigger(project_id, trigger_id, fields: nil, quota_user: nil, options: nil, &block)
673
+ command = make_simple_command(:delete, 'v1/projects/{projectId}/triggers/{triggerId}', options)
674
+ command.response_representation = Google::Apis::CloudbuildV1::Empty::Representation
675
+ command.response_class = Google::Apis::CloudbuildV1::Empty
676
+ command.params['projectId'] = project_id unless project_id.nil?
677
+ command.params['triggerId'] = trigger_id unless trigger_id.nil?
678
+ command.query['fields'] = fields unless fields.nil?
679
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
680
+ execute_or_queue_command(command, &block)
681
+ end
682
+
683
+ # Returns information about a `BuildTrigger`. This API is experimental.
684
+ # @param [String] project_id
685
+ # Required. ID of the project that owns the trigger.
686
+ # @param [String] trigger_id
687
+ # Required. Identifier (`id` or `name`) of the `BuildTrigger` to get.
688
+ # @param [String] fields
689
+ # Selector specifying which fields to include in a partial response.
690
+ # @param [String] quota_user
691
+ # Available to use for quota purposes for server-side applications. Can be any
692
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
693
+ # @param [Google::Apis::RequestOptions] options
694
+ # Request-specific options
695
+ #
696
+ # @yield [result, err] Result & error if block supplied
697
+ # @yieldparam result [Google::Apis::CloudbuildV1::BuildTrigger] parsed result object
698
+ # @yieldparam err [StandardError] error object if request failed
699
+ #
700
+ # @return [Google::Apis::CloudbuildV1::BuildTrigger]
701
+ #
702
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
703
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
704
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
705
+ def get_project_trigger(project_id, trigger_id, fields: nil, quota_user: nil, options: nil, &block)
706
+ command = make_simple_command(:get, 'v1/projects/{projectId}/triggers/{triggerId}', options)
707
+ command.response_representation = Google::Apis::CloudbuildV1::BuildTrigger::Representation
708
+ command.response_class = Google::Apis::CloudbuildV1::BuildTrigger
709
+ command.params['projectId'] = project_id unless project_id.nil?
710
+ command.params['triggerId'] = trigger_id unless trigger_id.nil?
711
+ command.query['fields'] = fields unless fields.nil?
712
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
713
+ execute_or_queue_command(command, &block)
714
+ end
715
+
716
+ # Lists existing `BuildTrigger`s. This API is experimental.
717
+ # @param [String] project_id
718
+ # Required. ID of the project for which to list BuildTriggers.
719
+ # @param [Fixnum] page_size
720
+ # Number of results to return in the list.
721
+ # @param [String] page_token
722
+ # Token to provide to skip to a particular spot in the list.
723
+ # @param [String] fields
724
+ # Selector specifying which fields to include in a partial response.
725
+ # @param [String] quota_user
726
+ # Available to use for quota purposes for server-side applications. Can be any
727
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
728
+ # @param [Google::Apis::RequestOptions] options
729
+ # Request-specific options
730
+ #
731
+ # @yield [result, err] Result & error if block supplied
732
+ # @yieldparam result [Google::Apis::CloudbuildV1::ListBuildTriggersResponse] parsed result object
733
+ # @yieldparam err [StandardError] error object if request failed
734
+ #
735
+ # @return [Google::Apis::CloudbuildV1::ListBuildTriggersResponse]
736
+ #
737
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
738
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
739
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
740
+ def list_project_triggers(project_id, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
741
+ command = make_simple_command(:get, 'v1/projects/{projectId}/triggers', options)
742
+ command.response_representation = Google::Apis::CloudbuildV1::ListBuildTriggersResponse::Representation
743
+ command.response_class = Google::Apis::CloudbuildV1::ListBuildTriggersResponse
744
+ command.params['projectId'] = project_id unless project_id.nil?
745
+ command.query['pageSize'] = page_size unless page_size.nil?
746
+ command.query['pageToken'] = page_token unless page_token.nil?
747
+ command.query['fields'] = fields unless fields.nil?
748
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
749
+ execute_or_queue_command(command, &block)
750
+ end
751
+
752
+ # Updates a `BuildTrigger` by its project ID and trigger ID. This API is
753
+ # experimental.
754
+ # @param [String] project_id
755
+ # Required. ID of the project that owns the trigger.
756
+ # @param [String] trigger_id
757
+ # Required. ID of the `BuildTrigger` to update.
758
+ # @param [Google::Apis::CloudbuildV1::BuildTrigger] build_trigger_object
759
+ # @param [String] fields
760
+ # Selector specifying which fields to include in a partial response.
761
+ # @param [String] quota_user
762
+ # Available to use for quota purposes for server-side applications. Can be any
763
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
764
+ # @param [Google::Apis::RequestOptions] options
765
+ # Request-specific options
766
+ #
767
+ # @yield [result, err] Result & error if block supplied
768
+ # @yieldparam result [Google::Apis::CloudbuildV1::BuildTrigger] parsed result object
769
+ # @yieldparam err [StandardError] error object if request failed
770
+ #
771
+ # @return [Google::Apis::CloudbuildV1::BuildTrigger]
772
+ #
773
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
774
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
775
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
776
+ def patch_project_trigger(project_id, trigger_id, build_trigger_object = nil, fields: nil, quota_user: nil, options: nil, &block)
777
+ command = make_simple_command(:patch, 'v1/projects/{projectId}/triggers/{triggerId}', options)
778
+ command.request_representation = Google::Apis::CloudbuildV1::BuildTrigger::Representation
779
+ command.request_object = build_trigger_object
780
+ command.response_representation = Google::Apis::CloudbuildV1::BuildTrigger::Representation
781
+ command.response_class = Google::Apis::CloudbuildV1::BuildTrigger
782
+ command.params['projectId'] = project_id unless project_id.nil?
783
+ command.params['triggerId'] = trigger_id unless trigger_id.nil?
784
+ command.query['fields'] = fields unless fields.nil?
785
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
786
+ execute_or_queue_command(command, &block)
787
+ end
788
+
789
+ # Runs a `BuildTrigger` at a particular source revision.
790
+ # @param [String] project_id
791
+ # Required. ID of the project.
792
+ # @param [String] trigger_id
793
+ # Required. ID of the trigger.
794
+ # @param [Google::Apis::CloudbuildV1::RepoSource] repo_source_object
795
+ # @param [String] fields
796
+ # Selector specifying which fields to include in a partial response.
797
+ # @param [String] quota_user
798
+ # Available to use for quota purposes for server-side applications. Can be any
799
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
800
+ # @param [Google::Apis::RequestOptions] options
801
+ # Request-specific options
802
+ #
803
+ # @yield [result, err] Result & error if block supplied
804
+ # @yieldparam result [Google::Apis::CloudbuildV1::Operation] parsed result object
805
+ # @yieldparam err [StandardError] error object if request failed
806
+ #
807
+ # @return [Google::Apis::CloudbuildV1::Operation]
808
+ #
809
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
810
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
811
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
812
+ def run_project_trigger(project_id, trigger_id, repo_source_object = nil, fields: nil, quota_user: nil, options: nil, &block)
813
+ command = make_simple_command(:post, 'v1/projects/{projectId}/triggers/{triggerId}:run', options)
814
+ command.request_representation = Google::Apis::CloudbuildV1::RepoSource::Representation
815
+ command.request_object = repo_source_object
816
+ command.response_representation = Google::Apis::CloudbuildV1::Operation::Representation
817
+ command.response_class = Google::Apis::CloudbuildV1::Operation
818
+ command.params['projectId'] = project_id unless project_id.nil?
819
+ command.params['triggerId'] = trigger_id unless trigger_id.nil?
820
+ command.query['fields'] = fields unless fields.nil?
821
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
822
+ execute_or_queue_command(command, &block)
823
+ end
824
+
825
+ protected
826
+
827
+ def apply_command_defaults(command)
828
+ command.query['key'] = key unless key.nil?
829
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
830
+ end
831
+ end
832
+ end
833
+ end
834
+ end