google-cloud-bigquery-reservation-v1 0.3.1 → 0.4.1

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,103 +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
84
  default_config.rpcs.list_reservations.timeout = 60.0
86
85
  default_config.rpcs.list_reservations.retry_policy = {
87
- initial_delay: 0.1,
88
- max_delay: 60.0,
89
- multiplier: 1.3,
90
- retry_codes: [4, 14]
86
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
91
87
  }
92
88
 
93
89
  default_config.rpcs.get_reservation.timeout = 60.0
94
90
  default_config.rpcs.get_reservation.retry_policy = {
95
- initial_delay: 0.1,
96
- max_delay: 60.0,
97
- multiplier: 1.3,
98
- retry_codes: [4, 14]
91
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
99
92
  }
100
93
 
101
94
  default_config.rpcs.delete_reservation.timeout = 60.0
102
95
  default_config.rpcs.delete_reservation.retry_policy = {
103
- initial_delay: 0.1,
104
- max_delay: 60.0,
105
- multiplier: 1.3,
106
- retry_codes: [4, 14]
96
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
107
97
  }
108
98
 
109
- default_config.rpcs.update_reservation.timeout = 60.0
99
+ default_config.rpcs.update_reservation.timeout = 300.0
110
100
 
111
- default_config.rpcs.create_capacity_commitment.timeout = 60.0
101
+ default_config.rpcs.create_capacity_commitment.timeout = 300.0
112
102
 
113
103
  default_config.rpcs.list_capacity_commitments.timeout = 60.0
114
104
  default_config.rpcs.list_capacity_commitments.retry_policy = {
115
- initial_delay: 0.1,
116
- max_delay: 60.0,
117
- multiplier: 1.3,
118
- retry_codes: [4, 14]
105
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
119
106
  }
120
107
 
121
108
  default_config.rpcs.get_capacity_commitment.timeout = 60.0
122
109
  default_config.rpcs.get_capacity_commitment.retry_policy = {
123
- initial_delay: 0.1,
124
- max_delay: 60.0,
125
- multiplier: 1.3,
126
- retry_codes: [4, 14]
110
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
127
111
  }
128
112
 
129
113
  default_config.rpcs.delete_capacity_commitment.timeout = 60.0
130
114
  default_config.rpcs.delete_capacity_commitment.retry_policy = {
131
- initial_delay: 0.1,
132
- max_delay: 60.0,
133
- multiplier: 1.3,
134
- retry_codes: [4, 14]
115
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
135
116
  }
136
117
 
137
- default_config.rpcs.update_capacity_commitment.timeout = 60.0
118
+ default_config.rpcs.update_capacity_commitment.timeout = 300.0
138
119
 
139
- default_config.rpcs.split_capacity_commitment.timeout = 60.0
120
+ default_config.rpcs.split_capacity_commitment.timeout = 300.0
140
121
 
141
- default_config.rpcs.merge_capacity_commitments.timeout = 60.0
122
+ default_config.rpcs.merge_capacity_commitments.timeout = 300.0
142
123
 
143
- default_config.rpcs.create_assignment.timeout = 60.0
124
+ default_config.rpcs.create_assignment.timeout = 300.0
144
125
 
145
126
  default_config.rpcs.list_assignments.timeout = 60.0
146
127
  default_config.rpcs.list_assignments.retry_policy = {
147
- initial_delay: 0.1,
148
- max_delay: 60.0,
149
- multiplier: 1.3,
150
- retry_codes: [4, 14]
128
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
151
129
  }
152
130
 
153
131
  default_config.rpcs.delete_assignment.timeout = 60.0
154
132
  default_config.rpcs.delete_assignment.retry_policy = {
155
- initial_delay: 0.1,
156
- max_delay: 60.0,
157
- multiplier: 1.3,
158
- retry_codes: [4, 14]
133
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
159
134
  }
160
135
 
161
136
  default_config.rpcs.search_assignments.timeout = 60.0
162
137
  default_config.rpcs.search_assignments.retry_policy = {
163
- initial_delay: 0.1,
164
- max_delay: 60.0,
165
- multiplier: 1.3,
166
- retry_codes: [4, 14]
138
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
167
139
  }
168
140
 
169
- default_config.rpcs.move_assignment.timeout = 60.0
141
+ default_config.rpcs.move_assignment.timeout = 300.0
170
142
 
171
143
  default_config.rpcs.get_bi_reservation.timeout = 60.0
172
144
  default_config.rpcs.get_bi_reservation.retry_policy = {
173
- initial_delay: 0.1,
174
- max_delay: 60.0,
175
- multiplier: 1.3,
176
- retry_codes: [4, 14]
145
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
177
146
  }
