lib/google/cloud/compute/v1/global_addresses/rest/client.rb in google-cloud-compute-v1-1.6.0 vs lib/google/cloud/compute/v1/global_addresses/rest/client.rb in google-cloud-compute-v1-1.7.0
- old
+ new
@@ -77,10 +77,12 @@
default_config.rpcs.list.timeout = 600.0
default_config.rpcs.list.retry_policy = {
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
}
+ default_config.rpcs.set_labels.timeout = 600.0
+
default_config
end
yield @configure if block_given?
@configure
end
@@ -432,10 +434,83 @@
gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
raise ::Google::Cloud::Error.from_error(gapic_error)
end
##
+ # Sets the labels on a GlobalAddress. To learn more about labels, read the Labeling Resources documentation.
+ #
+ # @overload set_labels(request, options = nil)
+ # Pass arguments to `set_labels` via a request object, either of type
+ # {::Google::Cloud::Compute::V1::SetLabelsGlobalAddressRequest} or an equivalent Hash.
+ #
+ # @param request [::Google::Cloud::Compute::V1::SetLabelsGlobalAddressRequest, ::Hash]
+ # A request object representing the call parameters. Required. To specify no
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
+ # @param options [::Gapic::CallOptions, ::Hash]
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
+ # Note: currently retry functionality is not implemented. While it is possible
+ # to set it using ::Gapic::CallOptions, it will not be applied
+ #
+ # @overload set_labels(global_set_labels_request_resource: nil, project: nil, resource: nil)
+ # Pass arguments to `set_labels` via keyword arguments. Note that at
+ # least one keyword argument is required. To specify no parameters, or to keep all
+ # the default parameter values, pass an empty Hash as a request object (see above).
+ #
+ # @param global_set_labels_request_resource [::Google::Cloud::Compute::V1::GlobalSetLabelsRequest, ::Hash]
+ # The body resource for this request
+ # @param project [::String]
+ # Project ID for this request.
+ # @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::GenericLRO::Operation]
+ # @yieldparam response [::Faraday::Response]
+ #
+ # @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?
+
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetLabelsGlobalAddressRequest
+
+ # Converts hash and nil to an options object
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
+
+ # Customize the options with defaults
+ call_metadata = @config.rpcs.set_labels.metadata.to_h
+
+ # Set x-goog-api-client header
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
+ gapic_version: ::Google::Cloud::Compute::V1::VERSION,
+ transports_version_send: [:rest]
+
+ options.apply_defaults timeout: @config.rpcs.set_labels.timeout,
+ metadata: call_metadata
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata
+
+ @global_addresses_stub.set_labels request, options do |result, response|
+ result = ::Google::Cloud::Compute::V1::GlobalOperations::Rest::NonstandardLro.create_operation(
+ operation: result,
+ client: global_operations,
+ request_values: {
+ "project" => request.project
+ },
+ options: options
+ )
+ yield result, response if block_given?
+ return result
+ end
+ rescue ::Faraday::Error => e
+ gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e
+ raise ::Google::Cloud::Error.from_error(gapic_error)
+ end
+
+ ##
# Configuration class for the GlobalAddresses REST API.
#
# This class represents the configuration for GlobalAddresses REST,
# providing control over credentials, timeouts, retry behavior, logging.
#
@@ -550,10 +625,15 @@
##
# RPC-specific configuration for `list`
# @return [::Gapic::Config::Method]
#
attr_reader :list
+ ##
+ # RPC-specific configuration for `set_labels`
+ # @return [::Gapic::Config::Method]
+ #
+ attr_reader :set_labels
# @private
def initialize parent_rpcs = nil
delete_config = parent_rpcs.delete if parent_rpcs.respond_to? :delete
@delete = ::Gapic::Config::Method.new delete_config
@@ -561,9 +641,11 @@
@get = ::Gapic::Config::Method.new get_config
insert_config = parent_rpcs.insert if parent_rpcs.respond_to? :insert
@insert = ::Gapic::Config::Method.new insert_config
list_config = parent_rpcs.list if parent_rpcs.respond_to? :list
@list = ::Gapic::Config::Method.new list_config
+ set_labels_config = parent_rpcs.set_labels if parent_rpcs.respond_to? :set_labels
+ @set_labels = ::Gapic::Config::Method.new set_labels_config
yield self if block_given?
end
end
end