google-cloud-bigquery-reservation-v1 0.3.2 → 0.4.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.
@@ -56,13 +56,12 @@ module Google
56
56
  # See {::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client::Configuration}
57
57
  # for a description of the configuration fields.
58
58
  #
59
- # ## Example
59
+ # @example
60
60
  #
61
- # To modify the configuration for all ReservationService clients:
62
- #
63
- # ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.configure do |config|
64
- # config.timeout = 10.0
65
- # end
61
+ # # Modify the configuration for all ReservationService clients
62
+ # ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.configure do |config|
63
+ # config.timeout = 10.0
64
+ # end
66
65
  #
67
66
  # @yield [config] Configure the Client client.
68
67
  # @yieldparam config [Client::Configuration]
@@ -80,73 +79,73 @@ module Google
80
79
  end
81
80
  default_config = Client::Configuration.new parent_config
82
81
 
83
- default_config.rpcs.create_reservation.timeout = 60.0
82
+ default_config.rpcs.create_reservation.timeout = 300.0
84
83
 
85
- default_config.rpcs.list_reservations.timeout = 60.0
84
+ default_config.rpcs.list_reservations.timeout = 300.0
86
85
  default_config.rpcs.list_reservations.retry_policy = {
87
86
  initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
88
87
  }
89
88
 
90
- default_config.rpcs.get_reservation.timeout = 60.0
89
+ default_config.rpcs.get_reservation.timeout = 300.0
91
90
  default_config.rpcs.get_reservation.retry_policy = {
92
91
  initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
93
92
  }
94
93
 
95
- default_config.rpcs.delete_reservation.timeout = 60.0
94
+ default_config.rpcs.delete_reservation.timeout = 300.0
96
95
  default_config.rpcs.delete_reservation.retry_policy = {
97
96
  initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
98
97
  }
99
98
 
100
- default_config.rpcs.update_reservation.timeout = 60.0
99
+ default_config.rpcs.update_reservation.timeout = 300.0
101
100
 
102
- default_config.rpcs.create_capacity_commitment.timeout = 60.0
101
+ default_config.rpcs.create_capacity_commitment.timeout = 300.0
103
102
 
104
- default_config.rpcs.list_capacity_commitments.timeout = 60.0
103
+ default_config.rpcs.list_capacity_commitments.timeout = 300.0
105
104
  default_config.rpcs.list_capacity_commitments.retry_policy = {
106
105
  initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
107
106
  }
108
107
 
109
- default_config.rpcs.get_capacity_commitment.timeout = 60.0
108
+ default_config.rpcs.get_capacity_commitment.timeout = 300.0
110
109
  default_config.rpcs.get_capacity_commitment.retry_policy = {
111
110
  initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
112
111
  }
113
112
 
114
- default_config.rpcs.delete_capacity_commitment.timeout = 60.0
113
+ default_config.rpcs.delete_capacity_commitment.timeout = 300.0
115
114
  default_config.rpcs.delete_capacity_commitment.retry_policy = {
116
115
  initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
117
116
  }
118
117
 
119
- default_config.rpcs.update_capacity_commitment.timeout = 60.0
118
+ default_config.rpcs.update_capacity_commitment.timeout = 300.0
120
119
 
121
- default_config.rpcs.split_capacity_commitment.timeout = 60.0
120
+ default_config.rpcs.split_capacity_commitment.timeout = 300.0
122
121
 
123
- default_config.rpcs.merge_capacity_commitments.timeout = 60.0
122
+ default_config.rpcs.merge_capacity_commitments.timeout = 300.0
124
123
 
125
- default_config.rpcs.create_assignment.timeout = 60.0
124
+ default_config.rpcs.create_assignment.timeout = 300.0
126
125
 
127
- default_config.rpcs.list_assignments.timeout = 60.0
126
+ default_config.rpcs.list_assignments.timeout = 300.0
128
127
  default_config.rpcs.list_assignments.retry_policy = {
129
128
  initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
130
129
  }
131
130
 
132
- default_config.rpcs.delete_assignment.timeout = 60.0
131
+ default_config.rpcs.delete_assignment.timeout = 300.0
133
132
  default_config.rpcs.delete_assignment.retry_policy = {
134
133
  initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
135
134
  }
136
135
 
137
- default_config.rpcs.search_assignments.timeout = 60.0
136
+ default_config.rpcs.search_assignments.timeout = 300.0
138
137
  default_config.rpcs.search_assignments.retry_policy = {
139
138
  initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
140
139
  }
141
140
 
142
- default_config.rpcs.move_assignment.timeout = 60.0
141
+ default_config.rpcs.move_assignment.timeout = 300.0
143
142
 
144
- default_config.rpcs.get_bi_reservation.timeout = 60.0
143
+ default_config.rpcs.get_bi_reservation.timeout = 300.0
145
144
  default_config.rpcs.get_bi_reservation.retry_policy = {
146
145
  initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
147
146
  }
148
147
 
149
- default_config.rpcs.update_bi_reservation.timeout = 60.0
148
+ default_config.rpcs.update_bi_reservation.timeout = 300.0
150
149
 
151
150
  default_config
152
151
  end
@@ -177,19 +176,15 @@ module Google
177
176
  ##
178
177
  # Create a new ReservationService client object.
179
178
  #
180
- # ## Examples
181
- #
182
- # To create a new ReservationService client with the default
183
- # configuration:
179
+ # @example
184
180
  #
185
- # client = ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
181
+ # # Create a client using the default configuration
182
+ # client = ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
186
183
  #
187
- # To create a new ReservationService client with a custom
188
- # configuration:
189
- #
190
- # client = ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new do |config|
191
- # config.timeout = 10.0
192
- # end
184
+ # # Create a client using a custom configuration
185
+ # client = ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new do |config|
186
+ # config.timeout = 10.0
187
+ # end
193
188
  #
194
189
  # @yield [config] Configure the ReservationService client.
195
190
  # @yieldparam config [Client::Configuration]
@@ -209,10 +204,9 @@ module Google
209
204
 
210
205
  # Create credentials
211
206
  credentials = @config.credentials
212
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
207
+ # Use self-signed JWT if the endpoint is unchanged from default,
213
208
  # but only if the default endpoint does not have a region prefix.
214
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
215
- @config.endpoint == Client.configure.endpoint &&
209
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
216
210
  !@config.endpoint.split(".").first.include?("-")
217
211
  credentials ||= Credentials.default scope: @config.scope,
218
212
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -268,6 +262,21 @@ module Google
268
262
  #
269
263
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
270
264
  #
265
+ # @example Basic example
266
+ # require "google/cloud/bigquery/reservation/v1"
267
+ #
268
+ # # Create a client object. The client can be reused for multiple calls.
269
+ # client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
270
+ #
271
+ # # Create a request. To set request fields, pass in keyword arguments.
272
+ # request = Google::Cloud::Bigquery::Reservation::V1::CreateReservationRequest.new
273
+ #
274
+ # # Call the create_reservation method.
275
+ # result = client.create_reservation request
276
+ #
277
+ # # The returned object is of type Google::Cloud::Bigquery::Reservation::V1::Reservation.
278
+ # p result
279
+ #
271
280
  def create_reservation request, options = nil