178
147
 
179
- default_config.rpcs.update_bi_reservation.timeout = 60.0
148
+ default_config.rpcs.update_bi_reservation.timeout = 300.0
180
149
 
181
150
  default_config
182
151
  end
@@ -207,19 +176,15 @@ module Google
207
176
  ##
208
177
  # Create a new ReservationService client object.
209
178
  #
210
- # ## Examples
211
- #
212
- # To create a new ReservationService client with the default
213
- # configuration:
179
+ # @example
214
180
  #
215
- # 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
216
183
  #
217
- # To create a new ReservationService client with a custom
218
- # configuration:
219
- #
220
- # client = ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new do |config|
221
- # config.timeout = 10.0
222
- # 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
223
188
  #
224
189
  # @yield [config] Configure the ReservationService client.
225
190
  # @yieldparam config [Client::Configuration]
@@ -239,14 +204,13 @@ module Google
239
204
 
240
205
  # Create credentials
241
206
  credentials = @config.credentials
242
- # 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,
243
208
  # but only if the default endpoint does not have a region prefix.
244
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
245
- @config.endpoint == Client.configure.endpoint &&
209
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
246
210
  !@config.endpoint.split(".").first.include?("-")
247
211
  credentials ||= Credentials.default scope: @config.scope,
248
212
  enable_self_signed_jwt: enable_self_signed_jwt
249
- if credentials.is_a?(String) || credentials.is_a?(Hash)
213
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
250
214
  credentials = Credentials.new credentials, scope: @config.scope
251
215
  end
252
216
  @quota_project_id = @config.quota_project
@@ -298,6 +262,21 @@ module Google
298
262
  #
299
263
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
300
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
+ #
301
280
  def create_reservation request, options = nil
302
281
  raise ::ArgumentError, "request must be provided" if request.nil?
303
282
 
@@ -315,16 +294,20 @@ module Google
315
294
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
316
295
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
317
296
 
318
- header_params = {
319
- "parent" => request.parent
320
- }
297
+ header_params = {}
298
+ if request.parent
299
+ header_params["parent"] = request.parent
300
+ end
301
+
321
302
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
322
303
  metadata[:"x-goog-request-params"] ||= request_params_header
323
304
 
324
305
  options.apply_defaults timeout: @config.rpcs.create_reservation.timeout,
325
306
  metadata: metadata,
326
307
  retry_policy: @config.rpcs.create_reservation.retry_policy
327
- options.apply_defaults metadata: @config.metadata,
308
+
309
+ options.apply_defaults timeout: @config.timeout,
310
+ metadata: @config.metadata,
328
311
  retry_policy: @config.retry_policy
329
312
 
330
313
  @reservation_service_stub.call_rpc :create_reservation, request, options: options do |response, operation|
@@ -369,6 +352,27 @@ module Google
369
352
  #
370
353
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
371
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
+ #
372
376
  def list_reservations request, options = nil
373
377
  raise ::ArgumentError, "request must be provided" if request.nil?
374
378
 
@@ -386,16 +390,20 @@ module Google
386
390
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
387
391
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
388
392
 
389
- header_params = {
390
- "parent" => request.parent
391
- }
393
+ header_params = {}
394
+ if request.parent
395
+ header_params["parent"] = request.parent
396
+ end
397
+
392
398
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
393
399
  metadata[:"x-goog-request-params"] ||= request_params_header
394
400
 
395
401
  options.apply_defaults timeout: @config.rpcs.list_reservations.timeout,
396
402
  metadata: metadata,
397
403
  retry_policy: @config.rpcs.list_reservations.retry_policy
398
- options.apply_defaults metadata: @config.metadata,
404
+
405
+ options.apply_defaults timeout: @config.timeout,
406
+ metadata: @config.metadata,
399
407
  retry_policy: @config.retry_policy
400
408
 
401
409
  @reservation_service_stub.call_rpc :list_reservations, request, options: options do |response, operation|
@@ -437,6 +445,21 @@ module Google
437
445
  #
438
446
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
439
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
+ #
440
463
  def get_reservation request, options = nil
441
464
  raise ::ArgumentError, "request must be provided" if request.nil?
442
465
 
@@ -454,16 +477,20 @@ module Google
454
477
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
455
478
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
456
479
 
457
- header_params = {
458
- "name" => request.name
459
- }
480
+ header_params = {}
481
+ if request.name
482
+ header_params["name"] = request.name
483
+ end
484
+
460
485
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
461
486
  metadata[:"x-goog-request-params"] ||= request_params_header
462
487
 
