aws-sdk-core 2.0.14 → 2.0.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a99189f526a93bcec29b923fe86029330596817
4
- data.tar.gz: 92810773845a6032bf64e39f27071272469c7aac
3
+ metadata.gz: 84fc88b74b44f8ef7c02f5d7a4a75ebc2f932aa7
4
+ data.tar.gz: 0706c496c2feca0125dceabe8ffcc09b3fb7a9ad
5
5
  SHA512:
6
- metadata.gz: 2c624911af7b139069028fafb48868028759f887d081ff244d7e40f1a0e61833d4734064741659cdac01e1dab1878f35805ffe7f217d41dfb5010f90c172b228
7
- data.tar.gz: 12920d0e861bb7ef3acd35a7a18a59e0a08297e6432f39fdf8592b9ab9cfce974f225ff22f491ec550294d2ddc66e34e07baabdd4bc77b66ade3e340cfd785d5
6
+ metadata.gz: f5e2875fe0423c6db01c9be6db915ca89462ff4cb44f99ddaa6a41a104a7b3eb22ca591fd78caa580f9674fe6009e2b1c0fe54753c56b554883e4d14a6ea7b36
7
+ data.tar.gz: 68bb2fc0e47ee3923be741bca221aa98926e268d0d361ff15e62dc68b5361b86751ff60190a57156aba293580f78f65676511aa25493a80a6e31abdeb29f72fe
@@ -456,7 +456,9 @@
456
456
  "VisibleToAllUsers":{"shape":"Boolean"},
457
457
  "Applications":{"shape":"ApplicationList"},
458
458
  "Tags":{"shape":"TagList"},
459
- "ServiceRole":{"shape":"String"}
459
+ "ServiceRole":{"shape":"String"},
460
+ "NormalizedInstanceHours":{"shape":"Integer"},
461
+ "MasterPublicDnsName":{"shape":"String"}
460
462
  }
461
463
  },
462
464
  "ClusterId":{"type":"string"},
@@ -508,7 +510,8 @@
508
510
  "members":{
509
511
  "Id":{"shape":"ClusterId"},
510
512
  "Name":{"shape":"String"},
511
- "Status":{"shape":"ClusterStatus"}
513
+ "Status":{"shape":"ClusterStatus"},
514
+ "NormalizedInstanceHours":{"shape":"Integer"}
512
515
  }
513
516
  },
514
517
  "ClusterSummaryList":{
@@ -1044,6 +1047,7 @@
1044
1047
  "members":{
1045
1048
  "ClusterId":{"shape":"ClusterId"},
1046
1049
  "StepStates":{"shape":"StepStateList"},
1050
+ "StepIds":{"shape":"XmlStringList"},
1047
1051
  "Marker":{"shape":"Marker"}
1048
1052
  }
1049
1053
  },
@@ -1265,6 +1269,8 @@
1265
1269
  "members":{
1266
1270
  "Id":{"shape":"StepId"},
1267
1271
  "Name":{"shape":"String"},
1272
+ "Config":{"shape":"HadoopStepConfig"},
1273
+ "ActionOnFailure":{"shape":"ActionOnFailure"},
1268
1274
  "Status":{"shape":"StepStatus"}
1269
1275
  }
1270
1276
  },
@@ -0,0 +1,42 @@
1
+ {
2
+ "version": 2,
3
+ "waiters": {
4
+ "ClusterRunning": {
5
+ "delay": 30,
6
+ "operation": "DescribeCluster",
7
+ "maxAttempts": 60,
8
+ "acceptors": [
9
+ {
10
+ "state": "success",
11
+ "matcher": "path",
12
+ "argument": "Cluster.Status.State",
13
+ "expected": "RUNNING"
14
+ },
15
+ {
16
+ "state": "success",
17
+ "matcher": "path",
18
+ "argument": "Cluster.Status.State",
19
+ "expected": "WAITING"
20
+ },
21
+ {
22
+ "state": "failure",
23
+ "matcher": "path",
24
+ "argument": "Cluster.Status.State",
25
+ "expected": "TERMINATING"
26
+ },
27
+ {
28
+ "state": "failure",
29
+ "matcher": "path",
30
+ "argument": "Cluster.Status.State",
31
+ "expected": "TERMINATED"
32
+ },
33
+ {
34
+ "state": "failure",
35
+ "matcher": "path",
36
+ "argument": "Cluster.Status.State",
37
+ "expected": "TERMINATED_WITH_ERRORS"
38
+ }
39
+ ]
40
+ }
41
+ }
42
+ }
@@ -786,6 +786,27 @@
786
786
  }
