google-cloud-build-v1 0.9.2 → 0.11.2

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.
@@ -254,6 +254,28 @@ module Google
254
254
  #
255
255
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
256
256
  #
257
+ # @example Basic example
258
+ # require "google/cloud/build/v1"
259
+ #
260
+ # # Create a client object. The client can be reused for multiple calls.
261
+ # client = Google::Cloud::Build::V1::CloudBuild::Client.new
262
+ #
263
+ # # Create a request. To set request fields, pass in keyword arguments.
264
+ # request = Google::Cloud::Build::V1::CreateBuildRequest.new
265
+ #
266
+ # # Call the create_build method.
267
+ # result = client.create_build request
268
+ #
269
+ # # The returned object is of type Gapic::Operation. You can use this
270
+ # # object to check the status of an operation, cancel it, or wait
271
+ # # for results. Here is how to block until completion:
272
+ # result.wait_until_done! timeout: 60
273
+ # if result.response?
274
+ # p result.response
275
+ # else
276
+ # puts "Error!"
277
+ # end
278
+ #
257
279
  def create_build request, options = nil
258
280
  raise ::ArgumentError, "request must be provided" if request.nil?
259
281
 
@@ -271,9 +293,11 @@ module Google
271
293
  gapic_version: ::Google::Cloud::Build::V1::VERSION
272
294
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
273
295
 
274
- header_params = {
275
- "project_id" => request.project_id
276
- }
296
+ header_params = {}
297
+ if request.project_id
298
+ header_params["project_id"] = request.project_id
299
+ end
300
+
277
301
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
278
302
  metadata[:"x-goog-request-params"] ||= request_params_header
279
303
 
@@ -331,6 +355,21 @@ module Google
331
355
  #
332
356
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
333
357
  #
358
+ # @example Basic example
359
+ # require "google/cloud/build/v1"
360
+ #
361
+ # # Create a client object. The client can be reused for multiple calls.
362
+ # client = Google::Cloud::Build::V1::CloudBuild::Client.new
363
+ #
364
+ # # Create a request. To set request fields, pass in keyword arguments.
365
+ # request = Google::Cloud::Build::V1::GetBuildRequest.new
366
+ #
367
+ # # Call the get_build method.
368
+ # result = client.get_build request
369
+ #
370
+ # # The returned object is of type Google::Cloud::Build::V1::Build.
371
+ # p result
372
+ #
334
373
  def get_build request, options = nil
335
374
  raise ::ArgumentError, "request must be provided" if request.nil?
336
375
 
@@ -348,10 +387,14 @@ module Google
348
387
  gapic_version: ::Google::Cloud::Build::V1::VERSION
349
388
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
350
389
 
351
- header_params = {
352
- "project_id" => request.project_id,
353
- "id" => request.id
354
- }
390
+ header_params = {}
391
+ if request.project_id
392
+ header_params["project_id"] = request.project_id
393
+ end
394
+ if request.id
395
+ header_params["id"] = request.id
396
+ end
397
+
355
398
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
356
399
  metadata[:"x-goog-request-params"] ||= request_params_header
357
400
 
@@ -420,6 +463,27 @@ module Google
420
463
  #
421
464
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
422
465
  #
466
+ # @example Basic example
467
+ # require "google/cloud/build/v1"
468
+ #
469
+ # # Create a client object. The client can be reused for multiple calls.
470
+ # client = Google::Cloud::Build::V1::CloudBuild::Client.new
471
+ #
472
+ # # Create a request. To set request fields, pass in keyword arguments.
473
+ # request = Google::Cloud::Build::V1::ListBuildsRequest.new
474
+ #
475
+ # # Call the list_builds method.
476
+ # result = client.list_builds request
477
+ #
478
+ # # The returned object is of type Gapic::PagedEnumerable. You can
479
+ # # iterate over all elements by calling #each, and the enumerable
480
+ # # will lazily make API calls to fetch subsequent pages. Other
481
+ # # methods are also available for managing paging directly.
482
+ # result.each do |response|
483
+ # # Each element is of type ::Google::Cloud::Build::V1::Build.
484
+ # p response
485
+ # end
486
+ #
423
487
  def list_builds request, options = nil