463
488
  options.apply_defaults timeout: @config.rpcs.get_reservation.timeout,
464
489
  metadata: metadata,
465
490
  retry_policy: @config.rpcs.get_reservation.retry_policy
466
- options.apply_defaults metadata: @config.metadata,
491
+
492
+ options.apply_defaults timeout: @config.timeout,
493
+ metadata: @config.metadata,
467
494
  retry_policy: @config.retry_policy
468
495
 
469
496
  @reservation_service_stub.call_rpc :get_reservation, request, options: options do |response, operation|
@@ -506,6 +533,21 @@ module Google
506
533
  #
507
534
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
508
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
+ #
509
551
  def delete_reservation request, options = nil
510
552
  raise ::ArgumentError, "request must be provided" if request.nil?
511
553
 
@@ -523,16 +565,20 @@ module Google
523
565
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
524
566
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
525
567
 
526
- header_params = {
527
- "name" => request.name
528
- }
568
+ header_params = {}
569
+ if request.name
570
+ header_params["name"] = request.name
571
+ end
572
+
529
573
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
530
574
  metadata[:"x-goog-request-params"] ||= request_params_header
531
575
 
532
576
  options.apply_defaults timeout: @config.rpcs.delete_reservation.timeout,
533
577
  metadata: metadata,
534
578
  retry_policy: @config.rpcs.delete_reservation.retry_policy
535
- options.apply_defaults metadata: @config.metadata,
579
+
580
+ options.apply_defaults timeout: @config.timeout,
581
+ metadata: @config.metadata,
536
582
  retry_policy: @config.retry_policy
537
583
 
538
584
  @reservation_service_stub.call_rpc :delete_reservation, request, options: options do |response, operation|
@@ -574,6 +620,21 @@ module Google
574
620
  #
575
621
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
576
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
+ #
577
638
  def update_reservation request, options = nil
578
639
  raise ::ArgumentError, "request must be provided" if request.nil?
579
640
 
@@ -591,16 +652,20 @@ module Google
591
652
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
592
653
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
593
654
 
594
- header_params = {
595
- "reservation.name" => request.reservation.name
596
- }
655
+ header_params = {}
656
+ if request.reservation&.name
657
+ header_params["reservation.name"] = request.reservation.name
658
+ end
659
+
597
660
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
598
661
  metadata[:"x-goog-request-params"] ||= request_params_header
599
662
 
600
663
  options.apply_defaults timeout: @config.rpcs.update_reservation.timeout,
601
664
  metadata: metadata,
602
665
  retry_policy: @config.rpcs.update_reservation.retry_policy
603
- options.apply_defaults metadata: @config.metadata,
666
+
667
+ options.apply_defaults timeout: @config.timeout,
668
+ metadata: @config.metadata,
604
669
  retry_policy: @config.retry_policy
605
670
 
606
671
  @reservation_service_stub.call_rpc :update_reservation, request, options: options do |response, operation|
@@ -624,7 +689,7 @@ module Google
624
689
  # @param options [::Gapic::CallOptions, ::Hash]
625
690
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
626
691
  #
627
- # @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)
628
693
  # Pass arguments to `create_capacity_commitment` via keyword arguments. Note that at
629
694
  # least one keyword argument is required. To specify no parameters, or to keep all
630
695
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -637,6 +702,12 @@ module Google
637
702
  # @param enforce_single_admin_project_per_org [::Boolean]
638
703
  # If true, fail the request if another project in the organization has a
639
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.
640
711
  #
641
712
  # @yield [response, operation] Access the result along with the RPC operation
642
713
  # @yieldparam response [::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment]
@@ -646,6 +717,21 @@ module Google
646
717
  #
647
718
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
648
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
+ #
649
735
  def create_capacity_commitment request, options = nil
650
736
  raise ::ArgumentError, "request must be provided" if request.nil?
651
737
 
@@ -663,16 +749,20 @@ module Google
663
749
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
664
750
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
665
751
 
666
- header_params = {
667
- "parent" => request.parent
668
- }
752
+ header_params = {}
753
+ if request.parent
754
+ header_params["parent"] = request.parent
755
+ end
756
+
669
757
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
670
758
  metadata[:"x-goog-request-params"] ||= request_params_header
671
759
 
672
760
  options.apply_defaults timeout: @config.rpcs.create_capacity_commitment.timeout,
673
761
  metadata: metadata,
674
762
  retry_policy: @config.rpcs.create_capacity_commitment.retry_policy
675
- options.apply_defaults metadata: @config.metadata,
763
+
764
+ options.apply_defaults timeout: @config.timeout,
765
+ metadata: @config.metadata,
676
766
  retry_policy: @config.retry_policy
