fluent-plugin-aws-elasticsearch-service 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da8385875d796c005689e289afd4d23ec3df97bf
|
4
|
+
data.tar.gz: 9b55914cce79cfd7c2513721d8a81dda81c93e8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43c2bb93d76c85f6409e072bf2a7562b500227e300b7a3f19d0285a328bf9f25199d3fb3a850e5593c65444a7cd98d68c694d61b17dd39663d3d33bd9f1ac155
|
7
|
+
data.tar.gz: 01b06dea5b0ee5ea9e3c5517d7c52e6a3cc3f2ac1c392657400c1b0be9a8bfd987adf7b34029d1da88cba51ff23f28dd8b26df04dde4b126d10d5f83df9f88d8
|
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "fluent-plugin-aws-elasticsearch-service"
|
8
|
-
spec.version = "0.1.
|
8
|
+
spec.version = "0.1.2"
|
9
9
|
spec.authors = ["atomita"]
|
10
10
|
spec.email = ["sleeping.cait.sith+gh@gmail.com"]
|
11
11
|
|
@@ -55,64 +55,78 @@ module Fluent
|
|
55
55
|
# get AWS Credentials
|
56
56
|
#
|
57
57
|
def credentials(access_key, secret_key)
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
credentials
|
63
|
-
if access_key.empty? or secret_key.empty?
|
64
|
-
credentials = Aws::InstanceProfileCredentials.new.credentials
|
65
|
-
credentials ||= Aws::SharedCredentials.new.credentials
|
66
|
-
end
|
67
|
-
credentials ||= Aws::Credentials.new access_key, secret_key
|
68
|
-
credentials
|
58
|
+
lambda do
|
59
|
+
credentials = nil
|
60
|
+
if access_key.empty? or secret_key.empty?
|
61
|
+
credentials = Aws::InstanceProfileCredentials.new.credentials
|
62
|
+
credentials ||= Aws::SharedCredentials.new.credentials
|
69
63
|
end
|
64
|
+
credentials ||= Aws::Credentials.new access_key, secret_key
|
65
|
+
credentials
|
66
|
+
end
|
70
67
|
end
|
71
68
|
|
69
|
+
end
|
72
70
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
# @override
|
84
|
-
#
|
85
|
-
def __build_connections
|
86
|
-
Elasticsearch::Transport::Transport::Connections::Collection.new(
|
87
|
-
:connections => hosts.map { |host|
|
88
|
-
host[:protocol] = host[:scheme] || DEFAULT_PROTOCOL
|
89
|
-
host[:port] ||= DEFAULT_PORT
|
90
|
-
url = __full_url(host)
|
91
|
-
|
92
|
-
Elasticsearch::Transport::Transport::Connections::Connection.new(
|
93
|
-
:host => host,
|
94
|
-
:connection => ::Faraday::Connection.new(
|
95
|
-
url,
|
96
|
-
(options[:transport_options] || {}),
|
97
|
-
&__aws_elasticsearch_service_setting(host, &@block)
|
98
|
-
),
|
99
|
-
:options => host[:connection_options]
|
100
|
-
)
|
101
|
-
},
|
102
|
-
:selector_class => options[:selector_class],
|
103
|
-
:selector => options[:selector]
|
104
|
-
)
|
71
|
+
|
72
|
+
#
|
73
|
+
# monkey patch
|
74
|
+
#
|
75
|
+
class ElasticsearchOutput
|
76
|
+
module Elasticsearch
|
77
|
+
|
78
|
+
module Client
|
79
|
+
include ::Elasticsearch::Client
|
80
|
+
extend self
|
105
81
|
end
|
106
82
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
83
|
+
module Transport
|
84
|
+
module Transport
|
85
|
+
module HTTP
|
86
|
+
class Faraday < ::Elasticsearch::Transport::Transport::HTTP::Faraday
|
87
|
+
|
88
|
+
alias :__build_connections_origin_from_aws_elasticsearch_service_output :__build_connections
|
89
|
+
|
90
|
+
# Builds and returns a collection of connections.
|
91
|
+
#
|
92
|
+
# @return [Connections::Collection]
|
93
|
+
# @override
|
94
|
+
#
|
95
|
+
def __build_connections
|
96
|
+
::Elasticsearch::Transport::Transport::Connections::Collection.new(
|
97
|
+
:connections => hosts.map { |host|
|
98
|
+
host[:protocol] = host[:scheme] || DEFAULT_PROTOCOL
|
99
|
+
host[:port] ||= DEFAULT_PORT
|
100
|
+
url = __full_url(host)
|
101
|
+
|
102
|
+
::Elasticsearch::Transport::Transport::Connections::Connection.new(
|
103
|
+
:host => host,
|
104
|
+
:connection => ::Faraday::Connection.new(
|
105
|
+
url,
|
106
|
+
(options[:transport_options] || {}),
|
107
|
+
&__aws_elasticsearch_service_setting(host, &@block)
|
108
|
+
),
|
109
|
+
:options => host[:connection_options]
|
110
|
+
)
|
111
|
+
},
|
112
|
+
:selector_class => options[:selector_class],
|
113
|
+
:selector => options[:selector]
|
114
|
+
)
|
115
|
+
end
|
116
|
+
|
117
|
+
def __aws_elasticsearch_service_setting(host, &block)
|
118
|
+
lambda do |faraday|
|
119
|
+
if host[:aws_elasticsearch_service]
|
120
|
+
faraday.request :aws_signers_v4,
|
121
|
+
credentials: host[:aws_elasticsearch_service][:credentials].call,
|
122
|
+
service_name: 'es',
|
123
|
+
region: host[:aws_elasticsearch_service][:region]
|
124
|
+
end
|
125
|
+
block.call faraday
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
114
129
|
end
|
115
|
-
block.call faraday
|
116
130
|
end
|
117
131
|
end
|
118
132
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-aws-elasticsearch-service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- atomita
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|