aws-sdk-sqs 1.0.0.rc2 → 1.0.0.rc3

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