677
767
 
678
768
  @reservation_service_stub.call_rpc :create_capacity_commitment, request, options: options do |response, operation|
@@ -717,6 +807,27 @@ module Google
717
807
  #
718
808
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
719
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
+ #
720
831
  def list_capacity_commitments request, options = nil
721
832
  raise ::ArgumentError, "request must be provided" if request.nil?
722
833
 
@@ -734,16 +845,20 @@ module Google
734
845
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
735
846
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
736
847
 
737
- header_params = {
738
- "parent" => request.parent
739
- }
848
+ header_params = {}
849
+ if request.parent
850
+ header_params["parent"] = request.parent
851
+ end
852
+
740
853
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
741
854
  metadata[:"x-goog-request-params"] ||= request_params_header
742
855
 
743
856
  options.apply_defaults timeout: @config.rpcs.list_capacity_commitments.timeout,
744
857
  metadata: metadata,
745
858
  retry_policy: @config.rpcs.list_capacity_commitments.retry_policy
746
- options.apply_defaults metadata: @config.metadata,
859
+
860
+ options.apply_defaults timeout: @config.timeout,
861
+ metadata: @config.metadata,
747
862
  retry_policy: @config.retry_policy
748
863
 
749
864
  @reservation_service_stub.call_rpc :list_capacity_commitments, request, options: options do |response, operation|
@@ -785,6 +900,21 @@ module Google
785
900
  #
786
901
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
787
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
+ #
788
918
  def get_capacity_commitment request, options = nil
789
919
  raise ::ArgumentError, "request must be provided" if request.nil?
790
920
 
@@ -802,16 +932,20 @@ module Google
802
932
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
803
933
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
804
934
 
805
- header_params = {
806
- "name" => request.name
807
- }
935
+ header_params = {}
936
+ if request.name
937
+ header_params["name"] = request.name
938
+ end
939
+
808
940
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
809
941
  metadata[:"x-goog-request-params"] ||= request_params_header
810
942
 
811
943
  options.apply_defaults timeout: @config.rpcs.get_capacity_commitment.timeout,
812
944
  metadata: metadata,
813
945
  retry_policy: @config.rpcs.get_capacity_commitment.retry_policy
814
- options.apply_defaults metadata: @config.metadata,
946
+
947
+ options.apply_defaults timeout: @config.timeout,
948
+ metadata: @config.metadata,
815
949
  retry_policy: @config.retry_policy
816
950
 
817
951
  @reservation_service_stub.call_rpc :get_capacity_commitment, request, options: options do |response, operation|
@@ -837,7 +971,7 @@ module Google
837
971
  # @param options [::Gapic::CallOptions, ::Hash]
838
972
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
839
973
  #
840
- # @overload delete_capacity_commitment(name: nil)
974
+ # @overload delete_capacity_commitment(name: nil, force: nil)
841
975
  # Pass arguments to `delete_capacity_commitment` via keyword arguments. Note that at
842
976
  # least one keyword argument is required. To specify no parameters, or to keep all
843
977
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -845,6 +979,10 @@ module Google
845
979
  # @param name [::String]
846
980
  # Required. Resource name of the capacity commitment to delete. E.g.,
847
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.
848
986
  #
849
987
  # @yield [response, operation] Access the result along with the RPC operation
850
988
  # @yieldparam response [::Google::Protobuf::Empty]
@@ -854,6 +992,21 @@ module Google
854
992
  #
855
993
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
856
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
+ #
857
1010
  def delete_capacity_commitment request, options = nil
858
1011
  raise ::ArgumentError, "request must be provided" if request.nil?
859
1012
 
@@ -871,16 +1024,20 @@ module Google
871
1024
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
872
1025
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
873
1026
 
874
- header_params = {
875
- "name" => request.name
876
- }
1027
+ header_params = {}
1028
+ if request.name
1029
+ header_params["name"] = request.name
1030
+ end
1031
+
877
1032
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
878
1033
  metadata[:"x-goog-request-params"] ||= request_params_header
879
1034
 
880
1035
  options.apply_defaults timeout: @config.rpcs.delete_capacity_commitment.timeout,
881
1036
  metadata: metadata,
882
1037
  retry_policy: @config.rpcs.delete_capacity_commitment.retry_policy
883
- options.apply_defaults metadata: @config.metadata,
1038
+
1039
+ options.apply_defaults timeout: @config.timeout,
1040
+ metadata: @config.metadata,
884
1041
  retry_policy: @config.retry_policy
885
1042
 
886
1043
  @reservation_service_stub.call_rpc :delete_capacity_commitment, request, options: options do |response, operation|