272
281
  raise ::ArgumentError, "request must be provided" if request.nil?
273
282
 
@@ -285,16 +294,20 @@ module Google
285
294
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
286
295
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
287
296
 
288
- header_params = {
289
- "parent" => request.parent
290
- }
297
+ header_params = {}
298
+ if request.parent
299
+ header_params["parent"] = request.parent
300
+ end
301
+
291
302
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
292
303
  metadata[:"x-goog-request-params"] ||= request_params_header
293
304
 
294
305
  options.apply_defaults timeout: @config.rpcs.create_reservation.timeout,
295
306
  metadata: metadata,
296
307
  retry_policy: @config.rpcs.create_reservation.retry_policy
297
- options.apply_defaults metadata: @config.metadata,
308
+
309
+ options.apply_defaults timeout: @config.timeout,
310
+ metadata: @config.metadata,
298
311
  retry_policy: @config.retry_policy
299
312
 
300
313
  @reservation_service_stub.call_rpc :create_reservation, request, options: options do |response, operation|
@@ -339,6 +352,27 @@ module Google
339
352
  #
340
353
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
341
354
  #
355
+ # @example Basic example
356
+ # require "google/cloud/bigquery/reservation/v1"
357
+ #
358
+ # # Create a client object. The client can be reused for multiple calls.
359
+ # client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
360
+ #
361
+ # # Create a request. To set request fields, pass in keyword arguments.
362
+ # request = Google::Cloud::Bigquery::Reservation::V1::ListReservationsRequest.new
363
+ #
364
+ # # Call the list_reservations method.
365
+ # result = client.list_reservations request
366
+ #
367
+ # # The returned object is of type Gapic::PagedEnumerable. You can
368
+ # # iterate over all elements by calling #each, and the enumerable
369
+ # # will lazily make API calls to fetch subsequent pages. Other
370
+ # # methods are also available for managing paging directly.
371
+ # result.each do |response|
372
+ # # Each element is of type ::Google::Cloud::Bigquery::Reservation::V1::Reservation.
373
+ # p response
374
+ # end
375
+ #
342
376
  def list_reservations request, options = nil
343
377
  raise ::ArgumentError, "request must be provided" if request.nil?
344
378
 
@@ -356,16 +390,20 @@ module Google
356
390
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
357
391
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
358
392
 
359
- header_params = {
360
- "parent" => request.parent
361
- }
393
+ header_params = {}
394
+ if request.parent
395
+ header_params["parent"] = request.parent
396
+ end
397
+
362
398
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
363
399
  metadata[:"x-goog-request-params"] ||= request_params_header
364
400
 
365
401
  options.apply_defaults timeout: @config.rpcs.list_reservations.timeout,
366
402
  metadata: metadata,
367
403
  retry_policy: @config.rpcs.list_reservations.retry_policy
368
- options.apply_defaults metadata: @config.metadata,
404
+
405
+ options.apply_defaults timeout: @config.timeout,
406
+ metadata: @config.metadata,
369
407
  retry_policy: @config.retry_policy
370
408
 
371
409
  @reservation_service_stub.call_rpc :list_reservations, request, options: options do |response, operation|
@@ -407,6 +445,21 @@ module Google
407
445
  #
408
446
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
409
447
  #
448
+ # @example Basic example
449
+ # require "google/cloud/bigquery/reservation/v1"
450
+ #
451
+ # # Create a client object. The client can be reused for multiple calls.
452
+ # client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
453
+ #
454
+ # # Create a request. To set request fields, pass in keyword arguments.
455
+ # request = Google::Cloud::Bigquery::Reservation::V1::GetReservationRequest.new
456
+ #
457
+ # # Call the get_reservation method.
458
+ # result = client.get_reservation request
459
+ #
460
+ # # The returned object is of type Google::Cloud::Bigquery::Reservation::V1::Reservation.
461
+ # p result
462
+ #
410
463
  def get_reservation request, options = nil
411
464
  raise ::ArgumentError, "request must be provided" if request.nil?
412
465
 
@@ -424,16 +477,20 @@ module Google
424
477
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
425
478
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
426
479
 
427
- header_params = {
428
- "name" => request.name
429
- }
480
+ header_params = {}
481
+ if request.name
482
+ header_params["name"] = request.name
483
+ end
484
+
430
485
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
431
486
  metadata[:"x-goog-request-params"] ||= request_params_header
432
487
 
433
488
  options.apply_defaults timeout: @config.rpcs.get_reservation.timeout,
434
489
  metadata: metadata,
435
490
  retry_policy: @config.rpcs.get_reservation.retry_policy
436
- options.apply_defaults metadata: @config.metadata,
491
+
492
+ options.apply_defaults timeout: @config.timeout,
493
+ metadata: @config.metadata,
437
494
  retry_policy: @config.retry_policy
438
495
 
439
496
  @reservation_service_stub.call_rpc :get_reservation, request, options: options do |response, operation|
@@ -476,6 +533,21 @@ module Google
476
533
  #
477
534
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
478
535
  #
536
+ # @example Basic example
537
+ # require "google/cloud/bigquery/reservation/v1"
538
+ #
539
+ # # Create a client object. The client can be reused for multiple calls.
540
+ # client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
541
+ #
542
+ # # Create a request. To set request fields, pass in keyword arguments.
543
+ # request = Google::Cloud::Bigquery::Reservation::V1::DeleteReservationRequest.new
544
+ #
545
+ # # Call the delete_reservation method.
546
+ # result = client.delete_reservation request
547
+ #
548
+ # # The returned object is of type Google::Protobuf::Empty.
549
+ # p result
550
+ #
479
551
  def delete_reservation request, options = nil
480
552
  raise ::ArgumentError, "request must be provided" if request.nil?
481
553
 
@@ -493,16 +565,20 @@ module Google
493
565
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
494
566
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
495
567
 
496
- header_params = {
497
- "name" => request.name
498
- }
568
+ header_params = {}
569
+ if request.name
570
+ header_params["name"] = request.name
571
+ end
572
+
499
573
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
500
574
  metadata[:"x-goog-request-params"] ||= request_params_header
501
575
 
502
576
  options.apply_defaults timeout: @config.rpcs.delete_reservation.timeout,
503
577
  metadata: metadata,
504
578
  retry_policy: @config.rpcs.delete_reservation.retry_policy
505
- options.apply_defaults metadata: @config.metadata,
579
+
580
+ options.apply_defaults timeout: @config.timeout,
581
+ metadata: @config.metadata,
506
582
  retry_policy: @config.retry_policy
507
583
 
508
584
  @reservation_service_stub.call_rpc :delete_reservation, request, options: options do |response, operation|
@@ -544,6 +620,21 @@ module Google
544
620
  #
545
621
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
546
622
  #
623
+ # @example Basic example
624
+ # require "google/cloud/bigquery/reservation/v1"
625
+ #
626
+ # # Create a client object. The client can be reused for multiple calls.
627
+ # client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
628
+ #
629
+ # # Create a request. To set request fields, pass in keyword arguments.
630
+ # request = Google::Cloud::Bigquery::Reservation::V1::UpdateReservationRequest.new
631
+ #
632
+ # # Call the update_reservation method.
633
+ # result = client.update_reservation request
634
+ #
635
+ # # The returned object is of type Google::Cloud::Bigquery::Reservation::V1::Reservation.
636
+ # p result
637
+ #
547
638
  def update_reservation request, options = nil
