Class: Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb

Overview

Client for the ReservationService service.

This API allows users to manage their BigQuery reservations.

A reservation provides computational resource guarantees, in the form of slots, to users. A slot is a unit of computational power in BigQuery, and serves as the basic unit of parallelism. In a scan of a multi-partitioned table, a single slot operates on a single partition of the table. A reservation resource exists as a child resource of the admin project and location, e.g.: projects/myproject/locations/US/reservations/reservationName.

A capacity commitment is a way to purchase compute capacity for BigQuery jobs (in the form of slots) with some committed period of usage. A capacity commitment resource exists as a child resource of the admin project and location, e.g.: projects/myproject/locations/US/capacityCommitments/id.

Defined Under Namespace

Classes: Configuration

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#assignment_path, #bi_reservation_path, #capacity_commitment_path, #location_path, #reservation_path

Constructor Details

#initialize {|config| ... } ⇒ Client

Create a new ReservationService client object.

Examples:


# Create a client using the default configuration
client = ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the ReservationService client.

Yield Parameters:



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 207

def initialize
  # These require statements are intentionally placed here to initialize
  # the gRPC module only when it's required.
  # See https://github.com/googleapis/toolkit/issues/446
  require "gapic/grpc"
  require "google/cloud/bigquery/reservation/v1/reservation_services_pb"

  # Create the configuration object
  @config = Configuration.new Client.configure

  # Yield the configuration if needed
  yield @config if block_given?

  # Create credentials
  credentials = @config.credentials
  # Use self-signed JWT if the endpoint is unchanged from default,
  # but only if the default endpoint does not have a region prefix.
  enable_self_signed_jwt = @config.endpoint.nil? ||
                           (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
                           !@config.endpoint.split(".").first.include?("-"))
  credentials ||= Credentials.default scope: @config.scope,
                                      enable_self_signed_jwt: enable_self_signed_jwt
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
    credentials = Credentials.new credentials, scope: @config.scope
  end
  @quota_project_id = @config.quota_project
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id

  @reservation_service_stub = ::Gapic::ServiceStub.new(
    ::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Stub,
    credentials: credentials,
    endpoint: @config.endpoint,
    endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
    universe_domain: @config.universe_domain,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors,
    channel_pool_config: @config.channel_pool,
    logger: @config.logger
  )

  @reservation_service_stub.stub_logger&.info do |entry|
    entry.set_system_name
    entry.set_service
    entry.message = "Created client for #{entry.service}"
    entry.set_credentials_fields credentials
    entry.set "customEndpoint", @config.endpoint if @config.endpoint
    entry.set "defaultTimeout", @config.timeout if @config.timeout
    entry.set "quotaProject", @quota_project_id if @quota_project_id
  end
end

Class Method Details

.configure {|config| ... } ⇒ Client::Configuration

Configure the ReservationService Client class.

See Configuration for a description of the configuration fields.

Examples:


# Modify the configuration for all ReservationService clients
::Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 77

def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "Bigquery", "Reservation", "V1"]
    parent_config = while namespace.any?
                      parent_name = namespace.join "::"
                      parent_const = const_get parent_name
                      break parent_const.configure if parent_const.respond_to? :configure
                      namespace.pop
                    end
    default_config = Client::Configuration.new parent_config

    default_config.rpcs.create_reservation.timeout = 300.0

    default_config.rpcs.list_reservations.timeout = 300.0
    default_config.rpcs.list_reservations.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.get_reservation.timeout = 300.0
    default_config.rpcs.get_reservation.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.delete_reservation.timeout = 300.0
    default_config.rpcs.delete_reservation.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.update_reservation.timeout = 300.0

    default_config.rpcs.create_capacity_commitment.timeout = 300.0

    default_config.rpcs.list_capacity_commitments.timeout = 300.0
    default_config.rpcs.list_capacity_commitments.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.get_capacity_commitment.timeout = 300.0
    default_config.rpcs.get_capacity_commitment.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.delete_capacity_commitment.timeout = 300.0
    default_config.rpcs.delete_capacity_commitment.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.update_capacity_commitment.timeout = 300.0

    default_config.rpcs.split_capacity_commitment.timeout = 300.0

    default_config.rpcs.merge_capacity_commitments.timeout = 300.0

    default_config.rpcs.create_assignment.timeout = 300.0

    default_config.rpcs.list_assignments.timeout = 300.0
    default_config.rpcs.list_assignments.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.delete_assignment.timeout = 300.0
    default_config.rpcs.delete_assignment.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.search_assignments.timeout = 300.0
    default_config.rpcs.search_assignments.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.move_assignment.timeout = 300.0

    default_config.rpcs.get_bi_reservation.timeout = 300.0
    default_config.rpcs.get_bi_reservation.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.update_bi_reservation.timeout = 300.0

    default_config
  end
  yield @configure if block_given?
  @configure
