aws-sdk-core 2.6.23 → 2.6.24

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,232 @@
1
+ {
2
+ "service": {
3
+ "actions": {
4
+ "CreateQueue": {
5
+ "request": { "operation": "CreateQueue" },
6
+ "resource": {
7
+ "type": "Queue",
8
+ "identifiers": [
9
+ { "target": "Url", "source": "response", "path": "QueueUrl" }
10
+ ]
11
+ }
12
+ },
13
+ "GetQueueByName": {
14
+ "request": { "operation": "GetQueueUrl" },
15
+ "resource": {
16
+ "type": "Queue",
17
+ "identifiers": [
18
+ { "target": "Url", "source": "response", "path": "QueueUrl" }
19
+ ]
20
+ }
21
+ }
22
+ },
23
+ "has": {
24
+ "Queue": {
25
+ "resource": {
26
+ "type": "Queue",
27
+ "identifiers": [
28
+ { "target": "Url", "source": "input" }
29
+ ]
30
+ }
31
+ }
32
+ },
33
+ "hasMany": {
34
+ "Queues": {
35
+ "request": { "operation": "ListQueues" },
36
+ "resource": {
37
+ "type": "Queue",
38
+ "identifiers": [
39
+ { "target": "Url", "source": "response", "path": "QueueUrls[]" }
40
+ ]
41
+ }
42
+ }
43
+ }
44
+ },
45
+ "resources": {
46
+ "Message": {
47
+ "identifiers": [
48
+ { "name": "QueueUrl" },
49
+ {
50
+ "name": "ReceiptHandle",
51
+ "memberName": "ReceiptHandle"
52
+ }
53
+ ],
54
+ "shape": "Message",
55
+ "actions": {
56
+ "ChangeVisibility": {
57
+ "request": {
58
+ "operation": "ChangeMessageVisibility",
59
+ "params": [
60
+ { "target": "QueueUrl", "source": "identifier", "name": "QueueUrl" },
61
+ { "target": "ReceiptHandle", "source": "identifier", "name": "ReceiptHandle" }
62
+ ]
63
+ }
64
+ },
65
+ "Delete": {
66
+ "request": {
67
+ "operation": "DeleteMessage",
68
+ "params": [
69
+ { "target": "QueueUrl", "source": "identifier", "name": "QueueUrl" },
70
+ { "target": "ReceiptHandle", "source": "identifier", "name": "ReceiptHandle" }
71
+ ]
72
+ }
73
+ }
74
+ },
75
+ "batchActions": {
76
+ "Delete": {
77
+ "request": {
78
+ "operation": "DeleteMessageBatch",
79
+ "params": [
80
+ { "target": "QueueUrl", "source": "identifier", "name": "QueueUrl" },
81
+ { "target": "Entries[*].Id", "source": "data", "path": "MessageId" },
82
+ { "target": "Entries[*].ReceiptHandle", "source": "identifier", "name": "ReceiptHandle" }
83
+ ]
84
+ }
85
+ }
86
+ },
87
+ "has": {
88
+ "Queue": {
89
+ "resource": {
90
+ "type": "Queue",
91
+ "identifiers": [
92
+ { "target": "Url", "source": "identifier", "name": "QueueUrl" }
93
+ ]
94
+ }
95
+ }
96
+ }
97
+ },
98
+ "Queue": {
99
+ "identifiers": [
100
+ { "name": "Url" }
101
+ ],
102
+ "shape": "GetQueueAttributesResult",
103
+ "load": {
104
+ "request": {
105
+ "operation": "GetQueueAttributes",
106
+ "params": [
107
+ { "target": "QueueUrl", "source": "identifier", "name": "Url" },
108
+ { "target": "AttributeNames[]", "source": "string", "value": "All" }
109
+ ]
110
+ },
111
+ "path": "@"
112
+ },
113
+ "actions": {
114
+ "AddPermission": {
115
+ "request": {
116
+ "operation": "AddPermission",
117
+ "params": [
118
+ { "target": "QueueUrl", "source": "identifier", "name": "Url" }
119
+ ]
120
+ }
121
+ },
122
+ "ChangeMessageVisibilityBatch": {
123
+ "request": {
124
+ "operation": "ChangeMessageVisibilityBatch",
125
+ "params": [
126
+ { "target": "QueueUrl", "source": "identifier", "name": "Url" }
127
+ ]
128
+ }
129
+ },
130
+ "Delete": {
131
+ "request": {
132
+ "operation": "DeleteQueue",
133
+ "params": [
134
+ { "target": "QueueUrl", "source": "identifier", "name": "Url" }
135
+ ]
136
+ }
137
+ },
138
+ "DeleteMessages": {
139
+ "request": {
140
+ "operation": "DeleteMessageBatch",
141
+ "params": [
142
+ { "target": "QueueUrl", "source": "identifier", "name": "Url" }
143
+ ]
144
+ }
145
+ },
146
+ "Purge": {
147
+ "request": {
148
+ "operation": "PurgeQueue",
149
+ "params": [
150
+ { "target": "QueueUrl", "source": "identifier", "name": "Url" }
151
+ ]
152
+ }
153
+ },
154
+ "ReceiveMessages": {
155
+ "request": {
156
+ "operation": "ReceiveMessage",
157
+ "params": [
158
+ { "target": "QueueUrl", "source": "identifier", "name": "Url" }
159
+ ]
160
+ },
161
+ "resource": {
162
+ "type": "Message",
163
+ "identifiers": [
164
+ { "target": "QueueUrl", "source": "identifier", "name": "Url" },
165
+ { "target": "ReceiptHandle", "source": "response", "path": "Messages[].ReceiptHandle" }
166
+ ],
167
+ "path": "Messages[]"
168
+ }
169
+ },
170
+ "RemovePermission": {
171
+ "request": {
172
+ "operation": "RemovePermission",
173
+ "params": [
174
+ { "target": "QueueUrl", "source": "identifier", "name": "Url" }
175
+ ]
176
+ }
177
+ },
178
+ "SendMessage": {
179
+ "request": {
180
+ "operation": "SendMessage",
181
+ "params": [
182
+ { "target": "QueueUrl", "source": "identifier", "name": "Url" }
183
+ ]
184
+ }
185
+ },
186
+ "SendMessages": {
187
+ "request": {
188
+ "operation": "SendMessageBatch",
189
+ "params": [
190
+ { "target": "QueueUrl", "source": "identifier", "name": "Url" }
191
+ ]
192
+ }
193
+ },
194
+ "SetAttributes": {
195
+ "request": {
196
+ "operation": "SetQueueAttributes",
197
+ "params": [
198
+ { "target": "QueueUrl", "source": "identifier", "name": "Url" }
199
+ ]
200
+ }
201
+ }
202
+ },
203
+ "has": {
204
+ "Message": {
205
+ "resource": {
206
+ "type": "Message",
207
+ "identifiers": [
208
+ { "target": "QueueUrl", "source": "identifier", "name": "Url" },
209
+ { "target": "ReceiptHandle", "source": "input" }
210
+ ]
211
+ }
212
+ }
213
+ },
214
+ "hasMany": {
215
+ "DeadLetterSourceQueues": {
216
+ "request": {
217
+ "operation": "ListDeadLetterSourceQueues",
218
+ "params": [
219
+ { "target": "QueueUrl", "source": "identifier", "name": "Url" }
220
+ ]
221
+ },
222
+ "resource": {
223
+ "type": "Queue",
224
+ "identifiers": [
225
+ { "target": "Url", "source": "response", "path": "QueueUrls[]" }
226
+ ]
227
+ }
228
+ }
229
+ }
230
+ }
231
+ }
232
+ }
@@ -230,6 +230,7 @@ module Aws
230
230
  autoload :Builder, 'aws-sdk-core/rest/request/builder'