@@ -928,6 +1085,21 @@ module Google
928
1085
  #
929
1086
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
930
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
+ #
931
1103
  def update_capacity_commitment request, options = nil
932
1104
  raise ::ArgumentError, "request must be provided" if request.nil?
933
1105
 
@@ -945,16 +1117,20 @@ module Google
945
1117
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
946
1118
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
947
1119
 
948
- header_params = {
949
- "capacity_commitment.name" => request.capacity_commitment.name
950
- }
1120
+ header_params = {}
1121
+ if request.capacity_commitment&.name
1122
+ header_params["capacity_commitment.name"] = request.capacity_commitment.name
1123
+ end
1124
+
951
1125
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
952
1126
  metadata[:"x-goog-request-params"] ||= request_params_header
953
1127
 
954
1128
  options.apply_defaults timeout: @config.rpcs.update_capacity_commitment.timeout,
955
1129
  metadata: metadata,
956
1130
  retry_policy: @config.rpcs.update_capacity_commitment.retry_policy
957
- options.apply_defaults metadata: @config.metadata,
1131
+
1132
+ options.apply_defaults timeout: @config.timeout,
1133
+ metadata: @config.metadata,
958
1134
  retry_policy: @config.retry_policy
959
1135
 
960
1136
  @reservation_service_stub.call_rpc :update_capacity_commitment, request, options: options do |response, operation|
@@ -1004,6 +1180,21 @@ module Google
1004
1180
  #
1005
1181
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1006
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
+ #
1007
1198
  def split_capacity_commitment request, options = nil
1008
1199
  raise ::ArgumentError, "request must be provided" if request.nil?
1009
1200
 
@@ -1021,16 +1212,20 @@ module Google
1021
1212
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
1022
1213
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1023
1214
 
1024
- header_params = {
1025
- "name" => request.name
1026
- }
1215
+ header_params = {}
1216
+ if request.name
1217
+ header_params["name"] = request.name
1218
+ end
1219
+
1027
1220
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1028
1221
  metadata[:"x-goog-request-params"] ||= request_params_header
1029
1222
 
1030
1223
  options.apply_defaults timeout: @config.rpcs.split_capacity_commitment.timeout,
1031
1224
  metadata: metadata,
1032
1225
  retry_policy: @config.rpcs.split_capacity_commitment.retry_policy
1033
- options.apply_defaults metadata: @config.metadata,
1226
+
1227
+ options.apply_defaults timeout: @config.timeout,
1228
+ metadata: @config.metadata,
1034
1229
  retry_policy: @config.retry_policy
1035
1230
 
1036
1231
  @reservation_service_stub.call_rpc :split_capacity_commitment, request, options: options do |response, operation|
@@ -1083,6 +1278,21 @@ module Google
1083
1278
  #
1084
1279
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1085
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
+ #
1086
1296
  def merge_capacity_commitments request, options = nil
1087
1297
  raise ::ArgumentError, "request must be provided" if request.nil?
1088
1298
 
@@ -1100,16 +1310,20 @@ module Google
1100
1310
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
1101
1311
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1102
1312
 
1103
- header_params = {
1104
- "parent" => request.parent
1105
- }
1313
+ header_params = {}
1314
+ if request.parent
1315
+ header_params["parent"] = request.parent
1316
+ end
1317
+
1106
1318
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1107
1319
  metadata[:"x-goog-request-params"] ||= request_params_header
1108
1320
 
1109
1321
  options.apply_defaults timeout: @config.rpcs.merge_capacity_commitments.timeout,
1110
1322
  metadata: metadata,
1111
1323
  retry_policy: @config.rpcs.merge_capacity_commitments.retry_policy
1112
- options.apply_defaults metadata: @config.metadata,
1324
+
1325
+ options.apply_defaults timeout: @config.timeout,
1326
+ metadata: @config.metadata,
1113
1327
  retry_policy: @config.retry_policy
1114
1328
 
1115
1329
  @reservation_service_stub.call_rpc :merge_capacity_commitments, request, options: options do |response, operation|
@@ -1145,6 +1359,11 @@ module Google
1145
1359
  # `project2`) could all be created and mapped to the same or different
1146
1360
  # reservations.
1147
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
+ #
1148
1367
  # Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have
1149
1368
  # 'bigquery.admin' permissions on the project using the reservation
1150
1369
  # and the project that owns this reservation.
@@ -1162,7 +1381,7 @@ module Google
1162
1381
  # @param options [::Gapic::CallOptions, ::Hash]
1163
1382
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1164
1383
  #
