lib/google/cloud/compute/v1/subnetworks/rest/client.rb in google-cloud-compute-v1-1.1.0 vs lib/google/cloud/compute/v1/subnetworks/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/subnetworks/rest/service_stub"
+require "google/cloud/compute/v1/region_operations/rest"
module Google
module Cloud
module Compute
module V1
@@ -157,13 +158,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
+
@subnetworks_stub = ::Google::Cloud::Compute::V1::Subnetworks::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
##
# Retrieves an aggregated list of subnetworks.
#
@@ -265,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 subnetwork [::String]
# Name of the Subnetwork resource to delete.
# @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?
@@ -295,11 +308,19 @@
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata
@subnetworks_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
@@ -335,14 +356,14 @@
# @param subnetwork [::String]
# Name of the Subnetwork resource to update.
# @param subnetworks_expand_ip_cidr_range_request_resource [::Google::Cloud::Compute::V1::SubnetworksExpandIpCidrRangeRequest, ::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 expand_ip_cidr_range request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
@@ -365,11 +386,19 @@
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata
@subnetworks_stub.expand_ip_cidr_range 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
@@ -535,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 subnetwork_resource [::Google::Cloud::Compute::V1::Subnetwork, ::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 insert request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
@@ -565,11 +594,19 @@
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata
@subnetworks_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
@@ -753,14 +790,14 @@
# @param subnetwork [::String]
# Name of the Subnetwork resource to patch.
# @param subnetwork_resource [::Google::Cloud::Compute::V1::Subnetwork, ::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 patch request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
@@ -783,11 +820,19 @@
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata
@subnetworks_stub.patch 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
@@ -890,14 +935,14 @@
# @param subnetwork [::String]
# Name of the Subnetwork resource.
# @param subnetworks_set_private_ip_google_access_request_resource [::Google::Cloud::Compute::V1::SubnetworksSetPrivateIpGoogleAccessRequest, ::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 set_private_ip_google_access request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?
@@ -920,10 +965,18 @@
options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata
@subnetworks_stub.set_private_ip_google_access 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