async-aws 0.0.1 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +42 -35
- data/README.md +9 -0
- data/async-aws.gemspec +3 -2
- data/lib/async/aws.rb +16 -5
- data/lib/async/aws/http_handler.rb +32 -3
- data/lib/async/aws/version.rb +1 -1
- metadata +23 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 101257bc534ed74edf2e3dce144db4f7689dcf2b626d693177605438cbe5853b
|
4
|
+
data.tar.gz: 2346df96c07eac2723f486ef9c624dca7fa9970603f2bbc562a81e11251772da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bae8bf53175273340c63d4fbf3470d04d07606ac0fa8788d829841cd9047a393266ac3cb6196276bb88aaaf5c632ba73fdd73c27658353f36b45dc62ce4b9ee2
|
7
|
+
data.tar.gz: 7b45cb4941d72f0506b1f179b17535192422eff2c2ce21dec0a86051c8aea2af1112dfb2860e67e72a21bd0ef66c0a11ab2cee4e2da5ba3ad6f08019b6ee60b0
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,65 +1,71 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
async-aws (
|
5
|
-
async-http (
|
4
|
+
async-aws (1.0.1)
|
5
|
+
async-http (~> 0.51)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
async (1.
|
10
|
+
async (1.24.2)
|
11
11
|
console (~> 1.0)
|
12
12
|
nio4r (~> 2.3)
|
13
13
|
timers (~> 4.1)
|
14
|
-
async-http (0.
|
15
|
-
async (~> 1.
|
16
|
-
async-io (~> 1.
|
17
|
-
|
18
|
-
protocol-
|
19
|
-
protocol-
|
20
|
-
|
14
|
+
async-http (0.51.2)
|
15
|
+
async (~> 1.23)
|
16
|
+
async-io (~> 1.28)
|
17
|
+
async-pool (~> 0.2)
|
18
|
+
protocol-http (~> 0.18.0)
|
19
|
+
protocol-http1 (~> 0.12.0)
|
20
|
+
protocol-http2 (~> 0.13.0)
|
21
|
+
async-io (1.28.0)
|
21
22
|
async (~> 1.14)
|
22
|
-
|
23
|
-
|
24
|
-
aws-
|
25
|
-
|
26
|
-
|
23
|
+
async-pool (0.2.0)
|
24
|
+
async (~> 1.8)
|
25
|
+
aws-eventstream (1.1.0)
|
26
|
+
aws-partitions (1.296.0)
|
27
|
+
aws-sdk-core (3.94.0)
|
28
|
+
aws-eventstream (~> 1, >= 1.0.2)
|
29
|
+
aws-partitions (~> 1, >= 1.239.0)
|
27
30
|
aws-sigv4 (~> 1.1)
|
28
31
|
jmespath (~> 1.0)
|
29
|
-
aws-sdk-
|
30
|
-
aws-sdk-core (~> 3, >= 3.
|
32
|
+
aws-sdk-dynamodb (1.45.0)
|
33
|
+
aws-sdk-core (~> 3, >= 3.71.0)
|
34
|
+
aws-sigv4 (~> 1.1)
|
35
|
+
aws-sdk-kms (1.30.0)
|
36
|
+
aws-sdk-core (~> 3, >= 3.71.0)
|
31
37
|
aws-sigv4 (~> 1.1)
|
32
|
-
aws-sdk-s3 (1.
|
33
|
-
aws-sdk-core (~> 3, >= 3.
|
38
|
+
aws-sdk-s3 (1.61.2)
|
39
|
+
aws-sdk-core (~> 3, >= 3.83.0)
|
34
40
|
aws-sdk-kms (~> 1)
|
35
41
|
aws-sigv4 (~> 1.1)
|
36
|
-
aws-sigv4 (1.1.
|
42
|
+
aws-sigv4 (1.1.1)
|
37
43
|
aws-eventstream (~> 1.0, >= 1.0.2)
|
38
|
-
console (1.
|
44
|
+
console (1.8.2)
|
39
45
|
diff-lcs (1.3)
|
40
46
|
jmespath (1.4.0)
|
41
47
|
nio4r (2.5.2)
|
42
|
-
protocol-hpack (1.4.
|
43
|
-
protocol-http (0.
|
44
|
-
protocol-http1 (0.
|
45
|
-
protocol-http (~> 0.
|
46
|
-
protocol-http2 (0.
|
48
|
+
protocol-hpack (1.4.2)
|
49
|
+
protocol-http (0.18.0)
|
50
|
+
protocol-http1 (0.12.0)
|
51
|
+
protocol-http (~> 0.18)
|
52
|
+
protocol-http2 (0.13.3)
|
47
53
|
protocol-hpack (~> 1.4)
|
48
|
-
protocol-http (~> 0.
|
49
|
-
rake (
|
54
|
+
protocol-http (~> 0.18)
|
55
|
+
rake (13.0.1)
|
50
56
|
rspec (3.9.0)
|
51
57
|
rspec-core (~> 3.9.0)
|
52
58
|
rspec-expectations (~> 3.9.0)
|
53
59
|
rspec-mocks (~> 3.9.0)
|
54
|
-
rspec-core (3.9.
|
55
|
-
rspec-support (~> 3.9.
|
56
|
-
rspec-expectations (3.9.
|
60
|
+
rspec-core (3.9.1)
|
61
|
+
rspec-support (~> 3.9.1)
|
62
|
+
rspec-expectations (3.9.1)
|
57
63
|
diff-lcs (>= 1.2.0, < 2.0)
|
58
64
|
rspec-support (~> 3.9.0)
|
59
|
-
rspec-mocks (3.9.
|
65
|
+
rspec-mocks (3.9.1)
|
60
66
|
diff-lcs (>= 1.2.0, < 2.0)
|
61
67
|
rspec-support (~> 3.9.0)
|
62
|
-
rspec-support (3.9.
|
68
|
+
rspec-support (3.9.2)
|
63
69
|
timers (4.3.0)
|
64
70
|
|
65
71
|
PLATFORMS
|
@@ -68,10 +74,11 @@ PLATFORMS
|
|
68
74
|
DEPENDENCIES
|
69
75
|
async
|
70
76
|
async-aws!
|
77
|
+
aws-sdk-dynamodb
|
71
78
|
aws-sdk-s3
|
72
79
|
bundler (~> 2.0)
|
73
|
-
rake (~>
|
80
|
+
rake (~> 13.0)
|
74
81
|
rspec (~> 3.0)
|
75
82
|
|
76
83
|
BUNDLED WITH
|
77
|
-
2.
|
84
|
+
2.1.2
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Async::Aws
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/async-aws.svg)](https://badge.fury.io/rb/async-aws)
|
4
|
+
|
3
5
|
An experimental HTTP handler for AWS SDK Ruby powered by `socketry/async-http`.
|
4
6
|
|
5
7
|
## Installation
|
@@ -18,6 +20,13 @@ Or install it yourself as:
|
|
18
20
|
|
19
21
|
$ gem install async-aws
|
20
22
|
|
23
|
+
## Configuration
|
24
|
+
```ruby
|
25
|
+
Async::Aws.configure(
|
26
|
+
connection_limit: 4 # Max number of connections per endpoint (passed to Async::HTTP::Client)
|
27
|
+
)
|
28
|
+
```
|
29
|
+
|
21
30
|
## Usage
|
22
31
|
|
23
32
|
### Method 1
|
data/async-aws.gemspec
CHANGED
@@ -28,11 +28,12 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
|
31
|
-
spec.add_dependency 'async-http', '
|
31
|
+
spec.add_dependency 'async-http', '~> 0.51'
|
32
32
|
|
33
33
|
spec.add_development_dependency "bundler", "~> 2.0"
|
34
|
-
spec.add_development_dependency "rake", "~>
|
34
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
35
35
|
spec.add_development_dependency "rspec", "~> 3.0"
|
36
36
|
spec.add_development_dependency "aws-sdk-s3"
|
37
|
+
spec.add_development_dependency "aws-sdk-dynamodb"
|
37
38
|
spec.add_development_dependency "async"
|
38
39
|
end
|
data/lib/async/aws.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'async/http'
|
2
|
-
require 'async/http/internet'
|
3
2
|
require 'async/aws/http_handler'
|
4
3
|
require 'async/aws/http_plugin'
|
5
4
|
|
@@ -7,12 +6,24 @@ module Async
|
|
7
6
|
module Aws
|
8
7
|
module_function
|
9
8
|
|
10
|
-
def
|
11
|
-
@
|
9
|
+
def config
|
10
|
+
@config ||= {}
|
12
11
|
end
|
13
12
|
|
14
|
-
def
|
15
|
-
|
13
|
+
def configure(**kwargs)
|
14
|
+
config.merge!(kwargs.slice(:connection_limit))
|
15
|
+
end
|
16
|
+
|
17
|
+
def set(key, value)
|
18
|
+
__send__("#{key}=".to_sym, value)
|
19
|
+
end
|
20
|
+
|
21
|
+
def connection_limit=(arg)
|
22
|
+
config[:connection_limit] = arg.to_i
|
23
|
+
end
|
24
|
+
|
25
|
+
def connection_limit
|
26
|
+
config.fetch(:connection_limit, 1)
|
16
27
|
end
|
17
28
|
end
|
18
29
|
end
|
@@ -1,15 +1,44 @@
|
|
1
1
|
module Async
|
2
2
|
module Aws
|
3
3
|
class HttpHandler < ::Seahorse::Client::Handler
|
4
|
+
def self.clients
|
5
|
+
@clients ||= {}
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.endpoints
|
9
|
+
@endpoints ||= {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.endpoint_for(url)
|
13
|
+
endpoints[url.to_s] ||= Async::HTTP::Endpoint.parse(url.to_s)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.client_for(endpoint)
|
17
|
+
clients[endpoint.hostname] ||= ::Async::HTTP::Client.new(
|
18
|
+
endpoint,
|
19
|
+
retries: 0,
|
20
|
+
connection_limit: Async::Aws.connection_limit
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
4
24
|
def call(context)
|
5
25
|
req = context.http_request
|
6
26
|
resp = context.http_response
|
27
|
+
endpoint = self.class.endpoint_for(req.endpoint)
|
7
28
|
|
8
29
|
begin
|
9
|
-
|
10
|
-
|
11
|
-
req.
|
30
|
+
client = self.class.client_for(endpoint)
|
31
|
+
headers = ::Protocol::HTTP::Headers.new(
|
32
|
+
req.headers.reject do |k, v|
|
33
|
+
k == 'host' || k == 'content-length'
|
34
|
+
end
|
35
|
+
)
|
36
|
+
buffered_body = Async::HTTP::Body::Buffered.wrap(req.body)
|
37
|
+
request = ::Protocol::HTTP::Request.new(
|
38
|
+
client.scheme, endpoint.authority, req.http_method, endpoint.path,
|
39
|
+
nil, headers, buffered_body
|
12
40
|
)
|
41
|
+
response = client.call(request)
|
13
42
|
body = response.read
|
14
43
|
resp.signal_headers(response.status.to_i, response.headers.to_h)
|
15
44
|
resp.signal_data(body)
|
data/lib/async/aws/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julien D.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-http
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.51'
|
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.51'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: aws-sdk-dynamodb
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: async
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
156
|
- !ruby/object:Gem::Version
|
143
157
|
version: '0'
|
144
158
|
requirements: []
|
145
|
-
rubygems_version: 3.
|
159
|
+
rubygems_version: 3.1.2
|
146
160
|
signing_key:
|
147
161
|
specification_version: 4
|
148
162
|
summary: Async AWS SDK adapter for `socketry/async` framework
|