548
639
  raise ::ArgumentError, "request must be provided" if request.nil?
549
640
 
@@ -561,16 +652,20 @@ module Google
561
652
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
562
653
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
563
654
 
564
- header_params = {
565
- "reservation.name" => request.reservation.name
566
- }
655
+ header_params = {}
656
+ if request.reservation&.name
657
+ header_params["reservation.name"] = request.reservation.name
658
+ end
659
+
567
660
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
568
661
  metadata[:"x-goog-request-params"] ||= request_params_header
569
662
 
570
663
  options.apply_defaults timeout: @config.rpcs.update_reservation.timeout,
571
664
  metadata: metadata,
572
665
  retry_policy: @config.rpcs.update_reservation.retry_policy
573
- options.apply_defaults metadata: @config.metadata,
666
+
667
+ options.apply_defaults timeout: @config.timeout,
668
+ metadata: @config.metadata,
574
669
  retry_policy: @config.retry_policy
575
670
 
576
671
  @reservation_service_stub.call_rpc :update_reservation, request, options: options do |response, operation|
@@ -594,7 +689,7 @@ module Google
594
689
  # @param options [::Gapic::CallOptions, ::Hash]
595
690
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
596
691
  #
597
- # @overload create_capacity_commitment(parent: nil, capacity_commitment: nil, enforce_single_admin_project_per_org: nil)
692
+ # @overload create_capacity_commitment(parent: nil, capacity_commitment: nil, enforce_single_admin_project_per_org: nil, capacity_commitment_id: nil)
598
693
  # Pass arguments to `create_capacity_commitment` via keyword arguments. Note that at
599
694
  # least one keyword argument is required. To specify no parameters, or to keep all
600
695
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -607,6 +702,12 @@ module Google
607
702
  # @param enforce_single_admin_project_per_org [::Boolean]
608
703
  # If true, fail the request if another project in the organization has a
609
704
  # capacity commitment.
705
+ # @param capacity_commitment_id [::String]
706
+ # The optional capacity commitment ID. Capacity commitment name will be
707
+ # generated automatically if this field is empty.
708
+ # This field must only contain lower case alphanumeric characters or dash.
709
+ # Max length is 64 characters.
710
+ # NOTE: this ID won't be kept if the capacity commitment is split or merged.
610
711
  #
611
712
  # @yield [response, operation] Access the result along with the RPC operation
612
713
  # @yieldparam response [::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment]
@@ -616,6 +717,21 @@ module Google
616
717
  #
617
718
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
618
719
  #
720
+ # @example Basic example
721
+ # require "google/cloud/bigquery/reservation/v1"
722
+ #
723
+ # # Create a client object. The client can be reused for multiple calls.
724
+ # client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
725
+ #
726
+ # # Create a request. To set request fields, pass in keyword arguments.
727
+ # request = Google::Cloud::Bigquery::Reservation::V1::CreateCapacityCommitmentRequest.new
728
+ #
729
+ # # Call the create_capacity_commitment method.
730
+ # result = client.create_capacity_commitment request
731
+ #
732
+ # # The returned object is of type Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment.
733
+ # p result
734
+ #
619
735
  def create_capacity_commitment request, options = nil
620
736
  raise ::ArgumentError, "request must be provided" if request.nil?
621
737
 
@@ -633,16 +749,20 @@ module Google
633
749
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
634
750
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
635
751
 
636
- header_params = {
637
- "parent" => request.parent
638
- }
752
+ header_params = {}
753
+ if request.parent
754
+ header_params["parent"] = request.parent
755
+ end
756
+
639
757
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
640
758
  metadata[:"x-goog-request-params"] ||= request_params_header
641
759
 
642
760
  options.apply_defaults timeout: @config.rpcs.create_capacity_commitment.timeout,
643
761
  metadata: metadata,
644
762
  retry_policy: @config.rpcs.create_capacity_commitment.retry_policy
645
- options.apply_defaults metadata: @config.metadata,
763
+
764
+ options.apply_defaults timeout: @config.timeout,
765
+ metadata: @config.metadata,
646
766
  retry_policy: @config.retry_policy
647
767
 
648
768
  @reservation_service_stub.call_rpc :create_capacity_commitment, request, options: options do |response, operation|
@@ -687,6 +807,27 @@ module Google
687
807
  #
688
808
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
689
809
  #
810
+ # @example Basic example
811
+ # require "google/cloud/bigquery/reservation/v1"
812
+ #
813
+ # # Create a client object. The client can be reused for multiple calls.
814
+ # client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
815
+ #
816
+ # # Create a request. To set request fields, pass in keyword arguments.
817
+ # request = Google::Cloud::Bigquery::Reservation::V1::ListCapacityCommitmentsRequest.new
818
+ #
819
+ # # Call the list_capacity_commitments method.
820
+ # result = client.list_capacity_commitments request
821
+ #
822
+ # # The returned object is of type Gapic::PagedEnumerable. You can
823
+ # # iterate over all elements by calling #each, and the enumerable
824
+ # # will lazily make API calls to fetch subsequent pages. Other
825
+ # # methods are also available for managing paging directly.
826
+ # result.each do |response|
827
+ # # Each element is of type ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment.
828
+ # p response
829
+ # end
830
+ #
690
831
  def list_capacity_commitments request, options = nil
691
832
  raise ::ArgumentError, "request must be provided" if request.nil?
692
833
 
@@ -704,16 +845,20 @@ module Google
704
845
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
705
846
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
706
847
 
707
- header_params = {
708
- "parent" => request.parent
709
- }
848
+ header_params = {}
849
+ if request.parent
850
+ header_params["parent"] = request.parent
851
+ end
852
+
710
853
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
711
854
  metadata[:"x-goog-request-params"] ||= request_params_header
712
855
 
713
856
  options.apply_defaults timeout: @config.rpcs.list_capacity_commitments.timeout,
714
857
  metadata: metadata,
715
858
  retry_policy: @config.rpcs.list_capacity_commitments.retry_policy
716
- options.apply_defaults metadata: @config.metadata,
859
+
860
+ options.apply_defaults timeout: @config.timeout,
861
+ metadata: @config.metadata,
717
862
  retry_policy: @config.retry_policy
718
863
 
719
864
  @reservation_service_stub.call_rpc :list_capacity_commitments, request, options: options do |response, operation|
@@ -755,6 +900,21 @@ module Google
755
900
  #
756
901
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
757
902
  #
903
+ # @example Basic example
904
+ # require "google/cloud/bigquery/reservation/v1"
905
+ #
906
+ # # Create a client object. The client can be reused for multiple calls.
907
+ # client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
908
+ #
909
+ # # Create a request. To set request fields, pass in keyword arguments.
910
+ # request = Google::Cloud::Bigquery::Reservation::V1::GetCapacityCommitmentRequest.new
911
+ #
912
+ # # Call the get_capacity_commitment method.
913
+ # result = client.get_capacity_commitment request
914
+ #
915
+ # # The returned object is of type Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment.
916
+ # p result
917
+ #
758
918
  def get_capacity_commitment request, options = nil