424
488
  raise ::ArgumentError, "request must be provided" if request.nil?
425
489
 
@@ -437,9 +501,11 @@ module Google
437
501
  gapic_version: ::Google::Cloud::Build::V1::VERSION
438
502
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
439
503
 
440
- header_params = {
441
- "project_id" => request.project_id
442
- }
504
+ header_params = {}
505
+ if request.project_id
506
+ header_params["project_id"] = request.project_id
507
+ end
508
+
443
509
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
444
510
  metadata[:"x-goog-request-params"] ||= request_params_header
445
511
 
@@ -494,6 +560,21 @@ module Google
494
560
  #
495
561
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
496
562
  #
563
+ # @example Basic example
564
+ # require "google/cloud/build/v1"
565
+ #
566
+ # # Create a client object. The client can be reused for multiple calls.
567
+ # client = Google::Cloud::Build::V1::CloudBuild::Client.new
568
+ #
569
+ # # Create a request. To set request fields, pass in keyword arguments.
570
+ # request = Google::Cloud::Build::V1::CancelBuildRequest.new
571
+ #
572
+ # # Call the cancel_build method.
573
+ # result = client.cancel_build request
574
+ #
575
+ # # The returned object is of type Google::Cloud::Build::V1::Build.
576
+ # p result
577
+ #
497
578
  def cancel_build request, options = nil
498
579
  raise ::ArgumentError, "request must be provided" if request.nil?
499
580
 
@@ -511,10 +592,14 @@ module Google
511
592
  gapic_version: ::Google::Cloud::Build::V1::VERSION
512
593
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
513
594
 
514
- header_params = {
515
- "project_id" => request.project_id,
516
- "id" => request.id
517
- }
595
+ header_params = {}
596
+ if request.project_id
597
+ header_params["project_id"] = request.project_id
598
+ end
599
+ if request.id
600
+ header_params["id"] = request.id
601
+ end
602
+
518
603
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
519
604
  metadata[:"x-goog-request-params"] ||= request_params_header
520
605
 
@@ -594,6 +679,28 @@ module Google
594
679
  #
595
680
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
596
681
  #
682
+ # @example Basic example
683
+ # require "google/cloud/build/v1"
684
+ #
685
+ # # Create a client object. The client can be reused for multiple calls.
686
+ # client = Google::Cloud::Build::V1::CloudBuild::Client.new
687
+ #
688
+ # # Create a request. To set request fields, pass in keyword arguments.
689
+ # request = Google::Cloud::Build::V1::RetryBuildRequest.new
690
+ #
691
+ # # Call the retry_build method.
692
+ # result = client.retry_build request
693
+ #
694
+ # # The returned object is of type Gapic::Operation. You can use this
695
+ # # object to check the status of an operation, cancel it, or wait
696
+ # # for results. Here is how to block until completion:
697
+ # result.wait_until_done! timeout: 60
698
+ # if result.response?
699
+ # p result.response
700
+ # else
701
+ # puts "Error!"
702
+ # end
703
+ #
597
704
  def retry_build request, options = nil
598
705
  raise ::ArgumentError, "request must be provided" if request.nil?
599
706
 
@@ -611,10 +718,14 @@ module Google
611
718
  gapic_version: ::Google::Cloud::Build::V1::VERSION
612
719
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
613
720
 
614
- header_params = {
615
- "project_id" => request.project_id,
616
- "id" => request.id
617
- }
721
+ header_params = {}
722
+ if request.project_id
723
+ header_params["project_id"] = request.project_id
724
+ end
725
+ if request.id
726
+ header_params["id"] = request.id
727
+ end
728
+
618
729
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
619
730
  metadata[:"x-goog-request-params"] ||= request_params_header
620
731
 
@@ -635,6 +746,107 @@ module Google
635
746
  raise ::Google::Cloud::Error.from_error(e)
636
747
  end
637
748
 
