faraday_middleware-aws-sigv4 0.2.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/test.yml +50 -0
- data/.gitignore +1 -0
- data/.simplecov +4 -0
- data/Appraisals +15 -0
- data/README.md +25 -4
- data/faraday_middleware-aws-sigv4.gemspec +8 -4
- data/gemfiles/.bundle/config +2 -0
- data/gemfiles/faraday_0.15.gemfile +7 -0
- data/gemfiles/faraday_0.16.gemfile +7 -0
- data/gemfiles/faraday_0.17.gemfile +7 -0
- data/gemfiles/faraday_1.0.gemfile +7 -0
- data/lib/faraday_middleware/request/aws_sigv4.rb +3 -9
- data/lib/faraday_middleware/request/aws_sigv4_util.rb +0 -9
- metadata +50 -16
- data/.travis.yml +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d0e5eb23ca6df3387ac50a4917e304311f606276c96fbab4aa0a8e8946ed97c4
|
4
|
+
data.tar.gz: 326b17872f5fe6d1127533eec5a46af0f2c5d5918485be48bfaf6c53ed198328
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cb0cc83b9b82920b26106ebc2039684c17679161ef97c93a65c01a72bcf54daa9d510cc0d0d7e40fbb6888db28dcd1a4a62b6c3defc9823b4889aba75088570
|
7
|
+
data.tar.gz: c5165646f89f56de6b3c653112d6f71bcdb60cf63dcc1949de6fb9ec905bd9858c32c552564ecc916cde03479ee7f01f63890bbd883276fc6dedc9e8a2a7f3af
|
@@ -0,0 +1,50 @@
|
|
1
|
+
name: test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
pull_request:
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
build:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
strategy:
|
11
|
+
fail-fast: false
|
12
|
+
matrix:
|
13
|
+
ruby:
|
14
|
+
- 2.4
|
15
|
+
- 2.5
|
16
|
+
- 2.6
|
17
|
+
- 2.7
|
18
|
+
gemfile:
|
19
|
+
- gemfiles/faraday_0.15.gemfile
|
20
|
+
- gemfiles/faraday_0.16.gemfile
|
21
|
+
- gemfiles/faraday_0.17.gemfile
|
22
|
+
|
23
|
+
steps:
|
24
|
+
- uses: actions/checkout@v2
|
25
|
+
- uses: actions/setup-ruby@v1
|
26
|
+
with:
|
27
|
+
ruby-version: ${{ matrix.ruby }}
|
28
|
+
- uses: actions/cache@v2
|
29
|
+
with:
|
30
|
+
path: gemfiles/vendor/bundle
|
31
|
+
key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles('faraday_middleware-aws-sigv4.gemspec', '**/Gemfile', '${{ matrix.gemfile }}') }}
|
32
|
+
restore-keys: |
|
33
|
+
${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.gemfile }}-
|
34
|
+
|
35
|
+
- name: Setup dependencies
|
36
|
+
run: |
|
37
|
+
bundle config path vendor/bundle
|
38
|
+
bundle install
|
39
|
+
env:
|
40
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
41
|
+
|
42
|
+
- name: Run tests
|
43
|
+
run: ${{ matrix.env }} bundle exec rake
|
44
|
+
env:
|
45
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
46
|
+
|
47
|
+
- name: Coveralls GitHub Action
|
48
|
+
uses: coverallsapp/github-action@v1.1.2
|
49
|
+
with:
|
50
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
data/.gitignore
CHANGED
data/.simplecov
ADDED
data/Appraisals
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
appraise 'faraday-0.15' do
|
2
|
+
gem 'faraday', '~> 0.15.0'
|
3
|
+
end
|
4
|
+
|
5
|
+
appraise 'faraday-0.16' do
|
6
|
+
gem 'faraday', '~> 0.16.0'
|
7
|
+
end
|
8
|
+
|
9
|
+
appraise 'faraday-0.17' do
|
10
|
+
gem 'faraday', '~> 0.17.0'
|
11
|
+
end
|
12
|
+
|
13
|
+
appraise 'faraday-1.0' do
|
14
|
+
gem 'faraday', '~> 1.0.0'
|
15
|
+
end
|
data/README.md
CHANGED
@@ -3,9 +3,15 @@
|
|
3
3
|
[Faraday](https://github.com/lostisland/faraday) middleware for AWS Signature Version 4 using [aws-sigv4](https://rubygems.org/gems/aws-sigv4).
|
4
4
|
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/faraday_middleware-aws-sigv4.svg)](https://badge.fury.io/rb/faraday_middleware-aws-sigv4)
|
6
|
-
|
6
|
+
![test](https://github.com/winebarrel/faraday_middleware-aws-sigv4/workflows/test/badge.svg)
|
7
7
|
[![Coverage Status](https://coveralls.io/repos/github/winebarrel/faraday_middleware-aws-sigv4/badge.svg?branch=master)](https://coveralls.io/github/winebarrel/faraday_middleware-aws-sigv4?branch=master)
|
8
8
|
|
9
|
+
* `faraday_middleware-aws-sigv4 < 0.3.0`
|
10
|
+
* `faraday < 0.15`
|
11
|
+
* `faraday_middleware-aws-sigv4 >= 0.3.0`
|
12
|
+
* `ruby >= 2.3`
|
13
|
+
* `faraday >= 0.15`
|
14
|
+
|
9
15
|
## Installation
|
10
16
|
|
11
17
|
Add this line to your application's Gemfile:
|
@@ -25,7 +31,8 @@ Or install it yourself as:
|
|
25
31
|
## Usage
|
26
32
|
|
27
33
|
```ruby
|
28
|
-
# `gem install faraday_middleware` is required.
|
34
|
+
# `gem install faraday_middleware` is required for this example.
|
35
|
+
# However, FaradayMiddleware::AwsSigV4 works without faraday_middleware.
|
29
36
|
require 'faraday_middleware'
|
30
37
|
require 'faraday_middleware/aws_sigv4'
|
31
38
|
require 'pp'
|
@@ -38,7 +45,10 @@ conn = Faraday.new(url: 'https://apigateway.us-east-1.amazonaws.com') do |farada
|
|
38
45
|
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
|
39
46
|
# see http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/Sigv4/Signer.html
|
40
47
|
|
41
|
-
|
48
|
+
# NOTE: The following middleware is from `faraday_middleware`
|
49
|
+
# cf. https://github.com/lostisland/faraday_middleware/blob/master/lib/faraday_middleware.rb
|
50
|
+
# **It is not an essential middleware to work.**
|
51
|
+
faraday.response :json, content_type: /\bjson\b/
|
42
52
|
faraday.response :raise_error
|
43
53
|
|
44
54
|
faraday.adapter Faraday.default_adapter
|
@@ -58,7 +68,18 @@ pp res.body
|
|
58
68
|
# "throttleSettings"=>{"rateLimit"=>10000.0, "burstLimit"=>5000}}
|
59
69
|
```
|
60
70
|
|
71
|
+
## Upgrading from `faraday_middleware-aws-signers-v4`
|
72
|
+
|
73
|
+
If you previously provided the `service_name` option, you need to rename it `service`
|
74
|
+
|
75
|
+
## Test
|
76
|
+
|
77
|
+
```sh
|
78
|
+
bundle install
|
79
|
+
bundle exec appraisal install
|
80
|
+
bundle exec appraisal faraday-0.16 rake
|
81
|
+
```
|
82
|
+
|
61
83
|
## Related Links
|
62
84
|
|
63
85
|
* http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/Sigv4/Signer.html
|
64
|
-
* https://github.com/winebarrel/faraday_middleware-aws-signers-v4 (aws-sdk-v2 version)
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'faraday_middleware-aws-sigv4'
|
7
|
-
spec.version = '0.
|
7
|
+
spec.version = '0.4.0'
|
8
8
|
spec.authors = ['Genki Sugawara']
|
9
9
|
spec.email = ['sugawara@cookpad.com']
|
10
10
|
|
@@ -20,7 +20,9 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
|
-
spec.
|
23
|
+
spec.required_ruby_version = '>= 2.3'
|
24
|
+
|
25
|
+
spec.add_dependency 'faraday', '>= 0.15'
|
24
26
|
spec.add_dependency 'aws-sigv4', '~> 1.0'
|
25
27
|
|
26
28
|
spec.add_development_dependency 'faraday_middleware'
|
@@ -28,6 +30,8 @@ Gem::Specification.new do |spec|
|
|
28
30
|
spec.add_development_dependency 'rake'
|
29
31
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
30
32
|
spec.add_development_dependency 'timecop'
|
31
|
-
spec.add_development_dependency '
|
32
|
-
spec.add_development_dependency '
|
33
|
+
spec.add_development_dependency 'aws-sdk-core', '~> 3.14.0'
|
34
|
+
spec.add_development_dependency 'appraisal', '>= 2.2'
|
35
|
+
spec.add_development_dependency 'simplecov'
|
36
|
+
spec.add_development_dependency 'simplecov-lcov'
|
33
37
|
end
|
@@ -18,14 +18,12 @@ class FaradayMiddleware::AwsSigV4 < Faraday::Middleware
|
|
18
18
|
private
|
19
19
|
|
20
20
|
def sign!(env)
|
21
|
-
if net_http_adapter?
|
22
|
-
normalize_for_net_http!(env)
|
23
|
-
end
|
24
|
-
|
25
21
|
request = build_aws_sigv4_request(env)
|
26
22
|
signature = @signer.sign_request(request)
|
27
23
|
|
28
|
-
|
24
|
+
signature.headers.each do |name, value|
|
25
|
+
env.request_headers[name] = value
|
26
|
+
end
|
29
27
|
end
|
30
28
|
|
31
29
|
def build_aws_sigv4_request(env)
|
@@ -36,8 +34,4 @@ class FaradayMiddleware::AwsSigV4 < Faraday::Middleware
|
|
36
34
|
body: env.body,
|
37
35
|
}
|
38
36
|
end
|
39
|
-
|
40
|
-
def net_http_adapter?
|
41
|
-
@app.is_a?(Faraday::Adapter::NetHttp)
|
42
|
-
end
|
43
37
|
end
|
@@ -1,13 +1,4 @@
|
|
1
1
|
module FaradayMiddleware::AwsSigV4Util
|
2
|
-
def normalize_for_net_http!(env)
|
3
|
-
if Net::HTTP::HAVE_ZLIB
|
4
|
-
env.request_headers['Accept-Encoding'] ||= 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3'
|
5
|
-
end
|
6
|
-
|
7
|
-
env.request_headers['Accept'] ||= '*/*'
|
8
|
-
env
|
9
|
-
end
|
10
|
-
|
11
2
|
def seahorse_encode_query(url)
|
12
3
|
return url unless url.query
|
13
4
|
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faraday_middleware-aws-sigv4
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.15'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.15'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: aws-sigv4
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,7 +109,35 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: aws-sdk-core
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 3.14.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 3.14.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: appraisal
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.2'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '2.2'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: simplecov
|
113
141
|
requirement: !ruby/object:Gem::Requirement
|
114
142
|
requirements:
|
115
143
|
- - ">="
|
@@ -123,19 +151,19 @@ dependencies:
|
|
123
151
|
- !ruby/object:Gem::Version
|
124
152
|
version: '0'
|
125
153
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
154
|
+
name: simplecov-lcov
|
127
155
|
requirement: !ruby/object:Gem::Requirement
|
128
156
|
requirements:
|
129
|
-
- - "
|
157
|
+
- - ">="
|
130
158
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
159
|
+
version: '0'
|
132
160
|
type: :development
|
133
161
|
prerelease: false
|
134
162
|
version_requirements: !ruby/object:Gem::Requirement
|
135
163
|
requirements:
|
136
|
-
- - "
|
164
|
+
- - ">="
|
137
165
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
166
|
+
version: '0'
|
139
167
|
description: Faraday middleware for AWS Signature Version 4 using aws-sigv4.
|
140
168
|
email:
|
141
169
|
- sugawara@cookpad.com
|
@@ -143,9 +171,11 @@ executables: []
|
|
143
171
|
extensions: []
|
144
172
|
extra_rdoc_files: []
|
145
173
|
files:
|
174
|
+
- ".github/workflows/test.yml"
|
146
175
|
- ".gitignore"
|
147
176
|
- ".rspec"
|
148
|
-
- ".
|
177
|
+
- ".simplecov"
|
178
|
+
- Appraisals
|
149
179
|
- Gemfile
|
150
180
|
- LICENSE.txt
|
151
181
|
- README.md
|
@@ -153,6 +183,11 @@ files:
|
|
153
183
|
- bin/console
|
154
184
|
- bin/setup
|
155
185
|
- faraday_middleware-aws-sigv4.gemspec
|
186
|
+
- gemfiles/.bundle/config
|
187
|
+
- gemfiles/faraday_0.15.gemfile
|
188
|
+
- gemfiles/faraday_0.16.gemfile
|
189
|
+
- gemfiles/faraday_0.17.gemfile
|
190
|
+
- gemfiles/faraday_1.0.gemfile
|
156
191
|
- lib/faraday_middleware/aws_sigv4.rb
|
157
192
|
- lib/faraday_middleware/request/aws_sigv4.rb
|
158
193
|
- lib/faraday_middleware/request/aws_sigv4_util.rb
|
@@ -168,15 +203,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
203
|
requirements:
|
169
204
|
- - ">="
|
170
205
|
- !ruby/object:Gem::Version
|
171
|
-
version: '
|
206
|
+
version: '2.3'
|
172
207
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
208
|
requirements:
|
174
209
|
- - ">="
|
175
210
|
- !ruby/object:Gem::Version
|
176
211
|
version: '0'
|
177
212
|
requirements: []
|
178
|
-
|
179
|
-
rubygems_version: 2.5.2
|
213
|
+
rubygems_version: 3.1.2
|
180
214
|
signing_key:
|
181
215
|
specification_version: 4
|
182
216
|
summary: Faraday middleware for AWS Signature Version 4 using aws-sigv4.
|