231
231
  autoload :Endpoint, 'aws-sdk-core/rest/request/endpoint'
232
232
  autoload :Headers, 'aws-sdk-core/rest/request/headers'
233
+ autoload :QuerystringBuilder, 'aws-sdk-core/rest/request/querystring_builder'
233
234
  end
234
235
  module Response
235
236
  autoload :Body, 'aws-sdk-core/rest/response/body'
@@ -24,9 +24,9 @@ module Aws
24
24
  [:assume_role_credentials, {}],
25
25
  [:shared_credentials, {}],
26
26
  [:instance_profile_credentials, {
27
- retries: 0,
28
- http_open_timeout: 1,
29
- http_read_timeout: 1,
27
+ retries: @config ? @config.instance_profile_credentials_retries : 0,
28
+ http_open_timeout: @config ? @config.instance_profile_credentials_timeout : 1,
29
+ http_read_timeout: @config ? @config.instance_profile_credentials_timeout : 1,
30
30
  }],
31
31
  ]
32
32
  end
@@ -37,6 +37,10 @@ module Aws
37
37
  CredentialProviderChain.new(config).resolve
38
38
  end
39
39
 
40
+ option(:instance_profile_credentials_retries, 0)
41
+
42
+ option(:instance_profile_credentials_timeout, 1)
43
+
40
44
  # Intentionally not documented - this should go away when all