749
+ ##
750
+ # Approves or rejects a pending build.
751
+ #
752
+ # If approved, the returned LRO will be analogous to the LRO returned from
753
+ # a CreateBuild call.
754
+ #
755
+ # If rejected, the returned LRO will be immediately done.
756
+ #
757
+ # @overload approve_build(request, options = nil)
758
+ # Pass arguments to `approve_build` via a request object, either of type
759
+ # {::Google::Cloud::Build::V1::ApproveBuildRequest} or an equivalent Hash.
760
+ #
761
+ # @param request [::Google::Cloud::Build::V1::ApproveBuildRequest, ::Hash]
762
+ # A request object representing the call parameters. Required. To specify no
763
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
764
+ # @param options [::Gapic::CallOptions, ::Hash]
765
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
766
+ #
767
+ # @overload approve_build(name: nil, approval_result: nil)
768
+ # Pass arguments to `approve_build` via keyword arguments. Note that at
769
+ # least one keyword argument is required. To specify no parameters, or to keep all
770
+ # the default parameter values, pass an empty Hash as a request object (see above).
771
+ #
772
+ # @param name [::String]
773
+ # Required. Name of the target build.
774
+ # For example: "projects/\\{$project_id}/builds/\\{$build_id}"
775
+ # @param approval_result [::Google::Cloud::Build::V1::ApprovalResult, ::Hash]
776
+ # Approval decision and metadata.
777
+ #
778
+ # @yield [response, operation] Access the result along with the RPC operation
779
+ # @yieldparam response [::Gapic::Operation]
780
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
781
+ #
782
+ # @return [::Gapic::Operation]
783
+ #
784
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
785
+ #
786
+ # @example Basic example
787
+ # require "google/cloud/build/v1"
788
+ #
789
+ # # Create a client object. The client can be reused for multiple calls.
790
+ # client = Google::Cloud::Build::V1::CloudBuild::Client.new
791
+ #
792
+ # # Create a request. To set request fields, pass in keyword arguments.
793
+ # request = Google::Cloud::Build::V1::ApproveBuildRequest.new
794
+ #
795
+ # # Call the approve_build method.
796
+ # result = client.approve_build request
797
+ #
798
+ # # The returned object is of type Gapic::Operation. You can use this
799
+ # # object to check the status of an operation, cancel it, or wait
800
+ # # for results. Here is how to block until completion:
801
+ # result.wait_until_done! timeout: 60
802
+ # if result.response?
803
+ # p result.response
804
+ # else
805
+ # puts "Error!"
806
+ # end
807
+ #
808
+ def approve_build request, options = nil
809
+ raise ::ArgumentError, "request must be provided" if request.nil?
810
+
811
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Build::V1::ApproveBuildRequest
812
+
813
+ # Converts hash and nil to an options object
814
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
815
+
816
+ # Customize the options with defaults
817
+ metadata = @config.rpcs.approve_build.metadata.to_h
818
+
819
+ # Set x-goog-api-client and x-goog-user-project headers
820
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
821
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
822
+ gapic_version: ::Google::Cloud::Build::V1::VERSION
823
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
824
+
825
+ header_params = {}
826
+ if request.name
827
+ header_params["name"] = request.name
828
+ end
829
+
830
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
831
+ metadata[:"x-goog-request-params"] ||= request_params_header
832
+
833
+ options.apply_defaults timeout: @config.rpcs.approve_build.timeout,
834
+ metadata: metadata,
835
+ retry_policy: @config.rpcs.approve_build.retry_policy
836
+
837
+ options.apply_defaults timeout: @config.timeout,
838
+ metadata: @config.metadata,
839
+ retry_policy: @config.retry_policy
840
+
841
+ @cloud_build_stub.call_rpc :approve_build, request, options: options do |response, operation|
842
+ response = ::Gapic::Operation.new response, @operations_client, options: options
843
+ yield response, operation if block_given?
844
+ return response
845
+ end
846
+ rescue ::GRPC::BadStatus => e
847
+ raise ::Google::Cloud::Error.from_error(e)
848
+ end
849
+
638
850
  ##
639
851
  # Creates a new `BuildTrigger`.
640
852
  #
@@ -671,6 +883,21 @@ module Google
671
883
  #
672
884
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
673
885
  #