end

Instance Method Details

#configure {|config| ... } ⇒ Client::Configuration

Configure the ReservationService Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on configure.

See Configuration for a description of the configuration fields.

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



177
178
179
180
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 177

def configure
  yield @config if block_given?
  @config
end

#create_assignment(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Assignment #create_assignment(parent: nil, assignment: nil, assignment_id: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Assignment

Creates an assignment object which allows the given project to submit jobs of a certain type using slots from the specified reservation.

Currently a resource (project, folder, organization) can only have one assignment per each (job_type, location) combination, and that reservation will be used for all jobs of the matching type.

Different assignments can be created on different levels of the projects, folders or organization hierarchy. During query execution, the assignment is looked up at the project, folder and organization levels in that order. The first assignment found is applied to the query.

When creating assignments, it does not matter if other assignments exist at higher levels.

Example:

  • The organization organizationA contains two projects, project1 and project2.
  • Assignments for all three entities (organizationA, project1, and project2) could all be created and mapped to the same or different reservations.

"None" assignments represent an absence of the assignment. Projects assigned to None use on-demand pricing. To create a "None" assignment, use "none" as a reservation_id in the parent. Example parent: projects/myproject/locations/US/reservations/none.

Returns google.rpc.Code.PERMISSION_DENIED if user does not have 'bigquery.admin' permissions on the project using the reservation and the project that owns this reservation.

Returns google.rpc.Code.INVALID_ARGUMENT when location of the assignment does not match location of the reservation.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::CreateAssignmentRequest.new

# Call the create_assignment method.
result = client.create_assignment request

# The returned object is of type Google::Cloud::Bigquery::Reservation::V1::Assignment.
p result

