google-cloud-logging 1.6.6 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb805e0101e2f5b5e9f9c21e4d67c46db3e1898940a3d8df972b934a295411d8
4
- data.tar.gz: c67765781081152b9c36aa3f5e453b1cc333666e39026c408ec61b0b2acb9ae5
3
+ metadata.gz: 9844d4e41540ef97cb06a18febc80c45155d6296032a532b31e26cc00a7eeca9
4
+ data.tar.gz: 5e1b5a06346223d342873406bd87cea59d441458d88192f0000a0d4e43f006d1
5
5
  SHA512:
6
- metadata.gz: 8f660fb238f57e2df1b9271fce3e2efc4838c37885381bf7b7e39152244a8ed887c8920f577877835f2d18a14fb7f97c37177cb277c5ee14c985f72c30de0b4e
7
- data.tar.gz: 2d78590be1672eeabd60e8bb2aaf5427950f32d4fc2a990ec691e9b2876a9df8d6111485ad978886d6ceb37f9e37d49f553d018b5c23245c9453787469f0f8fd
6
+ metadata.gz: 787ed9af979f2bdb9211ce456e06d40e05b2c397dd1a0750e228ae7dd5ccc6f6a4d0b407a3afdbed2a59a80439bb8a13745f081dd1190aa9e43887c8b70992ba
7
+ data.tar.gz: f4d201182423411533d12373d21199e659221364e5753d610cf2910b13eade54a15da8843a33867b43d771bc2d3048daeae5edac18ed1f4f19f32f4c94e33d17
@@ -1,5 +1,11 @@
1
1
  # Release History
2
2
 
3
+ ### 1.7.0 / 2019-08-23
4
+
5
+ #### Features
6
+
7
+ * Support overriding of service endpoint
8
+
3
9
  ### 1.6.6 / 2019-07-31
4
10
 
5
11
  * Fix max threads setting in thread pools
@@ -149,6 +149,7 @@ Google::Cloud.configure.add_config! :logging do |config|
149
149
  config.add_field! :scope, nil, match: [String, Array]
150
150
  config.add_field! :timeout, nil, match: Integer
151
151
  config.add_field! :client_config, nil, match: Hash
152
+ config.add_field! :endpoint, nil, match: String
152
153
  config.add_field! :log_name, nil, match: String
153
154
  config.add_field! :log_name_map, nil, match: Hash
154
155
  config.add_field! :labels, nil, match: Hash
@@ -65,6 +65,8 @@ module Google
65
65
  # @param [Integer] timeout Default timeout to use in requests. Optional.
66
66
  # @param [Hash] client_config A hash of values to override the default
67
67
  # behavior of the API client. Optional.
68
+ # @param [String] endpoint Override of the endpoint host name. Optional.
69
+ # If the param is nil, uses the default endpoint.
68
70
  # @param [String] project Alias for the `project_id` argument. Deprecated.
69
71
  # @param [String] keyfile Alias for the `credentials` argument.
70
72
  # Deprecated.
@@ -82,11 +84,12 @@ module Google
82
84
  # end
83
85
  #
84
86
  def self.new project_id: nil, credentials: nil, scope: nil, timeout: nil,
85
- client_config: nil, project: nil, keyfile: nil
87
+ client_config: nil, endpoint: nil, project: nil, keyfile: nil
86
88
  project_id ||= (project || default_project_id)
87
89
  scope ||= configure.scope
88
90
  timeout ||= configure.timeout
89
91
  client_config ||= configure.client_config
92
+ endpoint ||= configure.endpoint
90
93
  credentials ||= (keyfile || default_credentials(scope: scope))
91
94
 
92
95
  unless credentials.is_a? Google::Auth::Credentials
@@ -101,8 +104,8 @@ module Google
101
104
 
102
105
  Logging::Project.new(
103
106
  Logging::Service.new(
104
- project_id, credentials, timeout: timeout,
105
- client_config: client_config
107
+ project_id, credentials,
108
+ host: endpoint, timeout: timeout, client_config: client_config
106
109
  )
107
110
  )
108
111
  end
@@ -126,6 +129,8 @@ module Google
126
129
  # * `timeout` - (Integer) Default timeout to use in requests.
127
130
  # * `client_config` - (Hash) A hash of values to override the default