886
+ # @example Basic example
887
+ # require "google/cloud/build/v1"
888
+ #
889
+ # # Create a client object. The client can be reused for multiple calls.
890
+ # client = Google::Cloud::Build::V1::CloudBuild::Client.new
891
+ #
892
+ # # Create a request. To set request fields, pass in keyword arguments.
893
+ # request = Google::Cloud::Build::V1::CreateBuildTriggerRequest.new
894
+ #
895
+ # # Call the create_build_trigger method.
896
+ # result = client.create_build_trigger request
897
+ #
898
+ # # The returned object is of type Google::Cloud::Build::V1::BuildTrigger.
899
+ # p result
900
+ #
674
901
  def create_build_trigger request, options = nil
675
902
  raise ::ArgumentError, "request must be provided" if request.nil?
676
903
 
@@ -688,9 +915,11 @@ module Google
688
915
  gapic_version: ::Google::Cloud::Build::V1::VERSION
689
916
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
690
917
 
691
- header_params = {
692
- "project_id" => request.project_id
693
- }
918
+ header_params = {}
919
+ if request.project_id
920
+ header_params["project_id"] = request.project_id
921
+ end
922
+
694
923
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
695
924
  metadata[:"x-goog-request-params"] ||= request_params_header
696
925
 
@@ -746,6 +975,21 @@ module Google
746
975
  #
747
976
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
748
977
  #
978
+ # @example Basic example
979
+ # require "google/cloud/build/v1"
980
+ #
981
+ # # Create a client object. The client can be reused for multiple calls.
982
+ # client = Google::Cloud::Build::V1::CloudBuild::Client.new
983
+ #
984
+ # # Create a request. To set request fields, pass in keyword arguments.
985
+ # request = Google::Cloud::Build::V1::GetBuildTriggerRequest.new
986
+ #
987
+ # # Call the get_build_trigger method.
988
+ # result = client.get_build_trigger request
989
+ #
990
+ # # The returned object is of type Google::Cloud::Build::V1::BuildTrigger.
991
+ # p result
992
+ #
749
993
  def get_build_trigger request, options = nil
750
994
  raise ::ArgumentError, "request must be provided" if request.nil?
751
995
 
@@ -763,10 +1007,14 @@ module Google
763
1007
  gapic_version: ::Google::Cloud::Build::V1::VERSION
764
1008
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
765
1009
 
766
- header_params = {
767
- "project_id" => request.project_id,
768
- "trigger_id" => request.trigger_id
769
- }
1010
+ header_params = {}
1011
+ if request.project_id
1012
+ header_params["project_id"] = request.project_id
1013
+ end
1014
+ if request.trigger_id
1015
+ header_params["trigger_id"] = request.trigger_id
1016
+ end
1017
+
770
1018
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
771
1019
  metadata[:"x-goog-request-params"] ||= request_params_header
772
1020
 
@@ -824,6 +1072,27 @@ module Google
824
1072
  #
825
1073
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
826
1074
  #
1075
+ # @example Basic example
1076
+ # require "google/cloud/build/v1"
1077
+ #
1078
+ # # Create a client object. The client can be reused for multiple calls.
1079
+ # client = Google::Cloud::Build::V1::CloudBuild::Client.new
1080
+ #
1081
+ # # Create a request. To set request fields, pass in keyword arguments.
1082
+ # request = Google::Cloud::Build::V1::ListBuildTriggersRequest.new
1083
+ #
1084
+ # # Call the list_build_triggers method.
1085
+ # result = client.list_build_triggers request
1086
+ #
1087
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1088
+ # # iterate over all elements by calling #each, and the enumerable
1089
+ # # will lazily make API calls to fetch subsequent pages. Other
1090
+ # # methods are also available for managing paging directly.
1091
+ # result.each do |response|
1092
+ # # Each element is of type ::Google::Cloud::Build::V1::BuildTrigger.
1093
+ # p response
1094
+ # end
1095
+ #
827
1096
  def list_build_triggers request, options = nil
828
1097
  raise ::ArgumentError, "request must be provided" if request.nil?
829
1098
 
@@ -841,9 +1110,11 @@ module Google
841
1110
  gapic_version: ::Google::Cloud::Build::V1::VERSION
842
1111
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
843
1112
 
844
- header_params = {
845
- "project_id" => request.project_id
846
- }
1113
+ header_params = {}
1114
+ if request.project_id
1115
+ header_params["project_id"] = request.project_id
1116
+ end
1117
+
847
1118
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
848
1119
  metadata[:"x-goog-request-params"] ||= request_params_header