1165
- # @overload create_assignment(parent: nil, assignment: nil)
1384
+ # @overload create_assignment(parent: nil, assignment: nil, assignment_id: nil)
1166
1385
  # Pass arguments to `create_assignment` via keyword arguments. Note that at
1167
1386
  # least one keyword argument is required. To specify no parameters, or to keep all
1168
1387
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -1172,6 +1391,11 @@ module Google
1172
1391
  # E.g. `projects/myproject/locations/US/reservations/team1-prod`
1173
1392
  # @param assignment [::Google::Cloud::Bigquery::Reservation::V1::Assignment, ::Hash]
1174
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.
1175
1399
  #
1176
1400
  # @yield [response, operation] Access the result along with the RPC operation
1177
1401
  # @yieldparam response [::Google::Cloud::Bigquery::Reservation::V1::Assignment]
@@ -1181,6 +1405,21 @@ module Google
1181
1405
  #
1182
1406
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1183
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
+ #
1184
1423
  def create_assignment request, options = nil
1185
1424
  raise ::ArgumentError, "request must be provided" if request.nil?
1186
1425
 
@@ -1198,16 +1437,20 @@ module Google
1198
1437
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
1199
1438
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1200
1439
 
1201
- header_params = {
1202
- "parent" => request.parent
1203
- }
1440
+ header_params = {}
1441
+ if request.parent
1442
+ header_params["parent"] = request.parent
1443
+ end
1444
+
1204
1445
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1205
1446
  metadata[:"x-goog-request-params"] ||= request_params_header
1206
1447
 
1207
1448
  options.apply_defaults timeout: @config.rpcs.create_assignment.timeout,
1208
1449
  metadata: metadata,
1209
1450
  retry_policy: @config.rpcs.create_assignment.retry_policy
1210
- options.apply_defaults metadata: @config.metadata,
1451
+
1452
+ options.apply_defaults timeout: @config.timeout,
1453
+ metadata: @config.metadata,
1211
1454
  retry_policy: @config.retry_policy
1212
1455
 
1213
1456
  @reservation_service_stub.call_rpc :create_assignment, request, options: options do |response, operation|
@@ -1277,6 +1520,27 @@ module Google
1277
1520
  #
1278
1521
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1279
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
+ #
1280
1544
  def list_assignments request, options = nil
1281
1545
  raise ::ArgumentError, "request must be provided" if request.nil?
1282
1546
 
@@ -1294,16 +1558,20 @@ module Google
1294
1558
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
1295
1559
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1296
1560
 
1297
- header_params = {
1298
- "parent" => request.parent
1299
- }
1561
+ header_params = {}
1562
+ if request.parent
1563
+ header_params["parent"] = request.parent
1564
+ end
1565
+
1300
1566
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1301
1567
  metadata[:"x-goog-request-params"] ||= request_params_header
1302
1568
 
1303
1569
  options.apply_defaults timeout: @config.rpcs.list_assignments.timeout,
1304
1570
  metadata: metadata,
1305
1571
  retry_policy: @config.rpcs.list_assignments.retry_policy
1306
- options.apply_defaults metadata: @config.metadata,
1572
+
1573
+ options.apply_defaults timeout: @config.timeout,
1574
+ metadata: @config.metadata,
1307
1575
  retry_policy: @config.retry_policy
1308
1576
 
1309
1577
  @reservation_service_stub.call_rpc :list_assignments, request, options: options do |response, operation|
@@ -1359,6 +1627,21 @@ module Google
1359
1627
  #
1360
1628
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1361
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
+ #
1362
1645
  def delete_assignment request, options = nil
1363
1646
  raise ::ArgumentError, "request must be provided" if request.nil?
1364
1647
 
@@ -1376,16 +1659,20 @@ module Google
1376
1659
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
1377
1660
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1378
1661
 
1379
- header_params = {
1380
- "name" => request.name
1381
- }
1662
+ header_params = {}
1663
+ if request.name
1664
+ header_params["name"] = request.name
1665
+ end
1666
+
1382
1667
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1383
1668
  metadata[:"x-goog-request-params"] ||= request_params_header
1384
1669
 
1385
1670
  options.apply_defaults timeout: @config.rpcs.delete_assignment.timeout,
1386
1671
  metadata: metadata,
1387
1672
  retry_policy: @config.rpcs.delete_assignment.retry_policy
1388
- options.apply_defaults metadata: @config.metadata,
1673
+
1674
+ options.apply_defaults timeout: @config.timeout,
1675
+ metadata: @config.metadata,
1389
1676
  retry_policy: @config.retry_policy
1390
1677
 
