aws-sdk-sqs 1.0.0.rc2 → 1.0.0.rc3
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/lib/aws-sdk-sqs.rb +1 -1
- data/lib/aws-sdk-sqs/client.rb +1748 -1547
- data/lib/aws-sdk-sqs/client_api.rb +454 -456
- data/lib/aws-sdk-sqs/errors.rb +4 -13
- data/lib/aws-sdk-sqs/message.rb +198 -203
- data/lib/aws-sdk-sqs/plugins/md5s.rb +1 -1
- data/lib/aws-sdk-sqs/queue.rb +738 -684
- data/lib/aws-sdk-sqs/resource.rb +210 -201
- data/lib/aws-sdk-sqs/types.rb +1753 -1597
- metadata +2 -2
data/lib/aws-sdk-sqs/errors.rb
CHANGED
@@ -1,23 +1,14 @@
|
|
1
1
|
# WARNING ABOUT GENERATED CODE
|
2
2
|
#
|
3
|
-
# This file is generated. See the contributing for
|
3
|
+
# This file is generated. See the contributing guide for more information:
|
4
4
|
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
|
5
5
|
#
|
6
6
|
# WARNING ABOUT GENERATED CODE
|
7
7
|
|
8
|
-
module Aws
|
9
|
-
module
|
10
|
-
module Errors
|
8
|
+
module Aws::SQS
|
9
|
+
module Errors
|
11
10
|
|
12
|
-
|
11
|
+
extend Aws::Errors::DynamicErrors
|
13
12
|
|
14
|
-
# Raised when calling #load or #data on a resource class that can not be
|
15
|
-
# loaded. This can happen when:
|
16
|
-
#
|
17
|
-
# * A resource class has identifiers, but no data attributes.
|
18
|
-
# * Resource data is only available when making an API call that
|
19
|
-
# enumerates all resources of that type.
|
20
|
-
class ResourceNotLoadable < RuntimeError; end
|
21
|
-
end
|
22
13
|
end
|
23
14
|
end
|
data/lib/aws-sdk-sqs/message.rb
CHANGED
@@ -1,238 +1,233 @@
|
|
1
1
|
# WARNING ABOUT GENERATED CODE
|
2
2
|
#
|
3
|
-
# This file is generated. See the contributing for
|
3
|
+
# This file is generated. See the contributing guide for more information:
|
4
4
|
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
|
5
5
|
#
|
6
6
|
# WARNING ABOUT GENERATED CODE
|
7
7
|
|
8
|
-
module Aws
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
8
|
+
module Aws::SQS
|
9
|
+
class Message
|
10
|
+
|
11
|
+
extend Aws::Deprecations
|
12
|
+
|
13
|
+
# @overload def initialize(queue_url, receipt_handle, options = {})
|
14
|
+
# @param [String] queue_url
|
15
|
+
# @param [String] receipt_handle
|
16
|
+
# @option options [Client] :client
|
17
|
+
# @overload def initialize(options = {})
|
18
|
+
# @option options [required, String] :queue_url
|
19
|
+
# @option options [required, String] :receipt_handle
|
20
|
+
# @option options [Client] :client
|
21
|
+
def initialize(*args)
|
22
|
+
options = Hash === args.last ? args.pop.dup : {}
|
23
|
+
@queue_url = extract_queue_url(args, options)
|
24
|
+
@receipt_handle = extract_receipt_handle(args, options)
|
25
|
+
@data = options.delete(:data)
|
26
|
+
@client = options.delete(:client) || Client.new(options)
|
27
|
+
end
|
29
28
|
|
30
|
-
|
29
|
+
# @!group Read-Only Attributes
|
31
30
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
# @return [String]
|
32
|
+
def queue_url
|
33
|
+
@queue_url
|
34
|
+
end
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
36
|
+
# @return [String]
|
37
|
+
def receipt_handle
|
38
|
+
@receipt_handle
|
39
|
+
end
|
41
40
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
41
|
+
# A unique identifier for the message. A `MessageId`is considered unique
|
42
|
+
# across all AWS accounts for an extended period of time.
|
43
|
+
# @return [String]
|
44
|
+
def message_id
|
45
|
+
data.message_id
|
46
|
+
end
|
48
47
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
48
|
+
# An MD5 digest of the non-URL-encoded message body string.
|
49
|
+
# @return [String]
|
50
|
+
def md5_of_body
|
51
|
+
data.md5_of_body
|
52
|
+
end
|
54
53
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
54
|
+
# The message's contents (not URL-encoded).
|
55
|
+
# @return [String]
|
56
|
+
def body
|
57
|
+
data.body
|
58
|
+
end
|
60
59
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
60
|
+
# `SenderId`, `SentTimestamp`, `ApproximateReceiveCount`, and/or
|
61
|
+
# `ApproximateFirstReceiveTimestamp`. `SentTimestamp` and
|
62
|
+
# `ApproximateFirstReceiveTimestamp` are each returned as an integer
|
63
|
+
# representing the [epoch time][1] in milliseconds.
|
64
|
+
#
|
65
|
+
#
|
66
|
+
#
|
67
|
+
# [1]: http://en.wikipedia.org/wiki/Unix_time
|
68
|
+
# @return [Hash<String,String>]
|
69
|
+
def attributes
|
70
|
+
data.attributes
|
71
|
+
end
|
73
72
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
73
|
+
# An MD5 digest of the non-URL-encoded message attribute string. You can
|
74
|
+
# use this attribute to verify that Amazon SQS received the message
|
75
|
+
# correctly. Amazon SQS URL-decodes the message before creating the MD5
|
76
|
+
# digest. For information on MD5, see [RFC1321][1].
|
77
|
+
#
|
78
|
+
#
|
79
|
+
#
|
80
|
+
# [1]: https://www.ietf.org/rfc/rfc1321.txt
|
81
|
+
# @return [String]
|
82
|
+
def md5_of_message_attributes
|
83
|
+
data.md5_of_message_attributes
|
84
|
+
end
|
86
85
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
86
|
+
# Each message attribute consists of a `Name`, `Type`, and `Value`. For
|
87
|
+
# more information, see [Message Attribute Items and Validation][1] in
|
88
|
+
# the *Amazon SQS Developer Guide*.
|
89
|
+
#
|
90
|
+
#
|
91
|
+
#
|
92
|
+
# [1]: http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html#message-attributes-items-validation
|
93
|
+
# @return [Hash<String,Types::MessageAttributeValue>]
|
94
|
+
def message_attributes
|
95
|
+
data.message_attributes
|
96
|
+
end
|
98
97
|
|
99
|
-
|
98
|
+
# @!endgroup
|
100
99
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
100
|
+
# @return [Client]
|
101
|
+
def client
|
102
|
+
@client
|
103
|
+
end
|
105
104
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
105
|
+
# @raise [NotImplementedError]
|
106
|
+
# @api private
|
107
|
+
def load
|
108
|
+
msg = "#load is not implemented, data only available via enumeration"
|
109
|
+
raise NotImplementedError, msg
|
110
|
+
end
|
111
|
+
alias :reload :load
|
112
|
+
|
113
|
+
# @raise [NotImplementedError] Raises when {#data_loaded?} is `false`.
|
114
|
+
# @return [Types::Message]
|
115
|
+
# Returns the data for this {Message}.
|
116
|
+
def data
|
117
|
+
load unless @data
|
118
|
+
@data
|
119
|
+
end
|
121
120
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
121
|
+
# @return [Boolean]
|
122
|
+
# Returns `true` if this resource is loaded. Accessing attributes or
|
123
|
+
# {#data} on an unloaded resource will trigger a call to {#load}.
|
124
|
+
def data_loaded?
|
125
|
+
!!@data
|
126
|
+
end
|
128
127
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
128
|
+
# @!group Actions
|
129
|
+
|
130
|
+
# @example Request syntax with placeholder values
|
131
|
+
#
|
132
|
+
# message.change_visibility({
|
133
|
+
# visibility_timeout: 1, # required
|
134
|
+
# })
|
135
|
+
# @param [Hash] options ({})
|
136
|
+
# @option options [required, Integer] :visibility_timeout
|
137
|
+
# The new value for the message's visibility timeout (in seconds).
|
138
|
+
# Values values: `0` to `43200`. Maximum: 12 hours.
|
139
|
+
# @return [EmptyStructure]
|
140
|
+
def change_visibility(options = {})
|
141
|
+
options = options.merge(
|
142
|
+
queue_url: @queue_url,
|
143
|
+
receipt_handle: @receipt_handle
|
144
|
+
)
|
145
|
+
resp = @client.change_message_visibility(options)
|
146
|
+
resp.data
|
147
|
+
end
|
149
148
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
149
|
+
# @example Request syntax with placeholder values
|
150
|
+
#
|
151
|
+
# message.delete()
|
152
|
+
# @param [Hash] options ({})
|
153
|
+
# @return [EmptyStructure]
|
154
|
+
def delete(options = {})
|
155
|
+
options = options.merge(
|
156
|
+
queue_url: @queue_url,
|
157
|
+
receipt_handle: @receipt_handle
|
158
|
+
)
|
159
|
+
resp = @client.delete_message(options)
|
160
|
+
resp.data
|
161
|
+
end
|
163
162
|
|
164
|
-
|
163
|
+
# @!group Associations
|
165
164
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
165
|
+
# @return [Queue]
|
166
|
+
def queue
|
167
|
+
Queue.new(
|
168
|
+
url: @queue_url,
|
169
|
+
client: @client
|
170
|
+
)
|
171
|
+
end
|
173
172
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
end
|
173
|
+
# @deprecated
|
174
|
+
# @api private
|
175
|
+
def identifiers
|
176
|
+
{
|
177
|
+
queue_url: @queue_url,
|
178
|
+
receipt_handle: @receipt_handle
|
179
|
+
}
|
180
|
+
end
|
181
|
+
deprecated(:identifiers)
|
182
|
+
|
183
|
+
private
|
184
|
+
|
185
|
+
def extract_queue_url(args, options)
|
186
|
+
value = args[0] || options.delete(:queue_url)
|
187
|
+
case value
|
188
|
+
when String then value
|
189
|
+
when nil then raise ArgumentError, "missing required option :queue_url"
|
190
|
+
else
|
191
|
+
msg = "expected :queue_url to be a String, got #{value.class}"
|
192
|
+
raise ArgumentError, msg
|
195
193
|
end
|
194
|
+
end
|
196
195
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
end
|
196
|
+
def extract_receipt_handle(args, options)
|
197
|
+
value = args[1] || options.delete(:receipt_handle)
|
198
|
+
case value
|
199
|
+
when String then value
|
200
|
+
when nil then raise ArgumentError, "missing required option :receipt_handle"
|
201
|
+
else
|
202
|
+
msg = "expected :receipt_handle to be a String, got #{value.class}"
|
203
|
+
raise ArgumentError, msg
|
206
204
|
end
|
205
|
+
end
|
207
206
|
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
params[:
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
id: item.message_id,
|
225
|
-
receipt_handle: item.receipt_handle
|
226
|
-
}
|
227
|
-
end
|
228
|
-
batch[0].client.delete_message_batch(params)
|
207
|
+
class Collection < Aws::Resources::Collection
|
208
|
+
|
209
|
+
# @!group Batch Actions
|
210
|
+
|
211
|
+
# @param options ({})
|
212
|
+
# @return [void]
|
213
|
+
def batch_delete!(options = {})
|
214
|
+
batch_enum.each do |batch|
|
215
|
+
params = Aws::Util.copy_hash(options)
|
216
|
+
params[:queue_url] = batch[0].queue_url
|
217
|
+
params[:entries] ||= []
|
218
|
+
batch.each do |item|
|
219
|
+
params[:entries] << {
|
220
|
+
id: item.message_id,
|
221
|
+
receipt_handle: item.receipt_handle
|
222
|
+
}
|
229
223
|
end
|
230
|
-
|
224
|
+
batch[0].client.delete_message_batch(params)
|
231
225
|
end
|
226
|
+
nil
|
227
|
+
end
|
232
228
|
|
233
|
-
|
229
|
+
# @!endgroup
|
234
230
|
|
235
|
-
end
|
236
231
|
end
|
237
232
|
end
|
238
233
|
end
|