aws-sdk-core 3.22.1 → 3.23.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0135b4c9f4be1d1a66fc2e45dac396298d781b87
4
- data.tar.gz: 382757f33aa64c8db8f609eb8e61efaaf54ab2f2
3
+ metadata.gz: 863e0c2db542c1c5c45bb03309f1d01ed64d3f7d
4
+ data.tar.gz: db3a641dd73c9f2b5fcb6809314e7881da912602
5
5
  SHA512:
6
- metadata.gz: 5c7444fd636bc7e1c5cd10d019506c04e06ccb643798d119be7c0c6d65592ab304020be353646dd6f946075561b5005012d478b70f77bccf36fc8fb9b83fdc97
7
- data.tar.gz: 579d24a8c9e22748dcf8605ccd1e5912d6f6137499dbec7d32e9460eca7fe8304d7a57233c21fd8c8e6687cb46605d1d8b2be81b08e9c9a67eba5023ae24c1a2
6
+ metadata.gz: bb7fd926f77db04fa0caacafba5cdfe44019efd2236862eedc1e80fab038bf42787007e60dc6b82d98993d4fd556dcc20b6e66c4a0ee76cedfa030cc5cda2470
7
+ data.tar.gz: 65ea0631d143d0d1c132c232feaa26e78d8e5d8339ec1888600871ae8c2a172f15f60f67d56c696bbb77664b53299dca9fa13d3f3ccb3f43cdd55188539e8441
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.22.1
1
+ 3.23.0
@@ -6,6 +6,9 @@ module Aws
6
6
  # return when a client is using stubbed responses. Pass
7
7
  # `:stub_responses => true` to a client constructor to enable this
8
8
  # behavior.
9
+ #
10
+ # Also allows you to see the requests made by the client by reading the
11
+ # api_requests instance variable
9
12
  module ClientStubs
10
13
 
11
14
  # @api private
@@ -17,6 +20,19 @@ module Aws
17
20
  apply_stubs(operation_name, Array === stubs ? stubs : [stubs])
18
21
  end
19
22
  end
23
+
24
+ # When a client is stubbed allow the user to access the requests made
25
+ @api_requests = []
26
+
27
+ requests = @api_requests
28
+ self.handle do |context|
29
+ requests << {
30
+ operation_name: context.operation_name,
31
+ params: context.params,
32
+ context: context
33
+ }
34
+ @handler.call(context)
35
+ end
20
36
  end
21
37
 
22
38
  # Configures what data / errors should be returned from the named operation
@@ -166,6 +182,21 @@ module Aws
166
182
  end
167
183
  end
168
184
 
185
+ # Allows you to access all of the requests that the stubbed client has made
186
+ #
187
+ # @return [Array] Returns an array of the api requests made, each request object contains the
188
+ # :operation_name, :params, and :context of the request.
189
+ # @raise [NotImplementedError] Raises `NotImplementedError` when the client is not stubbed
190
+ def api_requests
191
+ if config.stub_responses
192
+ @api_requests
193
+ else
194
+ msg = 'This method is only implemented for stubbed clients, and is '
195
+ msg << 'available when you enable stubbing in the constructor with `stub_responses: true`'
196
+ raise NotImplementedError.new(msg)
197
+ end
198
+ end
199
+
169
200
  # Generates and returns stubbed response data from the named operation.
170
201
  #
171
202
  # s3 = Aws::S3::Client.new
@@ -56,9 +56,11 @@ module Aws
56
56
  end
57
57
 
58
58
  def timestamp(ref, value)
59
- if ref['timestampFormat'] == 'iso8601'
60
- value.utc.iso8601
59
+ case ref['timestampFormat'] || ref.shape['timestampFormat']
60
+ when 'iso8601' then value.utc.iso8601
61
+ when 'rfc822' then value.utc.httpdate
61
62
  else
63
+ # rest-json and jsonrpc default to unixTimestamp
62
64
  value.to_i
63
65
  end
64
66
  end
@@ -45,7 +45,7 @@ module Aws
45
45
  when ListShape then list(ref, value, prefix)
46
46
  when MapShape then raise NotImplementedError
47
47
  when BlobShape then set(prefix, blob(value))
48
- when TimestampShape then set(prefix, timestamp(value))
48
+ when TimestampShape then set(prefix, timestamp(ref, value))
49
49
  else
50
50
  set(prefix, value.to_s)
51
51
  end
@@ -68,8 +68,14 @@ module Aws
68
68
  Base64.strict_encode64(value)
69
69
  end
70
70
 
71
- def timestamp(value)
72
- value.utc.iso8601
71
+ def timestamp(ref, value)
72
+ case ref['timestampFormat'] || ref.shape['timestampFormat']
73
+ when 'unixTimestamp' then value.to_i
74
+ when 'rfc822' then value.utc.httpdate
75
+ else
76
+ # ec2 defaults to iso8601
77
+ value.utc.iso8601
78
+ end
73
79
  end
74
80
 
75
81
  end
@@ -66,7 +66,7 @@ module Aws
66
66
  when ListShape then list(ref, value, prefix)
67
67
  when MapShape then map(ref, value, prefix)
68
68
  when BlobShape then set(prefix, blob(value))
69
- when TimestampShape then set(prefix, timestamp(value))
69
+ when TimestampShape then set(prefix, timestamp(ref, value))
70
70
  else set(prefix, value.to_s)