849
1120
 
@@ -900,6 +1171,21 @@ module Google
900
1171
  #
901
1172
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
902
1173
  #
1174
+ # @example Basic example
1175
+ # require "google/cloud/build/v1"
1176
+ #
1177
+ # # Create a client object. The client can be reused for multiple calls.
1178
+ # client = Google::Cloud::Build::V1::CloudBuild::Client.new
1179
+ #
1180
+ # # Create a request. To set request fields, pass in keyword arguments.
1181
+ # request = Google::Cloud::Build::V1::DeleteBuildTriggerRequest.new
1182
+ #
1183
+ # # Call the delete_build_trigger method.
1184
+ # result = client.delete_build_trigger request
1185
+ #
1186
+ # # The returned object is of type Google::Protobuf::Empty.
1187
+ # p result
1188
+ #
903
1189
  def delete_build_trigger request, options = nil
904
1190
  raise ::ArgumentError, "request must be provided" if request.nil?
905
1191
 
@@ -917,10 +1203,14 @@ module Google
917
1203
  gapic_version: ::Google::Cloud::Build::V1::VERSION
918
1204
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
919
1205
 
920
- header_params = {
921
- "project_id" => request.project_id,
922
- "trigger_id" => request.trigger_id
923
- }
1206
+ header_params = {}
1207
+ if request.project_id
1208
+ header_params["project_id"] = request.project_id
1209
+ end
1210
+ if request.trigger_id
1211
+ header_params["trigger_id"] = request.trigger_id
1212
+ end
1213
+
924
1214
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
925
1215
  metadata[:"x-goog-request-params"] ||= request_params_header
926
1216
 
@@ -975,6 +1265,21 @@ module Google
975
1265
  #
976
1266
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
977
1267
  #
1268
+ # @example Basic example
1269
+ # require "google/cloud/build/v1"
1270
+ #
1271
+ # # Create a client object. The client can be reused for multiple calls.
1272
+ # client = Google::Cloud::Build::V1::CloudBuild::Client.new
1273
+ #
1274
+ # # Create a request. To set request fields, pass in keyword arguments.
1275
+ # request = Google::Cloud::Build::V1::UpdateBuildTriggerRequest.new
1276
+ #
1277
+ # # Call the update_build_trigger method.
1278
+ # result = client.update_build_trigger request
1279
+ #
1280
+ # # The returned object is of type Google::Cloud::Build::V1::BuildTrigger.
1281
+ # p result
1282
+ #
978
1283
  def update_build_trigger request, options = nil
979
1284
  raise ::ArgumentError, "request must be provided" if request.nil?
980
1285
 
@@ -992,10 +1297,14 @@ module Google
992
1297
  gapic_version: ::Google::Cloud::Build::V1::VERSION
993
1298
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
994
1299
 
995
- header_params = {
996
- "project_id" => request.project_id,
997
- "trigger_id" => request.trigger_id
998
- }
1300
+ header_params = {}
1301
+ if request.project_id
1302
+ header_params["project_id"] = request.project_id
1303
+ end
1304
+ if request.trigger_id
1305
+ header_params["trigger_id"] = request.trigger_id
1306
+ end
1307
+
999
1308
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1000
1309
  metadata[:"x-goog-request-params"] ||= request_params_header
1001
1310
 
@@ -1051,6 +1360,28 @@ module Google
1051
1360
  #
1052
1361
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1053
1362
  #
1363
+ # @example Basic example
1364
+ # require "google/cloud/build/v1"
1365
+ #
1366
+ # # Create a client object. The client can be reused for multiple calls.
1367
+ # client = Google::Cloud::Build::V1::CloudBuild::Client.new
1368
+ #
1369
+ # # Create a request. To set request fields, pass in keyword arguments.
1370
+ # request = Google::Cloud::Build::V1::RunBuildTriggerRequest.new
1371
+ #
1372
+ # # Call the run_build_trigger method.
1373
+ # result = client.run_build_trigger request
1374
+ #
1375
+ # # The returned object is of type Gapic::Operation. You can use this
1376
+ # # object to check the status of an operation, cancel it, or wait
1377
+ # # for results. Here is how to block until completion:
1378
+ # result.wait_until_done! timeout: 60
1379
+ # if result.response?
1380
+ # p result.response
1381
+ # else
1382
+ # puts "Error!"
1383
+ # end
1384
+ #
1054
1385
  def run_build_trigger request, options = nil