128
131
  # behavior of the API client.
132
+ # * `endpoint` - (String) Override of the endpoint host name, or `nil`
133
+ # to use the default endpoint.
129
134
  # * `log_name` - (String) Name of the application log file. Default:
130
135
  # `"ruby_app_log"`
131
136
  # * `log_name_map` - (Hash) Map specific request routes to other log.
@@ -17,6 +17,7 @@ require "google/cloud/errors"
17
17
  require "google/cloud/logging/version"
18
18
  require "google/cloud/logging/v2"
19
19
  require "google/gax/errors"
20
+ require "uri"
20
21
 
21
22
  module Google
22
23
  module Cloud
@@ -25,26 +26,30 @@ module Google
25
26
  # @private Represents the gRPC Logging service, including all the API
26
27
  # methods.
27
28
  class Service
28
- attr_accessor :project, :credentials, :timeout, :client_config
29
+ attr_accessor :project, :credentials, :timeout, :client_config, :host
29
30
 
30
31
  ##
31
32
  # Creates a new Service instance.
32
- def initialize project, credentials, timeout: nil, client_config: nil
33
+ def initialize project, credentials, timeout: nil, client_config: nil,
34
+ host: nil
33
35
  @project = project
34
36
  @credentials = credentials
35
37
  @timeout = timeout
36
38
  @client_config = client_config || {}
39
+ @host = host || V2::LoggingServiceV2Client::SERVICE_ADDRESS
37
40
  end
38
41
 
39
42
  def logging
40
43
  return mocked_logging if mocked_logging
41
44
  @logging ||= \
42
45
  V2::LoggingServiceV2Client.new(
43
- credentials: credentials,
44
- timeout: timeout,
45
- client_config: client_config,
46
- lib_name: "gccl",
47
- lib_version: Google::Cloud::Logging::VERSION
46
+ credentials: credentials,
47
+ timeout: timeout,
48
+ client_config: client_config,
49
+ service_address: service_address,
50
+ service_port: service_port,
51
+ lib_name: "gccl",
52
+ lib_version: Google::Cloud::Logging::VERSION
48
53
  )
49
54
  end
50
55
  attr_accessor :mocked_logging
@@ -53,11 +58,13 @@ module Google
53
58
  return mocked_sinks if mocked_sinks
54
59
  @sinks ||= \
55
60
  V2::ConfigServiceV2Client.new(
56
- credentials: credentials,
57
- timeout: timeout,
58
- client_config: client_config,
59
- lib_name: "gccl",
60
- lib_version: Google::Cloud::Logging::VERSION
61
+ credentials: credentials,
62
+ timeout: timeout,
63
+ client_config: client_config,
64
+ service_address: service_address,
65
+ service_port: service_port,
66
+ lib_name: "gccl",
67
+ lib_version: Google::Cloud::Logging::VERSION
61
68
  )
62
69
  end
63
70
  attr_accessor :mocked_sinks
@@ -66,11 +73,13 @@ module Google
66
73
  return mocked_metrics if mocked_metrics
67
74
  @metrics ||= \
68
75
  V2::MetricsServiceV2Client.new(
69
- credentials: credentials,
70
- timeout: timeout,
71
- client_config: client_config,
72
- lib_name: "gccl",
73
- lib_version: Google::Cloud::Logging::VERSION
76
+ credentials: credentials,
77
+ timeout: timeout,
78
+ client_config: client_config,
79
+ service_address: service_address,
80
+ service_port: service_port,
81
+ lib_name: "gccl",
82
+ lib_version: Google::Cloud::Logging::VERSION
74
83
  )
75
84
  end
76
85
  attr_accessor :mocked_metrics
@@ -271,6 +280,16 @@ module Google
271
280
 
272
281
  protected
273
282
 
283
+ def service_address
284
+ return nil if host.nil?
285
+ URI.parse("//#{host}").host
286
+ end
287
+
288
+ def service_port
289
+ return nil if host.nil?
290
+ URI.parse("//#{host}").port
291
+ end
292
+
274
293
  def project_path
275
294
  "projects/#{@project}"
276
295
  end
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Logging
19
- VERSION = "1.6.6".freeze
19
+ VERSION = "1.7.0".freeze
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.6
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-08-01 00:00:00.000000000 Z
12
+ date: 2019-08-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core