lib/google/cloud/dataproc/v1/cluster_controller/rest/client.rb in google-cloud-dataproc-v1-0.22.0 vs lib/google/cloud/dataproc/v1/cluster_controller/rest/client.rb in google-cloud-dataproc-v1-0.23.0
- old
+ new
@@ -32,10 +32,13 @@
#
# The ClusterControllerService provides methods to manage clusters
# of Compute Engine instances.
#
class Client
+ # @private
+ DEFAULT_ENDPOINT_TEMPLATE = "dataproc.$UNIVERSE_DOMAIN$"
+
include Paths
# @private
attr_reader :cluster_controller_stub
@@ -123,10 +126,19 @@
yield @config if block_given?
@config
end
##
+ # The effective universe domain
+ #
+ # @return [String]
+ #
+ def universe_domain
+ @cluster_controller_stub.universe_domain
+ end
+
+ ##
# Create a new ClusterController REST client object.
#
# @example
#
# # Create a client using the default configuration
@@ -149,12 +161,13 @@
# Create credentials
credentials = @config.credentials
# 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 == Configuration::DEFAULT_ENDPOINT &&
- !@config.endpoint.split(".").first.include?("-")
+ enable_self_signed_jwt = @config.endpoint.nil? ||
+ (@config.endpoint == Configuration::DEFAULT_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
@@ -164,20 +177,27 @@
@operations_client = ::Google::Cloud::Dataproc::V1::ClusterController::Rest::Operations.new do |config|
config.credentials = credentials
config.quota_project = @quota_project_id
config.endpoint = @config.endpoint
+ config.universe_domain = @config.universe_domain
end
@iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
config.credentials = credentials
config.quota_project = @quota_project_id
config.endpoint = @config.endpoint
+ config.universe_domain = @config.universe_domain
config.bindings_override = @config.bindings_override
end
- @cluster_controller_stub = ::Google::Cloud::Dataproc::V1::ClusterController::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
+ @cluster_controller_stub = ::Google::Cloud::Dataproc::V1::ClusterController::Rest::ServiceStub.new(
+ endpoint: @config.endpoint,
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
+ universe_domain: @config.universe_domain,
+ credentials: credentials
+ )
end
##
# Get the associated client for long-running operations.
#
@@ -1129,13 +1149,13 @@
# config.timeout = 10.0
# config.rpcs.create_cluster.timeout = 20.0
# end
#
# @!attribute [rw] endpoint
- # The hostname or hostname:port of the service endpoint.
- # Defaults to `"dataproc.googleapis.com"`.
- # @return [::String]
+ # A custom service endpoint, as a hostname or hostname:port. The default is
+ # nil, indicating to use the default endpoint in the current universe domain.
+ # @return [::String,nil]
# @!attribute [rw] credentials
# Credentials to send with calls. You may provide any of the following types:
# * (`String`) The path to a service account key file in JSON format
# * (`Hash`) A service account key as a Hash
# * (`Google::Auth::Credentials`) A googleauth credentials object
@@ -1168,17 +1188,24 @@
# trigger a retry.
# @return [::Hash]
# @!attribute [rw] quota_project
# A separate project against which to charge quota.
# @return [::String]
+ # @!attribute [rw] universe_domain
+ # The universe domain within which to make requests. This determines the
+ # default endpoint URL. The default value of nil uses the environment
+ # universe (usually the default "googleapis.com" universe).
+ # @return [::String,nil]
#
class Configuration
extend ::Gapic::Config
+ # @private
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
DEFAULT_ENDPOINT = "dataproc.googleapis.com"
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
+ config_attr :endpoint, nil, ::String, nil
config_attr :credentials, nil do |value|
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
allowed.any? { |klass| klass === value }
end
config_attr :scope, nil, ::String, ::Array, nil
@@ -1186,9 +1213,10 @@
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
+ config_attr :universe_domain, nil, ::String, nil
# @private
# Overrides for http bindings for the RPCs of this service
# are only used when this service is used as mixin, and only
# by the host service.