lib/google/cloud/compute/v1/reservations/rest/client.rb in google-cloud-compute-v1-1.1.0 vs lib/google/cloud/compute/v1/reservations/rest/client.rb in google-cloud-compute-v1-1.2.0

- old
+ new

@@ -17,10 +17,11 @@ # Auto-generated by gapic-generator-ruby. DO NOT EDIT! require "google/cloud/errors" require "google/cloud/compute/v1/compute_pb" require "google/cloud/compute/v1/reservations/rest/service_stub" +require "google/cloud/compute/v1/zone_operations/rest" module Google module Cloud module Compute module V1 @@ -150,13 +151,25 @@ credentials ||= Credentials.default scope: @config.scope if credentials.is_a?(::String) || credentials.is_a?(::Hash) credentials = Credentials.new credentials, scope: @config.scope end + @zone_operations = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::Client.new do |config| + config.credentials = credentials + config.endpoint = @config.endpoint + end + @reservations_stub = ::Google::Cloud::Compute::V1::Reservations::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials end + ## + # Get the associated client for long-running operations via ZoneOperations. + # + # @return [::Google::Cloud::Compute::V1::ZoneOperations::Rest::Client] + # + attr_reader :zone_operations + # Service calls ## # Retrieves an aggregated list of reservations. # @@ -258,14 +271,14 @@ # @param reservation [::String] # Name of the reservation to delete. # @param zone [::String] # Name of the zone for this request. # @yield [result, response] Access the result along with the Faraday response object - # @yieldparam result [::Gapic::Rest::BaseOperation] + # @yieldparam result [::Gapic::GenericLRO::Operation] # @yieldparam response [::Faraday::Response] # - # @return [::Gapic::Rest::BaseOperation] + # @return [::Gapic::GenericLRO::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def delete request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -288,11 +301,19 @@ options.apply_defaults timeout: @config.timeout, metadata: @config.metadata @reservations_stub.delete request, options do |result, response| - result = ::Gapic::Rest::BaseOperation.new result + result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( + operation: result, + client: zone_operations, + request_values: { + "project" => request.project, + "zone" => request.zone + }, + options: options + ) yield result, response if block_given? return result end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e @@ -458,14 +479,14 @@ # @param reservation_resource [::Google::Cloud::Compute::V1::Reservation, ::Hash] # The body resource for this request # @param zone [::String] # Name of the zone for this request. # @yield [result, response] Access the result along with the Faraday response object - # @yieldparam result [::Gapic::Rest::BaseOperation] + # @yieldparam result [::Gapic::GenericLRO::Operation] # @yieldparam response [::Faraday::Response] # - # @return [::Gapic::Rest::BaseOperation] + # @return [::Gapic::GenericLRO::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def insert request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -488,11 +509,19 @@ options.apply_defaults timeout: @config.timeout, metadata: @config.metadata @reservations_stub.insert request, options do |result, response| - result = ::Gapic::Rest::BaseOperation.new result + result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( + operation: result, + client: zone_operations, + request_values: { + "project" => request.project, + "zone" => request.zone + }, + options: options + ) yield result, response if block_given? return result end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e @@ -602,14 +631,14 @@ # @param reservations_resize_request_resource [::Google::Cloud::Compute::V1::ReservationsResizeRequest, ::Hash] # The body resource for this request # @param zone [::String] # Name of the zone for this request. # @yield [result, response] Access the result along with the Faraday response object - # @yieldparam result [::Gapic::Rest::BaseOperation] + # @yieldparam result [::Gapic::GenericLRO::Operation] # @yieldparam response [::Faraday::Response] # - # @return [::Gapic::Rest::BaseOperation] + # @return [::Gapic::GenericLRO::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def resize request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -632,11 +661,19 @@ options.apply_defaults timeout: @config.timeout, metadata: @config.metadata @reservations_stub.resize request, options do |result, response| - result = ::Gapic::Rest::BaseOperation.new result + result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( + operation: result, + client: zone_operations, + request_values: { + "project" => request.project, + "zone" => request.zone + }, + options: options + ) yield result, response if block_given? return result end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e @@ -809,14 +846,14 @@ # @param update_mask [::String] # Update_mask indicates fields to be updated as part of this request. # @param zone [::String] # Name of the zone for this request. # @yield [result, response] Access the result along with the Faraday response object - # @yieldparam result [::Gapic::Rest::BaseOperation] + # @yieldparam result [::Gapic::GenericLRO::Operation] # @yieldparam response [::Faraday::Response] # - # @return [::Gapic::Rest::BaseOperation] + # @return [::Gapic::GenericLRO::Operation] # # @raise [::Google::Cloud::Error] if the REST call is aborted. def update request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -839,10 +876,18 @@ options.apply_defaults timeout: @config.timeout, metadata: @config.metadata @reservations_stub.update request, options do |result, response| - result = ::Gapic::Rest::BaseOperation.new result + result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation( + operation: result, + client: zone_operations, + request_values: { + "project" => request.project, + "zone" => request.zone + }, + options: options + ) yield result, response if block_given? return result end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e