1055
1386
  raise ::ArgumentError, "request must be provided" if request.nil?
1056
1387
 
@@ -1068,10 +1399,14 @@ module Google
1068
1399
  gapic_version: ::Google::Cloud::Build::V1::VERSION
1069
1400
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1070
1401
 
1071
- header_params = {
1072
- "project_id" => request.project_id,
1073
- "trigger_id" => request.trigger_id
1074
- }
1402
+ header_params = {}
1403
+ if request.project_id
1404
+ header_params["project_id"] = request.project_id
1405
+ end
1406
+ if request.trigger_id
1407
+ header_params["trigger_id"] = request.trigger_id
1408
+ end
1409
+
1075
1410
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1076
1411
  metadata[:"x-goog-request-params"] ||= request_params_header
1077
1412
 
@@ -1131,6 +1466,21 @@ module Google
1131
1466
  #
1132
1467
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1133
1468
  #
1469
+ # @example Basic example
1470
+ # require "google/cloud/build/v1"
1471
+ #
1472
+ # # Create a client object. The client can be reused for multiple calls.
1473
+ # client = Google::Cloud::Build::V1::CloudBuild::Client.new
1474
+ #
1475
+ # # Create a request. To set request fields, pass in keyword arguments.
1476
+ # request = Google::Cloud::Build::V1::ReceiveTriggerWebhookRequest.new
1477
+ #
1478
+ # # Call the receive_trigger_webhook method.
1479
+ # result = client.receive_trigger_webhook request
1480
+ #
1481
+ # # The returned object is of type Google::Cloud::Build::V1::ReceiveTriggerWebhookResponse.
1482
+ # p result
1483
+ #
1134
1484
  def receive_trigger_webhook request, options = nil
1135
1485
  raise ::ArgumentError, "request must be provided" if request.nil?
1136
1486
 
@@ -1148,10 +1498,14 @@ module Google
1148
1498
  gapic_version: ::Google::Cloud::Build::V1::VERSION
1149
1499
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1150
1500
 
1151
- header_params = {
1152
- "project_id" => request.project_id,
1153
- "trigger" => request.trigger
1154
- }
1501
+ header_params = {}
1502
+ if request.project_id
1503
+ header_params["project_id"] = request.project_id
1504
+ end
1505
+ if request.trigger
1506
+ header_params["trigger"] = request.trigger
1507
+ end
1508
+
1155
1509
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1156
1510
  metadata[:"x-goog-request-params"] ||= request_params_header
1157
1511
 
@@ -1212,6 +1566,28 @@ module Google
1212
1566
  #
1213
1567
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1214
1568
  #
1569
+ # @example Basic example
1570
+ # require "google/cloud/build/v1"
1571
+ #
1572
+ # # Create a client object. The client can be reused for multiple calls.
1573
+ # client = Google::Cloud::Build::V1::CloudBuild::Client.new
1574
+ #
1575
+ # # Create a request. To set request fields, pass in keyword arguments.
1576
+ # request = Google::Cloud::Build::V1::CreateWorkerPoolRequest.new
1577
+ #
1578
+ # # Call the create_worker_pool method.
1579
+ # result = client.create_worker_pool request
1580
+ #
1581
+ # # The returned object is of type Gapic::Operation. You can use this
1582
+ # # object to check the status of an operation, cancel it, or wait
1583
+ # # for results. Here is how to block until completion:
1584
+ # result.wait_until_done! timeout: 60
1585
+ # if result.response?
1586
+ # p result.response
1587
+ # else
1588
+ # puts "Error!"
1589
+ # end
1590
+ #
1215
1591
  def create_worker_pool request, options = nil
1216
1592
  raise ::ArgumentError, "request must be provided" if request.nil?
1217
1593
 
@@ -1229,9 +1605,11 @@ module Google
1229
1605
  gapic_version: ::Google::Cloud::Build::V1::VERSION
1230
1606
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1231
1607
 
