lib/google/cloud/compute/v1/network_endpoint_groups/rest/client.rb in google-cloud-compute-v1-1.8.0 vs lib/google/cloud/compute/v1/network_endpoint_groups/rest/client.rb in google-cloud-compute-v1-1.9.0
- old
+ new
@@ -141,17 +141,26 @@
# Yield the configuration if needed
yield @config if block_given?
# Create credentials
credentials = @config.credentials
- credentials ||= Credentials.default scope: @config.scope
+ # Use self-signed JWT if the endpoint is unchanged from default,
+ # but only if the default endpoint does not have a region prefix.
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
+ !@config.endpoint.split(".").first.include?("-")
+ credentials ||= Credentials.default scope: @config.scope,
+ enable_self_signed_jwt: enable_self_signed_jwt
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
credentials = Credentials.new credentials, scope: @config.scope
end
+ @quota_project_id = @config.quota_project
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
+
@zone_operations = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::Client.new do |config|
config.credentials = credentials
+ config.quota_project = @quota_project_id
config.endpoint = @config.endpoint
end
@network_endpoint_groups_stub = ::Google::Cloud::Compute::V1::NetworkEndpointGroups::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
end
@@ -175,12 +184,10 @@
# @param request [::Google::Cloud::Compute::V1::AggregatedListNetworkEndpointGroupsRequest, ::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 aggregated_list(filter: nil, include_all_scopes: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil)
# Pass arguments to `aggregated_list` 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).
@@ -215,33 +222,33 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.aggregated_list.metadata.to_h
- # Set x-goog-api-client header
+ # Set x-goog-api-client and x-goog-user-project headers
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]
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
+
options.apply_defaults timeout: @config.rpcs.aggregated_list.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.aggregated_list.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@network_endpoint_groups_stub.aggregated_list request, options do |result, response|
result = ::Gapic::Rest::PagedEnumerable.new @network_endpoint_groups_stub, :aggregated_list, "items", request, result, options
yield result, response if block_given?
return result
end
- rescue ::Faraday::Error => e
- begin
- raise ::Gapic::Rest::Error.wrap_faraday_error e
- rescue ::Gapic::Rest::Error => gapic_error
- raise ::Google::Cloud::Error.from_error gapic_error
- end
+ rescue ::Gapic::Rest::Error => e
+ raise ::Google::Cloud::Error.from_error(e)
end
##
# Attach a list of network endpoints to the specified network endpoint group.
#
@@ -252,12 +259,10 @@
# @param request [::Google::Cloud::Compute::V1::AttachNetworkEndpointsNetworkEndpointGroupRequest, ::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 attach_network_endpoints(network_endpoint_group: nil, network_endpoint_groups_attach_endpoints_request_resource: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `attach_network_endpoints` 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).
@@ -288,21 +293,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.attach_network_endpoints.metadata.to_h
- # Set x-goog-api-client header
+ # Set x-goog-api-client and x-goog-user-project headers
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]
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
+
options.apply_defaults timeout: @config.rpcs.attach_network_endpoints.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.attach_network_endpoints.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@network_endpoint_groups_stub.attach_network_endpoints request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -313,16 +322,12 @@
options: options
)
yield result, response if block_given?
return result
end
- rescue ::Faraday::Error => e
- begin
- raise ::Gapic::Rest::Error.wrap_faraday_error e
- rescue ::Gapic::Rest::Error => gapic_error
- raise ::Google::Cloud::Error.from_error gapic_error
- end
+ rescue ::Gapic::Rest::Error => e
+ raise ::Google::Cloud::Error.from_error(e)
end
##
# Deletes the specified network endpoint group. The network endpoints in the NEG and the VM instances they belong to are not terminated when the NEG is deleted. Note that the NEG cannot be deleted if there are backend services referencing it.
#
@@ -333,12 +338,10 @@
# @param request [::Google::Cloud::Compute::V1::DeleteNetworkEndpointGroupRequest, ::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 delete(network_endpoint_group: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `delete` 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).
@@ -367,21 +370,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.delete.metadata.to_h
- # Set x-goog-api-client header
+ # Set x-goog-api-client and x-goog-user-project headers
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]
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
+
options.apply_defaults timeout: @config.rpcs.delete.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.delete.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@network_endpoint_groups_stub.delete request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -392,16 +399,12 @@
options: options
)
yield result, response if block_given?
return result
end
- rescue ::Faraday::Error => e
- begin
- raise ::Gapic::Rest::Error.wrap_faraday_error e
- rescue ::Gapic::Rest::Error => gapic_error
- raise ::Google::Cloud::Error.from_error gapic_error
- end
+ rescue ::Gapic::Rest::Error => e
+ raise ::Google::Cloud::Error.from_error(e)
end
##
# Detach a list of network endpoints from the specified network endpoint group.
#
@@ -412,12 +415,10 @@
# @param request [::Google::Cloud::Compute::V1::DetachNetworkEndpointsNetworkEndpointGroupRequest, ::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 detach_network_endpoints(network_endpoint_group: nil, network_endpoint_groups_detach_endpoints_request_resource: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `detach_network_endpoints` 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).
@@ -448,21 +449,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.detach_network_endpoints.metadata.to_h
- # Set x-goog-api-client header
+ # Set x-goog-api-client and x-goog-user-project headers
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]
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
+
options.apply_defaults timeout: @config.rpcs.detach_network_endpoints.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.detach_network_endpoints.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@network_endpoint_groups_stub.detach_network_endpoints request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -473,16 +478,12 @@
options: options
)
yield result, response if block_given?
return result
end
- rescue ::Faraday::Error => e
- begin
- raise ::Gapic::Rest::Error.wrap_faraday_error e
- rescue ::Gapic::Rest::Error => gapic_error
- raise ::Google::Cloud::Error.from_error gapic_error
- end
+ rescue ::Gapic::Rest::Error => e
+ raise ::Google::Cloud::Error.from_error(e)
end
##
# Returns the specified network endpoint group. Gets a list of available network endpoint groups by making a list() request.
#
@@ -493,12 +494,10 @@
# @param request [::Google::Cloud::Compute::V1::GetNetworkEndpointGroupRequest, ::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 get(network_endpoint_group: nil, project: nil, zone: nil)
# Pass arguments to `get` 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).
@@ -525,32 +524,32 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.get.metadata.to_h
- # Set x-goog-api-client header
+ # Set x-goog-api-client and x-goog-user-project headers
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]
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
+
options.apply_defaults timeout: @config.rpcs.get.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.get.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@network_endpoint_groups_stub.get request, options do |result, response|
yield result, response if block_given?
return result
end
- rescue ::Faraday::Error => e
- begin
- raise ::Gapic::Rest::Error.wrap_faraday_error e
- rescue ::Gapic::Rest::Error => gapic_error
- raise ::Google::Cloud::Error.from_error gapic_error
- end
+ rescue ::Gapic::Rest::Error => e
+ raise ::Google::Cloud::Error.from_error(e)
end
##
# Creates a network endpoint group in the specified project using the parameters that are included in the request.
#
@@ -561,12 +560,10 @@
# @param request [::Google::Cloud::Compute::V1::InsertNetworkEndpointGroupRequest, ::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 insert(network_endpoint_group_resource: nil, project: nil, request_id: nil, zone: nil)
# Pass arguments to `insert` 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).
@@ -595,21 +592,25 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.insert.metadata.to_h
- # Set x-goog-api-client header
+ # Set x-goog-api-client and x-goog-user-project headers
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]
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
+
options.apply_defaults timeout: @config.rpcs.insert.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.insert.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@network_endpoint_groups_stub.insert request, options do |result, response|
result = ::Google::Cloud::Compute::V1::ZoneOperations::Rest::NonstandardLro.create_operation(
operation: result,
client: zone_operations,
@@ -620,16 +621,12 @@
options: options
)
yield result, response if block_given?
return result
end
- rescue ::Faraday::Error => e
- begin
- raise ::Gapic::Rest::Error.wrap_faraday_error e
- rescue ::Gapic::Rest::Error => gapic_error
- raise ::Google::Cloud::Error.from_error gapic_error
- end
+ rescue ::Gapic::Rest::Error => e
+ raise ::Google::Cloud::Error.from_error(e)
end
##
# Retrieves the list of network endpoint groups that are located in the specified project and zone.
#
@@ -640,12 +637,10 @@
# @param request [::Google::Cloud::Compute::V1::ListNetworkEndpointGroupsRequest, ::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 list(filter: nil, max_results: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, zone: nil)
# Pass arguments to `list` 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).
@@ -680,33 +675,33 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.list.metadata.to_h
- # Set x-goog-api-client header
+ # Set x-goog-api-client and x-goog-user-project headers
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]
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
+
options.apply_defaults timeout: @config.rpcs.list.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.list.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@network_endpoint_groups_stub.list request, options do |result, response|
result = ::Gapic::Rest::PagedEnumerable.new @network_endpoint_groups_stub, :list, "items", request, result, options
yield result, response if block_given?
return result
end
- rescue ::Faraday::Error => e
- begin
- raise ::Gapic::Rest::Error.wrap_faraday_error e
- rescue ::Gapic::Rest::Error => gapic_error
- raise ::Google::Cloud::Error.from_error gapic_error
- end
+ rescue ::Gapic::Rest::Error => e
+ raise ::Google::Cloud::Error.from_error(e)
end
##
# Lists the network endpoints in the specified network endpoint group.
#
@@ -717,12 +712,10 @@
# @param request [::Google::Cloud::Compute::V1::ListNetworkEndpointsNetworkEndpointGroupsRequest, ::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 list_network_endpoints(filter: nil, max_results: nil, network_endpoint_group: nil, network_endpoint_groups_list_endpoints_request_resource: nil, order_by: nil, page_token: nil, project: nil, return_partial_success: nil, zone: nil)
# Pass arguments to `list_network_endpoints` 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).
@@ -761,33 +754,33 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.list_network_endpoints.metadata.to_h
- # Set x-goog-api-client header
+ # Set x-goog-api-client and x-goog-user-project headers
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]
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
+
options.apply_defaults timeout: @config.rpcs.list_network_endpoints.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.list_network_endpoints.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@network_endpoint_groups_stub.list_network_endpoints request, options do |result, response|
result = ::Gapic::Rest::PagedEnumerable.new @network_endpoint_groups_stub, :list_network_endpoints, "items", request, result, options
yield result, response if block_given?
return result
end
- rescue ::Faraday::Error => e
- begin
- raise ::Gapic::Rest::Error.wrap_faraday_error e
- rescue ::Gapic::Rest::Error => gapic_error
- raise ::Google::Cloud::Error.from_error gapic_error
- end
+ rescue ::Gapic::Rest::Error => e
+ raise ::Google::Cloud::Error.from_error(e)
end
##
# Returns permissions that a caller has on the specified resource.
#
@@ -798,12 +791,10 @@
# @param request [::Google::Cloud::Compute::V1::TestIamPermissionsNetworkEndpointGroupRequest, ::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 test_iam_permissions(project: nil, resource: nil, test_permissions_request_resource: nil, zone: nil)
# Pass arguments to `test_iam_permissions` 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).
@@ -832,57 +823,63 @@
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
# Customize the options with defaults
call_metadata = @config.rpcs.test_iam_permissions.metadata.to_h
- # Set x-goog-api-client header
+ # Set x-goog-api-client and x-goog-user-project headers
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]
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
+
options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
- metadata: call_metadata
+ metadata: call_metadata,
+ retry_policy: @config.rpcs.test_iam_permissions.retry_policy
options.apply_defaults timeout: @config.timeout,
- metadata: @config.metadata
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
@network_endpoint_groups_stub.test_iam_permissions request, options do |result, response|
yield result, response if block_given?
return result
end
- rescue ::Faraday::Error => e
- begin
- raise ::Gapic::Rest::Error.wrap_faraday_error e
- rescue ::Gapic::Rest::Error => gapic_error
- raise ::Google::Cloud::Error.from_error gapic_error
- end
+ rescue ::Gapic::Rest::Error => e
+ raise ::Google::Cloud::Error.from_error(e)
end
##
# Configuration class for the NetworkEndpointGroups REST API.
#
# This class represents the configuration for NetworkEndpointGroups REST,
- # providing control over credentials, timeouts, retry behavior, logging.
+ # providing control over timeouts, retry behavior, logging, transport
+ # parameters, and other low-level controls. Certain parameters can also be
+ # applied individually to specific RPCs. See
+ # {::Google::Cloud::Compute::V1::NetworkEndpointGroups::Rest::Client::Configuration::Rpcs}
+ # for a list of RPCs that can be configured independently.
#
# Configuration can be applied globally to all clients, or to a single client
# on construction.
#
- # # Examples
+ # @example
#
- # To modify the global config, setting the timeout for all calls to 10 seconds:
+ # # Modify the global config, setting the timeout for
+ # # aggregated_list to 20 seconds,
+ # # and all remaining timeouts to 10 seconds.
+ # ::Google::Cloud::Compute::V1::NetworkEndpointGroups::Rest::Client.configure do |config|
+ # config.timeout = 10.0
+ # config.rpcs.aggregated_list.timeout = 20.0
+ # end
#
- # ::Google::Cloud::Compute::V1::NetworkEndpointGroups::Client.configure do |config|
- # config.timeout = 10.0
- # end
+ # # Apply the above configuration only to a new client.
+ # client = ::Google::Cloud::Compute::V1::NetworkEndpointGroups::Rest::Client.new do |config|
+ # config.timeout = 10.0
+ # config.rpcs.aggregated_list.timeout = 20.0
+ # end
#
- # To apply the above configuration only to a new client:
- #
- # client = ::Google::Cloud::Compute::V1::NetworkEndpointGroups::Client.new do |config|
- # config.timeout = 10.0
- # end
- #
# @!attribute [rw] endpoint
# The hostname or hostname:port of the service endpoint.
# Defaults to `"compute.googleapis.com"`.
# @return [::String]
# @!attribute [rw] credentials
@@ -906,12 +903,23 @@
# @return [::String]
# @!attribute [rw] timeout
# The call timeout in seconds.
# @return [::Numeric]
# @!attribute [rw] metadata
- # Additional REST headers to be sent with the call.
+ # Additional headers to be sent with the call.
# @return [::Hash{::Symbol=>::String}]
+ # @!attribute [rw] retry_policy
+ # The retry policy. The value is a hash with the following keys:
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
+ # trigger a retry.
+ # @return [::Hash]
+ # @!attribute [rw] quota_project
+ # A separate project against which to charge quota.
+ # @return [::String]
#
class Configuration
extend ::Gapic::Config
config_attr :endpoint, "compute.googleapis.com", ::String
@@ -922,10 +930,12 @@
config_attr :scope, nil, ::String, ::Array, nil
config_attr :lib_name, nil, ::String, nil
config_attr :lib_version, nil, ::String, nil
config_attr :timeout, nil, ::Numeric, nil
config_attr :metadata, nil, ::Hash, nil
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
+ config_attr :quota_project, nil, ::String, nil
# @private
def initialize parent_config = nil
@parent_config = parent_config unless parent_config.nil?
@@ -950,12 +960,17 @@
# Includes fields providing the configuration for each RPC in this service.
# Each configuration object is of type `Gapic::Config::Method` and includes
# the following configuration fields:
#
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
- #
- # there is one other field (`retry_policy`) that can be set
- # but is currently not supported for REST Gapic libraries.
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
+ # include the following keys:
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
+ # trigger a retry.
#
class Rpcs
##
# RPC-specific configuration for `aggregated_list`
# @return [::Gapic::Config::Method]