google-cloud-bigquery-reservation-v1 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2066 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/bigquery/reservation/v1/reservation_pb"
21
+ require "google/cloud/bigquery/reservation/v1/reservation_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Bigquery
26
+ module Reservation
27
+ module V1
28
+ module ReservationService
29
+ module Rest
30
+ ##
31
+ # REST client for the ReservationService service.
32
+ #
33
+ # This API allows users to manage their flat-rate BigQuery reservations.
34
+ #
35
+ # A reservation provides computational resource guarantees, in the form of
36
+ # [slots](https://cloud.google.com/bigquery/docs/slots), to users. A slot is a
37
+ # unit of computational power in BigQuery, and serves as the basic unit of
38
+ # parallelism. In a scan of a multi-partitioned table, a single slot operates
39
+ # on a single partition of the table. A reservation resource exists as a child
40
+ # resource of the admin project and location, e.g.:
41
+ # `projects/myproject/locations/US/reservations/reservationName`.
42
+ #
43
+ # A capacity commitment is a way to purchase compute capacity for BigQuery jobs
44
+ # (in the form of slots) with some committed period of usage. A capacity
45
+ # commitment resource exists as a child resource of the admin project and
46
+ # location, e.g.:
47
+ # `projects/myproject/locations/US/capacityCommitments/id`.
48
+ #
49
+ class Client
50
+ include Paths
51
+
52
+ # @private
53
+ attr_reader :reservation_service_stub
54
+
55
+ ##
56
+ # Configure the ReservationService Client class.
57
+ #
58
+ # See {::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Rest::Client::Configuration}
59
+ # for a description of the configuration fields.
60
+ #
61
+ # @example
62
+ #
63
+ # # Modify the configuration for all ReservationService clients
64
+ # ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Rest::Client.configure do |config|
65
+ # config.timeout = 10.0
66
+ # end
67
+ #
68
+ # @yield [config] Configure the Client client.
69
+ # @yieldparam config [Client::Configuration]
70
+ #
71
+ # @return [Client::Configuration]
72
+ #
73
+ def self.configure
74
+ @configure ||= begin
75
+ namespace = ["Google", "Cloud", "Bigquery", "Reservation", "V1"]
76
+ parent_config = while namespace.any?
77
+ parent_name = namespace.join "::"
78
+ parent_const = const_get parent_name
79
+ break parent_const.configure if parent_const.respond_to? :configure
80
+ namespace.pop
81
+ end
82
+ default_config = Client::Configuration.new parent_config
83
+
84
+ default_config.rpcs.create_reservation.timeout = 300.0
85
+
86
+ default_config.rpcs.list_reservations.timeout = 300.0
87
+ default_config.rpcs.list_reservations.retry_policy = {
88
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
89
+ }
90
+
91
+ default_config.rpcs.get_reservation.timeout = 300.0
92
+ default_config.rpcs.get_reservation.retry_policy = {
93
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
94
+ }
95
+
96
+ default_config.rpcs.delete_reservation.timeout = 300.0
97
+ default_config.rpcs.delete_reservation.retry_policy = {
98
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
99
+ }
100
+
101
+ default_config.rpcs.update_reservation.timeout = 300.0
102
+
103
+ default_config.rpcs.create_capacity_commitment.timeout = 300.0
104
+
105
+ default_config.rpcs.list_capacity_commitments.timeout = 300.0
106
+ default_config.rpcs.list_capacity_commitments.retry_policy = {
107
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
108
+ }
109
+
110
+ default_config.rpcs.get_capacity_commitment.timeout = 300.0
111
+ default_config.rpcs.get_capacity_commitment.retry_policy = {
112
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
113
+ }
114
+
115
+ default_config.rpcs.delete_capacity_commitment.timeout = 300.0
116
+ default_config.rpcs.delete_capacity_commitment.retry_policy = {
117
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
118
+ }
119
+
120
+ default_config.rpcs.update_capacity_commitment.timeout = 300.0
121
+
122
+ default_config.rpcs.split_capacity_commitment.timeout = 300.0
123
+
124
+ default_config.rpcs.merge_capacity_commitments.timeout = 300.0
125
+
126
+ default_config.rpcs.create_assignment.timeout = 300.0
127
+
128
+ default_config.rpcs.list_assignments.timeout = 300.0
129
+ default_config.rpcs.list_assignments.retry_policy = {
130
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
131
+ }
132
+
133
+ default_config.rpcs.delete_assignment.timeout = 300.0
134
+ default_config.rpcs.delete_assignment.retry_policy = {
135
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
136
+ }
137
+
138
+ default_config.rpcs.search_assignments.timeout = 300.0
139
+ default_config.rpcs.search_assignments.retry_policy = {
140
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
141
+ }
142
+
143
+ default_config.rpcs.move_assignment.timeout = 300.0
144
+
145
+ default_config.rpcs.get_bi_reservation.timeout = 300.0
146
+ default_config.rpcs.get_bi_reservation.retry_policy = {
147
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
148
+ }
149
+
150
+ default_config.rpcs.update_bi_reservation.timeout = 300.0
151
+
152
+ default_config
153
+ end
154
+ yield @configure if block_given?
155
+ @configure
156
+ end
157
+
158
+ ##
159
+ # Configure the ReservationService Client instance.
160
+ #
161
+ # The configuration is set to the derived mode, meaning that values can be changed,
162
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
163
+ # should be made on {Client.configure}.
164
+ #
165
+ # See {::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Rest::Client::Configuration}
166
+ # for a description of the configuration fields.
167
+ #
168
+ # @yield [config] Configure the Client client.
169
+ # @yieldparam config [Client::Configuration]
170
+ #
171
+ # @return [Client::Configuration]
172
+ #
173
+ def configure
174
+ yield @config if block_given?
175
+ @config
176
+ end
177
+
178
+ ##
179
+ # Create a new ReservationService REST client object.
180
+ #
181
+ # @example
182
+ #
183
+ # # Create a client using the default configuration
184
+ # client = ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Rest::Client.new
185
+ #
186
+ # # Create a client using a custom configuration
187
+ # client = ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Rest::Client.new do |config|
188
+ # config.timeout = 10.0
189
+ # end
190
+ #
191
+ # @yield [config] Configure the ReservationService client.
192
+ # @yieldparam config [Client::Configuration]
193
+ #
194
+ def initialize
195
+ # Create the configuration object
196
+ @config = Configuration.new Client.configure
197
+
198
+ # Yield the configuration if needed
199
+ yield @config if block_given?
200
+
201
+ # Create credentials
202
+ credentials = @config.credentials
203
+ # Use self-signed JWT if the endpoint is unchanged from default,
204
+ # but only if the default endpoint does not have a region prefix.
205
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
206
+ !@config.endpoint.split(".").first.include?("-")
207
+ credentials ||= Credentials.default scope: @config.scope,
208
+ enable_self_signed_jwt: enable_self_signed_jwt
209
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
210
+ credentials = Credentials.new credentials, scope: @config.scope
211
+ end
212
+
213
+ @quota_project_id = @config.quota_project
214
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
215
+
216
+ @reservation_service_stub = ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
217
+ end
218
+
219
+ # Service calls
220
+
221
+ ##
222
+ # Creates a new reservation resource.
223
+ #
224
+ # @overload create_reservation(request, options = nil)
225
+ # Pass arguments to `create_reservation` via a request object, either of type
226
+ # {::Google::Cloud::Bigquery::Reservation::V1::CreateReservationRequest} or an equivalent Hash.
227
+ #
228
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::CreateReservationRequest, ::Hash]
229
+ # A request object representing the call parameters. Required. To specify no
230
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
231
+ # @param options [::Gapic::CallOptions, ::Hash]
232
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
233
+ #
234
+ # @overload create_reservation(parent: nil, reservation_id: nil, reservation: nil)
235
+ # Pass arguments to `create_reservation` via keyword arguments. Note that at
236
+ # least one keyword argument is required. To specify no parameters, or to keep all
237
+ # the default parameter values, pass an empty Hash as a request object (see above).
238
+ #
239
+ # @param parent [::String]
240
+ # Required. Project, location. E.g.,
241
+ # `projects/myproject/locations/US`
242
+ # @param reservation_id [::String]
243
+ # The reservation ID. It must only contain lower case alphanumeric
244
+ # characters or dashes. It must start with a letter and must not end
245
+ # with a dash. Its maximum length is 64 characters.
246
+ # @param reservation [::Google::Cloud::Bigquery::Reservation::V1::Reservation, ::Hash]
247
+ # Definition of the new reservation to create.
248
+ # @yield [result, operation] Access the result along with the TransportOperation object
249
+ # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::Reservation]
250
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
251
+ #
252
+ # @return [::Google::Cloud::Bigquery::Reservation::V1::Reservation]
253
+ #
254
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
255
+ def create_reservation request, options = nil
256
+ raise ::ArgumentError, "request must be provided" if request.nil?
257
+
258
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::CreateReservationRequest
259
+
260
+ # Converts hash and nil to an options object
261
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
262
+
263
+ # Customize the options with defaults
264
+ call_metadata = @config.rpcs.create_reservation.metadata.to_h
265
+
266
+ # Set x-goog-api-client and x-goog-user-project headers
267
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
268
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
269
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
270
+ transports_version_send: [:rest]
271
+
272
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
273
+
274
+ options.apply_defaults timeout: @config.rpcs.create_reservation.timeout,
275
+ metadata: call_metadata,
276
+ retry_policy: @config.rpcs.create_reservation.retry_policy
277
+
278
+ options.apply_defaults timeout: @config.timeout,
279
+ metadata: @config.metadata,
280
+ retry_policy: @config.retry_policy
281
+
282
+ @reservation_service_stub.create_reservation request, options do |result, operation|
283
+ yield result, operation if block_given?
284
+ return result
285
+ end
286
+ rescue ::Gapic::Rest::Error => e
287
+ raise ::Google::Cloud::Error.from_error(e)
288
+ end
289
+
290
+ ##
291
+ # Lists all the reservations for the project in the specified location.
292
+ #
293
+ # @overload list_reservations(request, options = nil)
294
+ # Pass arguments to `list_reservations` via a request object, either of type
295
+ # {::Google::Cloud::Bigquery::Reservation::V1::ListReservationsRequest} or an equivalent Hash.
296
+ #
297
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::ListReservationsRequest, ::Hash]
298
+ # A request object representing the call parameters. Required. To specify no
299
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
300
+ # @param options [::Gapic::CallOptions, ::Hash]
301
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
302
+ #
303
+ # @overload list_reservations(parent: nil, page_size: nil, page_token: nil)
304
+ # Pass arguments to `list_reservations` via keyword arguments. Note that at
305
+ # least one keyword argument is required. To specify no parameters, or to keep all
306
+ # the default parameter values, pass an empty Hash as a request object (see above).
307
+ #
308
+ # @param parent [::String]
309
+ # Required. The parent resource name containing project and location, e.g.:
310
+ # `projects/myproject/locations/US`
311
+ # @param page_size [::Integer]
312
+ # The maximum number of items to return per page.
313
+ # @param page_token [::String]
314
+ # The next_page_token value returned from a previous List request, if any.
315
+ # @yield [result, operation] Access the result along with the TransportOperation object
316
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Reservation>]
317
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
318
+ #
319
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Reservation>]
320
+ #
321
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
322
+ def list_reservations request, options = nil
323
+ raise ::ArgumentError, "request must be provided" if request.nil?
324
+
325
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::ListReservationsRequest
326
+
327
+ # Converts hash and nil to an options object
328
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
329
+
330
+ # Customize the options with defaults
331
+ call_metadata = @config.rpcs.list_reservations.metadata.to_h
332
+
333
+ # Set x-goog-api-client and x-goog-user-project headers
334
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
335
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
336
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
337
+ transports_version_send: [:rest]
338
+
339
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
340
+
341
+ options.apply_defaults timeout: @config.rpcs.list_reservations.timeout,
342
+ metadata: call_metadata,
343
+ retry_policy: @config.rpcs.list_reservations.retry_policy
344
+
345
+ options.apply_defaults timeout: @config.timeout,
346
+ metadata: @config.metadata,
347
+ retry_policy: @config.retry_policy
348
+
349
+ @reservation_service_stub.list_reservations request, options do |result, operation|
350
+ result = ::Gapic::Rest::PagedEnumerable.new @reservation_service_stub, :list_reservations, "reservations", request, result, options
351
+ yield result, operation if block_given?
352
+ return result
353
+ end
354
+ rescue ::Gapic::Rest::Error => e
355
+ raise ::Google::Cloud::Error.from_error(e)
356
+ end
357
+
358
+ ##
359
+ # Returns information about the reservation.
360
+ #
361
+ # @overload get_reservation(request, options = nil)
362
+ # Pass arguments to `get_reservation` via a request object, either of type
363
+ # {::Google::Cloud::Bigquery::Reservation::V1::GetReservationRequest} or an equivalent Hash.
364
+ #
365
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::GetReservationRequest, ::Hash]
366
+ # A request object representing the call parameters. Required. To specify no
367
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
368
+ # @param options [::Gapic::CallOptions, ::Hash]
369
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
370
+ #
371
+ # @overload get_reservation(name: nil)
372
+ # Pass arguments to `get_reservation` via keyword arguments. Note that at
373
+ # least one keyword argument is required. To specify no parameters, or to keep all
374
+ # the default parameter values, pass an empty Hash as a request object (see above).
375
+ #
376
+ # @param name [::String]
377
+ # Required. Resource name of the reservation to retrieve. E.g.,
378
+ # `projects/myproject/locations/US/reservations/team1-prod`
379
+ # @yield [result, operation] Access the result along with the TransportOperation object
380
+ # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::Reservation]
381
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
382
+ #
383
+ # @return [::Google::Cloud::Bigquery::Reservation::V1::Reservation]
384
+ #
385
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
386
+ def get_reservation request, options = nil
387
+ raise ::ArgumentError, "request must be provided" if request.nil?
388
+
389
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::GetReservationRequest
390
+
391
+ # Converts hash and nil to an options object
392
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
393
+
394
+ # Customize the options with defaults
395
+ call_metadata = @config.rpcs.get_reservation.metadata.to_h
396
+
397
+ # Set x-goog-api-client and x-goog-user-project headers
398
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
399
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
400
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
401
+ transports_version_send: [:rest]
402
+
403
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
404
+
405
+ options.apply_defaults timeout: @config.rpcs.get_reservation.timeout,
406
+ metadata: call_metadata,
407
+ retry_policy: @config.rpcs.get_reservation.retry_policy
408
+
409
+ options.apply_defaults timeout: @config.timeout,
410
+ metadata: @config.metadata,
411
+ retry_policy: @config.retry_policy
412
+
413
+ @reservation_service_stub.get_reservation request, options do |result, operation|
414
+ yield result, operation if block_given?
415
+ return result
416
+ end
417
+ rescue ::Gapic::Rest::Error => e
418
+ raise ::Google::Cloud::Error.from_error(e)
419
+ end
420
+
421
+ ##
422
+ # Deletes a reservation.
423
+ # Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has
424
+ # assignments.
425
+ #
426
+ # @overload delete_reservation(request, options = nil)
427
+ # Pass arguments to `delete_reservation` via a request object, either of type
428
+ # {::Google::Cloud::Bigquery::Reservation::V1::DeleteReservationRequest} or an equivalent Hash.
429
+ #
430
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::DeleteReservationRequest, ::Hash]
431
+ # A request object representing the call parameters. Required. To specify no
432
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
433
+ # @param options [::Gapic::CallOptions, ::Hash]
434
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
435
+ #
436
+ # @overload delete_reservation(name: nil)
437
+ # Pass arguments to `delete_reservation` via keyword arguments. Note that at
438
+ # least one keyword argument is required. To specify no parameters, or to keep all
439
+ # the default parameter values, pass an empty Hash as a request object (see above).
440
+ #
441
+ # @param name [::String]
442
+ # Required. Resource name of the reservation to retrieve. E.g.,
443
+ # `projects/myproject/locations/US/reservations/team1-prod`
444
+ # @yield [result, operation] Access the result along with the TransportOperation object
445
+ # @yieldparam result [::Google::Protobuf::Empty]
446
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
447
+ #
448
+ # @return [::Google::Protobuf::Empty]
449
+ #
450
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
451
+ def delete_reservation request, options = nil
452
+ raise ::ArgumentError, "request must be provided" if request.nil?
453
+
454
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::DeleteReservationRequest
455
+
456
+ # Converts hash and nil to an options object
457
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
458
+
459
+ # Customize the options with defaults
460
+ call_metadata = @config.rpcs.delete_reservation.metadata.to_h
461
+
462
+ # Set x-goog-api-client and x-goog-user-project headers
463
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
464
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
465
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
466
+ transports_version_send: [:rest]
467
+
468
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
469
+
470
+ options.apply_defaults timeout: @config.rpcs.delete_reservation.timeout,
471
+ metadata: call_metadata,
472
+ retry_policy: @config.rpcs.delete_reservation.retry_policy
473
+
474
+ options.apply_defaults timeout: @config.timeout,
475
+ metadata: @config.metadata,
476
+ retry_policy: @config.retry_policy
477
+
478
+ @reservation_service_stub.delete_reservation request, options do |result, operation|
479
+ yield result, operation if block_given?
480
+ return result
481
+ end
482
+ rescue ::Gapic::Rest::Error => e
483
+ raise ::Google::Cloud::Error.from_error(e)
484
+ end
485
+
486
+ ##
487
+ # Updates an existing reservation resource.
488
+ #
489
+ # @overload update_reservation(request, options = nil)
490
+ # Pass arguments to `update_reservation` via a request object, either of type
491
+ # {::Google::Cloud::Bigquery::Reservation::V1::UpdateReservationRequest} or an equivalent Hash.
492
+ #
493
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::UpdateReservationRequest, ::Hash]
494
+ # A request object representing the call parameters. Required. To specify no
495
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
496
+ # @param options [::Gapic::CallOptions, ::Hash]
497
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
498
+ #
499
+ # @overload update_reservation(reservation: nil, update_mask: nil)
500
+ # Pass arguments to `update_reservation` via keyword arguments. Note that at
501
+ # least one keyword argument is required. To specify no parameters, or to keep all
502
+ # the default parameter values, pass an empty Hash as a request object (see above).
503
+ #
504
+ # @param reservation [::Google::Cloud::Bigquery::Reservation::V1::Reservation, ::Hash]
505
+ # Content of the reservation to update.
506
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
507
+ # Standard field mask for the set of fields to be updated.
508
+ # @yield [result, operation] Access the result along with the TransportOperation object
509
+ # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::Reservation]
510
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
511
+ #
512
+ # @return [::Google::Cloud::Bigquery::Reservation::V1::Reservation]
513
+ #
514
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
515
+ def update_reservation request, options = nil
516
+ raise ::ArgumentError, "request must be provided" if request.nil?
517
+
518
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::UpdateReservationRequest
519
+
520
+ # Converts hash and nil to an options object
521
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
522
+
523
+ # Customize the options with defaults
524
+ call_metadata = @config.rpcs.update_reservation.metadata.to_h
525
+
526
+ # Set x-goog-api-client and x-goog-user-project headers
527
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
528
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
529
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
530
+ transports_version_send: [:rest]
531
+
532
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
533
+
534
+ options.apply_defaults timeout: @config.rpcs.update_reservation.timeout,
535
+ metadata: call_metadata,
536
+ retry_policy: @config.rpcs.update_reservation.retry_policy
537
+
538
+ options.apply_defaults timeout: @config.timeout,
539
+ metadata: @config.metadata,
540
+ retry_policy: @config.retry_policy
541
+
542
+ @reservation_service_stub.update_reservation request, options do |result, operation|
543
+ yield result, operation if block_given?
544
+ return result
545
+ end
546
+ rescue ::Gapic::Rest::Error => e
547
+ raise ::Google::Cloud::Error.from_error(e)
548
+ end
549
+
550
+ ##
551
+ # Creates a new capacity commitment resource.
552
+ #
553
+ # @overload create_capacity_commitment(request, options = nil)
554
+ # Pass arguments to `create_capacity_commitment` via a request object, either of type
555
+ # {::Google::Cloud::Bigquery::Reservation::V1::CreateCapacityCommitmentRequest} or an equivalent Hash.
556
+ #
557
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::CreateCapacityCommitmentRequest, ::Hash]
558
+ # A request object representing the call parameters. Required. To specify no
559
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
560
+ # @param options [::Gapic::CallOptions, ::Hash]
561
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
562
+ #
563
+ # @overload create_capacity_commitment(parent: nil, capacity_commitment: nil, enforce_single_admin_project_per_org: nil, capacity_commitment_id: nil)
564
+ # Pass arguments to `create_capacity_commitment` via keyword arguments. Note that at
565
+ # least one keyword argument is required. To specify no parameters, or to keep all
566
+ # the default parameter values, pass an empty Hash as a request object (see above).
567
+ #
568
+ # @param parent [::String]
569
+ # Required. Resource name of the parent reservation. E.g.,
570
+ # `projects/myproject/locations/US`
571
+ # @param capacity_commitment [::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment, ::Hash]
572
+ # Content of the capacity commitment to create.
573
+ # @param enforce_single_admin_project_per_org [::Boolean]
574
+ # If true, fail the request if another project in the organization has a
575
+ # capacity commitment.
576
+ # @param capacity_commitment_id [::String]
577
+ # The optional capacity commitment ID. Capacity commitment name will be
578
+ # generated automatically if this field is empty.
579
+ # This field must only contain lower case alphanumeric characters or dashes.
580
+ # The first and last character cannot be a dash. Max length is 64 characters.
581
+ # NOTE: this ID won't be kept if the capacity commitment is split or merged.
582
+ # @yield [result, operation] Access the result along with the TransportOperation object
583
+ # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment]
584
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
585
+ #
586
+ # @return [::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment]
587
+ #
588
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
589
+ def create_capacity_commitment request, options = nil
590
+ raise ::ArgumentError, "request must be provided" if request.nil?
591
+
592
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::CreateCapacityCommitmentRequest
593
+
594
+ # Converts hash and nil to an options object
595
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
596
+
597
+ # Customize the options with defaults
598
+ call_metadata = @config.rpcs.create_capacity_commitment.metadata.to_h
599
+
600
+ # Set x-goog-api-client and x-goog-user-project headers
601
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
602
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
603
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
604
+ transports_version_send: [:rest]
605
+
606
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
607
+
608
+ options.apply_defaults timeout: @config.rpcs.create_capacity_commitment.timeout,
609
+ metadata: call_metadata,
610
+ retry_policy: @config.rpcs.create_capacity_commitment.retry_policy
611
+
612
+ options.apply_defaults timeout: @config.timeout,
613
+ metadata: @config.metadata,
614
+ retry_policy: @config.retry_policy
615
+
616
+ @reservation_service_stub.create_capacity_commitment request, options do |result, operation|
617
+ yield result, operation if block_given?
618
+ return result
619
+ end
620
+ rescue ::Gapic::Rest::Error => e
621
+ raise ::Google::Cloud::Error.from_error(e)
622
+ end
623
+
624
+ ##
625
+ # Lists all the capacity commitments for the admin project.
626
+ #
627
+ # @overload list_capacity_commitments(request, options = nil)
628
+ # Pass arguments to `list_capacity_commitments` via a request object, either of type
629
+ # {::Google::Cloud::Bigquery::Reservation::V1::ListCapacityCommitmentsRequest} or an equivalent Hash.
630
+ #
631
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::ListCapacityCommitmentsRequest, ::Hash]
632
+ # A request object representing the call parameters. Required. To specify no
633
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
634
+ # @param options [::Gapic::CallOptions, ::Hash]
635
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
636
+ #
637
+ # @overload list_capacity_commitments(parent: nil, page_size: nil, page_token: nil)
638
+ # Pass arguments to `list_capacity_commitments` via keyword arguments. Note that at
639
+ # least one keyword argument is required. To specify no parameters, or to keep all
640
+ # the default parameter values, pass an empty Hash as a request object (see above).
641
+ #
642
+ # @param parent [::String]
643
+ # Required. Resource name of the parent reservation. E.g.,
644
+ # `projects/myproject/locations/US`
645
+ # @param page_size [::Integer]
646
+ # The maximum number of items to return.
647
+ # @param page_token [::String]
648
+ # The next_page_token value returned from a previous List request, if any.
649
+ # @yield [result, operation] Access the result along with the TransportOperation object
650
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment>]
651
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
652
+ #
653
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment>]
654
+ #
655
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
656
+ def list_capacity_commitments request, options = nil
657
+ raise ::ArgumentError, "request must be provided" if request.nil?
658
+
659
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::ListCapacityCommitmentsRequest
660
+
661
+ # Converts hash and nil to an options object
662
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
663
+
664
+ # Customize the options with defaults
665
+ call_metadata = @config.rpcs.list_capacity_commitments.metadata.to_h
666
+
667
+ # Set x-goog-api-client and x-goog-user-project headers
668
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
669
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
670
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
671
+ transports_version_send: [:rest]
672
+
673
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
674
+
675
+ options.apply_defaults timeout: @config.rpcs.list_capacity_commitments.timeout,
676
+ metadata: call_metadata,
677
+ retry_policy: @config.rpcs.list_capacity_commitments.retry_policy
678
+
679
+ options.apply_defaults timeout: @config.timeout,
680
+ metadata: @config.metadata,
681
+ retry_policy: @config.retry_policy
682
+
683
+ @reservation_service_stub.list_capacity_commitments request, options do |result, operation|
684
+ result = ::Gapic::Rest::PagedEnumerable.new @reservation_service_stub, :list_capacity_commitments, "capacity_commitments", request, result, options
685
+ yield result, operation if block_given?
686
+ return result
687
+ end
688
+ rescue ::Gapic::Rest::Error => e
689
+ raise ::Google::Cloud::Error.from_error(e)
690
+ end
691
+
692
+ ##
693
+ # Returns information about the capacity commitment.
694
+ #
695
+ # @overload get_capacity_commitment(request, options = nil)
696
+ # Pass arguments to `get_capacity_commitment` via a request object, either of type
697
+ # {::Google::Cloud::Bigquery::Reservation::V1::GetCapacityCommitmentRequest} or an equivalent Hash.
698
+ #
699
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::GetCapacityCommitmentRequest, ::Hash]
700
+ # A request object representing the call parameters. Required. To specify no
701
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
702
+ # @param options [::Gapic::CallOptions, ::Hash]
703
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
704
+ #
705
+ # @overload get_capacity_commitment(name: nil)
706
+ # Pass arguments to `get_capacity_commitment` via keyword arguments. Note that at
707
+ # least one keyword argument is required. To specify no parameters, or to keep all
708
+ # the default parameter values, pass an empty Hash as a request object (see above).
709
+ #
710
+ # @param name [::String]
711
+ # Required. Resource name of the capacity commitment to retrieve. E.g.,
712
+ # `projects/myproject/locations/US/capacityCommitments/123`
713
+ # @yield [result, operation] Access the result along with the TransportOperation object
714
+ # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment]
715
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
716
+ #
717
+ # @return [::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment]
718
+ #
719
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
720
+ def get_capacity_commitment request, options = nil
721
+ raise ::ArgumentError, "request must be provided" if request.nil?
722
+
723
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::GetCapacityCommitmentRequest
724
+
725
+ # Converts hash and nil to an options object
726
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
727
+
728
+ # Customize the options with defaults
729
+ call_metadata = @config.rpcs.get_capacity_commitment.metadata.to_h
730
+
731
+ # Set x-goog-api-client and x-goog-user-project headers
732
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
733
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
734
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
735
+ transports_version_send: [:rest]
736
+
737
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
738
+
739
+ options.apply_defaults timeout: @config.rpcs.get_capacity_commitment.timeout,
740
+ metadata: call_metadata,
741
+ retry_policy: @config.rpcs.get_capacity_commitment.retry_policy
742
+
743
+ options.apply_defaults timeout: @config.timeout,
744
+ metadata: @config.metadata,
745
+ retry_policy: @config.retry_policy
746
+
747
+ @reservation_service_stub.get_capacity_commitment request, options do |result, operation|
748
+ yield result, operation if block_given?
749
+ return result
750
+ end
751
+ rescue ::Gapic::Rest::Error => e
752
+ raise ::Google::Cloud::Error.from_error(e)
753
+ end
754
+
755
+ ##
756
+ # Deletes a capacity commitment. Attempting to delete capacity commitment
757
+ # before its commitment_end_time will fail with the error code
758
+ # `google.rpc.Code.FAILED_PRECONDITION`.
759
+ #
760
+ # @overload delete_capacity_commitment(request, options = nil)
761
+ # Pass arguments to `delete_capacity_commitment` via a request object, either of type
762
+ # {::Google::Cloud::Bigquery::Reservation::V1::DeleteCapacityCommitmentRequest} or an equivalent Hash.
763
+ #
764
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::DeleteCapacityCommitmentRequest, ::Hash]
765
+ # A request object representing the call parameters. Required. To specify no
766
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
767
+ # @param options [::Gapic::CallOptions, ::Hash]
768
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
769
+ #
770
+ # @overload delete_capacity_commitment(name: nil, force: nil)
771
+ # Pass arguments to `delete_capacity_commitment` via keyword arguments. Note that at
772
+ # least one keyword argument is required. To specify no parameters, or to keep all
773
+ # the default parameter values, pass an empty Hash as a request object (see above).
774
+ #
775
+ # @param name [::String]
776
+ # Required. Resource name of the capacity commitment to delete. E.g.,
777
+ # `projects/myproject/locations/US/capacityCommitments/123`
778
+ # @param force [::Boolean]
779
+ # Can be used to force delete commitments even if assignments exist. Deleting
780
+ # commitments with assignments may cause queries to fail if they no longer
781
+ # have access to slots.
782
+ # @yield [result, operation] Access the result along with the TransportOperation object
783
+ # @yieldparam result [::Google::Protobuf::Empty]
784
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
785
+ #
786
+ # @return [::Google::Protobuf::Empty]
787
+ #
788
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
789
+ def delete_capacity_commitment request, options = nil
790
+ raise ::ArgumentError, "request must be provided" if request.nil?
791
+
792
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::DeleteCapacityCommitmentRequest
793
+
794
+ # Converts hash and nil to an options object
795
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
796
+
797
+ # Customize the options with defaults
798
+ call_metadata = @config.rpcs.delete_capacity_commitment.metadata.to_h
799
+
800
+ # Set x-goog-api-client and x-goog-user-project headers
801
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
802
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
803
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
804
+ transports_version_send: [:rest]
805
+
806
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
807
+
808
+ options.apply_defaults timeout: @config.rpcs.delete_capacity_commitment.timeout,
809
+ metadata: call_metadata,
810
+ retry_policy: @config.rpcs.delete_capacity_commitment.retry_policy
811
+
812
+ options.apply_defaults timeout: @config.timeout,
813
+ metadata: @config.metadata,
814
+ retry_policy: @config.retry_policy
815
+
816
+ @reservation_service_stub.delete_capacity_commitment request, options do |result, operation|
817
+ yield result, operation if block_given?
818
+ return result
819
+ end
820
+ rescue ::Gapic::Rest::Error => e
821
+ raise ::Google::Cloud::Error.from_error(e)
822
+ end
823
+
824
+ ##
825
+ # Updates an existing capacity commitment.
826
+ #
827
+ # Only `plan` and `renewal_plan` fields can be updated.
828
+ #
829
+ # Plan can only be changed to a plan of a longer commitment period.
830
+ # Attempting to change to a plan with shorter commitment period will fail
831
+ # with the error code `google.rpc.Code.FAILED_PRECONDITION`.
832
+ #
833
+ # @overload update_capacity_commitment(request, options = nil)
834
+ # Pass arguments to `update_capacity_commitment` via a request object, either of type
835
+ # {::Google::Cloud::Bigquery::Reservation::V1::UpdateCapacityCommitmentRequest} or an equivalent Hash.
836
+ #
837
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::UpdateCapacityCommitmentRequest, ::Hash]
838
+ # A request object representing the call parameters. Required. To specify no
839
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
840
+ # @param options [::Gapic::CallOptions, ::Hash]
841
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
842
+ #
843
+ # @overload update_capacity_commitment(capacity_commitment: nil, update_mask: nil)
844
+ # Pass arguments to `update_capacity_commitment` via keyword arguments. Note that at
845
+ # least one keyword argument is required. To specify no parameters, or to keep all
846
+ # the default parameter values, pass an empty Hash as a request object (see above).
847
+ #
848
+ # @param capacity_commitment [::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment, ::Hash]
849
+ # Content of the capacity commitment to update.
850
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
851
+ # Standard field mask for the set of fields to be updated.
852
+ # @yield [result, operation] Access the result along with the TransportOperation object
853
+ # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment]
854
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
855
+ #
856
+ # @return [::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment]
857
+ #
858
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
859
+ def update_capacity_commitment request, options = nil
860
+ raise ::ArgumentError, "request must be provided" if request.nil?
861
+
862
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::UpdateCapacityCommitmentRequest
863
+
864
+ # Converts hash and nil to an options object
865
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
866
+
867
+ # Customize the options with defaults
868
+ call_metadata = @config.rpcs.update_capacity_commitment.metadata.to_h
869
+
870
+ # Set x-goog-api-client and x-goog-user-project headers
871
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
872
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
873
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
874
+ transports_version_send: [:rest]
875
+
876
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
877
+
878
+ options.apply_defaults timeout: @config.rpcs.update_capacity_commitment.timeout,
879
+ metadata: call_metadata,
880
+ retry_policy: @config.rpcs.update_capacity_commitment.retry_policy
881
+
882
+ options.apply_defaults timeout: @config.timeout,
883
+ metadata: @config.metadata,
884
+ retry_policy: @config.retry_policy
885
+
886
+ @reservation_service_stub.update_capacity_commitment request, options do |result, operation|
887
+ yield result, operation if block_given?
888
+ return result
889
+ end
890
+ rescue ::Gapic::Rest::Error => e
891
+ raise ::Google::Cloud::Error.from_error(e)
892
+ end
893
+
894
+ ##
895
+ # Splits capacity commitment to two commitments of the same plan and
896
+ # `commitment_end_time`.
897
+ #
898
+ # A common use case is to enable downgrading commitments.
899
+ #
900
+ # For example, in order to downgrade from 10000 slots to 8000, you might
901
+ # split a 10000 capacity commitment into commitments of 2000 and 8000. Then,
902
+ # you delete the first one after the commitment end time passes.
903
+ #
904
+ # @overload split_capacity_commitment(request, options = nil)
905
+ # Pass arguments to `split_capacity_commitment` via a request object, either of type
906
+ # {::Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentRequest} or an equivalent Hash.
907
+ #
908
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentRequest, ::Hash]
909
+ # A request object representing the call parameters. Required. To specify no
910
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
911
+ # @param options [::Gapic::CallOptions, ::Hash]
912
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
913
+ #
914
+ # @overload split_capacity_commitment(name: nil, slot_count: nil)
915
+ # Pass arguments to `split_capacity_commitment` via keyword arguments. Note that at
916
+ # least one keyword argument is required. To specify no parameters, or to keep all
917
+ # the default parameter values, pass an empty Hash as a request object (see above).
918
+ #
919
+ # @param name [::String]
920
+ # Required. The resource name e.g.,:
921
+ # `projects/myproject/locations/US/capacityCommitments/123`
922
+ # @param slot_count [::Integer]
923
+ # Number of slots in the capacity commitment after the split.
924
+ # @yield [result, operation] Access the result along with the TransportOperation object
925
+ # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentResponse]
926
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
927
+ #
928
+ # @return [::Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentResponse]
929
+ #
930
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
931
+ def split_capacity_commitment request, options = nil
932
+ raise ::ArgumentError, "request must be provided" if request.nil?
933
+
934
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentRequest
935
+
936
+ # Converts hash and nil to an options object
937
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
938
+
939
+ # Customize the options with defaults
940
+ call_metadata = @config.rpcs.split_capacity_commitment.metadata.to_h
941
+
942
+ # Set x-goog-api-client and x-goog-user-project headers
943
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
944
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
945
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
946
+ transports_version_send: [:rest]
947
+
948
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
949
+
950
+ options.apply_defaults timeout: @config.rpcs.split_capacity_commitment.timeout,
951
+ metadata: call_metadata,
952
+ retry_policy: @config.rpcs.split_capacity_commitment.retry_policy
953
+
954
+ options.apply_defaults timeout: @config.timeout,
955
+ metadata: @config.metadata,
956
+ retry_policy: @config.retry_policy
957
+
958
+ @reservation_service_stub.split_capacity_commitment request, options do |result, operation|
959
+ yield result, operation if block_given?
960
+ return result
961
+ end
962
+ rescue ::Gapic::Rest::Error => e
963
+ raise ::Google::Cloud::Error.from_error(e)
964
+ end
965
+
966
+ ##
967
+ # Merges capacity commitments of the same plan into a single commitment.
968
+ #
969
+ # The resulting capacity commitment has the greater commitment_end_time
970
+ # out of the to-be-merged capacity commitments.
971
+ #
972
+ # Attempting to merge capacity commitments of different plan will fail
973
+ # with the error code `google.rpc.Code.FAILED_PRECONDITION`.
974
+ #
975
+ # @overload merge_capacity_commitments(request, options = nil)
976
+ # Pass arguments to `merge_capacity_commitments` via a request object, either of type
977
+ # {::Google::Cloud::Bigquery::Reservation::V1::MergeCapacityCommitmentsRequest} or an equivalent Hash.
978
+ #
979
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::MergeCapacityCommitmentsRequest, ::Hash]
980
+ # A request object representing the call parameters. Required. To specify no
981
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
982
+ # @param options [::Gapic::CallOptions, ::Hash]
983
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
984
+ #
985
+ # @overload merge_capacity_commitments(parent: nil, capacity_commitment_ids: nil)
986
+ # Pass arguments to `merge_capacity_commitments` via keyword arguments. Note that at
987
+ # least one keyword argument is required. To specify no parameters, or to keep all
988
+ # the default parameter values, pass an empty Hash as a request object (see above).
989
+ #
990
+ # @param parent [::String]
991
+ # Parent resource that identifies admin project and location e.g.,
992
+ # `projects/myproject/locations/us`
993
+ # @param capacity_commitment_ids [::Array<::String>]
994
+ # Ids of capacity commitments to merge.
995
+ # These capacity commitments must exist under admin project and location
996
+ # specified in the parent.
997
+ # ID is the last portion of capacity commitment name e.g., 'abc' for
998
+ # projects/myproject/locations/US/capacityCommitments/abc
999
+ # @yield [result, operation] Access the result along with the TransportOperation object
1000
+ # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment]
1001
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1002
+ #
1003
+ # @return [::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment]
1004
+ #
1005
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1006
+ def merge_capacity_commitments request, options = nil
1007
+ raise ::ArgumentError, "request must be provided" if request.nil?
1008
+
1009
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::MergeCapacityCommitmentsRequest
1010
+
1011
+ # Converts hash and nil to an options object
1012
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1013
+
1014
+ # Customize the options with defaults
1015
+ call_metadata = @config.rpcs.merge_capacity_commitments.metadata.to_h
1016
+
1017
+ # Set x-goog-api-client and x-goog-user-project headers
1018
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1019
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1020
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
1021
+ transports_version_send: [:rest]
1022
+
1023
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1024
+
1025
+ options.apply_defaults timeout: @config.rpcs.merge_capacity_commitments.timeout,
1026
+ metadata: call_metadata,
1027
+ retry_policy: @config.rpcs.merge_capacity_commitments.retry_policy
1028
+
1029
+ options.apply_defaults timeout: @config.timeout,
1030
+ metadata: @config.metadata,
1031
+ retry_policy: @config.retry_policy
1032
+
1033
+ @reservation_service_stub.merge_capacity_commitments request, options do |result, operation|
1034
+ yield result, operation if block_given?
1035
+ return result
1036
+ end
1037
+ rescue ::Gapic::Rest::Error => e
1038
+ raise ::Google::Cloud::Error.from_error(e)
1039
+ end
1040
+
1041
+ ##
1042
+ # Creates an assignment object which allows the given project to submit jobs
1043
+ # of a certain type using slots from the specified reservation.
1044
+ #
1045
+ # Currently a
1046
+ # resource (project, folder, organization) can only have one assignment per
1047
+ # each (job_type, location) combination, and that reservation will be used
1048
+ # for all jobs of the matching type.
1049
+ #
1050
+ # Different assignments can be created on different levels of the
1051
+ # projects, folders or organization hierarchy. During query execution,
1052
+ # the assignment is looked up at the project, folder and organization levels
1053
+ # in that order. The first assignment found is applied to the query.
1054
+ #
1055
+ # When creating assignments, it does not matter if other assignments exist at
1056
+ # higher levels.
1057
+ #
1058
+ # Example:
1059
+ #
1060
+ # * The organization `organizationA` contains two projects, `project1`
1061
+ # and `project2`.
1062
+ # * Assignments for all three entities (`organizationA`, `project1`, and
1063
+ # `project2`) could all be created and mapped to the same or different
1064
+ # reservations.
1065
+ #
1066
+ # "None" assignments represent an absence of the assignment. Projects
1067
+ # assigned to None use on-demand pricing. To create a "None" assignment, use
1068
+ # "none" as a reservation_id in the parent. Example parent:
1069
+ # `projects/myproject/locations/US/reservations/none`.
1070
+ #
1071
+ # Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have
1072
+ # 'bigquery.admin' permissions on the project using the reservation
1073
+ # and the project that owns this reservation.
1074
+ #
1075
+ # Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment
1076
+ # does not match location of the reservation.
1077
+ #
1078
+ # @overload create_assignment(request, options = nil)
1079
+ # Pass arguments to `create_assignment` via a request object, either of type
1080
+ # {::Google::Cloud::Bigquery::Reservation::V1::CreateAssignmentRequest} or an equivalent Hash.
1081
+ #
1082
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::CreateAssignmentRequest, ::Hash]
1083
+ # A request object representing the call parameters. Required. To specify no
1084
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1085
+ # @param options [::Gapic::CallOptions, ::Hash]
1086
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1087
+ #
1088
+ # @overload create_assignment(parent: nil, assignment: nil, assignment_id: nil)
1089
+ # Pass arguments to `create_assignment` via keyword arguments. Note that at
1090
+ # least one keyword argument is required. To specify no parameters, or to keep all
1091
+ # the default parameter values, pass an empty Hash as a request object (see above).
1092
+ #
1093
+ # @param parent [::String]
1094
+ # Required. The parent resource name of the assignment
1095
+ # E.g. `projects/myproject/locations/US/reservations/team1-prod`
1096
+ # @param assignment [::Google::Cloud::Bigquery::Reservation::V1::Assignment, ::Hash]
1097
+ # Assignment resource to create.
1098
+ # @param assignment_id [::String]
1099
+ # The optional assignment ID. Assignment name will be generated automatically
1100
+ # if this field is empty.
1101
+ # This field must only contain lower case alphanumeric characters or dashes.
1102
+ # Max length is 64 characters.
1103
+ # @yield [result, operation] Access the result along with the TransportOperation object
1104
+ # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::Assignment]
1105
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1106
+ #
1107
+ # @return [::Google::Cloud::Bigquery::Reservation::V1::Assignment]
1108
+ #
1109
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1110
+ def create_assignment request, options = nil
1111
+ raise ::ArgumentError, "request must be provided" if request.nil?
1112
+
1113
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::CreateAssignmentRequest
1114
+
1115
+ # Converts hash and nil to an options object
1116
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1117
+
1118
+ # Customize the options with defaults
1119
+ call_metadata = @config.rpcs.create_assignment.metadata.to_h
1120
+
1121
+ # Set x-goog-api-client and x-goog-user-project headers
1122
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1123
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1124
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
1125
+ transports_version_send: [:rest]
1126
+
1127
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1128
+
1129
+ options.apply_defaults timeout: @config.rpcs.create_assignment.timeout,
1130
+ metadata: call_metadata,
1131
+ retry_policy: @config.rpcs.create_assignment.retry_policy
1132
+
1133
+ options.apply_defaults timeout: @config.timeout,
1134
+ metadata: @config.metadata,
1135
+ retry_policy: @config.retry_policy
1136
+
1137
+ @reservation_service_stub.create_assignment request, options do |result, operation|
1138
+ yield result, operation if block_given?
1139
+ return result
1140
+ end
1141
+ rescue ::Gapic::Rest::Error => e
1142
+ raise ::Google::Cloud::Error.from_error(e)
1143
+ end
1144
+
1145
+ ##
1146
+ # Lists assignments.
1147
+ #
1148
+ # Only explicitly created assignments will be returned.
1149
+ #
1150
+ # Example:
1151
+ #
1152
+ # * Organization `organizationA` contains two projects, `project1` and
1153
+ # `project2`.
1154
+ # * Reservation `res1` exists and was created previously.
1155
+ # * CreateAssignment was used previously to define the following
1156
+ # associations between entities and reservations: `<organizationA, res1>`
1157
+ # and `<project1, res1>`
1158
+ #
1159
+ # In this example, ListAssignments will just return the above two assignments
1160
+ # for reservation `res1`, and no expansion/merge will happen.
1161
+ #
1162
+ # The wildcard "-" can be used for
1163
+ # reservations in the request. In that case all assignments belongs to the
1164
+ # specified project and location will be listed.
1165
+ #
1166
+ # **Note** "-" cannot be used for projects nor locations.
1167
+ #
1168
+ # @overload list_assignments(request, options = nil)
1169
+ # Pass arguments to `list_assignments` via a request object, either of type
1170
+ # {::Google::Cloud::Bigquery::Reservation::V1::ListAssignmentsRequest} or an equivalent Hash.
1171
+ #
1172
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::ListAssignmentsRequest, ::Hash]
1173
+ # A request object representing the call parameters. Required. To specify no
1174
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1175
+ # @param options [::Gapic::CallOptions, ::Hash]
1176
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1177
+ #
1178
+ # @overload list_assignments(parent: nil, page_size: nil, page_token: nil)
1179
+ # Pass arguments to `list_assignments` via keyword arguments. Note that at
1180
+ # least one keyword argument is required. To specify no parameters, or to keep all
1181
+ # the default parameter values, pass an empty Hash as a request object (see above).
1182
+ #
1183
+ # @param parent [::String]
1184
+ # Required. The parent resource name e.g.:
1185
+ #
1186
+ # `projects/myproject/locations/US/reservations/team1-prod`
1187
+ #
1188
+ # Or:
1189
+ #
1190
+ # `projects/myproject/locations/US/reservations/-`
1191
+ # @param page_size [::Integer]
1192
+ # The maximum number of items to return per page.
1193
+ # @param page_token [::String]
1194
+ # The next_page_token value returned from a previous List request, if any.
1195
+ # @yield [result, operation] Access the result along with the TransportOperation object
1196
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Assignment>]
1197
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1198
+ #
1199
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Assignment>]
1200
+ #
1201
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1202
+ def list_assignments request, options = nil
1203
+ raise ::ArgumentError, "request must be provided" if request.nil?
1204
+
1205
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::ListAssignmentsRequest
1206
+
1207
+ # Converts hash and nil to an options object
1208
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1209
+
1210
+ # Customize the options with defaults
1211
+ call_metadata = @config.rpcs.list_assignments.metadata.to_h
1212
+
1213
+ # Set x-goog-api-client and x-goog-user-project headers
1214
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1215
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1216
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
1217
+ transports_version_send: [:rest]
1218
+
1219
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1220
+
1221
+ options.apply_defaults timeout: @config.rpcs.list_assignments.timeout,
1222
+ metadata: call_metadata,
1223
+ retry_policy: @config.rpcs.list_assignments.retry_policy
1224
+
1225
+ options.apply_defaults timeout: @config.timeout,
1226
+ metadata: @config.metadata,
1227
+ retry_policy: @config.retry_policy
1228
+
1229
+ @reservation_service_stub.list_assignments request, options do |result, operation|
1230
+ result = ::Gapic::Rest::PagedEnumerable.new @reservation_service_stub, :list_assignments, "assignments", request, result, options
1231
+ yield result, operation if block_given?
1232
+ return result
1233
+ end
1234
+ rescue ::Gapic::Rest::Error => e
1235
+ raise ::Google::Cloud::Error.from_error(e)
1236
+ end
1237
+
1238
+ ##
1239
+ # Deletes a assignment. No expansion will happen.
1240
+ #
1241
+ # Example:
1242
+ #
1243
+ # * Organization `organizationA` contains two projects, `project1` and
1244
+ # `project2`.
1245
+ # * Reservation `res1` exists and was created previously.
1246
+ # * CreateAssignment was used previously to define the following
1247
+ # associations between entities and reservations: `<organizationA, res1>`
1248
+ # and `<project1, res1>`
1249
+ #
1250
+ # In this example, deletion of the `<organizationA, res1>` assignment won't
1251
+ # affect the other assignment `<project1, res1>`. After said deletion,
1252
+ # queries from `project1` will still use `res1` while queries from
1253
+ # `project2` will switch to use on-demand mode.
1254
+ #
1255
+ # @overload delete_assignment(request, options = nil)
1256
+ # Pass arguments to `delete_assignment` via a request object, either of type
1257
+ # {::Google::Cloud::Bigquery::Reservation::V1::DeleteAssignmentRequest} or an equivalent Hash.
1258
+ #
1259
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::DeleteAssignmentRequest, ::Hash]
1260
+ # A request object representing the call parameters. Required. To specify no
1261
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1262
+ # @param options [::Gapic::CallOptions, ::Hash]
1263
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1264
+ #
1265
+ # @overload delete_assignment(name: nil)
1266
+ # Pass arguments to `delete_assignment` via keyword arguments. Note that at
1267
+ # least one keyword argument is required. To specify no parameters, or to keep all
1268
+ # the default parameter values, pass an empty Hash as a request object (see above).
1269
+ #
1270
+ # @param name [::String]
1271
+ # Required. Name of the resource, e.g.
1272
+ # `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
1273
+ # @yield [result, operation] Access the result along with the TransportOperation object
1274
+ # @yieldparam result [::Google::Protobuf::Empty]
1275
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1276
+ #
1277
+ # @return [::Google::Protobuf::Empty]
1278
+ #
1279
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1280
+ def delete_assignment request, options = nil
1281
+ raise ::ArgumentError, "request must be provided" if request.nil?
1282
+
1283
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::DeleteAssignmentRequest
1284
+
1285
+ # Converts hash and nil to an options object
1286
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1287
+
1288
+ # Customize the options with defaults
1289
+ call_metadata = @config.rpcs.delete_assignment.metadata.to_h
1290
+
1291
+ # Set x-goog-api-client and x-goog-user-project headers
1292
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1293
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1294
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
1295
+ transports_version_send: [:rest]
1296
+
1297
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1298
+
1299
+ options.apply_defaults timeout: @config.rpcs.delete_assignment.timeout,
1300
+ metadata: call_metadata,
1301
+ retry_policy: @config.rpcs.delete_assignment.retry_policy
1302
+
1303
+ options.apply_defaults timeout: @config.timeout,
1304
+ metadata: @config.metadata,
1305
+ retry_policy: @config.retry_policy
1306
+
1307
+ @reservation_service_stub.delete_assignment request, options do |result, operation|
1308
+ yield result, operation if block_given?
1309
+ return result
1310
+ end
1311
+ rescue ::Gapic::Rest::Error => e
1312
+ raise ::Google::Cloud::Error.from_error(e)
1313
+ end
1314
+
1315
+ ##
1316
+ # Deprecated: Looks up assignments for a specified resource for a particular
1317
+ # region. If the request is about a project:
1318
+ #
1319
+ # 1. Assignments created on the project will be returned if they exist.
1320
+ # 2. Otherwise assignments created on the closest ancestor will be
1321
+ # returned.
1322
+ # 3. Assignments for different JobTypes will all be returned.
1323
+ #
1324
+ # The same logic applies if the request is about a folder.
1325
+ #
1326
+ # If the request is about an organization, then assignments created on the
1327
+ # organization will be returned (organization doesn't have ancestors).
1328
+ #
1329
+ # Comparing to ListAssignments, there are some behavior
1330
+ # differences:
1331
+ #
1332
+ # 1. permission on the assignee will be verified in this API.
1333
+ # 2. Hierarchy lookup (project->folder->organization) happens in this API.
1334
+ # 3. Parent here is `projects/*/locations/*`, instead of
1335
+ # `projects/*/locations/*reservations/*`.
1336
+ #
1337
+ # **Note** "-" cannot be used for projects
1338
+ # nor locations.
1339
+ #
1340
+ # @overload search_assignments(request, options = nil)
1341
+ # Pass arguments to `search_assignments` via a request object, either of type
1342
+ # {::Google::Cloud::Bigquery::Reservation::V1::SearchAssignmentsRequest} or an equivalent Hash.
1343
+ #
1344
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::SearchAssignmentsRequest, ::Hash]
1345
+ # A request object representing the call parameters. Required. To specify no
1346
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1347
+ # @param options [::Gapic::CallOptions, ::Hash]
1348
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1349
+ #
1350
+ # @overload search_assignments(parent: nil, query: nil, page_size: nil, page_token: nil)
1351
+ # Pass arguments to `search_assignments` via keyword arguments. Note that at
1352
+ # least one keyword argument is required. To specify no parameters, or to keep all
1353
+ # the default parameter values, pass an empty Hash as a request object (see above).
1354
+ #
1355
+ # @param parent [::String]
1356
+ # Required. The resource name of the admin project(containing project and location),
1357
+ # e.g.:
1358
+ # `projects/myproject/locations/US`.
1359
+ # @param query [::String]
1360
+ # Please specify resource name as assignee in the query.
1361
+ #
1362
+ # Examples:
1363
+ #
1364
+ # * `assignee=projects/myproject`
1365
+ # * `assignee=folders/123`
1366
+ # * `assignee=organizations/456`
1367
+ # @param page_size [::Integer]
1368
+ # The maximum number of items to return per page.
1369
+ # @param page_token [::String]
1370
+ # The next_page_token value returned from a previous List request, if any.
1371
+ # @yield [result, operation] Access the result along with the TransportOperation object
1372
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Assignment>]
1373
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1374
+ #
1375
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Assignment>]
1376
+ #
1377
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1378
+ def search_assignments request, options = nil
1379
+ raise ::ArgumentError, "request must be provided" if request.nil?
1380
+
1381
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::SearchAssignmentsRequest
1382
+
1383
+ # Converts hash and nil to an options object
1384
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1385
+
1386
+ # Customize the options with defaults
1387
+ call_metadata = @config.rpcs.search_assignments.metadata.to_h
1388
+
1389
+ # Set x-goog-api-client and x-goog-user-project headers
1390
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1391
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1392
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
1393
+ transports_version_send: [:rest]
1394
+
1395
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1396
+
1397
+ options.apply_defaults timeout: @config.rpcs.search_assignments.timeout,
1398
+ metadata: call_metadata,
1399
+ retry_policy: @config.rpcs.search_assignments.retry_policy
1400
+
1401
+ options.apply_defaults timeout: @config.timeout,
1402
+ metadata: @config.metadata,
1403
+ retry_policy: @config.retry_policy
1404
+
1405
+ @reservation_service_stub.search_assignments request, options do |result, operation|
1406
+ result = ::Gapic::Rest::PagedEnumerable.new @reservation_service_stub, :search_assignments, "assignments", request, result, options
1407
+ yield result, operation if block_given?
1408
+ return result
1409
+ end
1410
+ rescue ::Gapic::Rest::Error => e
1411
+ raise ::Google::Cloud::Error.from_error(e)
1412
+ end
1413
+
1414
+ ##
1415
+ # Looks up assignments for a specified resource for a particular region.
1416
+ # If the request is about a project:
1417
+ #
1418
+ # 1. Assignments created on the project will be returned if they exist.
1419
+ # 2. Otherwise assignments created on the closest ancestor will be
1420
+ # returned.
1421
+ # 3. Assignments for different JobTypes will all be returned.
1422
+ #
1423
+ # The same logic applies if the request is about a folder.
1424
+ #
1425
+ # If the request is about an organization, then assignments created on the
1426
+ # organization will be returned (organization doesn't have ancestors).
1427
+ #
1428
+ # Comparing to ListAssignments, there are some behavior
1429
+ # differences:
1430
+ #
1431
+ # 1. permission on the assignee will be verified in this API.
1432
+ # 2. Hierarchy lookup (project->folder->organization) happens in this API.
1433
+ # 3. Parent here is `projects/*/locations/*`, instead of
1434
+ # `projects/*/locations/*reservations/*`.
1435
+ #
1436
+ # @overload search_all_assignments(request, options = nil)
1437
+ # Pass arguments to `search_all_assignments` via a request object, either of type
1438
+ # {::Google::Cloud::Bigquery::Reservation::V1::SearchAllAssignmentsRequest} or an equivalent Hash.
1439
+ #
1440
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::SearchAllAssignmentsRequest, ::Hash]
1441
+ # A request object representing the call parameters. Required. To specify no
1442
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1443
+ # @param options [::Gapic::CallOptions, ::Hash]
1444
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1445
+ #
1446
+ # @overload search_all_assignments(parent: nil, query: nil, page_size: nil, page_token: nil)
1447
+ # Pass arguments to `search_all_assignments` via keyword arguments. Note that at
1448
+ # least one keyword argument is required. To specify no parameters, or to keep all
1449
+ # the default parameter values, pass an empty Hash as a request object (see above).
1450
+ #
1451
+ # @param parent [::String]
1452
+ # Required. The resource name with location (project name could be the wildcard '-'),
1453
+ # e.g.:
1454
+ # `projects/-/locations/US`.
1455
+ # @param query [::String]
1456
+ # Please specify resource name as assignee in the query.
1457
+ #
1458
+ # Examples:
1459
+ #
1460
+ # * `assignee=projects/myproject`
1461
+ # * `assignee=folders/123`
1462
+ # * `assignee=organizations/456`
1463
+ # @param page_size [::Integer]
1464
+ # The maximum number of items to return per page.
1465
+ # @param page_token [::String]
1466
+ # The next_page_token value returned from a previous List request, if any.
1467
+ # @yield [result, operation] Access the result along with the TransportOperation object
1468
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Assignment>]
1469
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1470
+ #
1471
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Assignment>]
1472
+ #
1473
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1474
+ def search_all_assignments request, options = nil
1475
+ raise ::ArgumentError, "request must be provided" if request.nil?
1476
+
1477
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::SearchAllAssignmentsRequest
1478
+
1479
+ # Converts hash and nil to an options object
1480
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1481
+
1482
+ # Customize the options with defaults
1483
+ call_metadata = @config.rpcs.search_all_assignments.metadata.to_h
1484
+
1485
+ # Set x-goog-api-client and x-goog-user-project headers
1486
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1487
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1488
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
1489
+ transports_version_send: [:rest]
1490
+
1491
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1492
+
1493
+ options.apply_defaults timeout: @config.rpcs.search_all_assignments.timeout,
1494
+ metadata: call_metadata,
1495
+ retry_policy: @config.rpcs.search_all_assignments.retry_policy
1496
+
1497
+ options.apply_defaults timeout: @config.timeout,
1498
+ metadata: @config.metadata,
1499
+ retry_policy: @config.retry_policy
1500
+
1501
+ @reservation_service_stub.search_all_assignments request, options do |result, operation|
1502
+ result = ::Gapic::Rest::PagedEnumerable.new @reservation_service_stub, :search_all_assignments, "assignments", request, result, options
1503
+ yield result, operation if block_given?
1504
+ return result
1505
+ end
1506
+ rescue ::Gapic::Rest::Error => e
1507
+ raise ::Google::Cloud::Error.from_error(e)
1508
+ end
1509
+
1510
+ ##
1511
+ # Moves an assignment under a new reservation.
1512
+ #
1513
+ # This differs from removing an existing assignment and recreating a new one
1514
+ # by providing a transactional change that ensures an assignee always has an
1515
+ # associated reservation.
1516
+ #
1517
+ # @overload move_assignment(request, options = nil)
1518
+ # Pass arguments to `move_assignment` via a request object, either of type
1519
+ # {::Google::Cloud::Bigquery::Reservation::V1::MoveAssignmentRequest} or an equivalent Hash.
1520
+ #
1521
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::MoveAssignmentRequest, ::Hash]
1522
+ # A request object representing the call parameters. Required. To specify no
1523
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1524
+ # @param options [::Gapic::CallOptions, ::Hash]
1525
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1526
+ #
1527
+ # @overload move_assignment(name: nil, destination_id: nil)
1528
+ # Pass arguments to `move_assignment` via keyword arguments. Note that at
1529
+ # least one keyword argument is required. To specify no parameters, or to keep all
1530
+ # the default parameter values, pass an empty Hash as a request object (see above).
1531
+ #
1532
+ # @param name [::String]
1533
+ # Required. The resource name of the assignment,
1534
+ # e.g.
1535
+ # `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
1536
+ # @param destination_id [::String]
1537
+ # The new reservation ID, e.g.:
1538
+ # `projects/myotherproject/locations/US/reservations/team2-prod`
1539
+ # @yield [result, operation] Access the result along with the TransportOperation object
1540
+ # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::Assignment]
1541
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1542
+ #
1543
+ # @return [::Google::Cloud::Bigquery::Reservation::V1::Assignment]
1544
+ #
1545
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1546
+ def move_assignment request, options = nil
1547
+ raise ::ArgumentError, "request must be provided" if request.nil?
1548
+
1549
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::MoveAssignmentRequest
1550
+
1551
+ # Converts hash and nil to an options object
1552
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1553
+
1554
+ # Customize the options with defaults
1555
+ call_metadata = @config.rpcs.move_assignment.metadata.to_h
1556
+
1557
+ # Set x-goog-api-client and x-goog-user-project headers
1558
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1559
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1560
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
1561
+ transports_version_send: [:rest]
1562
+
1563
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1564
+
1565
+ options.apply_defaults timeout: @config.rpcs.move_assignment.timeout,
1566
+ metadata: call_metadata,
1567
+ retry_policy: @config.rpcs.move_assignment.retry_policy
1568
+
1569
+ options.apply_defaults timeout: @config.timeout,
1570
+ metadata: @config.metadata,
1571
+ retry_policy: @config.retry_policy
1572
+
1573
+ @reservation_service_stub.move_assignment request, options do |result, operation|
1574
+ yield result, operation if block_given?
1575
+ return result
1576
+ end
1577
+ rescue ::Gapic::Rest::Error => e
1578
+ raise ::Google::Cloud::Error.from_error(e)
1579
+ end
1580
+
1581
+ ##
1582
+ # Updates an existing assignment.
1583
+ #
1584
+ # Only the `priority` field can be updated.
1585
+ #
1586
+ # @overload update_assignment(request, options = nil)
1587
+ # Pass arguments to `update_assignment` via a request object, either of type
1588
+ # {::Google::Cloud::Bigquery::Reservation::V1::UpdateAssignmentRequest} or an equivalent Hash.
1589
+ #
1590
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::UpdateAssignmentRequest, ::Hash]
1591
+ # A request object representing the call parameters. Required. To specify no
1592
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1593
+ # @param options [::Gapic::CallOptions, ::Hash]
1594
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1595
+ #
1596
+ # @overload update_assignment(assignment: nil, update_mask: nil)
1597
+ # Pass arguments to `update_assignment` via keyword arguments. Note that at
1598
+ # least one keyword argument is required. To specify no parameters, or to keep all
1599
+ # the default parameter values, pass an empty Hash as a request object (see above).
1600
+ #
1601
+ # @param assignment [::Google::Cloud::Bigquery::Reservation::V1::Assignment, ::Hash]
1602
+ # Content of the assignment to update.
1603
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1604
+ # Standard field mask for the set of fields to be updated.
1605
+ # @yield [result, operation] Access the result along with the TransportOperation object
1606
+ # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::Assignment]
1607
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1608
+ #
1609
+ # @return [::Google::Cloud::Bigquery::Reservation::V1::Assignment]
1610
+ #
1611
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1612
+ def update_assignment request, options = nil
1613
+ raise ::ArgumentError, "request must be provided" if request.nil?
1614
+
1615
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::UpdateAssignmentRequest
1616
+
1617
+ # Converts hash and nil to an options object
1618
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1619
+
1620
+ # Customize the options with defaults
1621
+ call_metadata = @config.rpcs.update_assignment.metadata.to_h
1622
+
1623
+ # Set x-goog-api-client and x-goog-user-project headers
1624
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1625
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1626
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
1627
+ transports_version_send: [:rest]
1628
+
1629
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1630
+
1631
+ options.apply_defaults timeout: @config.rpcs.update_assignment.timeout,
1632
+ metadata: call_metadata,
1633
+ retry_policy: @config.rpcs.update_assignment.retry_policy
1634
+
1635
+ options.apply_defaults timeout: @config.timeout,
1636
+ metadata: @config.metadata,
1637
+ retry_policy: @config.retry_policy
1638
+
1639
+ @reservation_service_stub.update_assignment request, options do |result, operation|
1640
+ yield result, operation if block_given?
1641
+ return result
1642
+ end
1643
+ rescue ::Gapic::Rest::Error => e
1644
+ raise ::Google::Cloud::Error.from_error(e)
1645
+ end
1646
+
1647
+ ##
1648
+ # Retrieves a BI reservation.
1649
+ #
1650
+ # @overload get_bi_reservation(request, options = nil)
1651
+ # Pass arguments to `get_bi_reservation` via a request object, either of type
1652
+ # {::Google::Cloud::Bigquery::Reservation::V1::GetBiReservationRequest} or an equivalent Hash.
1653
+ #
1654
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::GetBiReservationRequest, ::Hash]
1655
+ # A request object representing the call parameters. Required. To specify no
1656
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1657
+ # @param options [::Gapic::CallOptions, ::Hash]
1658
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1659
+ #
1660
+ # @overload get_bi_reservation(name: nil)
1661
+ # Pass arguments to `get_bi_reservation` via keyword arguments. Note that at
1662
+ # least one keyword argument is required. To specify no parameters, or to keep all
1663
+ # the default parameter values, pass an empty Hash as a request object (see above).
1664
+ #
1665
+ # @param name [::String]
1666
+ # Required. Name of the requested reservation, for example:
1667
+ # `projects/{project_id}/locations/{location_id}/biReservation`
1668
+ # @yield [result, operation] Access the result along with the TransportOperation object
1669
+ # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::BiReservation]
1670
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1671
+ #
1672
+ # @return [::Google::Cloud::Bigquery::Reservation::V1::BiReservation]
1673
+ #
1674
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1675
+ def get_bi_reservation request, options = nil
1676
+ raise ::ArgumentError, "request must be provided" if request.nil?
1677
+
1678
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::GetBiReservationRequest
1679
+
1680
+ # Converts hash and nil to an options object
1681
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1682
+
1683
+ # Customize the options with defaults
1684
+ call_metadata = @config.rpcs.get_bi_reservation.metadata.to_h
1685
+
1686
+ # Set x-goog-api-client and x-goog-user-project headers
1687
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1688
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1689
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
1690
+ transports_version_send: [:rest]
1691
+
1692
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1693
+
1694
+ options.apply_defaults timeout: @config.rpcs.get_bi_reservation.timeout,
1695
+ metadata: call_metadata,
1696
+ retry_policy: @config.rpcs.get_bi_reservation.retry_policy
1697
+
1698
+ options.apply_defaults timeout: @config.timeout,
1699
+ metadata: @config.metadata,
1700
+ retry_policy: @config.retry_policy
1701
+
1702
+ @reservation_service_stub.get_bi_reservation request, options do |result, operation|
1703
+ yield result, operation if block_given?
1704
+ return result
1705
+ end
1706
+ rescue ::Gapic::Rest::Error => e
1707
+ raise ::Google::Cloud::Error.from_error(e)
1708
+ end
1709
+
1710
+ ##
1711
+ # Updates a BI reservation.
1712
+ #
1713
+ # Only fields specified in the `field_mask` are updated.
1714
+ #
1715
+ # A singleton BI reservation always exists with default size 0.
1716
+ # In order to reserve BI capacity it needs to be updated to an amount
1717
+ # greater than 0. In order to release BI capacity reservation size
1718
+ # must be set to 0.
1719
+ #
1720
+ # @overload update_bi_reservation(request, options = nil)
1721
+ # Pass arguments to `update_bi_reservation` via a request object, either of type
1722
+ # {::Google::Cloud::Bigquery::Reservation::V1::UpdateBiReservationRequest} or an equivalent Hash.
1723
+ #
1724
+ # @param request [::Google::Cloud::Bigquery::Reservation::V1::UpdateBiReservationRequest, ::Hash]
1725
+ # A request object representing the call parameters. Required. To specify no
1726
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1727
+ # @param options [::Gapic::CallOptions, ::Hash]
1728
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1729
+ #
1730
+ # @overload update_bi_reservation(bi_reservation: nil, update_mask: nil)
1731
+ # Pass arguments to `update_bi_reservation` via keyword arguments. Note that at
1732
+ # least one keyword argument is required. To specify no parameters, or to keep all
1733
+ # the default parameter values, pass an empty Hash as a request object (see above).
1734
+ #
1735
+ # @param bi_reservation [::Google::Cloud::Bigquery::Reservation::V1::BiReservation, ::Hash]
1736
+ # A reservation to update.
1737
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1738
+ # A list of fields to be updated in this request.
1739
+ # @yield [result, operation] Access the result along with the TransportOperation object
1740
+ # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::BiReservation]
1741
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1742
+ #
1743
+ # @return [::Google::Cloud::Bigquery::Reservation::V1::BiReservation]
1744
+ #
1745
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1746
+ def update_bi_reservation request, options = nil
1747
+ raise ::ArgumentError, "request must be provided" if request.nil?
1748
+
1749
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::UpdateBiReservationRequest
1750
+
1751
+ # Converts hash and nil to an options object
1752
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1753
+
1754
+ # Customize the options with defaults
1755
+ call_metadata = @config.rpcs.update_bi_reservation.metadata.to_h
1756
+
1757
+ # Set x-goog-api-client and x-goog-user-project headers
1758
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1759
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1760
+ gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION,
1761
+ transports_version_send: [:rest]
1762
+
1763
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1764
+
1765
+ options.apply_defaults timeout: @config.rpcs.update_bi_reservation.timeout,
1766
+ metadata: call_metadata,
1767
+ retry_policy: @config.rpcs.update_bi_reservation.retry_policy
1768
+
1769
+ options.apply_defaults timeout: @config.timeout,
1770
+ metadata: @config.metadata,
1771
+ retry_policy: @config.retry_policy
1772
+
1773
+ @reservation_service_stub.update_bi_reservation request, options do |result, operation|
1774
+ yield result, operation if block_given?
1775
+ return result
1776
+ end
1777
+ rescue ::Gapic::Rest::Error => e
1778
+ raise ::Google::Cloud::Error.from_error(e)
1779
+ end
1780
+
1781
+ ##
1782
+ # Configuration class for the ReservationService REST API.
1783
+ #
1784
+ # This class represents the configuration for ReservationService REST,
1785
+ # providing control over timeouts, retry behavior, logging, transport
1786
+ # parameters, and other low-level controls. Certain parameters can also be
1787
+ # applied individually to specific RPCs. See
1788
+ # {::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Rest::Client::Configuration::Rpcs}
1789
+ # for a list of RPCs that can be configured independently.
1790
+ #
1791
+ # Configuration can be applied globally to all clients, or to a single client
1792
+ # on construction.
1793
+ #
1794
+ # @example
1795
+ #
1796
+ # # Modify the global config, setting the timeout for
1797
+ # # create_reservation to 20 seconds,
1798
+ # # and all remaining timeouts to 10 seconds.
1799
+ # ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Rest::Client.configure do |config|
1800
+ # config.timeout = 10.0
1801
+ # config.rpcs.create_reservation.timeout = 20.0
1802
+ # end
1803
+ #
1804
+ # # Apply the above configuration only to a new client.
1805
+ # client = ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Rest::Client.new do |config|
1806
+ # config.timeout = 10.0
1807
+ # config.rpcs.create_reservation.timeout = 20.0
1808
+ # end
1809
+ #
1810
+ # @!attribute [rw] endpoint
1811
+ # The hostname or hostname:port of the service endpoint.
1812
+ # Defaults to `"bigqueryreservation.googleapis.com"`.
1813
+ # @return [::String]
1814
+ # @!attribute [rw] credentials
1815
+ # Credentials to send with calls. You may provide any of the following types:
1816
+ # * (`String`) The path to a service account key file in JSON format
1817
+ # * (`Hash`) A service account key as a Hash
1818
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1819
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1820
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1821
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1822
+ # * (`nil`) indicating no credentials
1823
+ # @return [::Object]
1824
+ # @!attribute [rw] scope
1825
+ # The OAuth scopes
1826
+ # @return [::Array<::String>]
1827
+ # @!attribute [rw] lib_name
1828
+ # The library name as recorded in instrumentation and logging
1829
+ # @return [::String]
1830
+ # @!attribute [rw] lib_version
1831
+ # The library version as recorded in instrumentation and logging
1832
+ # @return [::String]
1833
+ # @!attribute [rw] timeout
1834
+ # The call timeout in seconds.
1835
+ # @return [::Numeric]
1836
+ # @!attribute [rw] metadata
1837
+ # Additional headers to be sent with the call.
1838
+ # @return [::Hash{::Symbol=>::String}]
1839
+ # @!attribute [rw] retry_policy
1840
+ # The retry policy. The value is a hash with the following keys:
1841
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1842
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1843
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1844
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1845
+ # trigger a retry.
1846
+ # @return [::Hash]
1847
+ # @!attribute [rw] quota_project
1848
+ # A separate project against which to charge quota.
1849
+ # @return [::String]
1850
+ #
1851
+ class Configuration
1852
+ extend ::Gapic::Config
1853
+
1854
+ config_attr :endpoint, "bigqueryreservation.googleapis.com", ::String
1855
+ config_attr :credentials, nil do |value|
1856
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1857
+ allowed.any? { |klass| klass === value }
1858
+ end
1859
+ config_attr :scope, nil, ::String, ::Array, nil
1860
+ config_attr :lib_name, nil, ::String, nil
1861
+ config_attr :lib_version, nil, ::String, nil
1862
+ config_attr :timeout, nil, ::Numeric, nil
1863
+ config_attr :metadata, nil, ::Hash, nil
1864
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1865
+ config_attr :quota_project, nil, ::String, nil
1866
+
1867
+ # @private
1868
+ def initialize parent_config = nil
1869
+ @parent_config = parent_config unless parent_config.nil?
1870
+
1871
+ yield self if block_given?
1872
+ end
1873
+
1874
+ ##
1875
+ # Configurations for individual RPCs
1876
+ # @return [Rpcs]
1877
+ #
1878
+ def rpcs
1879
+ @rpcs ||= begin
1880
+ parent_rpcs = nil
1881
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1882
+ Rpcs.new parent_rpcs
1883
+ end
1884
+ end
1885
+
1886
+ ##
1887
+ # Configuration RPC class for the ReservationService API.
1888
+ #
1889
+ # Includes fields providing the configuration for each RPC in this service.
1890
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1891
+ # the following configuration fields:
1892
+ #
1893
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1894
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1895
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1896
+ # include the following keys:
1897
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1898
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1899
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1900
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1901
+ # trigger a retry.
1902
+ #
1903
+ class Rpcs
1904
+ ##
1905
+ # RPC-specific configuration for `create_reservation`
1906
+ # @return [::Gapic::Config::Method]
1907
+ #
1908
+ attr_reader :create_reservation
1909
+ ##
1910
+ # RPC-specific configuration for `list_reservations`
1911
+ # @return [::Gapic::Config::Method]
1912
+ #
1913
+ attr_reader :list_reservations
1914
+ ##
1915
+ # RPC-specific configuration for `get_reservation`
1916
+ # @return [::Gapic::Config::Method]
1917
+ #
1918
+ attr_reader :get_reservation
1919
+ ##
1920
+ # RPC-specific configuration for `delete_reservation`
1921
+ # @return [::Gapic::Config::Method]
1922
+ #
1923
+ attr_reader :delete_reservation
1924
+ ##
1925
+ # RPC-specific configuration for `update_reservation`
1926
+ # @return [::Gapic::Config::Method]
1927
+ #
1928
+ attr_reader :update_reservation
1929
+ ##
1930
+ # RPC-specific configuration for `create_capacity_commitment`
1931
+ # @return [::Gapic::Config::Method]
1932
+ #
1933
+ attr_reader :create_capacity_commitment
1934
+ ##
1935
+ # RPC-specific configuration for `list_capacity_commitments`
1936
+ # @return [::Gapic::Config::Method]
1937
+ #
1938
+ attr_reader :list_capacity_commitments
1939
+ ##
1940
+ # RPC-specific configuration for `get_capacity_commitment`
1941
+ # @return [::Gapic::Config::Method]
1942
+ #
1943
+ attr_reader :get_capacity_commitment
1944
+ ##
1945
+ # RPC-specific configuration for `delete_capacity_commitment`
1946
+ # @return [::Gapic::Config::Method]
1947
+ #
1948
+ attr_reader :delete_capacity_commitment
1949
+ ##
1950
+ # RPC-specific configuration for `update_capacity_commitment`
1951
+ # @return [::Gapic::Config::Method]
1952
+ #
1953
+ attr_reader :update_capacity_commitment
1954
+ ##
1955
+ # RPC-specific configuration for `split_capacity_commitment`
1956
+ # @return [::Gapic::Config::Method]
1957
+ #
1958
+ attr_reader :split_capacity_commitment
1959
+ ##
1960
+ # RPC-specific configuration for `merge_capacity_commitments`
1961
+ # @return [::Gapic::Config::Method]
1962
+ #
1963
+ attr_reader :merge_capacity_commitments
1964
+ ##
1965
+ # RPC-specific configuration for `create_assignment`
1966
+ # @return [::Gapic::Config::Method]
1967
+ #
1968
+ attr_reader :create_assignment
1969
+ ##
1970
+ # RPC-specific configuration for `list_assignments`
1971
+ # @return [::Gapic::Config::Method]
1972
+ #
1973
+ attr_reader :list_assignments
1974
+ ##
1975
+ # RPC-specific configuration for `delete_assignment`
1976
+ # @return [::Gapic::Config::Method]
1977
+ #
1978
+ attr_reader :delete_assignment
1979
+ ##
1980
+ # RPC-specific configuration for `search_assignments`
1981
+ # @return [::Gapic::Config::Method]
1982
+ #
1983
+ attr_reader :search_assignments
1984
+ ##
1985
+ # RPC-specific configuration for `search_all_assignments`
1986
+ # @return [::Gapic::Config::Method]
1987
+ #
1988
+ attr_reader :search_all_assignments
1989
+ ##
1990
+ # RPC-specific configuration for `move_assignment`
1991
+ # @return [::Gapic::Config::Method]
1992
+ #
1993
+ attr_reader :move_assignment
1994
+ ##
1995
+ # RPC-specific configuration for `update_assignment`
1996
+ # @return [::Gapic::Config::Method]
1997
+ #
1998
+ attr_reader :update_assignment
1999
+ ##
2000
+ # RPC-specific configuration for `get_bi_reservation`
2001
+ # @return [::Gapic::Config::Method]
2002
+ #
2003
+ attr_reader :get_bi_reservation
2004
+ ##
2005
+ # RPC-specific configuration for `update_bi_reservation`
2006
+ # @return [::Gapic::Config::Method]
2007
+ #
2008
+ attr_reader :update_bi_reservation
2009
+
2010
+ # @private
2011
+ def initialize parent_rpcs = nil
2012
+ create_reservation_config = parent_rpcs.create_reservation if parent_rpcs.respond_to? :create_reservation
2013
+ @create_reservation = ::Gapic::Config::Method.new create_reservation_config
2014
+ list_reservations_config = parent_rpcs.list_reservations if parent_rpcs.respond_to? :list_reservations
2015
+ @list_reservations = ::Gapic::Config::Method.new list_reservations_config
2016
+ get_reservation_config = parent_rpcs.get_reservation if parent_rpcs.respond_to? :get_reservation
2017
+ @get_reservation = ::Gapic::Config::Method.new get_reservation_config
2018
+ delete_reservation_config = parent_rpcs.delete_reservation if parent_rpcs.respond_to? :delete_reservation
2019
+ @delete_reservation = ::Gapic::Config::Method.new delete_reservation_config
2020
+ update_reservation_config = parent_rpcs.update_reservation if parent_rpcs.respond_to? :update_reservation
2021
+ @update_reservation = ::Gapic::Config::Method.new update_reservation_config
2022
+ create_capacity_commitment_config = parent_rpcs.create_capacity_commitment if parent_rpcs.respond_to? :create_capacity_commitment
2023
+ @create_capacity_commitment = ::Gapic::Config::Method.new create_capacity_commitment_config
2024
+ list_capacity_commitments_config = parent_rpcs.list_capacity_commitments if parent_rpcs.respond_to? :list_capacity_commitments
2025
+ @list_capacity_commitments = ::Gapic::Config::Method.new list_capacity_commitments_config
2026
+ get_capacity_commitment_config = parent_rpcs.get_capacity_commitment if parent_rpcs.respond_to? :get_capacity_commitment
2027
+ @get_capacity_commitment = ::Gapic::Config::Method.new get_capacity_commitment_config
2028
+ delete_capacity_commitment_config = parent_rpcs.delete_capacity_commitment if parent_rpcs.respond_to? :delete_capacity_commitment
2029
+ @delete_capacity_commitment = ::Gapic::Config::Method.new delete_capacity_commitment_config
2030
+ update_capacity_commitment_config = parent_rpcs.update_capacity_commitment if parent_rpcs.respond_to? :update_capacity_commitment
2031
+ @update_capacity_commitment = ::Gapic::Config::Method.new update_capacity_commitment_config
2032
+ split_capacity_commitment_config = parent_rpcs.split_capacity_commitment if parent_rpcs.respond_to? :split_capacity_commitment
2033
+ @split_capacity_commitment = ::Gapic::Config::Method.new split_capacity_commitment_config
2034
+ merge_capacity_commitments_config = parent_rpcs.merge_capacity_commitments if parent_rpcs.respond_to? :merge_capacity_commitments
2035
+ @merge_capacity_commitments = ::Gapic::Config::Method.new merge_capacity_commitments_config
2036
+ create_assignment_config = parent_rpcs.create_assignment if parent_rpcs.respond_to? :create_assignment
2037
+ @create_assignment = ::Gapic::Config::Method.new create_assignment_config
2038
+ list_assignments_config = parent_rpcs.list_assignments if parent_rpcs.respond_to? :list_assignments
2039
+ @list_assignments = ::Gapic::Config::Method.new list_assignments_config
2040
+ delete_assignment_config = parent_rpcs.delete_assignment if parent_rpcs.respond_to? :delete_assignment
2041
+ @delete_assignment = ::Gapic::Config::Method.new delete_assignment_config
2042
+ search_assignments_config = parent_rpcs.search_assignments if parent_rpcs.respond_to? :search_assignments
2043
+ @search_assignments = ::Gapic::Config::Method.new search_assignments_config
2044
+ search_all_assignments_config = parent_rpcs.search_all_assignments if parent_rpcs.respond_to? :search_all_assignments
2045
+ @search_all_assignments = ::Gapic::Config::Method.new search_all_assignments_config
2046
+ move_assignment_config = parent_rpcs.move_assignment if parent_rpcs.respond_to? :move_assignment
2047
+ @move_assignment = ::Gapic::Config::Method.new move_assignment_config
2048
+ update_assignment_config = parent_rpcs.update_assignment if parent_rpcs.respond_to? :update_assignment
2049
+ @update_assignment = ::Gapic::Config::Method.new update_assignment_config
2050
+ get_bi_reservation_config = parent_rpcs.get_bi_reservation if parent_rpcs.respond_to? :get_bi_reservation
2051
+ @get_bi_reservation = ::Gapic::Config::Method.new get_bi_reservation_config
2052
+ update_bi_reservation_config = parent_rpcs.update_bi_reservation if parent_rpcs.respond_to? :update_bi_reservation
2053
+ @update_bi_reservation = ::Gapic::Config::Method.new update_bi_reservation_config
2054
+
2055
+ yield self if block_given?
2056
+ end
2057
+ end
2058
+ end
2059
+ end
2060
+ end
2061
+ end
2062
+ end
2063
+ end
2064
+ end
2065
+ end
2066
+ end