lib/google/cloud/logging.rb in google-cloud-logging-1.6.6 vs lib/google/cloud/logging.rb in google-cloud-logging-1.7.0
- old
+ new
@@ -63,10 +63,12 @@
# * `https://www.googleapis.com/auth/logging.admin`
#
# @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::Logging::Project]
@@ -80,15 +82,16 @@
# entries.each do |e|
# puts "[#{e.timestamp}] #{e.log_name} #{e.payload.inspect}"
# end
#
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 = Logging::Credentials.new credentials, scope: scope
end
@@ -99,12 +102,12 @@
project_id = project_id.to_s # Always cast to a string
raise ArgumentError, "project_id is missing" if project_id.empty?
Logging::Project.new(
Logging::Service.new(
- project_id, credentials, timeout: timeout,
- client_config: client_config
+ project_id, credentials,
+ host: endpoint, timeout: timeout, client_config: client_config
)
)
end
##
@@ -124,9 +127,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.
# * `log_name` - (String) Name of the application log file. Default:
# `"ruby_app_log"`
# * `log_name_map` - (Hash) Map specific request routes to other log.
# Default: `{ "/_ah/health" => "ruby_health_check_log" }`
# * `monitored_resource.type` (String) Resource type name. See [full