fluent-plugin-http 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fluent/plugin/out_http.rb +30 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a90ae8a3c97f325c4a26a676433a6262b3ee70abb8ba932df8a473c0867a6d4e
|
4
|
+
data.tar.gz: 431e5874802d0a861ecd6ebc7a5776ec0e36b7cf9cad294728e353ef8ce1de0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d200335836951c5c9af98896dc67d85e7458e0d76501956d5592f315b04949d511f40ca94080a770ac075d8e9a7fd5bbf221609524a589c9b7651aca1a4f9d42
|
7
|
+
data.tar.gz: 24e0de266ce9fe270b8d3463a0acba41a109e638723bffd6be844aa25c0040352fcf87b82576613f38ce3df12c7452466ae613a0840894b080cff6454508a267
|
@@ -8,7 +8,7 @@ require 'uri'
|
|
8
8
|
# Fluentd
|
9
9
|
module Fluent
|
10
10
|
# The out_http buffered output plugin sends event records via HTTP.
|
11
|
-
class HTTPOutput < ObjectBufferedOutput
|
11
|
+
class HTTPOutput < ObjectBufferedOutput # rubocop:disable Metrics/ClassLength
|
12
12
|
Fluent::Plugin.register_output('http', self)
|
13
13
|
|
14
14
|
desc 'URL to send event records to'
|
@@ -23,6 +23,12 @@ module Fluent
|
|
23
23
|
desc 'Keep-alive timeout'
|
24
24
|
config_param :keep_alive_timeout, :float, default: 60.0
|
25
25
|
|
26
|
+
desc 'Basic auth username'
|
27
|
+
config_param :username, :string, default: nil
|
28
|
+
|
29
|
+
desc 'Basic auth password'
|
30
|
+
config_param :password, :string, default: nil, secret: true
|
31
|
+
|
26
32
|
def initialize
|
27
33
|
require 'fluent/plugin/http/error'
|
28
34
|
|
@@ -40,6 +46,8 @@ module Fluent
|
|
40
46
|
@accept_status_code = validate_accept_status_code(accept_status_code)
|
41
47
|
@authorization_token = validate_authorization_token(authorization_token)
|
42
48
|
@keep_alive_timeout = validate_keep_alive_timeout(keep_alive_timeout)
|
49
|
+
@username = validate_username(username)
|
50
|
+
@password = validate_password(password)
|
43
51
|
end
|
44
52
|
|
45
53
|
# Hook method that is called at the shutdown
|
@@ -119,6 +127,8 @@ module Fluent
|
|
119
127
|
if authorization_token
|
120
128
|
request['Authorization'] = "Token token=#{authorization_token}"
|
121
129
|
end
|
130
|
+
|
131
|
+
request.basic_auth(username, password) if username
|
122
132
|
end
|
123
133
|
end
|
124
134
|
|
@@ -159,5 +169,24 @@ module Fluent
|
|
159
169
|
|
160
170
|
raise Fluent::ConfigError, "Invalid keep-alive timeout: #{value.inspect}"
|
161
171
|
end
|
172
|
+
|
173
|
+
def validate_username(value)
|
174
|
+
return value if value.nil?
|
175
|
+
|
176
|
+
if authorization_token
|
177
|
+
raise Fluent::ConfigError,
|
178
|
+
'Mutually exclusive: authorization_token and username'
|
179
|
+
end
|
180
|
+
|
181
|
+
return value unless value.empty?
|
182
|
+
|
183
|
+
raise Fluent::ConfigError, "Invalid username: #{value.inspect}"
|
184
|
+
end
|
185
|
+
|
186
|
+
def validate_password(value)
|
187
|
+
return value if value.nil? || username
|
188
|
+
|
189
|
+
raise Fluent::ConfigError, 'Password requires a username'
|
190
|
+
end
|
162
191
|
end
|
163
192
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|