Overloads:

  • #create_assignment(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Assignment

    Pass arguments to create_assignment via a request object, either of type CreateAssignmentRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Bigquery::Reservation::V1::CreateAssignmentRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_assignment(parent: nil, assignment: nil, assignment_id: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Assignment

    Pass arguments to create_assignment via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The parent resource name of the assignment E.g. projects/myproject/locations/US/reservations/team1-prod

    • assignment (::Google::Cloud::Bigquery::Reservation::V1::Assignment, ::Hash) (defaults to: nil)

      Assignment resource to create.

    • assignment_id (::String) (defaults to: nil)

      The optional assignment ID. Assignment name will be generated automatically if this field is empty. This field must only contain lower case alphanumeric characters or dashes. Max length is 64 characters.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 1551

def create_assignment request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::CreateAssignmentRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_assignment..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_assignment.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_assignment.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :create_assignment, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_capacity_commitment(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment #create_capacity_commitment(parent: nil, capacity_commitment: nil, enforce_single_admin_project_per_org: nil, capacity_commitment_id: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment

Creates a new capacity commitment resource.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::CreateCapacityCommitmentRequest.new

# Call the create_capacity_commitment method.
result = client.create_capacity_commitment request

# The returned object is of type Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment.
p result

Overloads:

  • #create_capacity_commitment(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment

    Pass arguments to create_capacity_commitment via a request object, either of type CreateCapacityCommitmentRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Bigquery::Reservation::V1::CreateCapacityCommitmentRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_capacity_commitment(parent: nil, capacity_commitment: nil, enforce_single_admin_project_per_org: nil, capacity_commitment_id: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment

    Pass arguments to create_capacity_commitment via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. Resource name of the parent reservation. E.g., projects/myproject/locations/US

    • capacity_commitment (::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment, ::Hash) (defaults to: nil)

      Content of the capacity commitment to create.

    • enforce_single_admin_project_per_org (::Boolean) (defaults to: nil)

      If true, fail the request if another project in the organization has a capacity commitment.

    • capacity_commitment_id (::String) (defaults to: nil)

      The optional capacity commitment ID. Capacity commitment name will be generated automatically if this field is empty. This field must only contain lower case alphanumeric characters or dashes. The first and last character cannot be a dash. Max length is 64 characters. NOTE: this ID won't be kept if the capacity commitment is split or merged.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 864

def create_capacity_commitment request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::CreateCapacityCommitmentRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_capacity_commitment..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_capacity_commitment.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_capacity_commitment.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :create_capacity_commitment, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#create_reservation(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Reservation #create_reservation(parent: nil, reservation_id: nil, reservation: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Reservation

Creates a new reservation resource.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::CreateReservationRequest.new

# Call the create_reservation method.
result = client.create_reservation request

# The returned object is of type Google::Cloud::Bigquery::Reservation::V1::Reservation.
p result

Overloads:

  • #create_reservation(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Reservation

    Pass arguments to create_reservation via a request object, either of type CreateReservationRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Bigquery::Reservation::V1::CreateReservationRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_reservation(parent: nil, reservation_id: nil, reservation: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Reservation

    Pass arguments to create_reservation via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. Project, location. E.g., projects/myproject/locations/US

    • reservation_id (::String) (defaults to: nil)

      The reservation ID. It must only contain lower case alphanumeric characters or dashes. It must start with a letter and must not end with a dash. Its maximum length is 64 characters.

    • reservation (::Google::Cloud::Bigquery::Reservation::V1::Reservation, ::Hash) (defaults to: nil)

      Definition of the new reservation to create.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 320

def create_reservation request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::CreateReservationRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_reservation..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.create_reservation.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_reservation.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :create_reservation, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_assignment(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_assignment(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes a assignment. No expansion will happen.

Example:

  • Organization organizationA contains two projects, project1 and project2.
  • Reservation res1 exists and was created previously.
  • CreateAssignment was used previously to define the following associations between entities and reservations: <organizationA, res1> and <project1, res1>

In this example, deletion of the <organizationA, res1> assignment won't affect the other assignment <project1, res1>. After said deletion, queries from project1 will still use res1 while queries from project2 will switch to use on-demand mode.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::DeleteAssignmentRequest.new

# Call the delete_assignment method.
result = client.delete_assignment request

# The returned object is of type Google::Protobuf::Empty.
p result

Overloads:

  • #delete_assignment(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_assignment via a request object, either of type DeleteAssignmentRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Bigquery::Reservation::V1::DeleteAssignmentRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_assignment(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_assignment via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. Name of the resource, e.g. projects/myproject/locations/US/reservations/team1-prod/assignments/123

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 1772

def delete_assignment request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::DeleteAssignmentRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.delete_assignment..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.delete_assignment.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_assignment.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :delete_assignment, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_capacity_commitment(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_capacity_commitment(name: nil, force: nil) ⇒ ::Google::Protobuf::Empty

Deletes a capacity commitment. Attempting to delete capacity commitment before its commitment_end_time will fail with the error code google.rpc.Code.FAILED_PRECONDITION.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::DeleteCapacityCommitmentRequest.new

# Call the delete_capacity_commitment method.
result = client.delete_capacity_commitment request

# The returned object is of type Google::Protobuf::Empty.
p result

Overloads:

  • #delete_capacity_commitment(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_capacity_commitment via a request object, either of type DeleteCapacityCommitmentRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Bigquery::Reservation::V1::DeleteCapacityCommitmentRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_capacity_commitment(name: nil, force: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_capacity_commitment via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. Resource name of the capacity commitment to delete. E.g., projects/myproject/locations/US/capacityCommitments/123

    • force (::Boolean) (defaults to: nil)

      Can be used to force delete commitments even if assignments exist. Deleting commitments with assignments may cause queries to fail if they no longer have access to slots.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 1138

def delete_capacity_commitment request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::DeleteCapacityCommitmentRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.delete_capacity_commitment..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.delete_capacity_commitment.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_capacity_commitment.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :delete_capacity_commitment, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_reservation(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_reservation(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes a reservation. Returns google.rpc.Code.FAILED_PRECONDITION when reservation has assignments.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::DeleteReservationRequest.new

# Call the delete_reservation method.
result = client.delete_reservation request

# The returned object is of type Google::Protobuf::Empty.
p result

Overloads:

  • #delete_reservation(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_reservation via a request object, either of type DeleteReservationRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Bigquery::Reservation::V1::DeleteReservationRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_reservation(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_reservation via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. Resource name of the reservation to retrieve. E.g., projects/myproject/locations/US/reservations/team1-prod

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 590

def delete_reservation request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::DeleteReservationRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.delete_reservation..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.delete_reservation.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_reservation.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :delete_reservation, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#failover_reservation(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Reservation #failover_reservation(name: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Reservation

Fail over a reservation to the secondary location. The operation should be done in the current secondary location, which will be promoted to the new primary location for the reservation. Attempting to failover a reservation in the current primary location will fail with the error code google.rpc.Code.FAILED_PRECONDITION.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::FailoverReservationRequest.new

# Call the failover_reservation method.
result = client.failover_reservation request

# The returned object is of type Google::Cloud::Bigquery::Reservation::V1::Reservation.
p result

Overloads:

  • #failover_reservation(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Reservation

    Pass arguments to failover_reservation via a request object, either of type FailoverReservationRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Bigquery::Reservation::V1::FailoverReservationRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #failover_reservation(name: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Reservation

    Pass arguments to failover_reservation via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. Resource name of the reservation to failover. E.g., projects/myproject/locations/US/reservations/team1-prod

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 767

def failover_reservation request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::FailoverReservationRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.failover_reservation..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.failover_reservation.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.failover_reservation.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :failover_reservation, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_bi_reservation(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::BiReservation #get_bi_reservation(name: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::BiReservation

Retrieves a BI reservation.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::GetBiReservationRequest.new

# Call the get_bi_reservation method.
result = client.get_bi_reservation request

# The returned object is of type Google::Cloud::Bigquery::Reservation::V1::BiReservation.
p result

Overloads:

  • #get_bi_reservation(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::BiReservation

    Pass arguments to get_bi_reservation via a request object, either of type GetBiReservationRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Bigquery::Reservation::V1::GetBiReservationRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_bi_reservation(name: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::BiReservation

    Pass arguments to get_bi_reservation via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. Name of the requested reservation, for example: projects/{project_id}/locations/{location_id}/biReservation

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 2300

def get_bi_reservation request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::GetBiReservationRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_bi_reservation..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_bi_reservation.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_bi_reservation.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :get_bi_reservation, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_capacity_commitment(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment #get_capacity_commitment(name: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment

Returns information about the capacity commitment.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::GetCapacityCommitmentRequest.new

# Call the get_capacity_commitment method.
result = client.get_capacity_commitment request

# The returned object is of type Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment.
p result

Overloads:

  • #get_capacity_commitment(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment

    Pass arguments to get_capacity_commitment via a request object, either of type GetCapacityCommitmentRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Bigquery::Reservation::V1::GetCapacityCommitmentRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_capacity_commitment(name: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment

    Pass arguments to get_capacity_commitment via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. Resource name of the capacity commitment to retrieve. E.g., projects/myproject/locations/US/capacityCommitments/123

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 1046

def get_capacity_commitment request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::GetCapacityCommitmentRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_capacity_commitment..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_capacity_commitment.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_capacity_commitment.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :get_capacity_commitment, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_reservation(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Reservation #get_reservation(name: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Reservation

Returns information about the reservation.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::GetReservationRequest.new

# Call the get_reservation method.
result = client.get_reservation request

# The returned object is of type Google::Cloud::Bigquery::Reservation::V1::Reservation.
p result

Overloads:

  • #get_reservation(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Reservation

    Pass arguments to get_reservation via a request object, either of type GetReservationRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Bigquery::Reservation::V1::GetReservationRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_reservation(name: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Reservation

    Pass arguments to get_reservation via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. Resource name of the reservation to retrieve. E.g., projects/myproject/locations/US/reservations/team1-prod

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 502

def get_reservation request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::GetReservationRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_reservation..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.get_reservation.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_reservation.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :get_reservation, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_assignments(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Assignment> #list_assignments(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Assignment>

Lists assignments.

Only explicitly created assignments will be returned.

Example:

  • Organization organizationA contains two projects, project1 and project2.
  • Reservation res1 exists and was created previously.
  • CreateAssignment was used previously to define the following associations between entities and reservations: <organizationA, res1> and <project1, res1>

In this example, ListAssignments will just return the above two assignments for reservation res1, and no expansion/merge will happen.

The wildcard "-" can be used for reservations in the request. In that case all assignments belongs to the specified project and location will be listed.

Note "-" cannot be used for projects nor locations.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::ListAssignmentsRequest.new

# Call the list_assignments method.
result = client.list_assignments request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Bigquery::Reservation::V1::Assignment.
  p item
end

Overloads:

  • #list_assignments(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Assignment>

    Pass arguments to list_assignments via a request object, either of type ListAssignmentsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Bigquery::Reservation::V1::ListAssignmentsRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_assignments(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Assignment>

    Pass arguments to list_assignments via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The parent resource name e.g.:

      projects/myproject/locations/US/reservations/team1-prod

      Or:

      projects/myproject/locations/US/reservations/-

    • page_size (::Integer) (defaults to: nil)

      The maximum number of items to return per page.

    • page_token (::String) (defaults to: nil)

      The next_page_token value returned from a previous List request, if any.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 1670

def list_assignments request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::ListAssignmentsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_assignments..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_assignments.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_assignments.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :list_assignments, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @reservation_service_stub, :list_assignments, request, response, operation, options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_capacity_commitments(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment> #list_capacity_commitments(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment>

Lists all the capacity commitments for the admin project.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::ListCapacityCommitmentsRequest.new

# Call the list_capacity_commitments method.
result = client.list_capacity_commitments request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment.
  p item
end

Overloads:

  • #list_capacity_commitments(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment>

    Pass arguments to list_capacity_commitments via a request object, either of type ListCapacityCommitmentsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Bigquery::Reservation::V1::ListCapacityCommitmentsRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_capacity_commitments(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment>

    Pass arguments to list_capacity_commitments via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. Resource name of the parent reservation. E.g., projects/myproject/locations/US

    • page_size (::Integer) (defaults to: nil)

      The maximum number of items to return.

    • page_token (::String) (defaults to: nil)

      The next_page_token value returned from a previous List request, if any.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 958

def list_capacity_commitments request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::ListCapacityCommitmentsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_capacity_commitments..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_capacity_commitments.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_capacity_commitments.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :list_capacity_commitments, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @reservation_service_stub, :list_capacity_commitments, request, response, operation, options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_reservations(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Reservation> #list_reservations(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Reservation>

Lists all the reservations for the project in the specified location.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::ListReservationsRequest.new

# Call the list_reservations method.
result = client.list_reservations request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Bigquery::Reservation::V1::Reservation.
  p item
end

Overloads:

  • #list_reservations(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Reservation>

    Pass arguments to list_reservations via a request object, either of type ListReservationsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Bigquery::Reservation::V1::ListReservationsRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_reservations(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Reservation>

    Pass arguments to list_reservations via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The parent resource name containing project and location, e.g.: projects/myproject/locations/US

    • page_size (::Integer) (defaults to: nil)

      The maximum number of items to return per page.

    • page_token (::String) (defaults to: nil)

      The next_page_token value returned from a previous List request, if any.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 414

def list_reservations request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::ListReservationsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_reservations..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.list_reservations.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_reservations.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :list_reservations, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @reservation_service_stub, :list_reservations, request, response, operation, options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#loggerLogger

The logger used for request/response debug logging.

Returns:

  • (Logger)


263
264
265
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 263

def logger
  @reservation_service_stub.logger
end

#merge_capacity_commitments(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment #merge_capacity_commitments(parent: nil, capacity_commitment_ids: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment

Merges capacity commitments of the same plan into a single commitment.

The resulting capacity commitment has the greater commitment_end_time out of the to-be-merged capacity commitments.

Attempting to merge capacity commitments of different plan will fail with the error code google.rpc.Code.FAILED_PRECONDITION.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::MergeCapacityCommitmentsRequest.new

# Call the merge_capacity_commitments method.
result = client.merge_capacity_commitments request

# The returned object is of type Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment.
p result

Overloads:

  • #merge_capacity_commitments(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment

    Pass arguments to merge_capacity_commitments via a request object, either of type MergeCapacityCommitmentsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Bigquery::Reservation::V1::MergeCapacityCommitmentsRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #merge_capacity_commitments(parent: nil, capacity_commitment_ids: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment

    Pass arguments to merge_capacity_commitments via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Parent resource that identifies admin project and location e.g., projects/myproject/locations/us

    • capacity_commitment_ids (::Array<::String>) (defaults to: nil)

      Ids of capacity commitments to merge. These capacity commitments must exist under admin project and location specified in the parent. ID is the last portion of capacity commitment name e.g., 'abc' for projects/myproject/locations/US/capacityCommitments/abc

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 1424

def merge_capacity_commitments request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::MergeCapacityCommitmentsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.merge_capacity_commitments..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.merge_capacity_commitments.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.merge_capacity_commitments.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :merge_capacity_commitments, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#move_assignment(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Assignment #move_assignment(name: nil, destination_id: nil, assignment_id: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Assignment

Moves an assignment under a new reservation.

This differs from removing an existing assignment and recreating a new one by providing a transactional change that ensures an assignee always has an associated reservation.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::MoveAssignmentRequest.new

# Call the move_assignment method.
result = client.move_assignment request

# The returned object is of type Google::Cloud::Bigquery::Reservation::V1::Assignment.
p result

Overloads:

  • #move_assignment(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Assignment

    Pass arguments to move_assignment via a request object, either of type MoveAssignmentRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Bigquery::Reservation::V1::MoveAssignmentRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #move_assignment(name: nil, destination_id: nil, assignment_id: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Assignment

    Pass arguments to move_assignment via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The resource name of the assignment, e.g. projects/myproject/locations/US/reservations/team1-prod/assignments/123

    • destination_id (::String) (defaults to: nil)

      The new reservation ID, e.g.: projects/myotherproject/locations/US/reservations/team2-prod

    • assignment_id (::String) (defaults to: nil)

      The optional assignment ID. A new assignment name is generated if this field is empty.

      This field can contain only lowercase alphanumeric characters or dashes. Max length is 64 characters.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 2125

def move_assignment request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::MoveAssignmentRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.move_assignment..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.move_assignment.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.move_assignment.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :move_assignment, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#search_all_assignments(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Assignment> #search_all_assignments(parent: nil, query: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Assignment>

Looks up assignments for a specified resource for a particular region. If the request is about a project:

  1. Assignments created on the project will be returned if they exist.
  2. Otherwise assignments created on the closest ancestor will be returned.
  3. Assignments for different JobTypes will all be returned.

The same logic applies if the request is about a folder.

If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors).

Comparing to ListAssignments, there are some behavior differences:

  1. permission on the assignee will be verified in this API.
  2. Hierarchy lookup (project->folder->organization) happens in this API.
  3. Parent here is projects/*/locations/*, instead of projects/*/locations/*reservations/*.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::SearchAllAssignmentsRequest.new

# Call the search_all_assignments method.
result = client.search_all_assignments request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Bigquery::Reservation::V1::Assignment.
  p item
end

Overloads:

  • #search_all_assignments(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Assignment>

    Pass arguments to search_all_assignments via a request object, either of type SearchAllAssignmentsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Bigquery::Reservation::V1::SearchAllAssignmentsRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #search_all_assignments(parent: nil, query: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Assignment>

    Pass arguments to search_all_assignments via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The resource name with location (project name could be the wildcard '-'), e.g.: projects/-/locations/US.

    • query (::String) (defaults to: nil)

      Please specify resource name as assignee in the query.

      Examples:

      • assignee=projects/myproject
      • assignee=folders/123
      • assignee=organizations/456
    • page_size (::Integer) (defaults to: nil)

      The maximum number of items to return per page.

    • page_token (::String) (defaults to: nil)

      The next_page_token value returned from a previous List request, if any.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 2023

def search_all_assignments request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::SearchAllAssignmentsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.search_all_assignments..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.search_all_assignments.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.search_all_assignments.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :search_all_assignments, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @reservation_service_stub, :search_all_assignments, request, response, operation, options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#search_assignments(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Assignment> #search_assignments(parent: nil, query: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Assignment>

Deprecated.

This method is deprecated and may be removed in the next major version update.

Deprecated: Looks up assignments for a specified resource for a particular region. If the request is about a project:

  1. Assignments created on the project will be returned if they exist.
  2. Otherwise assignments created on the closest ancestor will be returned.
  3. Assignments for different JobTypes will all be returned.

The same logic applies if the request is about a folder.

If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors).

Comparing to ListAssignments, there are some behavior differences:

  1. permission on the assignee will be verified in this API.
  2. Hierarchy lookup (project->folder->organization) happens in this API.
  3. Parent here is projects/*/locations/*, instead of projects/*/locations/*reservations/*.

Note "-" cannot be used for projects nor locations.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::SearchAssignmentsRequest.new

# Call the search_assignments method.
result = client.search_assignments request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Bigquery::Reservation::V1::Assignment.
  p item
end

Overloads:

  • #search_assignments(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Assignment>

    Pass arguments to search_assignments via a request object, either of type SearchAssignmentsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Bigquery::Reservation::V1::SearchAssignmentsRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #search_assignments(parent: nil, query: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::Bigquery::Reservation::V1::Assignment>

    Pass arguments to search_assignments via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The resource name of the admin project(containing project and location), e.g.: projects/myproject/locations/US.

    • query (::String) (defaults to: nil)

      Please specify resource name as assignee in the query.

      Examples:

      • assignee=projects/myproject
      • assignee=folders/123
      • assignee=organizations/456
    • page_size (::Integer) (defaults to: nil)

      The maximum number of items to return per page.

    • page_token (::String) (defaults to: nil)

      The next_page_token value returned from a previous List request, if any.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 1899

def search_assignments request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::SearchAssignmentsRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.search_assignments..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.search_assignments.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.search_assignments.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :search_assignments, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @reservation_service_stub, :search_assignments, request, response, operation, options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#split_capacity_commitment(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentResponse #split_capacity_commitment(name: nil, slot_count: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentResponse

Splits capacity commitment to two commitments of the same plan and commitment_end_time.

A common use case is to enable downgrading commitments.

For example, in order to downgrade from 10000 slots to 8000, you might split a 10000 capacity commitment into commitments of 2000 and 8000. Then, you delete the first one after the commitment end time passes.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentRequest.new

# Call the split_capacity_commitment method.
result = client.split_capacity_commitment request

# The returned object is of type Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentResponse.
p result

Overloads:

  • #split_capacity_commitment(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentResponse

    Pass arguments to split_capacity_commitment via a request object, either of type SplitCapacityCommitmentRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentRequest, ::Hash)

      A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #split_capacity_commitment(name: nil, slot_count: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentResponse

    Pass arguments to split_capacity_commitment via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The resource name e.g.,: projects/myproject/locations/US/capacityCommitments/123

    • slot_count (::Integer) (defaults to: nil)

      Number of slots in the capacity commitment after the split.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 1326

def split_capacity_commitment request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.split_capacity_commitment..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.split_capacity_commitment.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.split_capacity_commitment.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :split_capacity_commitment, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#universe_domainString

The effective universe domain

Returns:

  • (String)


187
188
189
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 187

def universe_domain
  @reservation_service_stub.universe_domain
end

#update_assignment(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Assignment #update_assignment(assignment: nil, update_mask: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Assignment

Updates an existing assignment.

Only the priority field can be updated.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::UpdateAssignmentRequest.new

# Call the update_assignment method.
result = client.update_assignment request

# The returned object is of type Google::Cloud::Bigquery::Reservation::V1::Assignment.
p result

Overloads:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 2214

def update_assignment request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::UpdateAssignmentRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_assignment..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.assignment&.name
    header_params["assignment.name"] = request.assignment.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_assignment.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_assignment.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :update_assignment, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_bi_reservation(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::BiReservation #update_bi_reservation(bi_reservation: nil, update_mask: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::BiReservation

Updates a BI reservation.

Only fields specified in the field_mask are updated.

A singleton BI reservation always exists with default size 0. In order to reserve BI capacity it needs to be updated to an amount greater than 0. In order to release BI capacity reservation size must be set to 0.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::UpdateBiReservationRequest.new

# Call the update_bi_reservation method.
result = client.update_bi_reservation request

# The returned object is of type Google::Cloud::Bigquery::Reservation::V1::BiReservation.
p result

Overloads:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 2394

def update_bi_reservation request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::UpdateBiReservationRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_bi_reservation..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.bi_reservation&.name
    header_params["bi_reservation.name"] = request.bi_reservation.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_bi_reservation.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_bi_reservation.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :update_bi_reservation, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_capacity_commitment(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment #update_capacity_commitment(capacity_commitment: nil, update_mask: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment

Updates an existing capacity commitment.

Only plan and renewal_plan fields can be updated.

Plan can only be changed to a plan of a longer commitment period. Attempting to change to a plan with shorter commitment period will fail with the error code google.rpc.Code.FAILED_PRECONDITION.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::UpdateCapacityCommitmentRequest.new

# Call the update_capacity_commitment method.
result = client.update_capacity_commitment request

# The returned object is of type Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment.
p result

Overloads:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 1231

def update_capacity_commitment request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::UpdateCapacityCommitmentRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_capacity_commitment..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.capacity_commitment&.name
    header_params["capacity_commitment.name"] = request.capacity_commitment.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_capacity_commitment.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_capacity_commitment.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :update_capacity_commitment, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#update_reservation(request, options = nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Reservation #update_reservation(reservation: nil, update_mask: nil) ⇒ ::Google::Cloud::Bigquery::Reservation::V1::Reservation

Updates an existing reservation resource.

Examples:

Basic example

require "google/cloud/bigquery/reservation/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Bigquery::Reservation::V1::ReservationService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Bigquery::Reservation::V1::UpdateReservationRequest.new

# Call the update_reservation method.
result = client.update_reservation request

# The returned object is of type Google::Cloud::Bigquery::Reservation::V1::Reservation.
p result

Overloads:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
# File 'lib/google/cloud/bigquery/reservation/v1/reservation_service/client.rb', line 677

def update_reservation request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigquery::Reservation::V1::UpdateReservationRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_reservation..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Bigquery::Reservation::V1::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.reservation&.name
    header_params["reservation.name"] = request.reservation.name
  end

  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
  [:"x-goog-request-params"] ||= request_params_header

  options.apply_defaults timeout:      @config.rpcs.update_reservation.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_reservation.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @reservation_service_stub.call_rpc :update_reservation, request, options: options do |response, operation|
    yield response, operation if block_given?
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end