41
45
  # services support signature version 4 in every region.
42
46
  option(:signature_version) do |cfg|
@@ -5,15 +5,13 @@ module Aws
5
5
  module Request
6
6
  class Endpoint
7
7
 
8
- include Seahorse::Model::Shapes
9
-
10
8
  # @param [Seahorse::Model::Shapes::ShapeRef] rules
11
9
  # @param [String] request_uri_pattern
12
10
  def initialize(rules, request_uri_pattern)
13
11
  @rules = rules
14
12
  request_uri_pattern.split('?').tap do |path_part, query_part|
15
13
  @path_pattern = path_part
16
- @query_pattern = query_part
14
+ @query_prefix = query_part
17
15
  end
18
16
  end
19
17
 
@@ -50,70 +48,17 @@ module Aws
50
48
  end
51
49
 
52
50
  def apply_querystring_params(uri, params)
53
- parts = []
54
- parts << @query_pattern if @query_pattern
55
- @rules.shape.members.each do |member_name, member|
56
- if member.location == 'querystring' && !params[member_name].nil?
57
- case member.shape
58
-
59
- # supported scalar types
60
- when StringShape, BooleanShape, FloatShape, IntegerShape, StringShape
61
- param_name = member.location_name
62
- param_value = params[member_name]
63
- parts << "#{param_name}=#{escape(param_value.to_s)}"
64
-
65
- # map of strings or map of string-list
66
- when MapShape
67
- if StringShape === member.shape.value.shape
68
- parts += query_map_of_string(params[member_name])
69
- elsif ListShape === member.shape.value.shape
70
- parts += query_map_of_string_list(params[member_name])
71
- else
72
- msg = "only map of string and string list supported"
73
- raise NotImplementedError, msg
74
- end
75
-
76
- when ListShape
77
- if StringShape === member.shape.member.shape
78
- parts += list_of_strings(member.location_name, params[member_name])
79
- else
80
- msg = "Only list of strings supported, got "
81
- msg << member.shape.member.shape.class.name
82
- raise NotImplementedError, msg
83
- end
84
-
85
- # unsupported querystring shape
86
- else
87
- raise NotImplementedError
88
- end
89
-
90
- end
91
- end
92
- uri.query = parts.empty? ? nil : parts.join('&')
93
- end
94
-
95
- def query_map_of_string(hash)
96
- list = []
97
- hash.each_pair do |key, value|
98
- list << "#{escape(key)}=#{escape(value)}"
99
- end
100
- list
101
- end
102
-
103
- def query_map_of_string_list(hash)
104
- list = []
105
- hash.each_pair do |key, values|
106
- values.each do |value|
107
- list << "#{escape(key)}=#{escape(value)}"
51
+ # collect params that are supposed to be part of the query string
52
+ parts = @rules.shape.members.inject([]) do |parts, (member_name, member_ref)|
53
+ if member_ref.location == 'querystring' && !params[member_name].nil?
54
+ parts << [member_ref, params[member_name]]
108
55
  end