759
919
  raise ::ArgumentError, "request must be provided" if request.nil?
760
920
 
@@ -772,16 +932,20 @@ module Google
772
932
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
773
933
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
774
934
 
775
- header_params = {
776
- "name" => request.name
777
- }
935
+ header_params = {}
936
+ if request.name
937
+ header_params["name"] = request.name
938
+ end
939
+
778
940
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
779
941
  metadata[:"x-goog-request-params"] ||= request_params_header
780
942
 
781
943
  options.apply_defaults timeout: @config.rpcs.get_capacity_commitment.timeout,
782
944
  metadata: metadata,
783
945
  retry_policy: @config.rpcs.get_capacity_commitment.retry_policy
784
- options.apply_defaults metadata: @config.metadata,
946
+
947
+ options.apply_defaults timeout: @config.timeout,
948
+ metadata: @config.metadata,
785
949
  retry_policy: @config.retry_policy
786
950
 
787
951
  @reservation_service_stub.call_rpc :get_capacity_commitment, request, options: options do |response, operation|
@@ -807,7 +971,7 @@ module Google
807
971
  # @param options [::Gapic::CallOptions, ::Hash]
808
972
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
809
973
  #
810
- # @overload delete_capacity_commitment(name: nil)
974
+ # @overload delete_capacity_commitment(name: nil, force: nil)
811
975
  # Pass arguments to `delete_capacity_commitment` via keyword arguments. Note that at
812
976
  # least one keyword argument is required. To specify no parameters, or to keep all
813
977
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -815,6 +979,10 @@ module Google
815
979
  # @param name [::String]
816
980
  # Required. Resource name of the capacity commitment to delete. E.g.,
817
981
  # `projects/myproject/locations/US/capacityCommitments/123`
982
+ # @param force [::Boolean]
983
+ # Can be used to force delete commitments even if assignments exist. Deleting
984
+ # commitments with assignments may cause queries to fail if they no longer
985
+ # have access to slots.
818
986
  #
819
987
  # @yield [response, operation] Access the result along with the RPC operation
820
988
  # @yieldparam response [::Google::Protobuf::Empty]
@@ -824,6 +992,21 @@ module Google
824
992
  #
825
993
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
826
994
  #
995
+ # @example Basic example
996
+ # require "google/cloud/bigquery/reservation/v1"
997
+ #
998
+ # # Create a client object. The client can be reused for multiple calls.
999
+ # client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
1000
+ #
1001
+ # # Create a request. To set request fields, pass in keyword arguments.
1002
+ # request = Google::Cloud::Bigquery::Reservation::V1::DeleteCapacityCommitmentRequest.new
1003
+ #
1004
+ # # Call the delete_capacity_commitment method.
1005
+ # result = client.delete_capacity_commitment request
1006
+ #
1007
+ # # The returned object is of type Google::Protobuf::Empty.
1008
+ # p result
1009
+ #
827
1010
  def delete_capacity_commitment request, options = nil
828
1011
  raise ::ArgumentError, "request must be provided" if request.nil?
829
1012
 
@@ -841,16 +1024,20 @@ module Google
841
1024
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
842
1025
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
843
1026
 
844
- header_params = {
845
- "name" => request.name
846
- }
1027
+ header_params = {}
1028
+ if request.name
1029
+ header_params["name"] = request.name
1030
+ end
1031
+
847
1032
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
848
1033
  metadata[:"x-goog-request-params"] ||= request_params_header
849
1034
 
850
1035
  options.apply_defaults timeout: @config.rpcs.delete_capacity_commitment.timeout,
851
1036
  metadata: metadata,
852
1037
  retry_policy: @config.rpcs.delete_capacity_commitment.retry_policy
853
- options.apply_defaults metadata: @config.metadata,
1038
+
1039
+ options.apply_defaults timeout: @config.timeout,
1040
+ metadata: @config.metadata,
854
1041
  retry_policy: @config.retry_policy
855
1042
 
856
1043
  @reservation_service_stub.call_rpc :delete_capacity_commitment, request, options: options do |response, operation|
@@ -898,6 +1085,21 @@ module Google
898
1085
  #
899
1086
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
900
1087
  #
1088
+ # @example Basic example
1089
+ # require "google/cloud/bigquery/reservation/v1"
1090
+ #
1091
+ # # Create a client object. The client can be reused for multiple calls.
1092
+ # client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
1093
+ #
1094
+ # # Create a request. To set request fields, pass in keyword arguments.
1095
+ # request = Google::Cloud::Bigquery::Reservation::V1::UpdateCapacityCommitmentRequest.new
1096
+ #
1097
+ # # Call the update_capacity_commitment method.
1098
+ # result = client.update_capacity_commitment request
1099
+ #
1100
+ # # The returned object is of type Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment.
1101
+ # p result
1102
+ #
901
1103
  def update_capacity_commitment request, options = nil
902
1104
  raise ::ArgumentError, "request must be provided" if request.nil?
903
1105
 
@@ -915,16 +1117,20 @@ module Google
915
1117
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
916
1118
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
917
1119
 
918
- header_params = {
919
- "capacity_commitment.name" => request.capacity_commitment.name
920
- }
1120
+ header_params = {}
1121
+ if request.capacity_commitment&.name
1122
+ header_params["capacity_commitment.name"] = request.capacity_commitment.name
1123
+ end
1124
+
921
1125
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
922
1126
  metadata[:"x-goog-request-params"] ||= request_params_header
923
1127
 
924
1128
  options.apply_defaults timeout: @config.rpcs.update_capacity_commitment.timeout,
925
1129
  metadata: metadata,
926
1130
  retry_policy: @config.rpcs.update_capacity_commitment.retry_policy
927
- options.apply_defaults metadata: @config.metadata,
1131
+
1132
+ options.apply_defaults timeout: @config.timeout,
1133
+ metadata: @config.metadata,
928
1134
  retry_policy: @config.retry_policy
929
1135
 
930
1136
  @reservation_service_stub.call_rpc :update_capacity_commitment, request, options: options do |response, operation|
@@ -974,6 +1180,21 @@ module Google
974
1180
  #
975
1181
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
976
1182
  #
1183
+ # @example Basic example
1184
+ # require "google/cloud/bigquery/reservation/v1"
1185
+ #
1186
+ # # Create a client object. The client can be reused for multiple calls.
1187
+ # client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
1188
+ #
1189
+ # # Create a request. To set request fields, pass in keyword arguments.
1190
+ # request = Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentRequest.new
1191
+ #
1192
+ # # Call the split_capacity_commitment method.
1193
+ # result = client.split_capacity_commitment request
1194
+ #
1195
+ # # The returned object is of type Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentResponse.
1196
+ # p result
1197
+ #
977
1198
  def split_capacity_commitment request, options = nil
978
1199
  raise ::ArgumentError, "request must be provided" if request.nil?
979
1200
 
@@ -991,16 +1212,20 @@ module Google
991
1212
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
992
1213
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
993
1214
 
994
- header_params = {
995
- "name" => request.name
996
- }
1215
+ header_params = {}
1216
+ if request.name
1217
+ header_params["name"] = request.name
1218
+ end
1219
+
997
1220
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
998
1221
  metadata[:"x-goog-request-params"] ||= request_params_header