1391
1678
  @reservation_service_stub.call_rpc :delete_assignment, request, options: options do |response, operation|
@@ -1397,7 +1684,7 @@ module Google
1397
1684
  end
1398
1685
 
1399
1686
  ##
1400
- # Looks up assignments for a specified resource for a particular region.
1687
+ # Deprecated: Looks up assignments for a specified resource for a particular region.
1401
1688
  # If the request is about a project:
1402
1689
  #
1403
1690
  # 1. Assignments created on the project will be returned if they exist.
@@ -1421,6 +1708,8 @@ module Google
1421
1708
  # **Note** "-" cannot be used for projects
1422
1709
  # nor locations.
1423
1710
  #
1711
+ # @deprecated This method is deprecated and may be removed in the next major version update.
1712
+ #
1424
1713
  # @overload search_assignments(request, options = nil)
1425
1714
  # Pass arguments to `search_assignments` via a request object, either of type
1426
1715
  # {::Google::Cloud::Bigquery::Reservation::V1::SearchAssignmentsRequest} or an equivalent Hash.
@@ -1461,6 +1750,27 @@ module Google
1461
1750
  #
1462
1751
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1463
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
+ #
1464
1774
  def search_assignments request, options = nil
1465
1775
  raise ::ArgumentError, "request must be provided" if request.nil?
1466
1776
 
@@ -1478,16 +1788,20 @@ module Google
1478
1788
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
1479
1789
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1480
1790
 
1481
- header_params = {
1482
- "parent" => request.parent
1483
- }
1791
+ header_params = {}
1792
+ if request.parent
1793
+ header_params["parent"] = request.parent
1794
+ end
1795
+
1484
1796
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1485
1797
  metadata[:"x-goog-request-params"] ||= request_params_header
1486
1798
 
1487
1799
  options.apply_defaults timeout: @config.rpcs.search_assignments.timeout,
1488
1800
  metadata: metadata,
1489
1801
  retry_policy: @config.rpcs.search_assignments.retry_policy
1490
- options.apply_defaults metadata: @config.metadata,
1802
+
1803
+ options.apply_defaults timeout: @config.timeout,
1804
+ metadata: @config.metadata,
1491
1805
  retry_policy: @config.retry_policy
1492
1806
 
1493
1807
  @reservation_service_stub.call_rpc :search_assignments, request, options: options do |response, operation|
@@ -1499,6 +1813,131 @@ module Google
1499
1813
  raise ::Google::Cloud::Error.from_error(e)
1500
1814
  end
1501
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
+
1502
1941
  ##
1503
1942
  # Moves an assignment under a new reservation.
1504
1943
  #
@@ -1537,6 +1976,21 @@ module Google
1537
1976
  #
1538
1977
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1539
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
+ #
1540
1994
  def move_assignment request, options = nil
1541
1995
  raise ::ArgumentError, "request must be provided" if request.nil?
1542
1996
 
@@ -1554,16 +2008,20 @@ module Google
1554
2008
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
1555
2009
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1556
2010
 
1557
- header_params = {
1558
- "name" => request.name
1559
- }
2011
+ header_params = {}
2012
+ if request.name
2013
+ header_params["name"] = request.name
2014
+ end
2015
+
1560
2016
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1561
2017
  metadata[:"x-goog-request-params"] ||= request_params_header
1562
2018
 
1563
2019
  options.apply_defaults timeout: @config.rpcs.move_assignment.timeout,
1564
2020
  metadata: metadata,
1565
2021
  retry_policy: @config.rpcs.move_assignment.retry_policy
1566
- options.apply_defaults metadata: @config.metadata,
2022
+
2023
+ options.apply_defaults timeout: @config.timeout,
2024
+ metadata: @config.metadata,
1567
2025
  retry_policy: @config.retry_policy
1568
2026
 
1569
2027
  @reservation_service_stub.call_rpc :move_assignment, request, options: options do |response, operation|
@@ -1594,7 +2052,7 @@ module Google
1594
2052
  #
1595
2053
  # @param name [::String]
1596
2054
  # Required. Name of the requested reservation, for example:
1597
- # `projects/{project_id}/locations/{location_id}/bireservation`
2055
+ # `projects/{project_id}/locations/{location_id}/biReservation`
1598
2056
  #
1599
2057
  # @yield [response, operation] Access the result along with the RPC operation
1600
2058
  # @yieldparam response [::Google::Cloud::Bigquery::Reservation::V1::BiReservation]
@@ -1604,6 +2062,21 @@ module Google
1604
2062
  #
1605
2063
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1606
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
+ #
1607
2080
  def get_bi_reservation request, options = nil
