async-aws 0.0.1 → 1.0.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 +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +46 -35
- data/README.md +9 -0
- data/async-aws.gemspec +4 -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 +37 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e683070aa09b21e7398f22f30e2d99e8e2aadbf1cc91c465e8097dff22323056
|
|
4
|
+
data.tar.gz: 7bbbc5beadfc57d8d0aaaee36b9c67c070016e67e52abed0a71c00b61285c762
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 97652b664a9991837852cf9070861e0b0136baef7e03cbccf502e984554a310d54d52c05758ce507fcc1412444587644baeb3f77ad36d417345c0dd7c4dbd451
|
|
7
|
+
data.tar.gz: 223569a72176af151fbb747947d4194673335b2877fc92cb477d69272d82481803318c4624bdce87372f16fc0ad5b8452cec774e76ccd82f0599cf65c0db4617
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,65 +1,74 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
async-aws (
|
|
5
|
-
async-http (
|
|
4
|
+
async-aws (1.0.2)
|
|
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-
|
|
42
|
+
aws-sdk-sqs (1.24.0)
|
|
43
|
+
aws-sdk-core (~> 3, >= 3.71.0)
|
|
44
|
+
aws-sigv4 (~> 1.1)
|
|
45
|
+
aws-sigv4 (1.1.1)
|
|
37
46
|
aws-eventstream (~> 1.0, >= 1.0.2)
|
|
38
|
-
console (1.
|
|
47
|
+
console (1.8.2)
|
|
39
48
|
diff-lcs (1.3)
|
|
40
49
|
jmespath (1.4.0)
|
|
41
50
|
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.
|
|
51
|
+
protocol-hpack (1.4.2)
|
|
52
|
+
protocol-http (0.18.0)
|
|
53
|
+
protocol-http1 (0.12.0)
|
|
54
|
+
protocol-http (~> 0.18)
|
|
55
|
+
protocol-http2 (0.13.3)
|
|
47
56
|
protocol-hpack (~> 1.4)
|
|
48
|
-
protocol-http (~> 0.
|
|
49
|
-
rake (
|
|
57
|
+
protocol-http (~> 0.18)
|
|
58
|
+
rake (13.0.1)
|
|
50
59
|
rspec (3.9.0)
|
|
51
60
|
rspec-core (~> 3.9.0)
|
|
52
61
|
rspec-expectations (~> 3.9.0)
|
|
53
62
|
rspec-mocks (~> 3.9.0)
|
|
54
|
-
rspec-core (3.9.
|
|
55
|
-
rspec-support (~> 3.9.
|
|
56
|
-
rspec-expectations (3.9.
|
|
63
|
+
rspec-core (3.9.1)
|
|
64
|
+
rspec-support (~> 3.9.1)
|
|
65
|
+
rspec-expectations (3.9.1)
|
|
57
66
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
58
67
|
rspec-support (~> 3.9.0)
|
|
59
|
-
rspec-mocks (3.9.
|
|
68
|
+
rspec-mocks (3.9.1)
|
|
60
69
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
61
70
|
rspec-support (~> 3.9.0)
|
|
62
|
-
rspec-support (3.9.
|
|
71
|
+
rspec-support (3.9.2)
|
|
63
72
|
timers (4.3.0)
|
|
64
73
|
|
|
65
74
|
PLATFORMS
|
|
@@ -68,10 +77,12 @@ PLATFORMS
|
|
|
68
77
|
DEPENDENCIES
|
|
69
78
|
async
|
|
70
79
|
async-aws!
|
|
80
|
+
aws-sdk-dynamodb
|
|
71
81
|
aws-sdk-s3
|
|
82
|
+
aws-sdk-sqs
|
|
72
83
|
bundler (~> 2.0)
|
|
73
|
-
rake (~>
|
|
84
|
+
rake (~> 13.0)
|
|
74
85
|
rspec (~> 3.0)
|
|
75
86
|
|
|
76
87
|
BUNDLED WITH
|
|
77
|
-
2.
|
|
88
|
+
2.1.2
|
data/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Async::Aws
|
|
2
2
|
|
|
3
|
+
[](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,13 @@ 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"
|
|
38
|
+
spec.add_development_dependency "aws-sdk-sqs"
|
|
37
39
|
spec.add_development_dependency "async"
|
|
38
40
|
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.read)
|
|
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.2
|
|
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-06-14 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,34 @@ 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'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: aws-sdk-sqs
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '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'
|
|
83
111
|
- !ruby/object:Gem::Dependency
|
|
84
112
|
name: async
|
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -142,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
142
170
|
- !ruby/object:Gem::Version
|
|
143
171
|
version: '0'
|
|
144
172
|
requirements: []
|
|
145
|
-
rubygems_version: 3.
|
|
173
|
+
rubygems_version: 3.1.2
|
|
146
174
|
signing_key:
|
|
147
175
|
specification_version: 4
|
|
148
176
|
summary: Async AWS SDK adapter for `socketry/async` framework
|