lib/google/cloud/compute/v1/region_disks/rest/client.rb in google-cloud-compute-v1-1.1.0 vs lib/google/cloud/compute/v1/region_disks/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/region_disks/rest/service_stub" +require "google/cloud/compute/v1/region_operations/rest" module Google module Cloud module Compute module V1 @@ -151,13 +152,25 @@ credentials ||= Credentials.default scope: @config.scope if credentials.is_a?(::String) || credentials.is_a?(::Hash) credentials = Credentials.new credentials, scope: @config.scope end + @region_operations = ::Google::Cloud::Compute::V1::RegionOperations::Rest::Client.new do |config| + config.credentials = credentials + config.endpoint = @config.endpoint + end + @region_disks_stub = ::Google::Cloud::Compute::V1::RegionDisks::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials end + ## + # Get the associated client for long-running operations via RegionOperations. + # + # @return [::Google::Cloud::Compute::V1::RegionOperations::Rest::Client] + # + attr_reader :region_operations + # Service calls ## # Adds existing resource policies to a regional disk. You can only add one policy which will be applied to this disk for scheduling snapshot creation. # @@ -187,14 +200,14 @@ # @param region_disks_add_resource_policies_request_resource [::Google::Cloud::Compute::V1::RegionDisksAddResourcePoliciesRequest, ::Hash] # The body resource for this request # @param request_id [::String] # An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). # @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 add_resource_policies request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -217,11 +230,19 @@ options.apply_defaults timeout: @config.timeout, metadata: @config.metadata @region_disks_stub.add_resource_policies request, options do |result, response| - result = ::Gapic::Rest::BaseOperation.new result + result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation( + operation: result, + client: region_operations, + request_values: { + "project" => request.project, + "region" => request.region + }, + options: options + ) yield result, response if block_given? return result end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e @@ -257,14 +278,14 @@ # @param request_id [::String] # An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). # @param snapshot_resource [::Google::Cloud::Compute::V1::Snapshot, ::Hash] # The body resource 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 create_snapshot request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -287,11 +308,19 @@ options.apply_defaults timeout: @config.timeout, metadata: @config.metadata @region_disks_stub.create_snapshot request, options do |result, response| - result = ::Gapic::Rest::BaseOperation.new result + result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation( + operation: result, + client: region_operations, + request_values: { + "project" => request.project, + "region" => request.region + }, + options: options + ) yield result, response if block_given? return result end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e @@ -325,14 +354,14 @@ # @param region [::String] # Name of the region for this request. # @param request_id [::String] # An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). # @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? @@ -355,11 +384,19 @@ options.apply_defaults timeout: @config.timeout, metadata: @config.metadata @region_disks_stub.delete request, options do |result, response| - result = ::Gapic::Rest::BaseOperation.new result + result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation( + operation: result, + client: region_operations, + request_values: { + "project" => request.project, + "region" => request.region + }, + options: options + ) yield result, response if block_given? return result end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e @@ -527,14 +564,14 @@ # @param request_id [::String] # An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). # @param source_image [::String] # Source image to restore onto a disk. This field is optional. # @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? @@ -557,11 +594,19 @@ options.apply_defaults timeout: @config.timeout, metadata: @config.metadata @region_disks_stub.insert request, options do |result, response| - result = ::Gapic::Rest::BaseOperation.new result + result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation( + operation: result, + client: region_operations, + request_values: { + "project" => request.project, + "region" => request.region + }, + options: options + ) yield result, response if block_given? return result end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e @@ -671,14 +716,14 @@ # @param region_disks_remove_resource_policies_request_resource [::Google::Cloud::Compute::V1::RegionDisksRemoveResourcePoliciesRequest, ::Hash] # The body resource for this request # @param request_id [::String] # An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). # @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 remove_resource_policies request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -701,11 +746,19 @@ options.apply_defaults timeout: @config.timeout, metadata: @config.metadata @region_disks_stub.remove_resource_policies request, options do |result, response| - result = ::Gapic::Rest::BaseOperation.new result + result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation( + operation: result, + client: region_operations, + request_values: { + "project" => request.project, + "region" => request.region + }, + options: options + ) yield result, response if block_given? return result end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e @@ -741,14 +794,14 @@ # @param region_disks_resize_request_resource [::Google::Cloud::Compute::V1::RegionDisksResizeRequest, ::Hash] # The body resource for this request # @param request_id [::String] # An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). # @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? @@ -771,11 +824,19 @@ options.apply_defaults timeout: @config.timeout, metadata: @config.metadata @region_disks_stub.resize request, options do |result, response| - result = ::Gapic::Rest::BaseOperation.new result + result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation( + operation: result, + client: region_operations, + request_values: { + "project" => request.project, + "region" => request.region + }, + options: options + ) yield result, response if block_given? return result end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e @@ -878,14 +939,14 @@ # @param request_id [::String] # An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). # @param resource [::String] # Name or id of the resource 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 set_labels request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -908,10 +969,18 @@ options.apply_defaults timeout: @config.timeout, metadata: @config.metadata @region_disks_stub.set_labels request, options do |result, response| - result = ::Gapic::Rest::BaseOperation.new result + result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation( + operation: result, + client: region_operations, + request_values: { + "project" => request.project, + "region" => request.region + }, + options: options + ) yield result, response if block_given? return result end rescue ::Faraday::Error => e gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e