71
71
  end
72
72
  end
@@ -83,8 +83,14 @@ module Aws
83
83
  ref.shape.flattened
84
84
  end
85
85
 
86
- def timestamp(value)
87
- value.utc.iso8601
86
+ def timestamp(ref, value)
87
+ case ref['timestampFormat'] || ref.shape['timestampFormat']
88
+ when 'unixTimestamp' then value.to_i
89
+ when 'rfc822' then value.utc.httpdate
90
+ else
91
+ # query defaults to iso8601
92
+ value.utc.iso8601
93
+ end
88
94
  end
89
95
 
90
96
  def blob(value)
@@ -32,11 +32,21 @@ module Aws
32
32
  value = apply_json_trait(value) if ref['jsonvalue']
33
33
  headers[ref.location_name] =
34
34
  case ref.shape
35
- when TimestampShape then value.utc.httpdate
35
+ when TimestampShape then timestamp(ref, value)
36
36
  else value.to_s
37
37
  end
38
38
  end
39
39
 
40
+ def timestamp(ref, value)
41
+ case ref['timestampFormat'] || ref.shape['timestampFormat']
42
+ when 'unixTimestamp' then value.to_i
43
+ when 'iso8601' then value.utc.iso8601
44
+ else
45
+ # header default to rfc822
46
+ value.utc.httpdate
47
+ end
48
+ end
49
+
40
50
  def apply_header_map(headers, ref, values)
41
51
  prefix = ref.location_name || ''
42
52
  values.each_pair do |name, value|
@@ -36,7 +36,7 @@ module Aws
36
36
  "#{param_name}=#{escape(param_value.to_s)}"
37
37
  when TimestampShape
38
38
  param_name = shape_ref.location_name
39
- "#{param_name}=#{escape(param_value.utc.httpdate)}"
39
+ "#{param_name}=#{escape(timestamp(shape_ref, param_value))}"
40
40
  when MapShape
41
41
  if StringShape === shape_ref.shape.value.shape
42
42
  query_map_of_string(param_value)
@@ -59,6 +59,16 @@ module Aws
59
59
  end
60
60
  end
61
61
 
62
+ def timestamp(ref, value)
63
+ case ref['timestampFormat'] || ref.shape['timestampFormat']
64
+ when 'unixTimestamp' then value.to_i
65
+ when 'rfc822' then value.utc.httpdate
66
+ else
67
+ # querystring defaults to iso8601
68
+ value.utc.iso8601
69
+ end
70
+ end
71
+
62
72
  def query_map_of_string(hash)
63
73
  list = []
64
74
  hash.each_pair do |key, value|
@@ -42,6 +42,8 @@ module Aws
42
42
  when TimestampShape
43
43
  if value =~ /\d+(\.\d*)/
44
44
  Time.at(value.to_f)
45
+ elsif value =~ /^\d+$/
46
+ Time.at(value.to_i)
45
47
  else
46
48
  begin
47
49
  Time.parse(value)
@@ -87,7 +87,7 @@ module Aws
87
87
  when StructureShape then structure(name, ref, value)
88
88
  when ListShape then list(name, ref, value)
89
89
  when MapShape then map(name, ref, value)
90
- when TimestampShape then node(name, ref, timestamp(value))
90
+ when TimestampShape then node(name, ref, timestamp(ref, value))
91
91
  when BlobShape then node(name, ref, blob(value))
92
92
  else
93
93
  node(name, ref, value.to_s)
@@ -99,8 +99,14 @@ module Aws
99
99
  Base64.strict_encode64(value)
100
100
  end
101
101
 
102
- def timestamp(value)
103
- value.utc.iso8601
102
+ def timestamp(ref, value)
103
+ case ref['timestampFormat'] || ref.shape['timestampFormat']
104
+ when 'unixTimestamp' then value.to_i
105
+ when 'rfc822' then value.utc.httpdate
106
+ else
107
+ # xml defaults to iso8601
108
+ value.utc.iso8601
109
+ end
104
110
  end
105
111
 
106
112
  # The `args` list may contain:
@@ -40,6 +40,6 @@ require_relative 'aws-sdk-sts/customizations'
40
40
  # @service
41
41
  module Aws::STS
42
42
 
43
- GEM_VERSION = '3.22.1'
43
+ GEM_VERSION = '3.23.0'
44
44
 
45
45
  end
@@ -1486,7 +1486,7 @@ module Aws::STS
1486
1486
  params: params,
1487
1487
  config: config)
1488
1488
  context[:gem_name] = 'aws-sdk-core'
1489
- context[:gem_version] = '3.22.1'
1489
+ context[:gem_version] = '3.23.0'
1490
1490
  Seahorse::Client::Request.new(handlers, context)
1491
1491
  end
1492
1492
 
@@ -6,7 +6,7 @@ module Seahorse
6
6
  class << self
7
7
 
8
8
  def uri_escape(string)
9
- CGI.escape(string.encode('UTF-8')).gsub('+', '%20').gsub('%7E', '~')
9
+ CGI.escape(string.to_s.encode('UTF-8')).gsub('+', '%20').gsub('%7E', '~')
10
10
  end
11
11
 
12
12
  def uri_path_escape(path)
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.22.1
4
+ version: 3.23.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-06-28 00:00:00.000000000 Z
11
+ date: 2018-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jmespath