lib/google/cloud/compute/v1/network_endpoint_groups/rest/client.rb in google-cloud-compute-v1-1.1.0 vs lib/google/cloud/compute/v1/network_endpoint_groups/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/network_endpoint_groups/rest/service_stub" +require "google/cloud/compute/v1/zone_operations/rest" module Google module Cloud module Compute module V1 @@ -145,13 +146,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 + @network_endpoint_groups_stub = ::Google::Cloud::Compute::V1::NetworkEndpointGroups::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 the list of network endpoint groups and sorts them by zone. # @@ -255,14 +268,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 zone [::String] # The name of the zone where the network endpoint group is located. It should comply with RFC1035. # @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 attach_network_endpoints request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -285,11 +298,19 @@ options.apply_defaults timeout: @config.timeout, metadata: @config.metadata @network_endpoint_groups_stub.attach_network_endpoints 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 @@ -323,14 +344,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 zone [::String] # The name of the zone where the network endpoint group is located. It should comply with RFC1035. # @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? @@ -353,11 +374,19 @@ options.apply_defaults timeout: @config.timeout, metadata: @config.metadata @network_endpoint_groups_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 @@ -393,14 +422,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 zone [::String] # The name of the zone where the network endpoint group is located. It should comply with RFC1035. # @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 detach_network_endpoints request, options = nil raise ::ArgumentError, "request must be provided" if request.nil? @@ -423,11 +452,19 @@ options.apply_defaults timeout: @config.timeout, metadata: @config.metadata @network_endpoint_groups_stub.detach_network_endpoints 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 @@ -526,14 +563,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 zone [::String] # The name of the zone where you want to create the network endpoint group. It should comply with RFC1035. # @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? @@ -556,10 +593,18 @@ options.apply_defaults timeout: @config.timeout, metadata: @config.metadata @network_endpoint_groups_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