# frozen_string_literal: true # Copyright 2023 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Auto-generated by gapic-generator-ruby. DO NOT EDIT! require "google/cloud/bigquery/reservation/v1/reservation_pb" module Google module Cloud module Bigquery module Reservation module V1 module ReservationService module Rest ## # REST service stub for the ReservationService service. # Service stub contains baseline method implementations # including transcoding, making the REST call, and deserialing the response. # class ServiceStub def initialize endpoint:, credentials: # These require statements are intentionally placed here to initialize # the REST modules only when it's required. require "gapic/rest" @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials, numeric_enums: true, raise_faraday_errors: false end ## # Baseline implementation for the create_reservation REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::CreateReservationRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::Reservation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Bigquery::Reservation::V1::Reservation] # A result object deserialized from the server's reply def create_reservation request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_create_reservation_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Bigquery::Reservation::V1::Reservation.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # Baseline implementation for the list_reservations REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::ListReservationsRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::ListReservationsResponse] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Bigquery::Reservation::V1::ListReservationsResponse] # A result object deserialized from the server's reply def list_reservations request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_list_reservations_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Bigquery::Reservation::V1::ListReservationsResponse.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # Baseline implementation for the get_reservation REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::GetReservationRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::Reservation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Bigquery::Reservation::V1::Reservation] # A result object deserialized from the server's reply def get_reservation request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_get_reservation_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Bigquery::Reservation::V1::Reservation.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # Baseline implementation for the delete_reservation REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::DeleteReservationRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Protobuf::Empty] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Protobuf::Empty] # A result object deserialized from the server's reply def delete_reservation request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_delete_reservation_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # Baseline implementation for the update_reservation REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::UpdateReservationRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::Reservation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Bigquery::Reservation::V1::Reservation] # A result object deserialized from the server's reply def update_reservation request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_update_reservation_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Bigquery::Reservation::V1::Reservation.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # Baseline implementation for the create_capacity_commitment REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::CreateCapacityCommitmentRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment] # A result object deserialized from the server's reply def create_capacity_commitment request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_create_capacity_commitment_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # Baseline implementation for the list_capacity_commitments REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::ListCapacityCommitmentsRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::ListCapacityCommitmentsResponse] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Bigquery::Reservation::V1::ListCapacityCommitmentsResponse] # A result object deserialized from the server's reply def list_capacity_commitments request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_list_capacity_commitments_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Bigquery::Reservation::V1::ListCapacityCommitmentsResponse.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # Baseline implementation for the get_capacity_commitment REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::GetCapacityCommitmentRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment] # A result object deserialized from the server's reply def get_capacity_commitment request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_get_capacity_commitment_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # Baseline implementation for the delete_capacity_commitment REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::DeleteCapacityCommitmentRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Protobuf::Empty] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Protobuf::Empty] # A result object deserialized from the server's reply def delete_capacity_commitment request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_delete_capacity_commitment_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # Baseline implementation for the update_capacity_commitment REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::UpdateCapacityCommitmentRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment] # A result object deserialized from the server's reply def update_capacity_commitment request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_update_capacity_commitment_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # Baseline implementation for the split_capacity_commitment REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentResponse] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentResponse] # A result object deserialized from the server's reply def split_capacity_commitment request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_split_capacity_commitment_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentResponse.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # Baseline implementation for the merge_capacity_commitments REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::MergeCapacityCommitmentsRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment] # A result object deserialized from the server's reply def merge_capacity_commitments request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_merge_capacity_commitments_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Bigquery::Reservation::V1::CapacityCommitment.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # Baseline implementation for the create_assignment REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::CreateAssignmentRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::Assignment] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Bigquery::Reservation::V1::Assignment] # A result object deserialized from the server's reply def create_assignment request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_create_assignment_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Bigquery::Reservation::V1::Assignment.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # Baseline implementation for the list_assignments REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::ListAssignmentsRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::ListAssignmentsResponse] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Bigquery::Reservation::V1::ListAssignmentsResponse] # A result object deserialized from the server's reply def list_assignments request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_list_assignments_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Bigquery::Reservation::V1::ListAssignmentsResponse.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # Baseline implementation for the delete_assignment REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::DeleteAssignmentRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Protobuf::Empty] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Protobuf::Empty] # A result object deserialized from the server's reply def delete_assignment request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_delete_assignment_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # Baseline implementation for the search_assignments REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::SearchAssignmentsRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::SearchAssignmentsResponse] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Bigquery::Reservation::V1::SearchAssignmentsResponse] # A result object deserialized from the server's reply def search_assignments request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_search_assignments_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Bigquery::Reservation::V1::SearchAssignmentsResponse.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # Baseline implementation for the search_all_assignments REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::SearchAllAssignmentsRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::SearchAllAssignmentsResponse] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Bigquery::Reservation::V1::SearchAllAssignmentsResponse] # A result object deserialized from the server's reply def search_all_assignments request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_search_all_assignments_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Bigquery::Reservation::V1::SearchAllAssignmentsResponse.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # Baseline implementation for the move_assignment REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::MoveAssignmentRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::Assignment] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Bigquery::Reservation::V1::Assignment] # A result object deserialized from the server's reply def move_assignment request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_move_assignment_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Bigquery::Reservation::V1::Assignment.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # Baseline implementation for the update_assignment REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::UpdateAssignmentRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::Assignment] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Bigquery::Reservation::V1::Assignment] # A result object deserialized from the server's reply def update_assignment request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_update_assignment_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Bigquery::Reservation::V1::Assignment.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # Baseline implementation for the get_bi_reservation REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::GetBiReservationRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::BiReservation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Bigquery::Reservation::V1::BiReservation] # A result object deserialized from the server's reply def get_bi_reservation request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_get_bi_reservation_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Bigquery::Reservation::V1::BiReservation.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # Baseline implementation for the update_bi_reservation REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::UpdateBiReservationRequest] # A request object representing the call parameters. Required. # @param options [::Gapic::CallOptions] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Cloud::Bigquery::Reservation::V1::BiReservation] # @yieldparam operation [::Gapic::Rest::TransportOperation] # # @return [::Google::Cloud::Bigquery::Reservation::V1::BiReservation] # A result object deserialized from the server's reply def update_bi_reservation request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_update_bi_reservation_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Bigquery::Reservation::V1::BiReservation.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end ## # @private # # GRPC transcoding helper method for the create_reservation REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::CreateReservationRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_create_reservation_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :post, uri_template: "/v1/{parent}/reservations", body: "reservation", matches: [ ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] ] ) transcoder.transcode request_pb end ## # @private # # GRPC transcoding helper method for the list_reservations REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::ListReservationsRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_list_reservations_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :get, uri_template: "/v1/{parent}/reservations", matches: [ ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] ] ) transcoder.transcode request_pb end ## # @private # # GRPC transcoding helper method for the get_reservation REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::GetReservationRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_get_reservation_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :get, uri_template: "/v1/{name}", matches: [ ["name", %r{^projects/[^/]+/locations/[^/]+/reservations/[^/]+/?$}, false] ] ) transcoder.transcode request_pb end ## # @private # # GRPC transcoding helper method for the delete_reservation REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::DeleteReservationRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_delete_reservation_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :delete, uri_template: "/v1/{name}", matches: [ ["name", %r{^projects/[^/]+/locations/[^/]+/reservations/[^/]+/?$}, false] ] ) transcoder.transcode request_pb end ## # @private # # GRPC transcoding helper method for the update_reservation REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::UpdateReservationRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_update_reservation_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :patch, uri_template: "/v1/{reservation.name}", body: "reservation", matches: [ ["reservation.name", %r{^projects/[^/]+/locations/[^/]+/reservations/[^/]+/?$}, false] ] ) transcoder.transcode request_pb end ## # @private # # GRPC transcoding helper method for the create_capacity_commitment REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::CreateCapacityCommitmentRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_create_capacity_commitment_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :post, uri_template: "/v1/{parent}/capacityCommitments", body: "capacity_commitment", matches: [ ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] ] ) transcoder.transcode request_pb end ## # @private # # GRPC transcoding helper method for the list_capacity_commitments REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::ListCapacityCommitmentsRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_list_capacity_commitments_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :get, uri_template: "/v1/{parent}/capacityCommitments", matches: [ ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] ] ) transcoder.transcode request_pb end ## # @private # # GRPC transcoding helper method for the get_capacity_commitment REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::GetCapacityCommitmentRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_get_capacity_commitment_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :get, uri_template: "/v1/{name}", matches: [ ["name", %r{^projects/[^/]+/locations/[^/]+/capacityCommitments/[^/]+/?$}, false] ] ) transcoder.transcode request_pb end ## # @private # # GRPC transcoding helper method for the delete_capacity_commitment REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::DeleteCapacityCommitmentRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_delete_capacity_commitment_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :delete, uri_template: "/v1/{name}", matches: [ ["name", %r{^projects/[^/]+/locations/[^/]+/capacityCommitments/[^/]+/?$}, false] ] ) transcoder.transcode request_pb end ## # @private # # GRPC transcoding helper method for the update_capacity_commitment REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::UpdateCapacityCommitmentRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_update_capacity_commitment_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :patch, uri_template: "/v1/{capacity_commitment.name}", body: "capacity_commitment", matches: [ ["capacity_commitment.name", %r{^projects/[^/]+/locations/[^/]+/capacityCommitments/[^/]+/?$}, false] ] ) transcoder.transcode request_pb end ## # @private # # GRPC transcoding helper method for the split_capacity_commitment REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::SplitCapacityCommitmentRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_split_capacity_commitment_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :post, uri_template: "/v1/{name}:split", body: "*", matches: [ ["name", %r{^projects/[^/]+/locations/[^/]+/capacityCommitments/[^/]+/?$}, false] ] ) transcoder.transcode request_pb end ## # @private # # GRPC transcoding helper method for the merge_capacity_commitments REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::MergeCapacityCommitmentsRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_merge_capacity_commitments_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :post, uri_template: "/v1/{parent}/capacityCommitments:merge", body: "*", matches: [ ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] ] ) transcoder.transcode request_pb end ## # @private # # GRPC transcoding helper method for the create_assignment REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::CreateAssignmentRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_create_assignment_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :post, uri_template: "/v1/{parent}/assignments", body: "assignment", matches: [ ["parent", %r{^projects/[^/]+/locations/[^/]+/reservations/[^/]+/?$}, false] ] ) transcoder.transcode request_pb end ## # @private # # GRPC transcoding helper method for the list_assignments REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::ListAssignmentsRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_list_assignments_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :get, uri_template: "/v1/{parent}/assignments", matches: [ ["parent", %r{^projects/[^/]+/locations/[^/]+/reservations/[^/]+/?$}, false] ] ) transcoder.transcode request_pb end ## # @private # # GRPC transcoding helper method for the delete_assignment REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::DeleteAssignmentRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_delete_assignment_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :delete, uri_template: "/v1/{name}", matches: [ ["name", %r{^projects/[^/]+/locations/[^/]+/reservations/[^/]+/assignments/[^/]+/?$}, false] ] ) transcoder.transcode request_pb end ## # @private # # GRPC transcoding helper method for the search_assignments REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::SearchAssignmentsRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_search_assignments_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :get, uri_template: "/v1/{parent}:searchAssignments", matches: [ ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] ] ) transcoder.transcode request_pb end ## # @private # # GRPC transcoding helper method for the search_all_assignments REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::SearchAllAssignmentsRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_search_all_assignments_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :get, uri_template: "/v1/{parent}:searchAllAssignments", matches: [ ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] ] ) transcoder.transcode request_pb end ## # @private # # GRPC transcoding helper method for the move_assignment REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::MoveAssignmentRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_move_assignment_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :post, uri_template: "/v1/{name}:move", body: "*", matches: [ ["name", %r{^projects/[^/]+/locations/[^/]+/reservations/[^/]+/assignments/[^/]+/?$}, false] ] ) transcoder.transcode request_pb end ## # @private # # GRPC transcoding helper method for the update_assignment REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::UpdateAssignmentRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_update_assignment_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :patch, uri_template: "/v1/{assignment.name}", body: "assignment", matches: [ ["assignment.name", %r{^projects/[^/]+/locations/[^/]+/reservations/[^/]+/assignments/[^/]+/?$}, false] ] ) transcoder.transcode request_pb end ## # @private # # GRPC transcoding helper method for the get_bi_reservation REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::GetBiReservationRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_get_bi_reservation_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :get, uri_template: "/v1/{name}", matches: [ ["name", %r{^projects/[^/]+/locations/[^/]+/biReservation/?$}, false] ] ) transcoder.transcode request_pb end ## # @private # # GRPC transcoding helper method for the update_bi_reservation REST call # # @param request_pb [::Google::Cloud::Bigquery::Reservation::V1::UpdateBiReservationRequest] # A request object representing the call parameters. Required. # @return [Array(String, [String, nil], Hash{String => String})] # Uri, Body, Query string parameters def self.transcode_update_bi_reservation_request request_pb transcoder = Gapic::Rest::GrpcTranscoder.new .with_bindings( uri_method: :patch, uri_template: "/v1/{bi_reservation.name}", body: "bi_reservation", matches: [ ["bi_reservation.name", %r{^projects/[^/]+/locations/[^/]+/biReservation/?$}, false] ] ) transcoder.transcode request_pb end end end end end end end end end