1608
2081
  raise ::ArgumentError, "request must be provided" if request.nil?
1609
2082
 
@@ -1621,16 +2094,20 @@ module Google
1621
2094
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
1622
2095
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1623
2096
 
1624
- header_params = {
1625
- "name" => request.name
1626
- }
2097
+ header_params = {}
2098
+ if request.name
2099
+ header_params["name"] = request.name
2100
+ end
2101
+
1627
2102
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1628
2103
  metadata[:"x-goog-request-params"] ||= request_params_header
1629
2104
 
1630
2105
  options.apply_defaults timeout: @config.rpcs.get_bi_reservation.timeout,
1631
2106
  metadata: metadata,
1632
2107
  retry_policy: @config.rpcs.get_bi_reservation.retry_policy
1633
- options.apply_defaults metadata: @config.metadata,
2108
+
2109
+ options.apply_defaults timeout: @config.timeout,
2110
+ metadata: @config.metadata,
1634
2111
  retry_policy: @config.retry_policy
1635
2112
 
1636
2113
  @reservation_service_stub.call_rpc :get_bi_reservation, request, options: options do |response, operation|
@@ -1679,6 +2156,21 @@ module Google
1679
2156
  #
1680
2157
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1681
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
+ #
1682
2174
  def update_bi_reservation request, options = nil
1683
2175
  raise ::ArgumentError, "request must be provided" if request.nil?
1684
2176
 
@@ -1696,16 +2188,20 @@ module Google
1696
2188
  gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
1697
2189
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1698
2190
 
1699
- header_params = {
1700
- "bi_reservation.name" => request.bi_reservation.name
1701
- }
2191
+ header_params = {}
2192
+ if request.bi_reservation&.name
2193
+ header_params["bi_reservation.name"] = request.bi_reservation.name
2194
+ end
2195
+
1702
2196
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1703
2197
  metadata[:"x-goog-request-params"] ||= request_params_header
1704
2198
 
1705
2199
  options.apply_defaults timeout: @config.rpcs.update_bi_reservation.timeout,
1706
2200
  metadata: metadata,
1707
2201
  retry_policy: @config.rpcs.update_bi_reservation.retry_policy
1708
- options.apply_defaults metadata: @config.metadata,
2202
+
2203
+ options.apply_defaults timeout: @config.timeout,
2204
+ metadata: @config.metadata,
1709
2205
  retry_policy: @config.retry_policy
1710
2206
 
1711
2207
  @reservation_service_stub.call_rpc :update_bi_reservation, request, options: options do |response, operation|
@@ -1729,22 +2225,21 @@ module Google
1729
2225
  # Configuration can be applied globally to all clients, or to a single client
1730
2226
  # on construction.
1731
2227
  #
1732
- # # Examples
1733
- #
1734
- # To modify the global config, setting the timeout for create_reservation
1735
- # to 20 seconds, and all remaining timeouts to 10 seconds:
1736
- #
1737
- # ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.configure do |config|
1738
- # config.timeout = 10.0
1739
- # config.rpcs.create_reservation.timeout = 20.0
1740
- # end
2228
+ # @example
1741
2229
  #
1742
- # 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
1743
2237
  #
1744
- # client = ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new do |config|
1745
- # config.timeout = 10.0
1746
- # config.rpcs.create_reservation.timeout = 20.0
1747
- # 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
1748
2243
  #
1749
2244
  # @!attribute [rw] endpoint
1750
2245
  # The hostname or hostname:port of the service endpoint.
@@ -1933,6 +2428,11 @@ module Google
1933
2428
  #
1934
2429
  attr_reader :search_assignments
1935
2430
  ##
2431
+ # RPC-specific configuration for `search_all_assignments`
2432
+ # @return [::Gapic::Config::Method]
2433
+ #
2434
+ attr_reader :search_all_assignments
2435
+ ##
1936
2436
  # RPC-specific configuration for `move_assignment`
1937
2437
  # @return [::Gapic::Config::Method]
1938
2438
  #
@@ -1982,6 +2482,8 @@ module Google
1982
2482
  @delete_assignment = ::Gapic::Config::Method.new delete_assignment_config
1983
2483
  search_assignments_config = parent_rpcs.search_assignments if parent_rpcs.respond_to? :search_assignments
1984
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
1985
2487
  move_assignment_config = parent_rpcs.move_assignment if parent_rpcs.respond_to? :move_assignment
1986
2488
  @move_assignment = ::Gapic::Config::Method.new move_assignment_config
1987
2489
  get_bi_reservation_config = parent_rpcs.get_bi_reservation if parent_rpcs.respond_to? :get_bi_reservation