999
1222
 
1000
1223
  options.apply_defaults timeout: @config.rpcs.split_capacity_commitment.timeout,
1001
1224
  metadata: metadata,
1002
1225
  retry_policy: @config.rpcs.split_capacity_commitment.retry_policy
1003
- options.apply_defaults metadata: @config.metadata,
1226
+
1227
+ options.apply_defaults timeout: @config.timeout,
1228
+ metadata: @config.metadata,
1004
1229
  retry_policy: @config.retry_policy
1005
1230
 
1006
1231
  @reservation_service_stub.call_rpc :split_capacity_commitment, request, options: options do |response, operation|
@@ -1053,6 +1278,21 @@ module Google
1053
1278
  #
1054
1279
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1055
1280
  #
1281
+ # @example Basic example
1282
+ # require "google/cloud/bigquery/reservation/v1"
1283
+ #
1284
+ # # Create a client object. The client can be reused for multiple calls.
1285
+ # client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
1286
+ #
1287
+ # # Create a request. To set request fields, pass in keyword arguments.
1288
+ # request = Google::Cloud::Bigquery::Reservation::V1::MergeCapacityCommitmentsRequest.new
1289
+ #
1290
+ # # Call the merge_capacity_commitments method.
1291
+ # result = client.merge_capacity_commitments request
1292
+ #
1293
+ # # The returned object is of type Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment.
1294
+ # p result
1295
+ #
1056
1296
  def merge_capacity_commitments request, options = nil
1057
1297
  raise ::ArgumentError, "request must be provided" if request.nil?
1058
1298
 
@@ -1070,16 +1310,20 @@ module Google
1070
1310
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
1071
1311
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1072
1312
 
1073
- header_params = {
1074
- "parent" => request.parent
1075
- }
1313
+ header_params = {}
1314
+ if request.parent
1315
+ header_params["parent"] = request.parent
1316
+ end
1317
+
1076
1318
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1077
1319
  metadata[:"x-goog-request-params"] ||= request_params_header
1078
1320
 
1079
1321
  options.apply_defaults timeout: @config.rpcs.merge_capacity_commitments.timeout,
1080
1322
  metadata: metadata,
1081
1323
  retry_policy: @config.rpcs.merge_capacity_commitments.retry_policy
1082
- options.apply_defaults metadata: @config.metadata,
1324
+
1325
+ options.apply_defaults timeout: @config.timeout,
1326
+ metadata: @config.metadata,
1083
1327
  retry_policy: @config.retry_policy
1084
1328
 
1085
1329
  @reservation_service_stub.call_rpc :merge_capacity_commitments, request, options: options do |response, operation|
@@ -1115,6 +1359,11 @@ module Google
1115
1359
  # `project2`) could all be created and mapped to the same or different
1116
1360
  # reservations.
1117
1361
  #
1362
+ # "None" assignments represent an absence of the assignment. Projects
1363
+ # assigned to None use on-demand pricing. To create a "None" assignment, use
1364
+ # "none" as a reservation_id in the parent. Example parent:
1365
+ # `projects/myproject/locations/US/reservations/none`.
1366
+ #
1118
1367
  # Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have
1119
1368
  # 'bigquery.admin' permissions on the project using the reservation
1120
1369
  # and the project that owns this reservation.
@@ -1132,7 +1381,7 @@ module Google
1132
1381
  # @param options [::Gapic::CallOptions, ::Hash]
1133
1382
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1134
1383
  #
1135
- # @overload create_assignment(parent: nil, assignment: nil)
1384
+ # @overload create_assignment(parent: nil, assignment: nil, assignment_id: nil)
1136
1385
  # Pass arguments to `create_assignment` via keyword arguments. Note that at
1137
1386
  # least one keyword argument is required. To specify no parameters, or to keep all
1138
1387
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -1142,6 +1391,11 @@ module Google
1142
1391
  # E.g. `projects/myproject/locations/US/reservations/team1-prod`
1143
1392
  # @param assignment [::Google::Cloud::Bigquery::Reservation::V1::Assignment, ::Hash]
1144
1393
  # Assignment resource to create.
1394
+ # @param assignment_id [::String]
1395
+ # The optional assignment ID. Assignment name will be generated automatically
1396
+ # if this field is empty.
1397
+ # This field must only contain lower case alphanumeric characters or dash.
1398
+ # Max length is 64 characters.
1145
1399
  #
1146
1400
  # @yield [response, operation] Access the result along with the RPC operation
1147
1401
  # @yieldparam response [::Google::Cloud::Bigquery::Reservation::V1::Assignment]
@@ -1151,6 +1405,21 @@ module Google
1151
1405
  #
1152
1406
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1153
1407
  #
1408
+ # @example Basic example
1409
+ # require "google/cloud/bigquery/reservation/v1"
1410
+ #
1411
+ # # Create a client object. The client can be reused for multiple calls.
1412
+ # client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
1413
+ #
1414
+ # # Create a request. To set request fields, pass in keyword arguments.
1415
+ # request = Google::Cloud::Bigquery::Reservation::V1::CreateAssignmentRequest.new
1416
+ #
1417
+ # # Call the create_assignment method.
1418
+ # result = client.create_assignment request
1419
+ #
1420
+ # # The returned object is of type Google::Cloud::Bigquery::Reservation::V1::Assignment.
1421
+ # p result
1422
+ #
1154
1423
  def create_assignment request, options = nil
1155
1424
  raise ::ArgumentError, "request must be provided" if request.nil?
1156
1425
 
@@ -1168,16 +1437,20 @@ module Google
1168
1437
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
1169
1438
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1170
1439
 
1171
- header_params = {
1172
- "parent" => request.parent
1173
- }
1440
+ header_params = {}
1441
+ if request.parent
1442
+ header_params["parent"] = request.parent
1443
+ end
1444
+
1174
1445
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1175
1446
  metadata[:"x-goog-request-params"] ||= request_params_header
1176
1447
 
1177
1448
  options.apply_defaults timeout: @config.rpcs.create_assignment.timeout,
1178
1449
  metadata: metadata,
1179
1450
  retry_policy: @config.rpcs.create_assignment.retry_policy
1180
- options.apply_defaults metadata: @config.metadata,
1451
+
1452
+ options.apply_defaults timeout: @config.timeout,
1453
+ metadata: @config.metadata,
1181
1454
  retry_policy: @config.retry_policy
1182
1455
 
1183
1456
  @reservation_service_stub.call_rpc :create_assignment, request, options: options do |response, operation|
@@ -1247,6 +1520,27 @@ module Google
1247
1520
  #
1248
1521
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1249
1522
  #
1523
+ # @example Basic example
1524
+ # require "google/cloud/bigquery/reservation/v1"
1525
+ #
1526
+ # # Create a client object. The client can be reused for multiple calls.
1527
+ # client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
1528
+ #
1529
+ # # Create a request. To set request fields, pass in keyword arguments.
1530
+ # request = Google::Cloud::Bigquery::Reservation::V1::ListAssignmentsRequest.new
1531
+ #
1532
+ # # Call the list_assignments method.
1533
+ # result = client.list_assignments request
1534
+ #
1535
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1536
+ # # iterate over all elements by calling #each, and the enumerable
1537
+ # # will lazily make API calls to fetch subsequent pages. Other
1538
+ # # methods are also available for managing paging directly.
1539
+ # result.each do |response|
1540
+ # # Each element is of type ::Google::Cloud::Bigquery::Reservation::V1::Assignment.
1541
+ # p response
1542
+ # end
1543
+ #
1250
1544
  def list_assignments request, options = nil