787
787
  ]
788
788
  },
789
+ "ResetCache":{
790
+ "name":"ResetCache",
791
+ "http":{
792
+ "method":"POST",
793
+ "requestUri":"/"
794
+ },
795
+ "input":{"shape":"ResetCacheInput"},
796
+ "output":{"shape":"ResetCacheOutput"},
797
+ "errors":[
798
+ {
799
+ "shape":"InvalidGatewayRequestException",
800
+ "error":{"httpStatusCode":400},
801
+ "exception":true
802
+ },
803
+ {
804
+ "shape":"InternalServerError",
805
+ "error":{"httpStatusCode":500},
806
+ "exception":true
807
+ }
808
+ ]
809
+ },
789
810
  "RetrieveTapeArchive":{
790
811
  "name":"RetrieveTapeArchive",
791
812
  "http":{
@@ -995,6 +1016,27 @@
995
1016
  "exception":true
996
1017
  }
997
1018
  ]
1019
+ },
1020
+ "UpdateVTLDeviceType":{
1021
+ "name":"UpdateVTLDeviceType",
1022
+ "http":{
1023
+ "method":"POST",
1024
+ "requestUri":"/"
1025
+ },
1026
+ "input":{"shape":"UpdateVTLDeviceTypeInput"},
1027
+ "output":{"shape":"UpdateVTLDeviceTypeOutput"},
1028
+ "errors":[
1029
+ {
1030
+ "shape":"InvalidGatewayRequestException",
1031
+ "error":{"httpStatusCode":400},
1032
+ "exception":true
1033
+ },
1034
+ {
1035
+ "shape":"InternalServerError",
1036
+ "error":{"httpStatusCode":500},
1037
+ "exception":true
1038
+ }
1039
+ ]
998
1040
  }
999
1041
  },
1000
1042
  "shapes":{
@@ -1615,6 +1657,11 @@
1615
1657
  "min":1,
1616
1658
  "max":255
1617
1659
  },
