elasticsearch-transport-aws4 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bf8ee91fea1755e617daf59fbac37c08d8fcad52
4
+ data.tar.gz: fa0505de7347c2a9688aea3c26b1dea2d8b3dde3
5
+ SHA512:
6
+ metadata.gz: 7fb6504a81fb1fa0f0445443575896ea72b17e33e1aed93159f552de81574404aac924cc3fd6616af434c61ef56988cc48934e58a9416afcb45a410dbdb327a1
7
+ data.tar.gz: 2196c61d19e4f91def65965412af05ecf786d0cff5097cdb3c7bc32e0655487d5b9e45f1a7908ddbb5156c8911d4f98ee5128fbc4b3380411e577f54dc60260c
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /vendor/bundle
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.10.6
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ### 0.1.0
2
+
3
+ * Initial release.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org/"
2
+
3
+ gemspec
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Signature Version 4 Elasticsearch Transport for Amazon Elasticsearch Service
2
+
3
+ [![Build Status](https://travis-ci.org/castle/elasticsearch-transport-aws4.svg)](https://travis-ci.org/castle/elasticsearch-transport-aws4)
4
+
5
+ `elasticsearch-transport-aws4` signs [Amazon Elasticsearch Service](https://aws.amazon.com/elasticsearch-service/) requests using [Signature Version 4](http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html).
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem "elasticsearch-transport-aws4", "~> 0.1.0"
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install elasticsearch-transport-aws4
22
+
23
+ ## Usage
24
+
25
+ Create Elasticsearch client with `transport_class` and `aws4` options.
26
+
27
+ ```ruby
28
+ Elasticsearch::Client.new(
29
+ url: "https://search-XYZ-ABCDEFGHIJKLMMNOPQRTUVWXYZ.us-east-1.es.amazonaws.com",
30
+ transport_class: Elasticsearch::Transport::AWS4,
31
+ aws4: {
32
+ key: "KEY_KEY_KEY_KEY",
33
+ secret: "SECRET_SECRET",
34
+ region: "us-east-1"
35
+ }
36
+ )
37
+ ```
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,27 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = "elasticsearch-transport-aws4"
6
+ spec.version = "0.1.0"
7
+ spec.authors = ["Filip Tepper"]
8
+ spec.email = ["filip@tepper.pl"]
9
+
10
+ spec.summary = %q{Signature Version 4 Elasticsearch Transport for Amazon Elasticsearch Service}
11
+ spec.homepage = "https://github.com/castle/elasticsearch-transport-aws4"
12
+
13
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
14
+ spec.bindir = "exe"
15
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
16
+ spec.require_paths = ["lib"]
17
+
18
+ spec.add_dependency "aws-sdk", "~> 2.1.31"
19
+ spec.add_dependency "elasticsearch-transport", "~> 1.0.14"
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.10"
22
+ spec.add_development_dependency "elasticsearch", "~> 1.0.14"
23
+ spec.add_development_dependency "minitest", "~> 5.8.2"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "timecop", "~> 0.8.0"
26
+ spec.add_development_dependency "webmock", "~> 1.22.1"
27
+ end
@@ -0,0 +1,39 @@
1
+ require "elasticsearch/transport/transport/serializer/multi_json"
2
+ require "elasticsearch/transport/transport/base"
3
+ require "elasticsearch/transport/transport/http/faraday"
4
+ require "elasticsearch/transport/request"
5
+ require "aws-sdk-core/signers/v4"
6
+ require "aws-sdk-core/credentials"
7
+ require "seahorse/util"
8
+
9
+ module Elasticsearch
10
+ module Transport
11
+ class AWS4 < Elasticsearch::Transport::Transport::HTTP::Faraday
12
+ def initialize(arguments = {}, &block)
13
+ super arguments
14
+
15
+ @signer = Aws::Signers::V4.new(
16
+ Aws::Credentials.new(
17
+ arguments[:options][:aws4][:key],
18
+ arguments[:options][:aws4][:secret]
19
+ ),
20
+ "es",
21
+ arguments[:options][:aws4][:region]
22
+ )
23
+ end
24
+
25
+ def perform_request(method, path, params = {}, body = nil)
26
+ Elasticsearch::Transport::Transport::Base.instance_method(:perform_request).bind(self).call(method, path, params, body) do |connection, url|
27
+ connection.connection.run_request(
28
+ method.downcase.to_sym,
29
+ url,
30
+ (body ? __convert_to_json(body) : ""),
31
+ {}
32
+ ) do |request|
33
+ @signer.sign(request)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,13 @@
1
+ require "faraday"
2
+
3
+ module Faraday
4
+ class Request
5
+ def endpoint
6
+ URI.parse(self.path)
7
+ end
8
+
9
+ def http_method
10
+ self.method.to_s.upcase
11
+ end
12
+ end
13
+ end
metadata ADDED
@@ -0,0 +1,164 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: elasticsearch-transport-aws4
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Filip Tepper
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-10-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: aws-sdk
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.1.31
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.1.31
27
+ - !ruby/object:Gem::Dependency
28
+ name: elasticsearch-transport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.14
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.14
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.10'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.10'
55
+ - !ruby/object:Gem::Dependency
56
+ name: elasticsearch
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.14
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.0.14
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 5.8.2
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 5.8.2
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: timecop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.8.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.8.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: webmock
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 1.22.1
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.22.1
125
+ description:
126
+ email:
127
+ - filip@tepper.pl
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".gitignore"
133
+ - ".travis.yml"
134
+ - CHANGELOG.md
135
+ - Gemfile
136
+ - README.md
137
+ - Rakefile
138
+ - elasticsearch-transport-aws4.gemspec
139
+ - lib/elasticsearch/transport/aws4.rb
140
+ - lib/elasticsearch/transport/request.rb
141
+ homepage: https://github.com/castle/elasticsearch-transport-aws4
142
+ licenses: []
143
+ metadata: {}
144
+ post_install_message:
145
+ rdoc_options: []
146
+ require_paths:
147
+ - lib
148
+ required_ruby_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ required_rubygems_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ requirements: []
159
+ rubyforge_project:
160
+ rubygems_version: 2.4.5.1
161
+ signing_key:
162
+ specification_version: 4
163
+ summary: Signature Version 4 Elasticsearch Transport for Amazon Elasticsearch Service
164
+ test_files: []