1251
1545
  raise ::ArgumentError, "request must be provided" if request.nil?
1252
1546
 
@@ -1264,16 +1558,20 @@ module Google
1264
1558
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
1265
1559
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1266
1560
 
1267
- header_params = {
1268
- "parent" => request.parent
1269
- }
1561
+ header_params = {}
1562
+ if request.parent
1563
+ header_params["parent"] = request.parent
1564
+ end
1565
+
1270
1566
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1271
1567
  metadata[:"x-goog-request-params"] ||= request_params_header
1272
1568
 
1273
1569
  options.apply_defaults timeout: @config.rpcs.list_assignments.timeout,
1274
1570
  metadata: metadata,
1275
1571
  retry_policy: @config.rpcs.list_assignments.retry_policy
1276
- options.apply_defaults metadata: @config.metadata,
1572
+
1573
+ options.apply_defaults timeout: @config.timeout,
1574
+ metadata: @config.metadata,
1277
1575
  retry_policy: @config.retry_policy
1278
1576
 
1279
1577
  @reservation_service_stub.call_rpc :list_assignments, request, options: options do |response, operation|
@@ -1329,6 +1627,21 @@ module Google
1329
1627
  #
1330
1628
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1331
1629
  #
1630
+ # @example Basic example
1631
+ # require "google/cloud/bigquery/reservation/v1"
1632
+ #
1633
+ # # Create a client object. The client can be reused for multiple calls.
1634
+ # client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
1635
+ #
1636
+ # # Create a request. To set request fields, pass in keyword arguments.
1637
+ # request = Google::Cloud::Bigquery::Reservation::V1::DeleteAssignmentRequest.new
1638
+ #
1639
+ # # Call the delete_assignment method.
1640
+ # result = client.delete_assignment request
1641
+ #
1642
+ # # The returned object is of type Google::Protobuf::Empty.
1643
+ # p result
1644
+ #
1332
1645
  def delete_assignment request, options = nil
1333
1646
  raise ::ArgumentError, "request must be provided" if request.nil?
1334
1647
 
@@ -1346,16 +1659,20 @@ module Google
1346
1659
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
1347
1660
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1348
1661
 
1349
- header_params = {
1350
- "name" => request.name
1351
- }
1662
+ header_params = {}
1663
+ if request.name
1664
+ header_params["name"] = request.name
1665
+ end
1666
+
1352
1667
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1353
1668
  metadata[:"x-goog-request-params"] ||= request_params_header
1354
1669
 
1355
1670
  options.apply_defaults timeout: @config.rpcs.delete_assignment.timeout,
1356
1671
  metadata: metadata,
1357
1672
  retry_policy: @config.rpcs.delete_assignment.retry_policy
1358
- options.apply_defaults metadata: @config.metadata,
1673
+
1674
+ options.apply_defaults timeout: @config.timeout,
1675
+ metadata: @config.metadata,
1359
1676
  retry_policy: @config.retry_policy
1360
1677
 
1361
1678
  @reservation_service_stub.call_rpc :delete_assignment, request, options: options do |response, operation|
@@ -1367,7 +1684,7 @@ module Google
1367
1684
  end
1368
1685
 
1369
1686
  ##
1370
- # Looks up assignments for a specified resource for a particular region.
1687
+ # Deprecated: Looks up assignments for a specified resource for a particular region.
1371
1688
  # If the request is about a project:
1372
1689
  #
1373
1690
  # 1. Assignments created on the project will be returned if they exist.
@@ -1391,6 +1708,8 @@ module Google
1391
1708
  # **Note** "-" cannot be used for projects
1392
1709
  # nor locations.
1393
1710
  #
1711
+ # @deprecated This method is deprecated and may be removed in the next major version update.
1712
+ #
1394
1713
  # @overload search_assignments(request, options = nil)
1395
1714
  # Pass arguments to `search_assignments` via a request object, either of type
1396
1715
  # {::Google::Cloud::Bigquery::Reservation::V1::SearchAssignmentsRequest} or an equivalent Hash.
@@ -1431,6 +1750,27 @@ module Google
1431
1750
  #
1432
1751
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1433
1752
  #
1753
+ # @example Basic example
1754
+ # require "google/cloud/bigquery/reservation/v1"
1755
+ #
1756
+ # # Create a client object. The client can be reused for multiple calls.
1757
+ # client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
1758
+ #
1759
+ # # Create a request. To set request fields, pass in keyword arguments.
1760
+ # request = Google::Cloud::Bigquery::Reservation::V1::SearchAssignmentsRequest.new
1761
+ #
1762
+ # # Call the search_assignments method.
1763
+ # result = client.search_assignments request
1764
+ #
1765
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1766
+ # # iterate over all elements by calling #each, and the enumerable
1767
+ # # will lazily make API calls to fetch subsequent pages. Other
1768
+ # # methods are also available for managing paging directly.
1769
+ # result.each do |response|
1770
+ # # Each element is of type ::Google::Cloud::Bigquery::Reservation::V1::Assignment.
1771
+ # p response
1772
+ # end
1773
+ #
1434
1774
  def search_assignments request, options = nil
1435
1775
  raise ::ArgumentError, "request must be provided" if request.nil?
1436
1776
 
@@ -1448,16 +1788,20 @@ module Google
1448
1788
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
1449
1789
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1450
1790
 
1451
- header_params = {
1452
- "parent" => request.parent
1453
- }
1791
+ header_params = {}
1792
+ if request.parent
1793
+ header_params["parent"] = request.parent
1794
+ end
1795
+
1454
1796
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1455
1797
  metadata[:"x-goog-request-params"] ||= request_params_header
1456
1798
 
1457
1799
  options.apply_defaults timeout: @config.rpcs.search_assignments.timeout,
1458
1800
  metadata: metadata,
1459
1801
  retry_policy: @config.rpcs.search_assignments.retry_policy
1460
- options.apply_defaults metadata: @config.metadata,
1802
+
1803
+ options.apply_defaults timeout: @config.timeout,
1804
+ metadata: @config.metadata,
1461
1805
  retry_policy: @config.retry_policy
1462
1806
 
1463
1807
  @reservation_service_stub.call_rpc :search_assignments, request, options: options do |response, operation|
@@ -1469,6 +1813,131 @@ module Google
1469
1813
  raise ::Google::Cloud::Error.from_error(e)
1470
1814
  end
1471
1815
 