56
+ parts
109
57
  end
110
- list
111
- end
112
-
113
- def list_of_strings(name, values)
114
- values.map do |value|
115
- "#{name}=#{escape(value)}"
116
- end
58
+ querystring = QuerystringBuilder.new.build(parts)
59
+ querystring = [@query_prefix, querystring == '' ? nil : querystring].compact.join('&')
60
+ querystring = nil if querystring == ''
61
+ uri.query = querystring
117
62
  end
118
63
 
119
64
  def escape(string)
@@ -0,0 +1,90 @@
1
+ module Aws
2
+ module Rest
3
+ module Request
4
+ class QuerystringBuilder
5
+
6
+ include Seahorse::Model::Shapes
7
+
8
+ # Provide shape references and param values:
9
+ #
10
+ # [
11
+ # [shape_ref1, 123],
12
+ # [shape_ref2, "text"]
13
+ # ]
14
+ #
15
+ # Returns a querystring:
16
+ #
17
+ # "Count=123&Words=text"
18
+ #
19
+ # @param [Array<Array<Seahorse::Model::ShapeRef, Object>>] params An array of
20
+ # model shape references and request parameter value pairs.
21
+ #
22
+ # @return [String] Returns a built querystring
23
+ def build(params)
24
+ params.map do |(shape_ref, param_value)|
25
+ build_part(shape_ref, param_value)
26
+ end.join('&')
27
+ end
28
+
29
+ private
30
+
31
+ def build_part(shape_ref, param_value)
32
+ case shape_ref.shape
33
+ # supported scalar types
34
+ when StringShape, BooleanShape, FloatShape, IntegerShape, StringShape
35
+ param_name = shape_ref.location_name
36
+ "#{param_name}=#{escape(param_value.to_s)}"
37
+ when MapShape
38
+ if StringShape === shape_ref.shape.value.shape
39
+ query_map_of_string(param_value)
40
+ elsif ListShape === shape_ref.shape.value.shape
41
+ query_map_of_string_list(param_value)
42
+ else
43
+ msg = "only map of string and string list supported"
44
+ raise NotImplementedError, msg
45
+ end
46
+ when ListShape
47
+ if StringShape === shape_ref.shape.member.shape
48
+ list_of_strings(shape_ref.location_name, param_value)
49
+ else
50
+ msg = "Only list of strings supported, got "
51
+ msg << shape_ref.shape.member.shape.class.name
52
+ raise NotImplementedError, msg
53
+ end
54
+ else
55
+ raise NotImplementedError
56
+ end
57
+ end
58
+
59
+ def query_map_of_string(hash)
60
+ list = []
61
+ hash.each_pair do |key, value|
62
+ list << "#{escape(key)}=#{escape(value)}"
63
+ end
64
+ list
65
+ end
66
+
67
+ def query_map_of_string_list(hash)
68
+ list = []
69
+ hash.each_pair do |key, values|
70
+ values.each do |value|
71
+ list << "#{escape(key)}=#{escape(value)}"
72
+ end
73
+ end
74
+ list
75
+ end
76
+
77
+ def list_of_strings(name, values)
78
+ values.map do |value|
79
+ "#{name}=#{escape(value)}"
80
+ end
81
+ end
82
+
83
+ def escape(string)
84
+ Seahorse::Util.uri_escape(string)
85
+ end
86
+
87
+ end
88
+ end
89
+ end
90
+ end