lib/google/cloud/spanner.rb in google-cloud-spanner-1.9.5 vs lib/google/cloud/spanner.rb in google-cloud-spanner-1.10.0

- old
+ new

@@ -57,10 +57,12 @@ # * `https://www.googleapis.com/auth/spanner` # * `https://www.googleapis.com/auth/spanner.data` # @param [Integer] timeout Default timeout to use in requests. Optional. # @param [Hash] client_config A hash of values to override the default # behavior of the API client. Optional. + # @param [String] endpoint Override of the endpoint host name. Optional. + # If the param is nil, uses the default endpoint. # @param [String] project Alias for the `project_id` argument. Deprecated. # @param [String] keyfile Alias for the `credentials` argument. # Deprecated. # # @return [Google::Cloud::Spanner::Project] @@ -69,15 +71,16 @@ # require "google/cloud/spanner" # # spanner = Google::Cloud::Spanner.new # def self.new project_id: nil, credentials: nil, scope: nil, timeout: nil, - client_config: nil, project: nil, keyfile: nil + client_config: nil, endpoint: nil, project: nil, keyfile: nil project_id ||= (project || default_project_id) scope ||= configure.scope timeout ||= configure.timeout client_config ||= configure.client_config + endpoint ||= configure.endpoint credentials ||= (keyfile || default_credentials(scope: scope)) unless credentials.is_a? Google::Auth::Credentials credentials = Spanner::Credentials.new credentials, scope: scope end @@ -88,12 +91,12 @@ project_id = project_id.to_s # Always cast to a string raise ArgumentError, "project_id is missing" if project_id.empty? Spanner::Project.new( Spanner::Service.new( - project_id, credentials, timeout: timeout, - client_config: client_config + project_id, credentials, + host: endpoint, timeout: timeout, client_config: client_config ) ) end ## @@ -110,9 +113,11 @@ # * `scope` - (String, Array<String>) The OAuth 2.0 scopes controlling # the set of resources and operations that the connection can access. # * `timeout` - (Integer) Default timeout to use in requests. # * `client_config` - (Hash) A hash of values to override the default # behavior of the API client. + # * `endpoint` - (String) Override of the endpoint host name, or `nil` + # to use the default endpoint. # # @return [Google::Cloud::Config] The configuration object the # Google::Cloud::Spanner library uses. # def self.configure