1816
+ ##
1817
+ # Looks up assignments for a specified resource for a particular region.
1818
+ # If the request is about a project:
1819
+ #
1820
+ # 1. Assignments created on the project will be returned if they exist.
1821
+ # 2. Otherwise assignments created on the closest ancestor will be
1822
+ # returned.
1823
+ # 3. Assignments for different JobTypes will all be returned.
1824
+ #
1825
+ # The same logic applies if the request is about a folder.
1826
+ #
1827
+ # If the request is about an organization, then assignments created on the
1828
+ # organization will be returned (organization doesn't have ancestors).
1829
+ #
1830
+ # Comparing to ListAssignments, there are some behavior
1831
+ # differences:
1832
+ #
1833
+ # 1. permission on the assignee will be verified in this API.
1834
+ # 2. Hierarchy lookup (project->folder->organization) happens in this API.
1835
+ # 3. Parent here is `projects/*/locations/*`, instead of
1836
+ # `projects/*/locations/*reservations/*`.
1837
+ #
1838
+ # @overload search_all_assignments(request, options = nil)
1839
+ # Pass arguments to `search_all_assignments` via a request object, either of type
1840
+ # {::Google::Cloud::Bigquery::Reservation::V1::SearchAllAssignmentsRequest} or an equivalent Hash.
1841
+ #
1842
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::SearchAllAssignmentsRequest, ::Hash]
1843
+ # A request object representing the call parameters. Required. To specify no
1844
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1845
+ # @param options [::Gapic::CallOptions, ::Hash]
1846
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1847
+ #
1848
+ # @overload search_all_assignments(parent: nil, query: nil, page_size: nil, page_token: nil)
1849
+ # Pass arguments to `search_all_assignments` via keyword arguments. Note that at
1850
+ # least one keyword argument is required. To specify no parameters, or to keep all
1851
+ # the default parameter values, pass an empty Hash as a request object (see above).
1852
+ #
1853
+ # @param parent [::String]
1854
+ # Required. The resource name with location (project name could be the wildcard '-'),
1855
+ # e.g.:
1856
+ # `projects/-/locations/US`.
1857
+ # @param query [::String]
1858
+ # Please specify resource name as assignee in the query.
1859
+ #
1860
+ # Examples:
1861
+ #
1862
+ # * `assignee=projects/myproject`
1863
+ # * `assignee=folders/123`
1864
+ # * `assignee=organizations/456`
1865
+ # @param page_size [::Integer]
1866
+ # The maximum number of items to return per page.
1867
+ # @param page_token [::String]
1868
+ # The next_page_token value returned from a previous List request, if any.
1869
+ #
1870
+ # @yield [response, operation] Access the result along with the RPC operation
1871
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Assignment>]
1872
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1873
+ #
1874
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Assignment>]
1875
+ #
1876
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1877
+ #
1878
+ # @example Basic example
1879
+ # require "google/cloud/bigquery/reservation/v1"
1880
+ #
1881
+ # # Create a client object. The client can be reused for multiple calls.
1882
+ # client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
1883
+ #
1884
+ # # Create a request. To set request fields, pass in keyword arguments.
1885
+ # request = Google::Cloud::Bigquery::Reservation::V1::SearchAllAssignmentsRequest.new
1886
+ #
1887
+ # # Call the search_all_assignments method.
1888
+ # result = client.search_all_assignments request
1889
+ #
1890
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1891
+ # # iterate over all elements by calling #each, and the enumerable
1892
+ # # will lazily make API calls to fetch subsequent pages. Other
1893
+ # # methods are also available for managing paging directly.
1894
+ # result.each do |response|
1895
+ # # Each element is of type ::Google::Cloud::Bigquery::Reservation::V1::Assignment.
1896
+ # p response
1897
+ # end
1898
+ #
1899
+ def search_all_assignments request, options = nil
1900
+ raise ::ArgumentError, "request must be provided" if request.nil?
1901
+
1902
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::SearchAllAssignmentsRequest
1903
+
1904
+ # Converts hash and nil to an options object
1905
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1906
+
1907
+ # Customize the options with defaults
1908
+ metadata = @config.rpcs.search_all_assignments.metadata.to_h
1909
+
1910
+ # Set x-goog-api-client and x-goog-user-project headers
1911
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1912
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1913
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
1914
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1915
+
1916
+ header_params = {}
1917
+ if request.parent
1918
+ header_params["parent"] = request.parent
1919
+ end
1920
+
1921
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1922
+ metadata[:"x-goog-request-params"] ||= request_params_header
1923
+
1924
+ options.apply_defaults timeout: @config.rpcs.search_all_assignments.timeout,
1925
+ metadata: metadata,
1926
+ retry_policy: @config.rpcs.search_all_assignments.retry_policy
1927
+
1928
+ options.apply_defaults timeout: @config.timeout,
1929
+ metadata: @config.metadata,
1930
+ retry_policy: @config.retry_policy
1931
+
1932
+ @reservation_service_stub.call_rpc :search_all_assignments, request, options: options do |response, operation|
1933
+ response = ::Gapic::PagedEnumerable.new @reservation_service_stub, :search_all_assignments, request, response, operation, options
1934
+ yield response, operation if block_given?
1935
+ return response
1936
+ end
1937
+ rescue ::GRPC::BadStatus => e
1938
+ raise ::Google::Cloud::Error.from_error(e)
1939
+ end
1940
+
1472
1941
  ##
1473
1942
  # Moves an assignment under a new reservation.
1474
1943
  #
@@ -1507,6 +1976,21 @@ module Google
1507
1976
  #
1508
1977
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1509
1978
  #
1979
+ # @example Basic example
1980
+ # require "google/cloud/bigquery/reservation/v1"
1981
+ #
1982
+ # # Create a client object. The client can be reused for multiple calls.
1983
+ # client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
1984
+ #
1985
+ # # Create a request. To set request fields, pass in keyword arguments.
1986
+ # request = Google::Cloud::Bigquery::Reservation::V1::MoveAssignmentRequest.new
1987
+ #
1988
+ # # Call the move_assignment method.
1989
+ # result = client.move_assignment request
1990
+ #
1991
+ # # The returned object is of type Google::Cloud::Bigquery::Reservation::V1::Assignment.
1992
+ # p result
1993
+ #
1510
1994
  def move_assignment request, options = nil
1511
1995
  raise ::ArgumentError, "request must be provided" if request.nil?
1512
1996
 
@@ -1524,16 +2008,20 @@ module Google
1524
2008
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
1525
2009
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1526
2010
 
1527
- header_params = {
1528
- "name" => request.name
1529
- }
2011
+ header_params = {}
2012
+ if request.name
2013
+ header_params["name"] = request.name
2014
+ end
2015
+
1530
2016
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1531
2017
  metadata[:"x-goog-request-params"] ||= request_params_header
1532
2018
 
1533
2019
  options.apply_defaults timeout: @config.rpcs.move_assignment.timeout,
1534
2020
  metadata: metadata,
1535
2021
  retry_policy: @config.rpcs.move_assignment.retry_policy
1536
- options.apply_defaults metadata: @config.metadata,
2022
+
2023
+ options.apply_defaults timeout: @config.timeout,
2024
+ metadata: @config.metadata,
1537
2025
  retry_policy: @config.retry_policy
1538
2026
 
1539
2027
  @reservation_service_stub.call_rpc :move_assignment, request, options: options do |response, operation|
@@ -1564,7 +2052,7 @@ module Google
1564
2052
  #
1565
2053
  # @param name [::String]
1566
2054
  # Required. Name of the requested reservation, for example:
1567
- # `projects/{project_id}/locations/{location_id}/bireservation`
2055
+ # `projects/{project_id}/locations/{location_id}/biReservation`
1568
2056
  #