1232
- header_params = {
1233
- "parent" => request.parent
1234
- }
1608
+ header_params = {}
1609
+ if request.parent
1610
+ header_params["parent"] = request.parent
1611
+ end
1612
+
1235
1613
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1236
1614
  metadata[:"x-goog-request-params"] ||= request_params_header
1237
1615
 
@@ -1282,6 +1660,21 @@ module Google
1282
1660
  #
1283
1661
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1284
1662
  #
1663
+ # @example Basic example
1664
+ # require "google/cloud/build/v1"
1665
+ #
1666
+ # # Create a client object. The client can be reused for multiple calls.
1667
+ # client = Google::Cloud::Build::V1::CloudBuild::Client.new
1668
+ #
1669
+ # # Create a request. To set request fields, pass in keyword arguments.
1670
+ # request = Google::Cloud::Build::V1::GetWorkerPoolRequest.new
1671
+ #
1672
+ # # Call the get_worker_pool method.
1673
+ # result = client.get_worker_pool request
1674
+ #
1675
+ # # The returned object is of type Google::Cloud::Build::V1::WorkerPool.
1676
+ # p result
1677
+ #
1285
1678
  def get_worker_pool request, options = nil
1286
1679
  raise ::ArgumentError, "request must be provided" if request.nil?
1287
1680
 
@@ -1299,9 +1692,11 @@ module Google
1299
1692
  gapic_version: ::Google::Cloud::Build::V1::VERSION
1300
1693
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1301
1694
 
1302
- header_params = {
1303
- "name" => request.name
1304
- }
1695
+ header_params = {}
1696
+ if request.name
1697
+ header_params["name"] = request.name
1698
+ end
1699
+
1305
1700
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1306
1701
  metadata[:"x-goog-request-params"] ||= request_params_header
1307
1702
 
@@ -1361,6 +1756,28 @@ module Google
1361
1756
  #
1362
1757
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1363
1758
  #
1759
+ # @example Basic example
1760
+ # require "google/cloud/build/v1"
1761
+ #
1762
+ # # Create a client object. The client can be reused for multiple calls.
1763
+ # client = Google::Cloud::Build::V1::CloudBuild::Client.new
1764
+ #
1765
+ # # Create a request. To set request fields, pass in keyword arguments.
1766
+ # request = Google::Cloud::Build::V1::DeleteWorkerPoolRequest.new
1767
+ #
1768
+ # # Call the delete_worker_pool method.
1769
+ # result = client.delete_worker_pool request
1770
+ #
1771
+ # # The returned object is of type Gapic::Operation. You can use this
1772
+ # # object to check the status of an operation, cancel it, or wait
1773
+ # # for results. Here is how to block until completion:
1774
+ # result.wait_until_done! timeout: 60
1775
+ # if result.response?
1776
+ # p result.response
1777
+ # else
1778
+ # puts "Error!"
1779
+ # end
1780
+ #
1364
1781
  def delete_worker_pool request, options = nil
1365
1782
  raise ::ArgumentError, "request must be provided" if request.nil?
1366
1783
 
@@ -1378,9 +1795,11 @@ module Google
1378
1795
  gapic_version: ::Google::Cloud::Build::V1::VERSION
1379
1796
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1380
1797
 
1381
- header_params = {
1382
- "name" => request.name
1383
- }
1798
+ header_params = {}
1799
+ if request.name
1800
+ header_params["name"] = request.name
1801
+ end
1802
+
1384
1803
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1385
1804
  metadata[:"x-goog-request-params"] ||= request_params_header
1386
1805
 
@@ -1438,6 +1857,28 @@ module Google
1438
1857
  #
1439
1858
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1440
1859
  #
1860
+ # @example Basic example
1861
+ # require "google/cloud/build/v1"
1862
+ #
1863
+ # # Create a client object. The client can be reused for multiple calls.
1864
+ # client = Google::Cloud::Build::V1::CloudBuild::Client.new
1865
+ #
1866
+ # # Create a request. To set request fields, pass in keyword arguments.
1867
+ # request = Google::Cloud::Build::V1::UpdateWorkerPoolRequest.new
1868
+ #
1869
+ # # Call the update_worker_pool method.
1870
+ # result = client.update_worker_pool request
1871
+ #
1872
+ # # The returned object is of type Gapic::Operation. You can use this
1873
+ # # object to check the status of an operation, cancel it, or wait
1874
+ # # for results. Here is how to block until completion:
1875
+ # result.wait_until_done! timeout: 60
1876
+ # if result.response?
1877
+ # p result.response
1878
+ # else
1879
+ # puts "Error!"
1880
+ # end
1881
+ #
1441
1882
  def update_worker_pool request, options = nil