1660
+ "DeviceType":{
1661
+ "type":"string",
1662
+ "min":2,
1663
+ "max":50
1664
+ },
1618
1665
  "DeviceiSCSIAttributes":{
1619
1666
  "type":"structure",
1620
1667
  "members":{
@@ -1643,6 +1690,7 @@
1643
1690
  "DiskId":{"shape":"DiskId"},
1644
1691
  "DiskPath":{"shape":"string"},
1645
1692
  "DiskNode":{"shape":"string"},
1693
+ "DiskStatus":{"shape":"string"},
1646
1694
  "DiskSizeInBytes":{"shape":"long"},
1647
1695
  "DiskAllocationType":{"shape":"DiskAllocationType"},
1648
1696
  "DiskAllocationResource":{"shape":"string"}
@@ -1924,6 +1972,19 @@
1924
1972
  "min":1,
1925
1973
  "max":25
1926
1974
  },
1975
+ "ResetCacheInput":{
1976
+ "type":"structure",
1977
+ "required":["GatewayARN"],
1978
+ "members":{
1979
+ "GatewayARN":{"shape":"GatewayARN"}
1980
+ }
1981
+ },
1982
+ "ResetCacheOutput":{
1983
+ "type":"structure",
1984
+ "members":{
1985
+ "GatewayARN":{"shape":"GatewayARN"}
1986
+ }
1987
+ },
1927
1988
  "RetrieveTapeArchiveInput":{
1928
1989
  "type":"structure",
1929
1990
  "required":[
@@ -2086,11 +2147,7 @@
2086
2147
  "member":{"shape":"TapeRecoveryPointInfo"}
2087
2148
  },
2088
2149
  "TapeRecoveryPointStatus":{"type":"string"},
2089
- "TapeSize":{
2090
- "type":"long",
2091
- "min":107374182400,
2092
- "max":2748779069440
2093
- },
2150
+ "TapeSize":{"type":"long"},
2094
2151
  "TapeStatus":{"type":"string"},
2095
2152
  "Tapes":{
2096
2153
  "type":"list",
@@ -2213,6 +2270,23 @@
2213
2270
  "VolumeARN":{"shape":"VolumeARN"}
2214
2271
  }
2215
2272
  },
2273
+ "UpdateVTLDeviceTypeInput":{
2274
+ "type":"structure",
2275
+ "required":[
2276
+ "VTLDeviceARN",
2277
+ "DeviceType"
2278
+ ],
2279
+ "members":{
2280
+ "VTLDeviceARN":{"shape":"VTLDeviceARN"},
2281
+ "DeviceType":{"shape":"DeviceType"}
2282
+ }
2283
+ },
2284
+ "UpdateVTLDeviceTypeOutput":{
2285
+ "type":"structure",
2286
+ "members":{
2287
+ "VTLDeviceARN":{"shape":"VTLDeviceARN"}
2288
+ }
2289
+ },
2216
2290
  "VTLDevice":{
2217
2291
  "type":"structure",
2218
2292
  "members":{
@@ -124,6 +124,7 @@ module Aws
124
124
  autoload :CSDConditionalSigning, 'aws-sdk-core/plugins/csd_conditional_signing'
125
125
  autoload :DynamoDBExtendedRetries, 'aws-sdk-core/plugins/dynamodb_extended_retries'
126
126
  autoload :DynamoDBSimpleAttributes, 'aws-sdk-core/plugins/dynamodb_simple_attributes'
127
+ autoload :DynamoDBCRC32Validation, 'aws-sdk-core/plugins/dynamodb_crc32_validation'
127
128
  autoload :EC2CopyEncryptedSnapshot, 'aws-sdk-core/plugins/ec2_copy_encrypted_snapshot'
128
129
  autoload :GlacierAccountId, 'aws-sdk-core/plugins/glacier_account_id'
129
130
  autoload :GlacierApiVersion, 'aws-sdk-core/plugins/glacier_api_version'
@@ -67,6 +67,7 @@ module Aws
67
67
  customize 'dynamodb' do
68
68
  add_plugin 'Aws::Plugins::DynamoDBExtendedRetries'
69
69
  add_plugin 'Aws::Plugins::DynamoDBSimpleAttributes'
70
+ add_plugin 'Aws::Plugins::DynamoDBCRC32Validation'
70
71
  end
71
72
 
72
73
  customize 'ec2' do
@@ -7,8 +7,9 @@ module Aws
7
7
  def call(context)
8
8
  build_json(context)
9
9
  @handler.call(context).on_success do |response|
10
- response.error = nil
11
- response.data = parse_json(context)
10
+ unless response.error
11
+ response.data = parse_json(context)
12
+ end
12
13
  end
13
14
  end
14
15
 
@@ -0,0 +1,52 @@
1
+ module Aws
2
+ module Plugins
3
+
4
+ # @seahorse.client.option [Boolean] :compute_checksums (true)
5
+ # When `true`, a CRC32 checksum is computed of every HTTP
6
+ # response body and compared against the `X-Amz-Crc32` header.
7
+ # If the checksums do not match, the request is re-sent.
8
+ # Failures can be retried up to `:retry_limit` times.
9
+ class DynamoDBCRC32Validation < Seahorse::Client::Plugin
10
+
11
+ option(:compute_checksums, true)
12
+
13
+ def add_handlers(handlers, config)
14
+ if config.compute_checksums
15
+ handlers.add(Handler, step: :sign)
16
+ end
17
+ end
18
+
19
+ class Handler < Seahorse::Client::Handler
20
+
21
+ def call(context)
22
+ # disable response gzipping - Net::HTTP unzips these responses
23
+ # before we can see the body, making it impossible to verify
24
+ # the CRC32 checksum against the compressed body stream
25
+ context.http_request.headers['accept-encoding'] = ''
26
+
27
+ @handler.call(context).on_success do |response|
28
+ response.error = validate(context)
29
+ end
30
+ end
31
+
32
+ private
33
+
34
+ def validate(context)
35
+ unless crc32_is_valid?(context.http_response)
36
+ msg = "Response failed CRC32 check."
37
+ return Aws::DynamoDB::Errors::CRC32CheckFailed.new(context, msg)
38
+ end
39
+ end
40
+
41
+ def crc32_is_valid?(response)
42
+ if crc_checksum = response.headers['x-amz-crc32']
43
+ crc_checksum.to_i == Zlib.crc32(response.body_contents)
44
+ else
45
+ true
46
+ end
47
+ end
48
+
49
+ end
50
+ end
51
+ end
52
+ end
@@ -61,7 +61,7 @@ module Aws
61
61
  end
62
62
 
63
63
  def networking?
64
- @error.is_a?(Seahorse::Client::Http::Error) ||
64
+ @error.is_a?(Seahorse::Client::NetworkingError) ||
65
65
  NETWORKING_ERRORS.include?(@name) ||
66
66
  @http_status_code == 0
67
67
  end
@@ -115,7 +115,7 @@ module Aws
115
115
  context.retries += 1
116
116
  context.config.credentials.refresh! if error.expired_credentials?
117
117
  context.http_request.body.rewind
118
- context.http_response.body.truncate(0)
118
+ context.http_response.reset
119
119
  call(context)
120
120
  end
121
121
 
@@ -57,7 +57,7 @@ module Aws
57
57
  when 'structure' then structure(shape, value, prefix + '.')
58
58
  when 'list' then list(shape, value, prefix)
59
59
  when 'map' then raise NotImplementedError
60
- when 'blob' then set(prefix, Base64.strict_encode64(value))
60
+ when 'blob' then set(prefix, Base64.strict_encode64(value.read))
61
61
  when 'timestamp'
62
62
  set(prefix, shape.format_time(value, 'iso8601').to_s)
63
63
  else
@@ -80,7 +80,7 @@ module Aws
80
80
  when 'structure' then structure(shape, value, prefix + '.')
81
81
  when 'list' then list(shape, value, prefix)
82
82
  when 'map' then map(shape, value, prefix)
83
- when 'blob' then set(prefix, Base64.strict_encode64(value))
83
+ when 'blob' then set(prefix, Base64.strict_encode64(value.read))
84
84
  when 'timestamp'
85
85
  set(prefix, shape.format_time(value, 'iso8601').to_s)
86
86
  else
@@ -1,3 +1,3 @@
1
1
  module Aws
2
- VERSION = '2.0.14'
2
+ VERSION = '2.0.15'
3
3
  end
@@ -66,7 +66,7 @@ module Aws
66
66
  when 'structure' then structure(name, shape, value)
67
67
  when 'list' then list(name, shape, value)
68
68
  when 'timestamp' then node(name, shape, shape.format_time(value, 'iso8601'))
69
- when 'blob' then node(name, shape, Base64.strict_encode64(value))
69
+ when 'blob' then node(name, shape, Base64.strict_encode64(value.read))
70
70
  when 'map' then raise NotImplementedError, 'not supported'
71
71
  else
72
72
  node(name, shape, value.to_s)
@@ -12,6 +12,7 @@ module Seahorse
12
12
  autoload :HandlerList, 'seahorse/client/handler_list'
13
13
  autoload :HandlerListEntry, 'seahorse/client/handler_list_entry'
14
14
  autoload :ManagedFile, 'seahorse/client/managed_file'
15
+ autoload :NetworkingError, 'seahorse/client/networking_error'
15
16
  autoload :ParamConverter, 'seahorse/client/param_converter'
16
17
  autoload :ParamValidator, 'seahorse/client/param_validator'
17
18
  autoload :Plugin, 'seahorse/client/plugin'
@@ -21,7 +22,6 @@ module Seahorse
21
22
  autoload :Response, 'seahorse/client/response'
22
23
 
23
24
  module Http
24
- autoload :Error, 'seahorse/client/http/error'
25
25
  autoload :Headers, 'seahorse/client/http/headers'
26
26
  autoload :Request, 'seahorse/client/http/request'
27
27
  autoload :Response, 'seahorse/client/http/response'
@@ -0,0 +1,21 @@
1
+ module Seahorse
2
+ module Client
3
+ module EventEmitter
4
+
5
+ def initialize(*args)
6
+ @listeners = {}
7
+ super
8
+ end
9
+
10
+ def emit(event_name, *args, &block)
11
+ @listeners[event_name] ||= []
12
+ @listeners[event_name] << Proc.new
13
+ end
14
+
15
+ def signal(event, *args)
16
+ @listeners
17
+ end
18
+
19
+ end
20
+ end
21
+ end
@@ -10,6 +10,8 @@ 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
+ @listeners = Hash.new { |h,k| h[k] = [] }
14
+ @complete = false
13
15
  end
14
16
 
15
17
  # @return [Integer] Returns `0` if the request failed to generate
@@ -22,6 +24,9 @@ module Seahorse
22
24
  # @return [IO]
23
25
  attr_accessor :body
24
26
 
27
+ # @return [StandardError, nil]
28
+ attr_reader :error
29
+
25
30
  # @param [#read, #size, #rewind] io
26
31
  def body=(io)
27
32
  @body = case io
@@ -39,6 +44,133 @@ module Seahorse
39
44
  contents
40
45
  end
41
46
 
47
+ # @param [Integer] status_code
48
+ # @param [Hash<String,String>] headers
49
+ def signal_headers(status_code, headers)
50
+ @status_code = status_code
51
+ @headers = Headers.new(headers)
52
+ emit(:headers, @status_code, @headers)
53
+ end
54
+
55
+ # @param [string] chunk
56
+ def signal_data(chunk)
57
+ unless chunk == ''
58
+ @body.write(chunk)
59
+ emit(:data, chunk)
60
+ end
61
+ end
62
+
63
+ # Completes the http response.
64
+ #
65
+ # @example Completing the response in a singal call
66
+ #
67
+ # http_response.signal_done(
68
+ # status_code: 200,
69
+ # headers: {},
70
+ # body: ''
71
+ # )
72
+ #
73
+ # @example Complete the response in parts
74
+ #
75
+ # # signal headers straight-way
76
+ # http_response.signal_headers(200, {})
77
+ #
78
+ # # signal data as it is received from the socket
79
+ # http_response.signal_data("...")
80
+ # http_response.signal_data("...")
81
+ # http_response.signal_data("...")
82
+ #
83
+ # # signal done once the body data is all written
84
+ # http_response.signal_done
85
+ #
86
+ # @overload signal_done()
87
+ #
88
+ # @overload signal_done(options = {})
89
+ # @option options [required, Integer] :status_code
90
+ # @option options [required, Hash] :headers
91
+ # @option options [required, String] :body
92
+ #
93
+ def signal_done(options = {})
94
+ if options.keys.sort == [:body, :headers, :status_code]
95
+ signal_headers(options[:status_code], options[:headers])
96
+ signal_data(options[:body])
97
+ signal_done
98
+ elsif options.empty?
99
+ @body.rewind if @body.respond_to?(:rewind)
100
+ @done = true
101
+ emit(:done)
102
+ else
103
+ msg = "options must be empty or must contain :status_code, :headers, "
104
+ msg << "and :body"
105
+ raise ArgumentError, msg
106
+ end
107
+ end
108
+
109
+ # @param [StandardError] networking_error
110
+ def signal_error(networking_error)
111
+ @error = networking_error
112
+ signal_done
113
+ end
114
+
115
+ def on_headers(status_code_range = nil, &block)
116
+ @listeners[:headers] << listener(status_code_range, Proc.new)
117
+ end
118
+
119
+ def on_data(&callback)
120
+ @listeners[:data] << Proc.new
121
+ end
122
+
123
+ def on_done(status_code_range, &callback)
124
+ listener = listener(status_code_range, Proc.new)
125
+ if @done
126
+ listener.call
127
+ else
128
+ @listeners[:done] << listener
129
+ end
130
+ end
131
+
132
+ def on_success(status_code_range = 200..599, &callback)
133
+ on_done(status_code_range) do
134
+ unless @error
135
+ yield
136
+ end
137
+ end
138
+ end
139
+
140
+ def on_error(&callback)
141
+ on_done(0..599) do
142
+ if @error
143
+ yield(@error)
144
+ end
145
+ end
146
+ end
147
+
148
+ def reset
149
+ @status_code = 0
150
+ @headers.clear
151
+ @body.truncate(0)
152
+ @error = nil
153
+ end
154
+
155
+ private
156
+
157
+ def listener(range, callback)
158
+ range = range..range if Integer === range
159
+ if range
160
+ lambda do |*args|
161
+ if range.include?(@status_code)
162
+ callback.call(*args)
163
+ end
164
+ end
165
+ else
166
+ callback
167
+ end
168
+ end
169
+
170
+ def emit(event_name, *args)
171
+ @listeners[event_name].each { |listener| listener.call(*args) }
172
+ end
173
+
42
174
  end
43
175
  end
44
176
  end
@@ -22,13 +22,8 @@ module Seahorse
22
22
  # @param [RequestContext] context
23
23
  # @return [Response]
24
24
  def call(context)
25
- response = Response.new(context: context)
26
- begin
27
- transmit(context.config, context.http_request, context.http_response)
28
- rescue *NETWORK_ERRORS => error
29
- response.error = Http::Error.new(error, error_message(context, error))
30
- end
31
- response
25
+ transmit(context.config, context.http_request, context.http_response)
26
+ Response.new(context: context)
32
27
  end
33
28
 
34
29
  # @param [Configuration] config
@@ -39,9 +34,9 @@ module Seahorse
39
34
 
40
35
  private
41
36
 
42
- def error_message(context, error)
37
+ def error_message(req, error)
43
38
  if error.is_a?(SocketError) && error.message == DNS_ERROR_MESSAGE
44
- host = context.http_request.endpoint.host
39
+ host = req.endpoint.host
45
40
  "unable to connect to `#{host}`; SocketError: #{error.message}"
46
41
  else
47
42
  error.message
@@ -49,27 +44,38 @@ module Seahorse
49
44
  end
50
45
 
51
46
  # @param [Configuration] config
52
- # @param [Http::Request] request
53
- # @param [Http::Response] response
47
+ # @param [Http::Request] req
48
+ # @param [Http::Response] resp
54
49
  # @return [void]
55
- def transmit(config, request, response)
56
- pool_for(config).session_for(request.endpoint) do |http|
57
-
58
- http.read_timeout = config.http_read_timeout
59
- http.request(net_http_request(request)) do |resp|
50
+ def transmit(config, req, resp)
51
+ session(config, req) do |http|
52
+ http.request(build_net_request(req)) do |net_resp|
60
53
 
61
- # extract HTTP status code and headers
62
- response.status_code = resp.code.to_i
63
- response.headers.update(response_headers(resp))
54
+ status_code = net_resp.code.to_i
55
+ headers = extract_headers(net_resp)
64
56
 
65
- # read the body in chunks
66
- resp.read_body do |chunk|
67
- response.body.write(chunk)
57
+ resp.signal_headers(status_code, headers)
58
+ net_resp.read_body do |chunk|
59
+ resp.signal_data(chunk)
68
60
  end
69
- response.body.rewind if response.body.respond_to?(:rewind)
61
+ resp.signal_done
70
62
 
71
63
  end
72
64
  end
65
+ rescue *NETWORK_ERRORS => error
66
+ # these are retryable
67
+ error = NetworkingError.new(error, error_message(req, error))
68
+ resp.signal_error(error)
69
+ rescue => error
70
+ # not retryable
71
+ resp.signal_error(error)
72
+ end
73
+
74
+ def session(config, req, &block)
75
+ pool_for(config).session_for(req.endpoint) do |http|
76
+ http.read_timeout = config.http_read_timeout
77
+ yield(http)
78
+ end
73
79
  end
74
80
 
75
81
  # Extracts the {ConnectionPool} configuration options.
@@ -86,7 +92,7 @@ module Seahorse
86
92
  # a {Http::Request}.
87
93
  # @param [Http::Request] request
88
94
  # @return [Net::HTTP::Request]
89
- def net_http_request(request)
95
+ def build_net_request(request)
90
96
  request_class = net_http_request_class(request)
91
97
  req = request_class.new(request.endpoint.request_uri, headers(request))
92
98
  req.body_stream = request.body
@@ -118,7 +124,7 @@ module Seahorse
118
124
 
119
125
  # @param [Net::HTTP::Response] response
120
126
  # @return [Hash<String, String>]
121
- def response_headers(response)
127
+ def extract_headers(response)
122
128
  response.to_hash.inject({}) do |headers, (k, v)|
123
129
  headers[k] = v.first
124
130
  headers
@@ -0,0 +1,15 @@
1
+ module Seahorse
2
+ module Client
3
+ class NetworkingError < StandardError
4
+
5
+ def initialize(error, msg = nil)
6
+ super(msg || error.message)
7
+ set_backtrace(error.backtrace)
8
+ @original_error = error
9
+ end
10
+
11
+ attr_reader :original_error
12
+
13
+ end
14
+ end
15
+ end
@@ -200,7 +200,7 @@ module Seahorse
200
200
  add(Model::Shapes::Blob, IO)
201
201
  add(Model::Shapes::Blob, Tempfile)
202
202
  add(Model::Shapes::Blob, StringIO)
203
- add(Model::Shapes::Blob, String)
203
+ add(Model::Shapes::Blob, String) { |str| StringIO.new(str) }
204
204
 
205
205
  end
206
206
  end
@@ -12,6 +12,9 @@ module Seahorse
12
12
  @error = options[:error]
13
13
  @http_request = @context.http_request
14
14
  @http_response = @context.http_response
15
+ @http_response.on_error do |error|
16
+ @error = error
17
+ end
15
18
  end
16
19
 
17
20
  # @return [RequestContext]
@@ -24,14 +27,21 @@ module Seahorse
24
27
  # @return [StandardError, nil]
25
28
  attr_accessor :error
26
29
 
27
- # @param [Integer,Range<Integer>] status_code_range The block will be
28
- # triggered only for responses with a status code that matches
29
- # the given status code or status code range.
30
+ # @overload on(status_code, &block)
31
+ # @param [Integer] status_code The block will be
32
+ # triggered only for responses with the given status code.
33
+ #
34
+ # @overload on(status_code_range, &block)
35
+ # @param [Range<Integer>] status_code_range The block will be
36
+ # triggered only for responses with a status code that falls
37
+ # witin the given range.
38
+ #
30
39
  # @return [self]
31
- def on(status_code_range, &block)
32
- range = status_code_range
33
- range = range..range if range.is_a?(Integer)
34
- yield(self) if range.include?(status_code)
40
+ def on(range, &block)
41
+ response = self
42
+ @context.http_response.on_success(range) do
43
+ block.call(response)
44
+ end
35
45
  self
36
46
  end
37
47
 
@@ -41,15 +51,10 @@ module Seahorse
41
51
  on(200..299, &block)
42
52
  end
43
53
 
44
- # @param [Boolean] Returns `true` if the http response status
45
- # is a 200 level status code.
54
+ # @return [Boolean] Returns `true` if the response is complete with
55
+ # a ~ 200 level http status code.
46
56
  def successful?
47
- (200..299).include?(status_code)
48
- end
49
-
50
- # @api private
51
- def respond_to?(*args)
52
- @data.respond_to?(args.first, false) || super
57
+ (200..299).include?(@context.http_response.status_code) && @error.nil?
53
58
  end
54
59
 
55
60
  # @api private
@@ -61,12 +66,13 @@ module Seahorse
61
66
  end
62
67
  end
63
68
 
64
- private
65
-
66
- def status_code
67
- @http_response.status_code
69
+ # @api private
70
+ def respond_to?(*args)
71
+ @data.respond_to?(args.first, false) || super
68
72
  end
69
73
 
74
+ private
75
+
70
76
  def method_missing(*args, &block)
71
77
  if @data.respond_to?(args.first, false)
72
78
  @data.send(*args, &block)
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: 2.0.14
4
+ version: 2.0.15
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: 2014-12-12 00:00:00.000000000 Z
11
+ date: 2014-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -133,6 +133,7 @@ files:
133
133
  - lib/aws-sdk-core/paging/pager.rb
134
134
  - lib/aws-sdk-core/paging/provider.rb
135
135
  - lib/aws-sdk-core/plugins/csd_conditional_signing.rb
136
+ - lib/aws-sdk-core/plugins/dynamodb_crc32_validation.rb
136
137
  - lib/aws-sdk-core/plugins/dynamodb_extended_retries.rb
137
138
  - lib/aws-sdk-core/plugins/dynamodb_simple_attributes.rb
138
139
  - lib/aws-sdk-core/plugins/ec2_copy_encrypted_snapshot.rb
@@ -210,11 +211,11 @@ files:
210
211
  - lib/seahorse/client/base.rb
211
212
  - lib/seahorse/client/block_io.rb
212
213
  - lib/seahorse/client/configuration.rb
214
+ - lib/seahorse/client/events.rb
213
215
  - lib/seahorse/client/handler.rb
214
216
  - lib/seahorse/client/handler_builder.rb
215
217
  - lib/seahorse/client/handler_list.rb
216
218
  - lib/seahorse/client/handler_list_entry.rb
217
- - lib/seahorse/client/http/error.rb
218
219
  - lib/seahorse/client/http/headers.rb
219
220
  - lib/seahorse/client/http/request.rb
220
221
  - lib/seahorse/client/http/response.rb
@@ -224,6 +225,7 @@ files:
224
225
  - lib/seahorse/client/net_http/connection_pool.rb
225
226
  - lib/seahorse/client/net_http/handler.rb
226
227
  - lib/seahorse/client/net_http/patches.rb
228
+ - lib/seahorse/client/networking_error.rb
227
229
  - lib/seahorse/client/param_converter.rb
228
230
  - lib/seahorse/client/param_validator.rb
229
231
  - lib/seahorse/client/plugin.rb
@@ -294,6 +296,7 @@ files:
294
296
  - apis/ElasticTranscoder.waiters.json
295
297
  - apis/EMR.api.json
296
298
  - apis/EMR.paginators.json
299
+ - apis/EMR.waiters2.json
297
300
  - apis/Glacier.api.json
298
301
  - apis/Glacier.paginators.json
299
302
  - apis/Glacier.resources.json
@@ -1,17 +0,0 @@
1
- module Seahorse
2
- module Client
3
- module Http
4
- class Error < StandardError
5
-
6
- def initialize(error, msg = nil)
7
- super(msg || error.message)
8
- set_backtrace(error.backtrace)
9
- @original_error = error
10
- end
11
-
12
- attr_reader :original_error
13
-
14
- end
15
- end
16
- end
17
- end