1569
2057
  # @yield [response, operation] Access the result along with the RPC operation
1570
2058
  # @yieldparam response [::Google::Cloud::Bigquery::Reservation::V1::BiReservation]
@@ -1574,6 +2062,21 @@ module Google
1574
2062
  #
1575
2063
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1576
2064
  #
2065
+ # @example Basic example
2066
+ # require "google/cloud/bigquery/reservation/v1"
2067
+ #
2068
+ # # Create a client object. The client can be reused for multiple calls.
2069
+ # client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
2070
+ #
2071
+ # # Create a request. To set request fields, pass in keyword arguments.
2072
+ # request = Google::Cloud::Bigquery::Reservation::V1::GetBiReservationRequest.new
2073
+ #
2074
+ # # Call the get_bi_reservation method.
2075
+ # result = client.get_bi_reservation request
2076
+ #
2077
+ # # The returned object is of type Google::Cloud::Bigquery::Reservation::V1::BiReservation.
2078
+ # p result
2079
+ #
1577
2080
  def get_bi_reservation request, options = nil
1578
2081
  raise ::ArgumentError, "request must be provided" if request.nil?
1579
2082
 
@@ -1591,16 +2094,20 @@ module Google
1591
2094
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
1592
2095
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1593
2096
 
1594
- header_params = {
1595
- "name" => request.name
1596
- }
2097
+ header_params = {}
2098
+ if request.name
2099
+ header_params["name"] = request.name
2100
+ end
2101
+
1597
2102
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1598
2103
  metadata[:"x-goog-request-params"] ||= request_params_header
1599
2104
 
1600
2105
  options.apply_defaults timeout: @config.rpcs.get_bi_reservation.timeout,
1601
2106
  metadata: metadata,
1602
2107
  retry_policy: @config.rpcs.get_bi_reservation.retry_policy
1603
- options.apply_defaults metadata: @config.metadata,
2108
+
2109
+ options.apply_defaults timeout: @config.timeout,
2110
+ metadata: @config.metadata,
1604
2111
  retry_policy: @config.retry_policy
1605
2112
 
1606
2113
  @reservation_service_stub.call_rpc :get_bi_reservation, request, options: options do |response, operation|
@@ -1649,6 +2156,21 @@ module Google
1649
2156
  #
1650
2157
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1651
2158
  #
2159
+ # @example Basic example
2160
+ # require "google/cloud/bigquery/reservation/v1"
2161
+ #
2162
+ # # Create a client object. The client can be reused for multiple calls.
2163
+ # client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new
2164
+ #
2165
+ # # Create a request. To set request fields, pass in keyword arguments.
2166
+ # request = Google::Cloud::Bigquery::Reservation::V1::UpdateBiReservationRequest.new
2167
+ #
2168
+ # # Call the update_bi_reservation method.
2169
+ # result = client.update_bi_reservation request
2170
+ #
2171
+ # # The returned object is of type Google::Cloud::Bigquery::Reservation::V1::BiReservation.
2172
+ # p result
2173
+ #
1652
2174
  def update_bi_reservation request, options = nil
1653
2175
  raise ::ArgumentError, "request must be provided" if request.nil?
1654
2176
 
@@ -1666,16 +2188,20 @@ module Google
1666
2188
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
1667
2189
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1668
2190
 
1669
- header_params = {
1670
- "bi_reservation.name" => request.bi_reservation.name
1671
- }
2191
+ header_params = {}
2192
+ if request.bi_reservation&.name
2193
+ header_params["bi_reservation.name"] = request.bi_reservation.name
2194
+ end
2195
+
1672
2196
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1673
2197
  metadata[:"x-goog-request-params"] ||= request_params_header
1674
2198
 
1675
2199
  options.apply_defaults timeout: @config.rpcs.update_bi_reservation.timeout,
1676
2200
  metadata: metadata,
1677
2201
  retry_policy: @config.rpcs.update_bi_reservation.retry_policy
1678
- options.apply_defaults metadata: @config.metadata,
2202
+
2203
+ options.apply_defaults timeout: @config.timeout,
2204
+ metadata: @config.metadata,
1679
2205
  retry_policy: @config.retry_policy
1680
2206
 
1681
2207
  @reservation_service_stub.call_rpc :update_bi_reservation, request, options: options do |response, operation|
@@ -1699,22 +2225,21 @@ module Google
1699
2225
  # Configuration can be applied globally to all clients, or to a single client
1700
2226
  # on construction.
1701
2227
  #
1702
- # # Examples
1703
- #
1704
- # To modify the global config, setting the timeout for create_reservation
1705
- # to 20 seconds, and all remaining timeouts to 10 seconds:
1706
- #
1707
- # ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.configure do |config|
1708
- # config.timeout = 10.0
1709
- # config.rpcs.create_reservation.timeout = 20.0
1710
- # end
2228
+ # @example
1711
2229
  #
1712
- # To apply the above configuration only to a new client:
2230
+ # # Modify the global config, setting the timeout for
2231
+ # # create_reservation to 20 seconds,
2232
+ # # and all remaining timeouts to 10 seconds.
2233
+ # ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.configure do |config|
2234
+ # config.timeout = 10.0
2235
+ # config.rpcs.create_reservation.timeout = 20.0
2236
+ # end
1713
2237
  #
1714
- # client = ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new do |config|
1715
- # config.timeout = 10.0
1716
- # config.rpcs.create_reservation.timeout = 20.0
1717
- # end
2238
+ # # Apply the above configuration only to a new client.
2239
+ # client = ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new do |config|
2240
+ # config.timeout = 10.0
2241
+ # config.rpcs.create_reservation.timeout = 20.0
2242
+ # end
1718
2243
  #
1719
2244
  # @!attribute [rw] endpoint
1720
2245
  # The hostname or hostname:port of the service endpoint.
@@ -1903,6 +2428,11 @@ module Google
1903
2428
  #
1904
2429
  attr_reader :search_assignments
1905
2430
  ##
2431
+ # RPC-specific configuration for `search_all_assignments`
2432
+ # @return [::Gapic::Config::Method]
2433
+ #
2434
+ attr_reader :search_all_assignments
2435
+ ##
1906
2436
  # RPC-specific configuration for `move_assignment`
1907
2437
  # @return [::Gapic::Config::Method]
1908
2438
  #
@@ -1952,6 +2482,8 @@ module Google
1952
2482
  @delete_assignment = ::Gapic::Config::Method.new delete_assignment_config
1953
2483
  search_assignments_config = parent_rpcs.search_assignments if parent_rpcs.respond_to? :search_assignments
1954
2484
  @search_assignments = ::Gapic::Config::Method.new search_assignments_config
2485
+ search_all_assignments_config = parent_rpcs.search_all_assignments if parent_rpcs.respond_to? :search_all_assignments
2486
+ @search_all_assignments = ::Gapic::Config::Method.new search_all_assignments_config
1955
2487
  move_assignment_config = parent_rpcs.move_assignment if parent_rpcs.respond_to? :move_assignment
1956
2488
  @move_assignment = ::Gapic::Config::Method.new move_assignment_config
1957
2489
  get_bi_reservation_config = parent_rpcs.get_bi_reservation if parent_rpcs.respond_to? :get_bi_reservation