1442
1883
  raise ::ArgumentError, "request must be provided" if request.nil?
1443
1884
 
@@ -1455,9 +1896,11 @@ module Google
1455
1896
  gapic_version: ::Google::Cloud::Build::V1::VERSION
1456
1897
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1457
1898
 
1458
- header_params = {
1459
- "worker_pool.name" => request.worker_pool.name
1460
- }
1899
+ header_params = {}
1900
+ if request.worker_pool&.name
1901
+ header_params["worker_pool.name"] = request.worker_pool.name
1902
+ end
1903
+
1461
1904
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1462
1905
  metadata[:"x-goog-request-params"] ||= request_params_header
1463
1906
 
@@ -1514,6 +1957,27 @@ module Google
1514
1957
  #
1515
1958
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1516
1959
  #
1960
+ # @example Basic example
1961
+ # require "google/cloud/build/v1"
1962
+ #
1963
+ # # Create a client object. The client can be reused for multiple calls.
1964
+ # client = Google::Cloud::Build::V1::CloudBuild::Client.new
1965
+ #
1966
+ # # Create a request. To set request fields, pass in keyword arguments.
1967
+ # request = Google::Cloud::Build::V1::ListWorkerPoolsRequest.new
1968
+ #
1969
+ # # Call the list_worker_pools method.
1970
+ # result = client.list_worker_pools request
1971
+ #
1972
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1973
+ # # iterate over all elements by calling #each, and the enumerable
1974
+ # # will lazily make API calls to fetch subsequent pages. Other
1975
+ # # methods are also available for managing paging directly.
1976
+ # result.each do |response|
1977
+ # # Each element is of type ::Google::Cloud::Build::V1::WorkerPool.
1978
+ # p response
1979
+ # end
1980
+ #
1517
1981
  def list_worker_pools request, options = nil
1518
1982
  raise ::ArgumentError, "request must be provided" if request.nil?
1519
1983
 
@@ -1531,9 +1995,11 @@ module Google
1531
1995
  gapic_version: ::Google::Cloud::Build::V1::VERSION
1532
1996
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1533
1997
 
1534
- header_params = {
1535
- "parent" => request.parent
1536
- }
1998
+ header_params = {}
1999
+ if request.parent
2000
+ header_params["parent"] = request.parent
2001
+ end
2002
+
1537
2003
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1538
2004
  metadata[:"x-goog-request-params"] ||= request_params_header
1539
2005
 
@@ -1715,6 +2181,11 @@ module Google
1715
2181
  #
1716
2182
  attr_reader :retry_build
1717
2183
  ##
2184
+ # RPC-specific configuration for `approve_build`
2185
+ # @return [::Gapic::Config::Method]
2186
+ #
2187
+ attr_reader :approve_build
2188
+ ##
1718
2189
  # RPC-specific configuration for `create_build_trigger`
1719
2190
  # @return [::Gapic::Config::Method]
1720
2191
  #
@@ -1787,6 +2258,8 @@ module Google
1787
2258
  @cancel_build = ::Gapic::Config::Method.new cancel_build_config
1788
2259
  retry_build_config = parent_rpcs.retry_build if parent_rpcs.respond_to? :retry_build
1789
2260
  @retry_build = ::Gapic::Config::Method.new retry_build_config
2261
+ approve_build_config = parent_rpcs.approve_build if parent_rpcs.respond_to? :approve_build
2262
+ @approve_build = ::Gapic::Config::Method.new approve_build_config
1790
2263
  create_build_trigger_config = parent_rpcs.create_build_trigger if parent_rpcs.respond_to? :create_build_trigger
1791
2264
  @create_build_trigger = ::Gapic::Config::Method.new create_build_trigger_config
1792
2265
  get_build_trigger_config = parent_rpcs.get_build_trigger if parent_rpcs.respond_to? :get_build_trigger