aws-sdk-core 3.20.2 → 3.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/aws-sdk-core.rb +4 -0
- data/lib/aws-sdk-core/binary.rb +3 -0
- data/lib/aws-sdk-core/binary/decode_handler.rb +46 -0
- data/lib/aws-sdk-core/binary/event_parser.rb +104 -0
- data/lib/aws-sdk-core/binary/event_stream_decoder.rb +59 -0
- data/lib/aws-sdk-core/errors.rb +35 -0
- data/lib/aws-sdk-core/event_emitter.rb +18 -0
- data/lib/aws-sdk-core/param_validator.rb +38 -17
- data/lib/aws-sdk-core/plugins/event_stream_configuration.rb +16 -0
- data/lib/aws-sdk-core/rest/response/body.rb +14 -1
- data/lib/aws-sdk-core/rest/response/parser.rb +4 -1
- data/lib/aws-sdk-core/stubbing/empty_stub.rb +4 -1
- data/lib/aws-sdk-core/stubbing/protocols/rest.rb +73 -0
- data/lib/aws-sdk-core/stubbing/protocols/rest_json.rb +5 -1
- data/lib/aws-sdk-core/stubbing/protocols/rest_xml.rb +9 -5
- data/lib/aws-sdk-sts.rb +1 -1
- data/lib/aws-sdk-sts/client.rb +1 -1
- data/lib/seahorse/client/http/response.rb +10 -0
- data/lib/seahorse/model/shapes.rb +24 -0
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3a585a1201cb947b02277c975d145eaccd64a2d
|
4
|
+
data.tar.gz: 3291a88b44edce997e8fec94a138f9de101720f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e346bb0c9d68b0fd570ce16b18496399659d373b2f480b6f7bd80a4b6c2fd9d392b7d3ae0e4cabb1bf135c13d9c5c2450dbd81a7a2594af6fad4646a45a05ca
|
7
|
+
data.tar.gz: ff787ba1c2d818247b7d2ff4552a54b9b3b9573b7f4c19a5793bad2e5196a8c958e1ef1d5d62c4290bd2d6eb93a47339203baf90cb242c71334160c7678a642d
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.21.0
|
data/lib/aws-sdk-core.rb
CHANGED
@@ -62,6 +62,10 @@ require_relative 'aws-sdk-core/rest'
|
|
62
62
|
require_relative 'aws-sdk-core/xml'
|
63
63
|
require_relative 'aws-sdk-core/json'
|
64
64
|
|
65
|
+
# event stream
|
66
|
+
require_relative 'aws-sdk-core/binary'
|
67
|
+
require_relative 'aws-sdk-core/event_emitter'
|
68
|
+
|
65
69
|
# aws-sdk-sts is vendored to support Aws::AssumeRoleCredentials
|
66
70
|
|
67
71
|
require 'aws-sdk-sts'
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Aws
|
2
|
+
module Binary
|
3
|
+
|
4
|
+
# @api private
|
5
|
+
class DecodeHandler < Seahorse::Client::Handler
|
6
|
+
|
7
|
+
def call(context)
|
8
|
+
if eventstream_member = eventstream?(context)
|
9
|
+
attach_eventstream_listeners(context, eventstream_member)
|
10
|
+
end
|
11
|
+
@handler.call(context)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def eventstream?(ctx)
|
17
|
+
ctx.operation.output.shape.members.each do |_, ref|
|
18
|
+
return ref if ref.eventstream
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def attach_eventstream_listeners(context, rules)
|
23
|
+
|
24
|
+
context.http_response.on_headers(200) do
|
25
|
+
protocol = context.config.api.metadata['protocol']
|
26
|
+
context.http_response.body = EventStreamDecoder.new(
|
27
|
+
protocol,
|
28
|
+
rules,
|
29
|
+
context.http_response.body,
|
30
|
+
context[:event_stream_handler])
|
31
|
+
end
|
32
|
+
|
33
|
+
context.http_response.on_success(200) do
|
34
|
+
context.http_response.body = context.http_response.body.events
|
35
|
+
end
|
36
|
+
|
37
|
+
context.http_response.on_error do
|
38
|
+
context.http_response.body = context.http_response.raw_stream
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
module Aws
|
2
|
+
module Binary
|
3
|
+
# @api private
|
4
|
+
class EventParser
|
5
|
+
|
6
|
+
include Seahorse::Model::Shapes
|
7
|
+
|
8
|
+
# @param [Class] parser_class
|
9
|
+
# @param [Seahorse::Model::ShapeRef] rules
|
10
|
+
def initialize(parser_class, rules)
|
11
|
+
@parser_class = parser_class
|
12
|
+
@rules = rules
|
13
|
+
end
|
14
|
+
|
15
|
+
# Parse raw event message into event struct
|
16
|
+
# based on its ShapeRef
|
17
|
+
#
|
18
|
+
# @return [Struct] Event Struct
|
19
|
+
def apply(raw_event)
|
20
|
+
parse(raw_event)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def parse(raw_event)
|
26
|
+
message_type = raw_event.headers.delete(":message-type")
|
27
|
+
if message_type
|
28
|
+
case message_type.value
|
29
|
+
when 'error'
|
30
|
+
parse_error_event(raw_event)
|
31
|
+
when 'event'
|
32
|
+
parse_event(raw_event)
|
33
|
+
when 'exception'
|
34
|
+
# Pending
|
35
|
+
raise Aws::Errors::EventStreamParserError.new(
|
36
|
+
':exception event parsing is not supported')
|
37
|
+
else
|
38
|
+
raise Aws::Errors::EventStreamParserError.new(
|
39
|
+
'Unrecognized :message-type value for the event')
|
40
|
+
end
|
41
|
+
else
|
42
|
+
# no :message-type header, regular event by default
|
43
|
+
parse_event(raw_event)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def parse_error_event(raw_event)
|
48
|
+
error_code = raw_event.headers.delete(":error-code")
|
49
|
+
error_message = raw_event.headers.delete(":error-message")
|
50
|
+
Aws::Errors::EventError.new(
|
51
|
+
:error,
|
52
|
+
error_code ? error_code.value : error_code,
|
53
|
+
error_message ? error_message.value : error_message
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
def parse_event(raw_event)
|
58
|
+
event_type = raw_event.headers.delete(":event-type").value
|
59
|
+
# content_type = raw_event.headers.delete(":content-type").value
|
60
|
+
|
61
|
+
# Pending
|
62
|
+
if event_type == 'initial-response'
|
63
|
+
raise Aws::Errors::EventStreamParserError.new(
|
64
|
+
'non eventstream member at response is not supported yet'
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
# locate event from eventstream
|
69
|
+
name, ref = @rules.shape.member_by_location_name(event_type)
|
70
|
+
raise "Non event member found at eventstream" unless ref.event
|
71
|
+
|
72
|
+
event = ref.shape.struct_class.new
|
73
|
+
event.event_type = name
|
74
|
+
# locate payload and headers in the event
|
75
|
+
ref.shape.members.each do |member_name, member_ref|
|
76
|
+
if member_ref.eventpayload
|
77
|
+
eventpayload_streaming?(member_ref) ?
|
78
|
+
event.send("#{member_name}=", raw_event.payload) :
|
79
|
+
event.send("#{member_name}=", parse_payload(raw_event.payload.read, member_ref))
|
80
|
+
elsif member_ref.eventheader
|
81
|
+
# allow incomplete event members in response
|
82
|
+
if raw_event.headers.key?(member_ref.location_name)
|
83
|
+
event.send("#{member_name}=", raw_event.headers[member_ref.location_name].value)
|
84
|
+
end
|
85
|
+
else
|
86
|
+
raise "Non eventpayload or eventheader member found at event"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
event
|
91
|
+
end
|
92
|
+
|
93
|
+
def eventpayload_streaming?(ref)
|
94
|
+
BlobShape === ref.shape || StringShape === ref.shape
|
95
|
+
end
|
96
|
+
|
97
|
+
def parse_payload(body, rules)
|
98
|
+
@parser_class.new(rules).parse(body) if body.size > 0
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'aws-eventstream'
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
module Binary
|
5
|
+
# @api private
|
6
|
+
class EventStreamDecoder
|
7
|
+
|
8
|
+
# @param [String] protocol
|
9
|
+
# @param [ShapeRef] rules ShapeRef of the eventstream member
|
10
|
+
# @param [EventStream|nil] event_stream_handler A Service EventStream object
|
11
|
+
# that registered with callbacks for processing events when they arrive
|
12
|
+
def initialize(protocol, rules, io, event_stream_handler = nil)
|
13
|
+
@decoder = Aws::EventStream::Decoder.new
|
14
|
+
@event_parser = EventParser.new(parser_class(protocol), rules)
|
15
|
+
@stream_class = extract_stream_class(rules.shape.struct_class)
|
16
|
+
@emitter = event_stream_handler.event_emitter
|
17
|
+
@events = []
|
18
|
+
end
|
19
|
+
|
20
|
+
# @return [Array] events Array of arrived event objects
|
21
|
+
attr_reader :events
|
22
|
+
|
23
|
+
def write(chunk)
|
24
|
+
raw_event, eof = @decoder.decode_chunk(chunk)
|
25
|
+
emit_event(raw_event) if raw_event
|
26
|
+
while !eof
|
27
|
+
# exhaust message_buffer data
|
28
|
+
raw_event, eof = @decoder.decode_chunk
|
29
|
+
emit_event(raw_event) if raw_event
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def emit_event(raw_event)
|
36
|
+
event = @event_parser.apply(raw_event)
|
37
|
+
@events << event
|
38
|
+
@emitter.signal(event.event_type, event) unless @emitter.nil?
|
39
|
+
end
|
40
|
+
|
41
|
+
def parser_class(protocol)
|
42
|
+
case protocol
|
43
|
+
when 'rest-xml' then Aws::Xml::Parser
|
44
|
+
when 'rest-json' then Aws::Json::Parser
|
45
|
+
else raise "unsupported protocol #{protocol} for event stream"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def extract_stream_class(type_class)
|
50
|
+
parts = type_class.to_s.split('::')
|
51
|
+
parts.inject(Kernel) do |const, part_name|
|
52
|
+
part_name == 'Types' ? const.const_get('EventStreams')
|
53
|
+
: const.const_get(part_name)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
data/lib/aws-sdk-core/errors.rb
CHANGED
@@ -34,6 +34,41 @@ module Aws
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
# Raised when EventStream Parser failed to parse
|
38
|
+
# a raw event message
|
39
|
+
class EventStreamParserError < RuntimeError; end
|
40
|
+
|
41
|
+
# Error event in an event stream which has event_type :error
|
42
|
+
# error code and error message can be retrieved when available.
|
43
|
+
#
|
44
|
+
# example usage:
|
45
|
+
#
|
46
|
+
# client.stream_foo(name: 'bar') do |event|
|
47
|
+
# stream.on_error_event do |event|
|
48
|
+
# puts "Error #{event.error_code}: #{event.error_message}"
|
49
|
+
# raise event
|
50
|
+
# end
|
51
|
+
# end
|
52
|
+
#
|
53
|
+
class EventError < RuntimeError
|
54
|
+
|
55
|
+
def initialize(event_type, code, message)
|
56
|
+
@event_type = event_type
|
57
|
+
@error_code = code
|
58
|
+
@error_message = message
|
59
|
+
end
|
60
|
+
|
61
|
+
# @return [Symbol]
|
62
|
+
attr_reader :event_type
|
63
|
+
|
64
|
+
# @return [String]
|
65
|
+
attr_reader :error_code
|
66
|
+
|
67
|
+
# @return [String]
|
68
|
+
attr_reader :error_message
|
69
|
+
|
70
|
+
end
|
71
|
+
|
37
72
|
# Various plugins perform client-side checksums of responses.
|
38
73
|
# This error indicates a checksum failed.
|
39
74
|
class ChecksumError < RuntimeError; end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class EventEmitter
|
2
|
+
|
3
|
+
def initialize
|
4
|
+
@listeners = {}
|
5
|
+
end
|
6
|
+
|
7
|
+
def on(type, callback)
|
8
|
+
(@listeners[type] ||= []) << callback
|
9
|
+
end
|
10
|
+
|
11
|
+
def signal(type, event)
|
12
|
+
return unless @listeners[type]
|
13
|
+
@listeners[type].each do |listener|
|
14
|
+
listener.call(event) if event.event_type == type
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -38,28 +38,48 @@ module Aws
|
|
38
38
|
# ensure the value is hash like
|
39
39
|
return unless correct_type?(ref, values, errors, context)
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
41
|
+
if ref.eventstream
|
42
|
+
values.each do |value|
|
43
|
+
# each event is structure type
|
44
|
+
case value[:message_type]
|
45
|
+
when 'event'
|
46
|
+
val = value.dup
|
47
|
+
val.delete(:message_type)
|
48
|
+
structure(ref.shape.member(val[:event_type]), val, errors, context)
|
49
|
+
when 'error' # Error is unmodeled
|
50
|
+
when 'exception' # Pending
|
51
|
+
raise Aws::Errors::EventStreamParserError.new(
|
52
|
+
':exception event validation is not supported')
|
53
|
+
end
|
54
|
+
end
|
55
|
+
else
|
56
|
+
shape = ref.shape
|
57
|
+
|
58
|
+
# ensure required members are present
|
59
|
+
if @validate_required
|
60
|
+
shape.required.each do |member_name|
|
61
|
+
if values[member_name].nil?
|
62
|
+
param = "#{context}[#{member_name.inspect}]"
|
63
|
+
errors << "missing required parameter #{param}"
|
64
|
+
end
|
49
65
|
end
|
50
66
|
end
|
51
|
-
end
|
52
67
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
68
|
+
# validate non-nil members
|
69
|
+
values.each_pair do |name, value|
|
70
|
+
unless value.nil?
|
71
|
+
# :event_type is not modeled
|
72
|
+
# and also needed when construct body
|
73
|
+
next if name == :event_type
|
74
|
+
if shape.member?(name)
|
75
|
+
member_ref = shape.member(name)
|
76
|
+
shape(member_ref, value, errors, context + "[#{name.inspect}]")
|
77
|
+
else
|
78
|
+
errors << "unexpected value at #{context}[#{name.inspect}]"
|
79
|
+
end
|
61
80
|
end
|
62
81
|
end
|
82
|
+
|
63
83
|
end
|
64
84
|
end
|
65
85
|
|
@@ -130,6 +150,7 @@ module Aws
|
|
130
150
|
case value
|
131
151
|
when Hash then true
|
132
152
|
when ref.shape.struct_class then true
|
153
|
+
when Enumerator then ref.eventstream && value.respond_to?(:event_types)
|
133
154
|
else
|
134
155
|
errors << expected_got(context, "a hash", value)
|
135
156
|
false
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Aws
|
2
|
+
module Plugins
|
3
|
+
|
4
|
+
class EventStreamConfiguration < Seahorse::Client::Plugin
|
5
|
+
|
6
|
+
option(:event_stream_handler,
|
7
|
+
default: nil,
|
8
|
+
doc_type: 'Proc',
|
9
|
+
docstring: <<-DOCS)
|
10
|
+
When an EventStream or Proc object is provided, it will be used as callback for each chunk of event stream response received along the way.
|
11
|
+
DOCS
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -15,7 +15,9 @@ module Aws
|
|
15
15
|
# @param [IO] body
|
16
16
|
# @param [Hash, Struct] data
|
17
17
|
def apply(body, data)
|
18
|
-
if
|
18
|
+
if event_stream?
|
19
|
+
data[@rules[:payload]] = parse_eventstream(body)
|
20
|
+
elsif streaming?
|
19
21
|
data[@rules[:payload]] = body
|
20
22
|
elsif @rules[:payload]
|
21
23
|
data[@rules[:payload]] = parse(body.read, @rules[:payload_member])
|
@@ -26,6 +28,10 @@ module Aws
|
|
26
28
|
|
27
29
|
private
|
28
30
|
|
31
|
+
def event_stream?
|
32
|
+
@rules[:payload] && @rules[:payload_member].eventstream
|
33
|
+
end
|
34
|
+
|
29
35
|
def streaming?
|
30
36
|
@rules[:payload] && (
|
31
37
|
BlobShape === @rules[:payload_member].shape ||
|
@@ -37,6 +43,13 @@ module Aws
|
|
37
43
|
@parser_class.new(rules).parse(body, target) if body.size > 0
|
38
44
|
end
|
39
45
|
|
46
|
+
def parse_eventstream(body)
|
47
|
+
# body contains an array of parsed event when they arrive
|
48
|
+
@rules[:payload_member].shape.struct_class.new do |payload|
|
49
|
+
body.each { |event| payload << event }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
40
53
|
end
|
41
54
|
end
|
42
55
|
end
|
@@ -29,7 +29,10 @@ module Aws
|
|
29
29
|
|
30
30
|
def extract_body(rules, response)
|
31
31
|
Body.new(parser_class(response), rules).
|
32
|
-
apply(
|
32
|
+
apply(
|
33
|
+
response.context.http_response.body,
|
34
|
+
response.data
|
35
|
+
)
|
33
36
|
end
|
34
37
|
|
35
38
|
def parser_class(response)
|
@@ -36,7 +36,10 @@ module Aws
|
|
36
36
|
|
37
37
|
def stub_structure(ref, visited)
|
38
38
|
ref.shape.members.inject(ref.shape.struct_class.new) do |struct, (mname, mref)|
|
39
|
-
|
39
|
+
# For eventstream shape, it returns an Enumerator
|
40
|
+
unless mref.eventstream
|
41
|
+
struct[mname] = stub_ref(mref, visited)
|
42
|
+
end
|
40
43
|
struct
|
41
44
|
end
|
42
45
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'aws-eventstream'
|
2
|
+
|
1
3
|
module Aws
|
2
4
|
module Stubbing
|
3
5
|
module Protocols
|
@@ -74,6 +76,77 @@ module Aws
|
|
74
76
|
operation.http_method == "HEAD"
|
75
77
|
end
|
76
78
|
|
79
|
+
def eventstream?(rules)
|
80
|
+
rules.eventstream
|
81
|
+
end
|
82
|
+
|
83
|
+
def encode_eventstream_response(rules, data, builder)
|
84
|
+
data.inject('') do |stream, event_data|
|
85
|
+
# construct message headers and payload
|
86
|
+
opts = {headers: {}}
|
87
|
+
case event_data.delete(:message_type)
|
88
|
+
when 'event'
|
89
|
+
encode_event(opts, rules, event_data, builder)
|
90
|
+
when 'error'
|
91
|
+
# errors are unmodeled
|
92
|
+
encode_error(opts, event_data)
|
93
|
+
when 'exception'
|
94
|
+
# Pending
|
95
|
+
raise 'Stubbing :exception event is not supported'
|
96
|
+
end
|
97
|
+
stream << Aws::EventStream::Encoder.new.encode(
|
98
|
+
Aws::EventStream::Message.new(opts))
|
99
|
+
stream
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def encode_error(opts, event_data)
|
104
|
+
opts[:headers][':error-message'] = Aws::EventStream::HeaderValue.new(
|
105
|
+
value: event_data[:error_message],
|
106
|
+
type: 'string'
|
107
|
+
)
|
108
|
+
opts[:headers][':error-code'] = Aws::EventStream::HeaderValue.new(
|
109
|
+
value: event_data[:error_code],
|
110
|
+
type: 'string'
|
111
|
+
)
|
112
|
+
opts[:headers][':message-type'] = Aws::EventStream::HeaderValue.new(
|
113
|
+
value: 'error',
|
114
|
+
type: 'string'
|
115
|
+
)
|
116
|
+
opts
|
117
|
+
end
|
118
|
+
|
119
|
+
def encode_event(opts, rules, event_data, builder)
|
120
|
+
event_ref = rules.shape.member(event_data.delete(:event_type))
|
121
|
+
event_data.each do |k, v|
|
122
|
+
member_ref = event_ref.shape.member(k)
|
123
|
+
if member_ref.eventheader
|
124
|
+
opts[:headers][member_ref.location_name] = Aws::EventStream::HeaderValue.new(
|
125
|
+
value: v,
|
126
|
+
type: member_ref.eventheader_type
|
127
|
+
)
|
128
|
+
elsif member_ref.eventpayload
|
129
|
+
case member_ref.eventpayload_type
|
130
|
+
when 'string'
|
131
|
+
opts[:payload] = StringIO.new(v)
|
132
|
+
when 'blob'
|
133
|
+
opts[:payload] = v
|
134
|
+
when 'structure'
|
135
|
+
opts[:payload] = StringIO.new(builder.new(member_ref).serialize(v))
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
opts[:headers][':event-type'] = Aws::EventStream::HeaderValue.new(
|
140
|
+
value: event_ref.location_name,
|
141
|
+
type: 'string'
|
142
|
+
)
|
143
|
+
opts[:headers][':message-type'] = Aws::EventStream::HeaderValue.new(
|
144
|
+
value: 'event',
|
145
|
+
type: 'string'
|
146
|
+
)
|
147
|
+
opts
|
148
|
+
end
|
149
|
+
|
77
150
|
end
|
78
151
|
end
|
79
152
|
end
|
@@ -4,7 +4,11 @@ module Aws
|
|
4
4
|
class RestJson < Rest
|
5
5
|
|
6
6
|
def body_for(_, _, rules, data)
|
7
|
-
|
7
|
+
if eventstream?(rules)
|
8
|
+
encode_eventstream_response(rules, data, Aws::Json::Builder)
|
9
|
+
else
|
10
|
+
Aws::Json::Builder.new(rules).serialize(data)
|
11
|
+
end
|
8
12
|
end
|
9
13
|
|
10
14
|
def stub_error(error_code)
|
@@ -6,11 +6,15 @@ module Aws
|
|
6
6
|
include Seahorse::Model::Shapes
|
7
7
|
|
8
8
|
def body_for(api, operation, rules, data)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
if eventstream?(rules)
|
10
|
+
encode_eventstream_response(rules, data, Xml::Builder)
|
11
|
+
else
|
12
|
+
xml = []
|
13
|
+
rules.location_name = operation.name + 'Result'
|
14
|
+
rules['xmlNamespace'] = { 'uri' => api.metadata['xmlNamespace'] }
|
15
|
+
Xml::Builder.new(rules, target:xml).to_xml(data)
|
16
|
+
xml.join
|
17
|
+
end
|
14
18
|
end
|
15
19
|
|
16
20
|
def stub_error(error_code)
|
data/lib/aws-sdk-sts.rb
CHANGED
data/lib/aws-sdk-sts/client.rb
CHANGED
@@ -10,6 +10,7 @@ module Seahorse
|
|
10
10
|
@status_code = options[:status_code] || 0
|
11
11
|
@headers = options[:headers] || Headers.new
|
12
12
|
@body = options[:body] || StringIO.new
|
13
|
+
@raw_stream = options[:raw_stream] || StringIO.new
|
13
14
|
@listeners = Hash.new { |h,k| h[k] = [] }
|
14
15
|
@complete = false
|
15
16
|
@done = nil
|
@@ -26,6 +27,12 @@ module Seahorse
|
|
26
27
|
# @return [StandardError, nil]
|
27
28
|
attr_reader :error
|
28
29
|
|
30
|
+
# Raw binary stream data used for eventstream only
|
31
|
+
# body is concatenated parsed event structs in StringIO
|
32
|
+
#
|
33
|
+
# @return [IO]
|
34
|
+
attr_accessor :raw_stream
|
35
|
+
|
29
36
|
# @return [IO]
|
30
37
|
def body
|
31
38
|
@body
|
@@ -59,6 +66,9 @@ module Seahorse
|
|
59
66
|
# @param [string] chunk
|
60
67
|
def signal_data(chunk)
|
61
68
|
unless chunk == ''
|
69
|
+
# record raw binary stream for eventstream
|
70
|
+
# in case error happens, body is used for emit/track events
|
71
|
+
@raw_stream.write(chunk)
|
62
72
|
@body.write(chunk)
|
63
73
|
emit(:data, chunk)
|
64
74
|
end
|
@@ -10,6 +10,12 @@ module Seahorse
|
|
10
10
|
@metadata = {}
|
11
11
|
@required = false
|
12
12
|
@deprecated = false
|
13
|
+
@event = false
|
14
|
+
@eventstream = false
|
15
|
+
@eventpayload = false
|
16
|
+
@eventpayload_type = ''
|
17
|
+
@eventheader = false
|
18
|
+
@eventheader_type = ''
|
13
19
|
options.each do |key, value|
|
14
20
|
if key == :metadata
|
15
21
|
value.each do |k,v|
|
@@ -33,6 +39,24 @@ module Seahorse
|
|
33
39
|
# @return [Boolean]
|
34
40
|
attr_accessor :deprecated
|
35
41
|
|
42
|
+
# @return [Boolean]
|
43
|
+
attr_accessor :event
|
44
|
+
|
45
|
+
# @return [Boolean]
|
46
|
+
attr_accessor :eventstream
|
47
|
+
|
48
|
+
# @return [Boolean]
|
49
|
+
attr_accessor :eventpayload
|
50
|
+
|
51
|
+
# @return [Boolean]
|
52
|
+
attr_accessor :eventheader
|
53
|
+
|
54
|
+
# @return [String]
|
55
|
+
attr_accessor :eventpayload_type
|
56
|
+
|
57
|
+
# @return [Boolean]
|
58
|
+
attr_accessor :eventheader_type
|
59
|
+
|
36
60
|
# @return [String, nil]
|
37
61
|
def location
|
38
62
|
@location || (shape && shape[:location])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jmespath
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: aws-eventstream
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.0'
|
55
69
|
description: Provides API clients for AWS. This gem is part of the official AWS SDK
|
56
70
|
for Ruby.
|
57
71
|
email:
|
@@ -63,6 +77,10 @@ files:
|
|
63
77
|
- ca-bundle.crt
|
64
78
|
- lib/aws-sdk-core.rb
|
65
79
|
- lib/aws-sdk-core/assume_role_credentials.rb
|
80
|
+
- lib/aws-sdk-core/binary.rb
|
81
|
+
- lib/aws-sdk-core/binary/decode_handler.rb
|
82
|
+
- lib/aws-sdk-core/binary/event_parser.rb
|
83
|
+
- lib/aws-sdk-core/binary/event_stream_decoder.rb
|
66
84
|
- lib/aws-sdk-core/client_stubs.rb
|
67
85
|
- lib/aws-sdk-core/credential_provider.rb
|
68
86
|
- lib/aws-sdk-core/credential_provider_chain.rb
|
@@ -71,6 +89,7 @@ files:
|
|
71
89
|
- lib/aws-sdk-core/eager_loader.rb
|
72
90
|
- lib/aws-sdk-core/ecs_credentials.rb
|
73
91
|
- lib/aws-sdk-core/errors.rb
|
92
|
+
- lib/aws-sdk-core/event_emitter.rb
|
74
93
|
- lib/aws-sdk-core/ini_parser.rb
|
75
94
|
- lib/aws-sdk-core/instance_profile_credentials.rb
|
76
95
|
- lib/aws-sdk-core/json.rb
|
@@ -93,6 +112,7 @@ files:
|
|
93
112
|
- lib/aws-sdk-core/plugins/apig_credentials_configuration.rb
|
94
113
|
- lib/aws-sdk-core/plugins/apig_user_agent.rb
|
95
114
|
- lib/aws-sdk-core/plugins/credentials_configuration.rb
|
115
|
+
- lib/aws-sdk-core/plugins/event_stream_configuration.rb
|
96
116
|
- lib/aws-sdk-core/plugins/global_configuration.rb
|
97
117
|
- lib/aws-sdk-core/plugins/helpful_socket_errors.rb
|
98
118
|
- lib/aws-sdk-core/plugins/idempotency_token.rb
|