azure-storage-queue 1.0.1 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,749 +1,755 @@
1
- # frozen_string_literal: true
2
-
3
- #-------------------------------------------------------------------------
4
- # # Copyright (c) Microsoft and contributors. All rights reserved.
5
- #
6
- # The MIT License(MIT)
7
-
8
- # Permission is hereby granted, free of charge, to any person obtaining a copy
9
- # of this software and associated documentation files(the "Software"), to deal
10
- # in the Software without restriction, including without limitation the rights
11
- # to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
12
- # copies of the Software, and to permit persons to whom the Software is
13
- # furnished to do so, subject to the following conditions :
14
-
15
- # The above copyright notice and this permission notice shall be included in
16
- # all copies or substantial portions of the Software.
17
-
18
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
21
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- # THE SOFTWARE.
25
- #--------------------------------------------------------------------------
26
- module Azure::Storage
27
- include Azure::Storage::Common::Service
28
- StorageService = Azure::Storage::Common::Service::StorageService
29
-
30
- module Queue
31
- class QueueService < StorageService
32
- class << self
33
- # Public: Creates an instance of [Azure::Storage::Queue::QueueService]
34
- #
35
- # ==== Attributes
36
- #
37
- # * +options+ - Hash. Optional parameters.
38
- #
39
- # ==== Options
40
- #
41
- # Accepted key/value pairs in options parameter are:
42
- #
43
- # * +:use_development_storage+ - TrueClass|FalseClass. Whether to use storage emulator.
44
- # * +:development_storage_proxy_uri+ - String. Used with +:use_development_storage+ if emulator is hosted other than localhost.
45
- # * +:storage_account_name+ - String. The name of the storage account.
46
- # * +:storage_access_key+ - Base64 String. The access key of the storage account.
47
- # * +:storage_sas_token+ - String. The signed access signature for the storage account or one of its service.
48
- # * +:storage_queue_host+ - String. Specified Queue service endpoint or hostname
49
- # * +:storage_dns_suffix+ - String. The suffix of a regional Storage Service, to
50
- # * +:default_endpoints_protocol+ - String. http or https
51
- # * +:use_path_style_uri+ - String. Whether use path style URI for specified endpoints
52
- # * +:ca_file+ - String. File path of the CA file if having issue with SSL
53
- # * +:user_agent_prefix+ - String. The user agent prefix that can identify the application calls the library
54
- #
55
- # The valid set of options include:
56
- # * Storage Emulator: +:use_development_storage+ required, +:development_storage_proxy_uri+ optionally
57
- # * Storage account name and key: +:storage_account_name+ and +:storage_access_key+ required, set +:storage_dns_suffix+ necessarily
58
- # * Storage account name and SAS token: +:storage_account_name+ and +:storage_sas_token+ required, set +:storage_dns_suffix+ necessarily
59
- # * Specified hosts and SAS token: At least one of the service host and SAS token. It's up to user to ensure the SAS token is suitable for the serivce
60
- # * Anonymous Queue: only +:storage_queue_host+, if it is to only access queues within a container
61
- #
62
- # Additional notes:
63
- # * Specified hosts can be set when use account name with access key or sas token
64
- # * +:default_endpoints_protocol+ can be set if the scheme is not specified in hosts
65
- # * Storage emulator always use path style URI
66
- # * +:ca_file+ is independent.
67
- #
68
- # When empty options are given, it will try to read settings from Environment Variables. Refer to [Azure::Storage::Common::ClientOptions.env_vars_mapping] for the mapping relationship
69
- #
70
- # @return [Azure::Storage::Queue::QueueService]
71
- def create(options = {}, &block)
72
- service_options = { client: Azure::Storage::Common::Client::create(options, &block), api_version: Azure::Storage::Queue::Default::STG_VERSION }
73
- service_options[:user_agent_prefix] = options[:user_agent_prefix] if options[:user_agent_prefix]
74
- Azure::Storage::Queue::QueueService.new(service_options, &block)
75
- end
76
-
77
- # Public: Creates an instance of [Azure::Storage::Queue::QueueService] with Storage Emulator
78
- #
79
- # ==== Attributes
80
- #
81
- # * +proxy_uri+ - String. Used with +:use_development_storage+ if emulator is hosted other than localhost.
82
- #
83
- # @return [Azure::Storage::Queue::QueueService]
84
- def create_development(proxy_uri = nil, &block)
85
- service_options = { client: Azure::Storage::Common::Client::create_development(proxy_uri, &block), api_version: Azure::Storage::Queue::Default::STG_VERSION }
86
- Azure::Storage::Queue::QueueService.new(service_options, &block)
87
- end
88
-
89
- # Public: Creates an instance of [Azure::Storage::Queue::QueueService] from Environment Variables
90
- #
91
- # @return [Azure::Storage::Queue::QueueService]
92
- def create_from_env(&block)
93
- service_options = { client: Azure::Storage::Common::Client::create_from_env(&block), api_version: Azure::Storage::Queue::Default::STG_VERSION }
94
- Azure::Storage::Queue::QueueService.new(service_options, &block)
95
- end
96
-
97
- # Public: Creates an instance of [Azure::Storage::Queue::QueueService] from Environment Variables
98
- #
99
- # ==== Attributes
100
- #
101
- # * +connection_string+ - String. Please refer to https://azure.microsoft.com/en-us/documentation/articles/storage-configure-connection-string/.
102
- #
103
- # @return [Azure::Storage::Queue::QueueService]
104
- def create_from_connection_string(connection_string, &block)
105
- service_options = { client: Azure::Storage::Common::Client::create_from_connection_string(connection_string, &block), api_version: Azure::Storage::Queue::Default::STG_VERSION }
106
- Azure::Storage::Queue::QueueService.new(service_options, &block)
107
- end
108
- end
109
-
110
- # Public: Initializes an instance of [Azure::Storage::Queue::QueueService]
111
- #
112
- # ==== Attributes
113
- #
114
- # * +options+ - Hash. Optional parameters.
115
- #
116
- # ==== Options
117
- #
118
- # Accepted key/value pairs in options parameter are:
119
- #
120
- # * +:use_development_storage+ - TrueClass|FalseClass. Whether to use storage emulator.
121
- # * +:development_storage_proxy_uri+ - String. Used with +:use_development_storage+ if emulator is hosted other than localhost.
122
- # * +:storage_connection_string+ - String. The storage connection string.
123
- # * +:storage_account_name+ - String. The name of the storage account.
124
- # * +:storage_access_key+ - Base64 String. The access key of the storage account.
125
- # * +:storage_sas_token+ - String. The signed access signature for the storage account or one of its service.
126
- # * +:storage_queue_host+ - String. Specified Queue serivce endpoint or hostname
127
- # * +:storage_dns_suffix+ - String. The suffix of a regional Storage Serivce, to
128
- # * +:default_endpoints_protocol+ - String. http or https
129
- # * +:use_path_style_uri+ - String. Whether use path style URI for specified endpoints
130
- # * +:ca_file+ - String. File path of the CA file if having issue with SSL
131
- # * +:user_agent_prefix+ - String. The user agent prefix that can identify the application calls the library
132
- # * +:client+ - Azure::Storage::Common::Client. The common client used to initalize the service.
133
- #
134
- # The valid set of options include:
135
- # * Storage Emulator: +:use_development_storage+ required, +:development_storage_proxy_uri+ optionally
136
- # * Storage account name and key: +:storage_account_name+ and +:storage_access_key+ required, set +:storage_dns_suffix+ necessarily
137
- # * Storage account name and SAS token: +:storage_account_name+ and +:storage_sas_token+ required, set +:storage_dns_suffix+ necessarily
138
- # * Specified hosts and SAS token: At least one of the service host and SAS token. It's up to user to ensure the SAS token is suitable for the serivce
139
- # * Azure::Storage::Common::Client: The common client used to initalize the service. This client can be initalized and used repeatedly.
140
- # * Anonymous Queue: only +:storage_queue_host+, if it is to only access queues within a container
141
- #
142
- # Additional notes:
143
- # * Specified hosts can be set when use account name with access key or sas token
144
- # * +:default_endpoints_protocol+ can be set if the scheme is not specified in hosts
145
- # * Storage emulator always use path style URI
146
- # * +:ca_file+ is independent.
147
- #
148
- # When empty options are given, it will try to read settings from Environment Variables. Refer to [Azure::Storage::Common::ClientOptions.env_vars_mapping] for the mapping relationship
149
- def initialize(options = {}, &block)
150
- service_options = options.clone
151
- client_config = service_options[:client] ||= Azure::Storage::Common::Client::create(service_options, &block)
152
- @user_agent_prefix = service_options[:user_agent_prefix] if service_options[:user_agent_prefix]
153
- @api_version = service_options[:api_version] || Azure::Storage::Queue::Default::STG_VERSION
154
- signer = service_options[:signer] || client_config.signer || Azure::Storage::Common::Core::Auth::SharedKey.new(client_config.storage_account_name, client_config.storage_access_key)
155
- signer.api_ver = @api_version if signer.is_a? Azure::Storage::Common::Core::Auth::SharedAccessSignatureSigner
156
- super(signer, client_config.storage_account_name, service_options, &block)
157
- @storage_service_host[:primary] = client.storage_queue_host
158
- @storage_service_host[:secondary] = client.storage_queue_host true
159
- end
160
-
161
- # Public: Get a list of Queues from the server
162
- #
163
- # ==== Attributes
164
- #
165
- # * +options+ - Hash. Optional parameters.
166
- #
167
- # ==== Options
168
- #
169
- # Accepted key/value pairs in options parameter are:
170
- # * +:prefix+ - String. Filters the results to return only containers
171
- # whose name begins with the specified prefix. (optional)
172
- # * +:marker+ - String. An identifier the specifies the portion of the
173
- # list to be returned. This value comes from the property
174
- # Azure::Service::EnumerationResults.continuation_token when there
175
- # are more containers available than were returned. The
176
- # marker value may then be used here to request the next set
177
- # of list items. (optional)
178
- # * +:max_results+ - Integer. Specifies the maximum number of containers to return.
179
- # If max_results is not specified, or is a value greater than
180
- # 5,000, the server will return up to 5,000 items. If it is set
181
- # to a value less than or equal to zero, the server will return
182
- # status code 400 (Bad Request). (optional)
183
- # * +:metadata+ - Boolean. Specifies whether or not to return the container metadata.
184
- # (optional, Default=false)
185
- # * +:timeout+ - Integer. A timeout in seconds.
186
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
187
- # in the analytics logs when storage analytics logging is enabled.
188
- # * +:location_mode+ - LocationMode. Specifies the location mode used to decide
189
- # which location the request should be sent to.
190
- #
191
- # NOTE: Metadata requested with the :metadata parameter must have been stored in
192
- # accordance with the naming restrictions imposed by the 2009-09-19 version of the queue
193
- # service. Beginning with that version, all metadata names must adhere to the naming
194
- # conventions for C# identifiers.
195
- #
196
- # See http://msdn.microsoft.com/en-us/library/azure/dd179466
197
- #
198
- # Any metadata with invalid names which were previously stored, will be returned with the
199
- # key "x-ms-invalid-name" in the metadata hash. This may contain multiple values and be an
200
- # Array (vs a String if it only contains a single value).
201
- #
202
- # Returns an Azure::Storage::Common::EnumerationResults
203
- def list_queues(options = {})
204
- query = {}
205
- query["prefix"] = options[:prefix] if options[:prefix]
206
- query["marker"] = options[:marker] if options[:marker]
207
- query["maxresults"] = options[:max_results].to_s if options[:max_results]
208
- query["include"] = "metadata" if options[:metadata] == true
209
- query["timeout"] = options[:timeout].to_s if options[:timeout]
210
-
211
- options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY
212
- uri = collection_uri(query, options)
213
- response = call(:get, uri, nil, {}, options)
214
-
215
- Serialization.queue_enumeration_results_from_xml(response.body)
216
- end
217
-
218
- # Public: Clears all messages from the queue.
219
- #
220
- # If a queue contains a large number of messages, Clear Messages may time out
221
- # before all messages have been deleted. In this case the Queue service will
222
- # return status code 500 (Internal Server Error), with the additional error
223
- # code OperationTimedOut. If the operation times out, the client should
224
- # continue to retry Clear Messages until it succeeds, to ensure that all
225
- # messages have been deleted.
226
- #
227
- # ==== Attributes
228
- #
229
- # * +queue_name+ - String. The name of the queue.
230
- # * +options+ - Hash. Optional parameters.
231
- #
232
- # ==== Options
233
- #
234
- # Accepted key/value pairs in options parameter are:
235
- # * +:timeout+ - Integer. A timeout in seconds.
236
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
237
- # in the analytics logs when storage analytics logging is enabled.
238
- #
239
- # See http://msdn.microsoft.com/en-us/library/azure/dd179454
240
- #
241
- # Returns nil on success
242
- def clear_messages(queue_name, options = {})
243
- query = {}
244
- query["timeout"] = options[:timeout].to_s if options[:timeout]
245
- uri = messages_uri(queue_name, query)
246
- call(:delete, uri, nil, {}, options)
247
- nil
248
- end
249
-
250
- # Public: Creates a new queue under the storage account.
251
- #
252
- # ==== Attributes
253
- #
254
- # * +queue_name+ - String. The queue name.
255
- # * +options+ - Hash. Optional parameters.
256
- #
257
- # ==== Options
258
- #
259
- # Accepted key/value pairs in options parameter are:
260
- # * +:metadata+ - Hash. A hash of user defined metadata.
261
- # * +:timeout+ - Integer. A timeout in seconds.
262
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
263
- # in the analytics logs when storage analytics logging is enabled.
264
- #
265
- # See http://msdn.microsoft.com/en-us/library/azure/dd179342
266
- #
267
- # Returns nil on success
268
- def create_queue(queue_name, options = {})
269
- query = {}
270
- query["timeout"] = options[:timeout].to_s if options[:timeout]
271
-
272
- uri = queue_uri(queue_name, query)
273
-
274
- headers = {}
275
- StorageService.add_metadata_to_headers(options[:metadata] || {}, headers) if options[:metadata]
276
-
277
- call(:put, uri, nil, headers, options)
278
- nil
279
- end
280
-
281
- # Public: Deletes a queue.
282
- #
283
- # ==== Attributes
284
- #
285
- # * +queue_name+ - String. The queue name.
286
- # * +options+ - Hash. Optional parameters.
287
- #
288
- # ==== Options
289
- #
290
- # Accepted key/value pairs in options parameter are:
291
- # * +:timeout+ - Integer. A timeout in seconds.
292
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
293
- # in the analytics logs when storage analytics logging is enabled.
294
- #
295
- # See http://msdn.microsoft.com/en-us/library/azure/dd179436
296
- #
297
- # Returns nil on success
298
- def delete_queue(queue_name, options = {})
299
- query = {}
300
- query["timeout"] = options[:timeout].to_s if options[:timeout]
301
-
302
- uri = queue_uri(queue_name, query)
303
-
304
- call(:delete, uri, nil, {}, options)
305
- nil
306
- end
307
-
308
- # Public: Returns queue properties, including user-defined metadata.
309
- #
310
- # ==== Attributes
311
- #
312
- # * +queue_name+ - String. The queue name.
313
- # * +options+ - Hash. Optional parameters.
314
- #
315
- # ==== Options
316
- #
317
- # Accepted key/value pairs in options parameter are:
318
- # * +:timeout+ - Integer. A timeout in seconds.
319
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
320
- # in the analytics logs when storage analytics logging is enabled.
321
- # * +:location_mode+ - LocationMode. Specifies the location mode used to decide
322
- # which location the request should be sent to.
323
- #
324
- # See http://msdn.microsoft.com/en-us/library/azure/dd179384
325
- #
326
- # Returns a tuple of (approximate_message_count, metadata)
327
- # * approximate_messages_count - Integer. The approximate number of messages in the queue. This number is not
328
- # lower than the actual number of messages in the queue, but could be higher.
329
- # * metadata - Hash. The queue metadata (Default: {})
330
- #
331
- def get_queue_metadata(queue_name, options = {})
332
- query = { "comp" => "metadata" }
333
- query["timeout"] = options[:timeout].to_s if options[:timeout]
334
-
335
- options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY
336
- uri = queue_uri(queue_name, query, options)
337
-
338
- response = call(:get, uri, nil, {}, options)
339
-
340
- approximate_messages_count = response.headers["x-ms-approximate-messages-count"]
341
- metadata = Serialization.metadata_from_headers(response.headers)
342
-
343
- return approximate_messages_count.to_i, metadata
344
- end
345
-
346
- # Public: Sets user-defined metadata on the queue. To delete queue metadata, call
347
- # this API with an empty hash in the metadata parameter.
348
- #
349
- # ==== Attributes
350
- #
351
- # * +queue_name+ - String. The queue name.
352
- # * +metadata+ - Hash. A hash of user defined metadata
353
- # * +options+ - Hash. Optional parameters.
354
- #
355
- # ==== Options
356
- #
357
- # Accepted key/value pairs in options parameter are:
358
- # * +:timeout+ - Integer. A timeout in seconds.
359
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
360
- # in the analytics logs when storage analytics logging is enabled.
361
- #
362
- # See http://msdn.microsoft.com/en-us/library/azure/dd179348
363
- #
364
- # Returns nil on success
365
- def set_queue_metadata(queue_name, metadata, options = {})
366
- query = { "comp" => "metadata" }
367
- query["timeout"] = options[:timeout].to_s if options[:timeout]
368
-
369
- uri = queue_uri(queue_name, query)
370
-
371
- headers = {}
372
- StorageService.add_metadata_to_headers(metadata || {}, headers)
373
-
374
- call(:put, uri, nil, headers, options)
375
- nil
376
- end
377
-
378
- # Public: Gets the access control list (ACL) for the queue.
379
- #
380
- # ==== Attributes
381
- #
382
- # * +queue_name+ - String. The queue name.
383
- # * +options+ - Hash. Optional parameters.
384
- #
385
- # ==== Options
386
- #
387
- # Accepted key/value pairs in options parameter are:
388
- # * +:timeout+ - Integer. A timeout in seconds.
389
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
390
- # in the analytics logs when storage analytics logging is enabled.
391
- # * +:location_mode+ - LocationMode. Specifies the location mode used to decide
392
- # which location the request should be sent to.
393
- #
394
- # See http://msdn.microsoft.com/en-us/library/azure/jj159101
395
- #
396
- # Returns a list of Azure::Storage::Entity::SignedIdentifier instances
397
- def get_queue_acl(queue_name, options = {})
398
- query = { "comp" => "acl" }
399
- query["timeout"] = options[:timeout].to_s if options[:timeout]
400
-
401
- options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY
402
- response = call(:get, queue_uri(queue_name, query, options), nil, {}, options)
403
-
404
- signed_identifiers = []
405
- signed_identifiers = Serialization.signed_identifiers_from_xml(response.body) unless response.body == (nil) || response.body.length < (1)
406
- signed_identifiers
407
- end
408
-
409
- # Public: Sets the access control list (ACL) for the queue.
410
- #
411
- # ==== Attributes
412
- #
413
- # * +queue_name+ - String. The queue name.
414
- # * +options+ - Hash. Optional parameters.
415
- #
416
- # ==== Options
417
- #
418
- # Accepted key/value pairs in options parameter are:
419
- # * +:signed_identifiers+ - Array. A list of Azure::Storage::Entity::SignedIdentifier instances
420
- # * +:timeout+ - Integer. A timeout in seconds.
421
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
422
- # in the analytics logs when storage analytics logging is enabled.
423
- #
424
- # See http://msdn.microsoft.com/en-us/library/azure/jj159099
425
- #
426
- # Returns nil on success
427
- def set_queue_acl(queue_name, options = {})
428
- query = { "comp" => "acl" }
429
- query["timeout"] = options[:timeout].to_s if options[:timeout]
430
-
431
- uri = queue_uri(queue_name, query)
432
- body = nil
433
- body = Serialization.signed_identifiers_to_xml(options[:signed_identifiers]) if options[:signed_identifiers] && options[:signed_identifiers].length > 0
434
-
435
- call(:put, uri, body, {}, options)
436
- nil
437
- end
438
-
439
- # Public: Adds a message to the queue and optionally sets a visibility timeout for the message.
440
- #
441
- # ==== Attributes
442
- #
443
- # * +queue_name+ - String. The queue name.
444
- # * +message_text+ - String. The message contents. Note that the message content must be in a format that may be encoded with UTF-8.
445
- # * +options+ - Hash. Optional parameters.
446
- #
447
- # ==== Options
448
- #
449
- # Accepted key/value pairs in options parameter are:
450
- # * +:visibility_timeout+ - Integer. Specifies the new visibility timeout value, in seconds, relative to server
451
- # time. The new value must be larger than or equal to 0, and cannot be larger than 7
452
- # days. The visibility timeout of a message cannot be set to a value later than the
453
- # expiry time. :visibility_timeout should be set to a value smaller than the
454
- # time-to-live value. If not specified, the default value is 0.
455
- # * +:message_ttl+ - Integer. Specifies the time-to-live interval for the message, in seconds. The maximum
456
- # time-to-live allowed is 7 days. If not specified, the default time-to-live is 7 days.
457
- # * +:encode+ - Boolean. If set to true, the message will be base64 encoded.
458
- # * +:timeout+ - Integer. A timeout in seconds.
459
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
460
- # in the analytics logs when storage analytics logging is enabled.
461
- #
462
- # See http://msdn.microsoft.com/en-us/library/azure/dd179346
463
- #
464
- # Returns a list of Azure::Storage::Queue::Message object containing only the echo of request on success
465
- def create_message(queue_name, message_text, options = {})
466
- query = {}
467
-
468
- unless options.empty?
469
- query["visibilitytimeout"] = options[:visibility_timeout] if options[:visibility_timeout]
470
- query["messagettl"] = options[:message_ttl] if options[:message_ttl]
471
- query["timeout"] = options[:timeout].to_s if options[:timeout]
472
- end
473
-
474
- uri = messages_uri(queue_name, query)
475
- body = Serialization.message_to_xml(message_text, options[:encode])
476
-
477
- response = call(:post, uri, body, {}, options)
478
- Serialization.queue_messages_from_xml(response.body, options[:decode])
479
- end
480
-
481
- # Public: Deletes a specified message from the queue.
482
- #
483
- # ==== Attributes
484
- #
485
- # * +queue_name+ - String. The queue name.
486
- # * +message_id+ - String. The id of the message.
487
- # * +pop_receipt+ - String. The valid pop receipt value returned from an earlier call to the Get Messages or
488
- # Update Message operation.
489
- # * +options+ - Hash. Optional parameters.
490
- #
491
- # ==== Options
492
- #
493
- # Accepted key/value pairs in options parameter are:
494
- # * +:timeout+ - Integer. A timeout in seconds.
495
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
496
- # in the analytics logs when storage analytics logging is enabled.
497
- #
498
- # See http://msdn.microsoft.com/en-us/library/azure/dd179347
499
- #
500
- # Returns nil on success
501
- #
502
- # Remarks:
503
- #
504
- # When a message is successfully deleted, it is immediately marked for deletion and is no longer accessible to
505
- # clients. The message is later removed from the queue during garbage collection.
506
- #
507
- # After a client retrieves a message with the Get Messages operation, the client is expected to process and
508
- # delete the message. To delete the message, you must have two items of data returned in the response body of
509
- # the Get Messages operation:
510
- #
511
- # * The message ID, an opaque GUID value that identifies the message in the queue.
512
- #
513
- # * A valid pop receipt, an opaque value that indicates that the message has been retrieved.
514
- #
515
- # The message ID is returned from the previous Get Messages operation. The pop receipt is returned from the most
516
- # recent Get Messages or Update Message operation. In order for the Delete Message operation to succeed, the pop
517
- # receipt specified on the request must match the pop receipt returned from the Get Messages or Update Message
518
- # operation.
519
- #
520
- # Pop receipts remain valid until one of the following events occurs:
521
- #
522
- # * The message has expired.
523
- #
524
- # * The message has been deleted using the last pop receipt received either from Get Messages or Update Message.
525
- #
526
- # * The invisibility time has elapsed and the message has been dequeued by a Get Messages request. When the
527
- # invisibility time elapses, the message becomes visible again. If it is retrieved by another Get Messages
528
- # request, the returned pop receipt can be used to delete or update the message.
529
- #
530
- # * The message has been updated with a new visibility timeout. When the message is updated, a new pop receipt
531
- # will be returned.
532
- #
533
- # If the message has already been deleted when Delete Message is called, the Queue service returns status code
534
- # 404 (Not Found).
535
- #
536
- # If a message with a matching pop receipt is not found, the service returns status code 400 (Bad Request), with
537
- # additional error information indicating that the cause of the failure was a mismatched pop receipt.
538
- #
539
- def delete_message(queue_name, message_id, pop_receipt, options = {})
540
- query = { "popreceipt" => pop_receipt }
541
- query["timeout"] = options[:timeout].to_s if options[:timeout]
542
-
543
- uri = message_uri(queue_name, message_id, query)
544
-
545
- call(:delete, uri, nil, {}, options)
546
- nil
547
- end
548
-
549
- # Public: Retrieves one or more messages from the front of the queue, without changing the message visibility.
550
- #
551
- # ==== Attributes
552
- #
553
- # * +queue_name+ - String. The queue name.
554
- # * +options+ - Hash. Optional parameters.
555
- #
556
- # ==== Options
557
- #
558
- # Accepted key/value pairs in options parameter are:
559
- # * +:number_of_messages+ - Integer. How many messages to return. (optional, Default: 1)
560
- # * +:decode+ - Boolean. Boolean value indicating if the message should be base64 decoded.
561
- # * +:timeout+ - Integer. A timeout in seconds.
562
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
563
- # in the analytics logs when storage analytics logging is enabled.
564
- # * +:location_mode+ - LocationMode. Specifies the location mode used to decide
565
- # which location the request should be sent to.
566
- #
567
- # See http://msdn.microsoft.com/en-us/library/azure/dd179472
568
- #
569
- # Returns a list of Azure::Storage::Entity::Queue::Message instances
570
- def peek_messages(queue_name, options = {})
571
- number_of_messages = 1
572
- number_of_messages = options[:number_of_messages] if options[:number_of_messages]
573
-
574
- query = { "peekonly" => "true", "numofmessages" => number_of_messages.to_s }
575
- query["timeout"] = options[:timeout].to_s if options[:timeout]
576
-
577
- options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY
578
- uri = messages_uri(queue_name, query, options)
579
- response = call(:get, uri, nil, {}, options)
580
-
581
- messages = Serialization.queue_messages_from_xml(response.body, options[:decode])
582
- messages
583
- end
584
-
585
- # Public: Retrieves one or more messages from the front of the queue.
586
- #
587
- # ==== Attributes
588
- #
589
- # * +queue_name+ - String. The queue name.
590
- # * +visibility_timeout+ - Integer. The new visibility timeout value, in seconds, relative to server time.
591
- # * +options+ - Hash. Optional parameters.
592
- #
593
- # ==== Options
594
- #
595
- # Accepted key/value pairs in options parameter are:
596
- # * +:number_of_messages+ - Integer. How many messages to return. (optional, Default: 1)
597
- # * +:timeout+ - Integer. A timeout in seconds.
598
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
599
- # in the analytics logs when storage analytics logging is enabled.
600
- # * +:decode+ - Boolean. Boolean value indicating if the message should be base64 decoded.
601
- #
602
- # See http://msdn.microsoft.com/en-us/library/azure/dd179474
603
- #
604
- # Returns a list of Azure::Storage::Entity::Queue::Message instances
605
- def list_messages(queue_name, visibility_timeout, options = {})
606
- number_of_messages = 1
607
- number_of_messages = options[:number_of_messages] if options[:number_of_messages]
608
-
609
- query = { "visibilitytimeout" => visibility_timeout.to_s, "numofmessages" => number_of_messages.to_s }
610
- query["timeout"] = options[:timeout].to_s if options[:timeout]
611
-
612
- uri = messages_uri(queue_name, query)
613
- response = call(:get, uri, nil, {}, options)
614
-
615
- messages = Serialization.queue_messages_from_xml(response.body, options[:decode])
616
- messages
617
- end
618
-
619
- # Public: Adds a message to the queue and optionally sets a visibility timeout for the message.
620
- #
621
- # ==== Attributes
622
- #
623
- # * +queue_name+ - String. The queue name.
624
- # * +message_id+ - String. The id of the message.
625
- # * +pop_receipt+ - String. The valid pop receipt value returned from an earlier call to the Get Messages or
626
- # update Message operation.
627
- # * +message_text+ - String. The message contents. Note that the message content must be in a format that may
628
- # be encoded with UTF-8.
629
- # * +visibility_timeout+ - Integer. The new visibility timeout value, in seconds, relative to server time.
630
- # * +options+ - Hash. Optional parameters.
631
- #
632
- # ==== Options
633
- #
634
- # Accepted key/value pairs in options parameter are:
635
- # * +:encode+ - Boolean. If set to true, the message will be base64 encoded.
636
- # * +:timeout+ - Integer. A timeout in seconds.
637
- # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
638
- # in the analytics logs when storage analytics logging is enabled.
639
- #
640
- # See http://msdn.microsoft.com/en-us/library/azure/hh452234
641
- #
642
- # Returns a tuple of (pop_receipt, time_next_visible)
643
- # * pop_receipt - String. The pop receipt of the queue message.
644
- # * time_next_visible - String. A UTC date/time value that represents when the message will be visible on the queue.
645
- #
646
- # Remarks:
647
- #
648
- # An Update Message operation will fail if the specified message does not exist in the queue, or if the
649
- # specified pop receipt does not match the message.
650
- #
651
- # A pop receipt is returned by the Get Messages operation or the Update Message operation. Pop receipts
652
- # remain valid until one of the following events occurs:
653
- #
654
- # * The message has expired.
655
- #
656
- # * The message has been deleted using the last pop receipt received either from Get Messages or
657
- # Update Message.
658
- #
659
- # * The invisibility time has elapsed and the message has been dequeued by a Get Messages request. When
660
- # the invisibility time elapses, the message becomes visible again. If it is retrieved by another
661
- # Get Messages request, the returned pop receipt can be used to delete or update the message.
662
- #
663
- # * The message has been updated with a new visibility timeout. When the message is updated, a new pop
664
- # receipt will be returned.
665
- #
666
- # The Update Message operation can be used to continually extend the invisibility of a queue message. This
667
- # functionality can be useful if you want a worker role to "lease" a queue message. For example, if a worker
668
- # role calls Get Messages and recognizes that it needs more time to process a message, it can continually
669
- # extend the message's invisibility until it is processed. If the worker role were to fail during processing,
670
- # eventually the message would become visible again and another worker role could process it.
671
- #
672
- def update_message(queue_name, message_id, pop_receipt, message_text, visibility_timeout, options = {})
673
- query = { "visibilitytimeout" => visibility_timeout.to_s, "popreceipt" => pop_receipt }
674
- query["timeout"] = options[:timeout].to_s if options[:timeout]
675
-
676
- uri = message_uri(queue_name, message_id, query)
677
- body = Serialization.message_to_xml(message_text, options[:encode])
678
-
679
- response = call(:put, uri, body, {}, options)
680
- new_pop_receipt = response.headers["x-ms-popreceipt"]
681
- time_next_visible = response.headers["x-ms-time-next-visible"]
682
- return new_pop_receipt, time_next_visible
683
- end
684
-
685
- # Protected: Generate the URI for the collection of queues.
686
- #
687
- # ==== Attributes
688
- #
689
- # * +query+ - A Hash of query parameters (default: {}).
690
- #
691
- # Returns a URI.
692
- protected
693
- def collection_uri(query = {}, options = {})
694
- query.update(comp: "list", include: "metadata")
695
- generate_uri("", query, options)
696
- end
697
-
698
- # Protected: Generate the URI for a given queue.
699
- #
700
- # ==== Attributes
701
- #
702
- # * +queue_name+ - The name of the queue.
703
- # * +query+ - A Hash of query parameters (default: {}).
704
- #
705
- # Returns a URI.
706
- protected
707
- def queue_uri(queue_name, query = {}, options = {})
708
- return queue_name if queue_name.kind_of? ::URI
709
- generate_uri(queue_name, query, options)
710
- end
711
-
712
- # Protected: Generate the messages URI for the given queue.
713
- #
714
- # ==== Attributes
715
- #
716
- # * +queue_name+ - The name of the queue.
717
- # * +query+ - A Hash of query parameters (default: {}).
718
- #
719
- # Returns a URI.
720
- protected
721
- def messages_uri(queue_name, query = {}, options = {})
722
- generate_uri("#{queue_name}/messages", query, options)
723
- end
724
-
725
- # Protected: Generate the URI for a given message
726
- #
727
- # ==== Attributes
728
- #
729
- # * +queue_name+ - The name of the queue.
730
- # * +message_id+ - The id of the message.
731
- # * +query+ - A Hash of query parameters (default: {}).
732
- #
733
- # Returns a URI.
734
- protected
735
- def message_uri(queue_name, message_id, query = {}, options = {})
736
- generate_uri("#{queue_name}/messages/#{message_id}", query, options)
737
- end
738
-
739
- protected
740
- def call(method, uri, body = nil, headers = {}, options = {})
741
- headers["x-ms-version"] = @api_version ? @api_version : Default::STG_VERSION
742
- headers["User-Agent"] = @user_agent_prefix ? "#{@user_agent_prefix}; #{Default::USER_AGENT}" : Default::USER_AGENT
743
- super
744
- end
745
- end
746
- end
747
- end
748
-
749
- Azure::Storage::QueueService = Azure::Storage::Queue::QueueService
1
+ # frozen_string_literal: true
2
+
3
+ #-------------------------------------------------------------------------
4
+ # # Copyright (c) Microsoft and contributors. All rights reserved.
5
+ #
6
+ # The MIT License(MIT)
7
+
8
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ # of this software and associated documentation files(the "Software"), to deal
10
+ # in the Software without restriction, including without limitation the rights
11
+ # to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
12
+ # copies of the Software, and to permit persons to whom the Software is
13
+ # furnished to do so, subject to the following conditions :
14
+
15
+ # The above copyright notice and this permission notice shall be included in
16
+ # all copies or substantial portions of the Software.
17
+
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
21
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ # THE SOFTWARE.
25
+ #--------------------------------------------------------------------------
26
+ module Azure::Storage
27
+ include Azure::Storage::Common::Service
28
+ StorageService = Azure::Storage::Common::Service::StorageService
29
+
30
+ module Queue
31
+ class QueueService < StorageService
32
+ class << self
33
+ # Public: Creates an instance of [Azure::Storage::Queue::QueueService]
34
+ #
35
+ # ==== Attributes
36
+ #
37
+ # * +options+ - Hash. Optional parameters.
38
+ #
39
+ # ==== Options
40
+ #
41
+ # Accepted key/value pairs in options parameter are:
42
+ #
43
+ # * +:use_development_storage+ - TrueClass|FalseClass. Whether to use storage emulator.
44
+ # * +:development_storage_proxy_uri+ - String. Used with +:use_development_storage+ if emulator is hosted other than localhost.
45
+ # * +:storage_account_name+ - String. The name of the storage account.
46
+ # * +:storage_access_key+ - Base64 String. The access key of the storage account.
47
+ # * +:storage_sas_token+ - String. The signed access signature for the storage account or one of its service.
48
+ # * +:storage_queue_host+ - String. Specified Queue service endpoint or hostname
49
+ # * +:storage_dns_suffix+ - String. The suffix of a regional Storage Service, to
50
+ # * +:default_endpoints_protocol+ - String. http or https
51
+ # * +:use_path_style_uri+ - String. Whether use path style URI for specified endpoints
52
+ # * +:ca_file+ - String. File path of the CA file if having issue with SSL
53
+ # * +:ssl_version+ - Symbol. The ssl version to be used, sample: :TLSv1_1, :TLSv1_2, for the details, see https://github.com/ruby/openssl/blob/master/lib/openssl/ssl.rb
54
+ # * +:ssl_min_version+ - Symbol. The min ssl version supported, only supported in Ruby 2.5+
55
+ # * +:ssl_max_version+ - Symbol. The max ssl version supported, only supported in Ruby 2.5+
56
+ # * +:user_agent_prefix+ - String. The user agent prefix that can identify the application calls the library
57
+ #
58
+ # The valid set of options include:
59
+ # * Storage Emulator: +:use_development_storage+ required, +:development_storage_proxy_uri+ optionally
60
+ # * Storage account name and key: +:storage_account_name+ and +:storage_access_key+ required, set +:storage_dns_suffix+ necessarily
61
+ # * Storage account name and SAS token: +:storage_account_name+ and +:storage_sas_token+ required, set +:storage_dns_suffix+ necessarily
62
+ # * Specified hosts and SAS token: At least one of the service host and SAS token. It's up to user to ensure the SAS token is suitable for the serivce
63
+ # * Anonymous Queue: only +:storage_queue_host+, if it is to only access queues within a container
64
+ #
65
+ # Additional notes:
66
+ # * Specified hosts can be set when use account name with access key or sas token
67
+ # * +:default_endpoints_protocol+ can be set if the scheme is not specified in hosts
68
+ # * Storage emulator always use path style URI
69
+ # * +:ca_file+ is independent.
70
+ #
71
+ # When empty options are given, it will try to read settings from Environment Variables. Refer to [Azure::Storage::Common::ClientOptions.env_vars_mapping] for the mapping relationship
72
+ #
73
+ # @return [Azure::Storage::Queue::QueueService]
74
+ def create(options = {}, &block)
75
+ service_options = { client: Azure::Storage::Common::Client::create(options, &block), api_version: Azure::Storage::Queue::Default::STG_VERSION }
76
+ service_options[:user_agent_prefix] = options[:user_agent_prefix] if options[:user_agent_prefix]
77
+ Azure::Storage::Queue::QueueService.new(service_options, &block)
78
+ end
79
+
80
+ # Public: Creates an instance of [Azure::Storage::Queue::QueueService] with Storage Emulator
81
+ #
82
+ # ==== Attributes
83
+ #
84
+ # * +proxy_uri+ - String. Used with +:use_development_storage+ if emulator is hosted other than localhost.
85
+ #
86
+ # @return [Azure::Storage::Queue::QueueService]
87
+ def create_development(proxy_uri = nil, &block)
88
+ service_options = { client: Azure::Storage::Common::Client::create_development(proxy_uri, &block), api_version: Azure::Storage::Queue::Default::STG_VERSION }
89
+ Azure::Storage::Queue::QueueService.new(service_options, &block)
90
+ end
91
+
92
+ # Public: Creates an instance of [Azure::Storage::Queue::QueueService] from Environment Variables
93
+ #
94
+ # @return [Azure::Storage::Queue::QueueService]
95
+ def create_from_env(&block)
96
+ service_options = { client: Azure::Storage::Common::Client::create_from_env(&block), api_version: Azure::Storage::Queue::Default::STG_VERSION }
97
+ Azure::Storage::Queue::QueueService.new(service_options, &block)
98
+ end
99
+
100
+ # Public: Creates an instance of [Azure::Storage::Queue::QueueService] from Environment Variables
101
+ #
102
+ # ==== Attributes
103
+ #
104
+ # * +connection_string+ - String. Please refer to https://azure.microsoft.com/en-us/documentation/articles/storage-configure-connection-string/.
105
+ #
106
+ # @return [Azure::Storage::Queue::QueueService]
107
+ def create_from_connection_string(connection_string, &block)
108
+ service_options = { client: Azure::Storage::Common::Client::create_from_connection_string(connection_string, &block), api_version: Azure::Storage::Queue::Default::STG_VERSION }
109
+ Azure::Storage::Queue::QueueService.new(service_options, &block)
110
+ end
111
+ end
112
+
113
+ # Public: Initializes an instance of [Azure::Storage::Queue::QueueService]
114
+ #
115
+ # ==== Attributes
116
+ #
117
+ # * +options+ - Hash. Optional parameters.
118
+ #
119
+ # ==== Options
120
+ #
121
+ # Accepted key/value pairs in options parameter are:
122
+ #
123
+ # * +:use_development_storage+ - TrueClass|FalseClass. Whether to use storage emulator.
124
+ # * +:development_storage_proxy_uri+ - String. Used with +:use_development_storage+ if emulator is hosted other than localhost.
125
+ # * +:storage_connection_string+ - String. The storage connection string.
126
+ # * +:storage_account_name+ - String. The name of the storage account.
127
+ # * +:storage_access_key+ - Base64 String. The access key of the storage account.
128
+ # * +:storage_sas_token+ - String. The signed access signature for the storage account or one of its service.
129
+ # * +:storage_queue_host+ - String. Specified Queue serivce endpoint or hostname
130
+ # * +:storage_dns_suffix+ - String. The suffix of a regional Storage Serivce, to
131
+ # * +:default_endpoints_protocol+ - String. http or https
132
+ # * +:use_path_style_uri+ - String. Whether use path style URI for specified endpoints
133
+ # * +:ca_file+ - String. File path of the CA file if having issue with SSL
134
+ # * +:ssl_version+ - Symbol. The ssl version to be used, sample: :TLSv1_1, :TLSv1_2, for the details, see https://github.com/ruby/openssl/blob/master/lib/openssl/ssl.rb
135
+ # * +:ssl_min_version+ - Symbol. The min ssl version supported, only supported in Ruby 2.5+
136
+ # * +:ssl_max_version+ - Symbol. The max ssl version supported, only supported in Ruby 2.5+
137
+ # * +:user_agent_prefix+ - String. The user agent prefix that can identify the application calls the library
138
+ # * +:client+ - Azure::Storage::Common::Client. The common client used to initalize the service.
139
+ #
140
+ # The valid set of options include:
141
+ # * Storage Emulator: +:use_development_storage+ required, +:development_storage_proxy_uri+ optionally
142
+ # * Storage account name and key: +:storage_account_name+ and +:storage_access_key+ required, set +:storage_dns_suffix+ necessarily
143
+ # * Storage account name and SAS token: +:storage_account_name+ and +:storage_sas_token+ required, set +:storage_dns_suffix+ necessarily
144
+ # * Specified hosts and SAS token: At least one of the service host and SAS token. It's up to user to ensure the SAS token is suitable for the serivce
145
+ # * Azure::Storage::Common::Client: The common client used to initalize the service. This client can be initalized and used repeatedly.
146
+ # * Anonymous Queue: only +:storage_queue_host+, if it is to only access queues within a container
147
+ #
148
+ # Additional notes:
149
+ # * Specified hosts can be set when use account name with access key or sas token
150
+ # * +:default_endpoints_protocol+ can be set if the scheme is not specified in hosts
151
+ # * Storage emulator always use path style URI
152
+ # * +:ca_file+ is independent.
153
+ #
154
+ # When empty options are given, it will try to read settings from Environment Variables. Refer to [Azure::Storage::Common::ClientOptions.env_vars_mapping] for the mapping relationship
155
+ def initialize(options = {}, &block)
156
+ service_options = options.clone
157
+ client_config = service_options[:client] ||= Azure::Storage::Common::Client::create(service_options, &block)
158
+ @user_agent_prefix = service_options[:user_agent_prefix] if service_options[:user_agent_prefix]
159
+ @api_version = service_options[:api_version] || Azure::Storage::Queue::Default::STG_VERSION
160
+ signer = service_options[:signer] || client_config.signer || Azure::Storage::Common::Core::Auth::SharedKey.new(client_config.storage_account_name, client_config.storage_access_key)
161
+ signer.api_ver = @api_version if signer.is_a? Azure::Storage::Common::Core::Auth::SharedAccessSignatureSigner
162
+ super(signer, client_config.storage_account_name, service_options, &block)
163
+ @storage_service_host[:primary] = client.storage_queue_host
164
+ @storage_service_host[:secondary] = client.storage_queue_host true
165
+ end
166
+
167
+ # Public: Get a list of Queues from the server
168
+ #
169
+ # ==== Attributes
170
+ #
171
+ # * +options+ - Hash. Optional parameters.
172
+ #
173
+ # ==== Options
174
+ #
175
+ # Accepted key/value pairs in options parameter are:
176
+ # * +:prefix+ - String. Filters the results to return only containers
177
+ # whose name begins with the specified prefix. (optional)
178
+ # * +:marker+ - String. An identifier the specifies the portion of the
179
+ # list to be returned. This value comes from the property
180
+ # Azure::Service::EnumerationResults.continuation_token when there
181
+ # are more containers available than were returned. The
182
+ # marker value may then be used here to request the next set
183
+ # of list items. (optional)
184
+ # * +:max_results+ - Integer. Specifies the maximum number of containers to return.
185
+ # If max_results is not specified, or is a value greater than
186
+ # 5,000, the server will return up to 5,000 items. If it is set
187
+ # to a value less than or equal to zero, the server will return
188
+ # status code 400 (Bad Request). (optional)
189
+ # * +:metadata+ - Boolean. Specifies whether or not to return the container metadata.
190
+ # (optional, Default=false)
191
+ # * +:timeout+ - Integer. A timeout in seconds.
192
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
193
+ # in the analytics logs when storage analytics logging is enabled.
194
+ # * +:location_mode+ - LocationMode. Specifies the location mode used to decide
195
+ # which location the request should be sent to.
196
+ #
197
+ # NOTE: Metadata requested with the :metadata parameter must have been stored in
198
+ # accordance with the naming restrictions imposed by the 2009-09-19 version of the queue
199
+ # service. Beginning with that version, all metadata names must adhere to the naming
200
+ # conventions for C# identifiers.
201
+ #
202
+ # See http://msdn.microsoft.com/en-us/library/azure/dd179466
203
+ #
204
+ # Any metadata with invalid names which were previously stored, will be returned with the
205
+ # key "x-ms-invalid-name" in the metadata hash. This may contain multiple values and be an
206
+ # Array (vs a String if it only contains a single value).
207
+ #
208
+ # Returns an Azure::Storage::Common::EnumerationResults
209
+ def list_queues(options = {})
210
+ query = {}
211
+ query["prefix"] = options[:prefix] if options[:prefix]
212
+ query["marker"] = options[:marker] if options[:marker]
213
+ query["maxresults"] = options[:max_results].to_s if options[:max_results]
214
+ query["include"] = "metadata" if options[:metadata] == true
215
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
216
+
217
+ options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY
218
+ uri = collection_uri(query, options)
219
+ response = call(:get, uri, nil, {}, options)
220
+
221
+ Serialization.queue_enumeration_results_from_xml(response.body)
222
+ end
223
+
224
+ # Public: Clears all messages from the queue.
225
+ #
226
+ # If a queue contains a large number of messages, Clear Messages may time out
227
+ # before all messages have been deleted. In this case the Queue service will
228
+ # return status code 500 (Internal Server Error), with the additional error
229
+ # code OperationTimedOut. If the operation times out, the client should
230
+ # continue to retry Clear Messages until it succeeds, to ensure that all
231
+ # messages have been deleted.
232
+ #
233
+ # ==== Attributes
234
+ #
235
+ # * +queue_name+ - String. The name of the queue.
236
+ # * +options+ - Hash. Optional parameters.
237
+ #
238
+ # ==== Options
239
+ #
240
+ # Accepted key/value pairs in options parameter are:
241
+ # * +:timeout+ - Integer. A timeout in seconds.
242
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
243
+ # in the analytics logs when storage analytics logging is enabled.
244
+ #
245
+ # See http://msdn.microsoft.com/en-us/library/azure/dd179454
246
+ #
247
+ # Returns nil on success
248
+ def clear_messages(queue_name, options = {})
249
+ query = {}
250
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
251
+ uri = messages_uri(queue_name, query)
252
+ call(:delete, uri, nil, {}, options)
253
+ nil
254
+ end
255
+
256
+ # Public: Creates a new queue under the storage account.
257
+ #
258
+ # ==== Attributes
259
+ #
260
+ # * +queue_name+ - String. The queue name.
261
+ # * +options+ - Hash. Optional parameters.
262
+ #
263
+ # ==== Options
264
+ #
265
+ # Accepted key/value pairs in options parameter are:
266
+ # * +:metadata+ - Hash. A hash of user defined metadata.
267
+ # * +:timeout+ - Integer. A timeout in seconds.
268
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
269
+ # in the analytics logs when storage analytics logging is enabled.
270
+ #
271
+ # See http://msdn.microsoft.com/en-us/library/azure/dd179342
272
+ #
273
+ # Returns nil on success
274
+ def create_queue(queue_name, options = {})
275
+ query = {}
276
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
277
+
278
+ uri = queue_uri(queue_name, query)
279
+
280
+ headers = {}
281
+ StorageService.add_metadata_to_headers(options[:metadata] || {}, headers) if options[:metadata]
282
+
283
+ call(:put, uri, nil, headers, options)
284
+ nil
285
+ end
286
+
287
+ # Public: Deletes a queue.
288
+ #
289
+ # ==== Attributes
290
+ #
291
+ # * +queue_name+ - String. The queue name.
292
+ # * +options+ - Hash. Optional parameters.
293
+ #
294
+ # ==== Options
295
+ #
296
+ # Accepted key/value pairs in options parameter are:
297
+ # * +:timeout+ - Integer. A timeout in seconds.
298
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
299
+ # in the analytics logs when storage analytics logging is enabled.
300
+ #
301
+ # See http://msdn.microsoft.com/en-us/library/azure/dd179436
302
+ #
303
+ # Returns nil on success
304
+ def delete_queue(queue_name, options = {})
305
+ query = {}
306
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
307
+
308
+ uri = queue_uri(queue_name, query)
309
+
310
+ call(:delete, uri, nil, {}, options)
311
+ nil
312
+ end
313
+
314
+ # Public: Returns queue properties, including user-defined metadata.
315
+ #
316
+ # ==== Attributes
317
+ #
318
+ # * +queue_name+ - String. The queue name.
319
+ # * +options+ - Hash. Optional parameters.
320
+ #
321
+ # ==== Options
322
+ #
323
+ # Accepted key/value pairs in options parameter are:
324
+ # * +:timeout+ - Integer. A timeout in seconds.
325
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
326
+ # in the analytics logs when storage analytics logging is enabled.
327
+ # * +:location_mode+ - LocationMode. Specifies the location mode used to decide
328
+ # which location the request should be sent to.
329
+ #
330
+ # See http://msdn.microsoft.com/en-us/library/azure/dd179384
331
+ #
332
+ # Returns a tuple of (approximate_message_count, metadata)
333
+ # * approximate_messages_count - Integer. The approximate number of messages in the queue. This number is not
334
+ # lower than the actual number of messages in the queue, but could be higher.
335
+ # * metadata - Hash. The queue metadata (Default: {})
336
+ #
337
+ def get_queue_metadata(queue_name, options = {})
338
+ query = { "comp" => "metadata" }
339
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
340
+
341
+ options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY
342
+ uri = queue_uri(queue_name, query, options)
343
+
344
+ response = call(:get, uri, nil, {}, options)
345
+
346
+ approximate_messages_count = response.headers["x-ms-approximate-messages-count"]
347
+ metadata = Serialization.metadata_from_headers(response.headers)
348
+
349
+ return approximate_messages_count.to_i, metadata
350
+ end
351
+
352
+ # Public: Sets user-defined metadata on the queue. To delete queue metadata, call
353
+ # this API with an empty hash in the metadata parameter.
354
+ #
355
+ # ==== Attributes
356
+ #
357
+ # * +queue_name+ - String. The queue name.
358
+ # * +metadata+ - Hash. A hash of user defined metadata
359
+ # * +options+ - Hash. Optional parameters.
360
+ #
361
+ # ==== Options
362
+ #
363
+ # Accepted key/value pairs in options parameter are:
364
+ # * +:timeout+ - Integer. A timeout in seconds.
365
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
366
+ # in the analytics logs when storage analytics logging is enabled.
367
+ #
368
+ # See http://msdn.microsoft.com/en-us/library/azure/dd179348
369
+ #
370
+ # Returns nil on success
371
+ def set_queue_metadata(queue_name, metadata, options = {})
372
+ query = { "comp" => "metadata" }
373
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
374
+
375
+ uri = queue_uri(queue_name, query)
376
+
377
+ headers = {}
378
+ StorageService.add_metadata_to_headers(metadata || {}, headers)
379
+
380
+ call(:put, uri, nil, headers, options)
381
+ nil
382
+ end
383
+
384
+ # Public: Gets the access control list (ACL) for the queue.
385
+ #
386
+ # ==== Attributes
387
+ #
388
+ # * +queue_name+ - String. The queue name.
389
+ # * +options+ - Hash. Optional parameters.
390
+ #
391
+ # ==== Options
392
+ #
393
+ # Accepted key/value pairs in options parameter are:
394
+ # * +:timeout+ - Integer. A timeout in seconds.
395
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
396
+ # in the analytics logs when storage analytics logging is enabled.
397
+ # * +:location_mode+ - LocationMode. Specifies the location mode used to decide
398
+ # which location the request should be sent to.
399
+ #
400
+ # See http://msdn.microsoft.com/en-us/library/azure/jj159101
401
+ #
402
+ # Returns a list of Azure::Storage::Entity::SignedIdentifier instances
403
+ def get_queue_acl(queue_name, options = {})
404
+ query = { "comp" => "acl" }
405
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
406
+
407
+ options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY
408
+ response = call(:get, queue_uri(queue_name, query, options), nil, {}, options)
409
+
410
+ signed_identifiers = []
411
+ signed_identifiers = Serialization.signed_identifiers_from_xml(response.body) unless response.body == (nil) || response.body.length < (1)
412
+ signed_identifiers
413
+ end
414
+
415
+ # Public: Sets the access control list (ACL) for the queue.
416
+ #
417
+ # ==== Attributes
418
+ #
419
+ # * +queue_name+ - String. The queue name.
420
+ # * +options+ - Hash. Optional parameters.
421
+ #
422
+ # ==== Options
423
+ #
424
+ # Accepted key/value pairs in options parameter are:
425
+ # * +:signed_identifiers+ - Array. A list of Azure::Storage::Entity::SignedIdentifier instances
426
+ # * +:timeout+ - Integer. A timeout in seconds.
427
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
428
+ # in the analytics logs when storage analytics logging is enabled.
429
+ #
430
+ # See http://msdn.microsoft.com/en-us/library/azure/jj159099
431
+ #
432
+ # Returns nil on success
433
+ def set_queue_acl(queue_name, options = {})
434
+ query = { "comp" => "acl" }
435
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
436
+
437
+ uri = queue_uri(queue_name, query)
438
+ body = nil
439
+ body = Serialization.signed_identifiers_to_xml(options[:signed_identifiers]) if options[:signed_identifiers] && options[:signed_identifiers].length > 0
440
+
441
+ call(:put, uri, body, {}, options)
442
+ nil
443
+ end
444
+
445
+ # Public: Adds a message to the queue and optionally sets a visibility timeout for the message.
446
+ #
447
+ # ==== Attributes
448
+ #
449
+ # * +queue_name+ - String. The queue name.
450
+ # * +message_text+ - String. The message contents. Note that the message content must be in a format that may be encoded with UTF-8.
451
+ # * +options+ - Hash. Optional parameters.
452
+ #
453
+ # ==== Options
454
+ #
455
+ # Accepted key/value pairs in options parameter are:
456
+ # * +:visibility_timeout+ - Integer. Specifies the new visibility timeout value, in seconds, relative to server
457
+ # time. The new value must be larger than or equal to 0, and cannot be larger than 7
458
+ # days. The visibility timeout of a message cannot be set to a value later than the
459
+ # expiry time. :visibility_timeout should be set to a value smaller than the
460
+ # time-to-live value. If not specified, the default value is 0.
461
+ # * +:message_ttl+ - Integer. Specifies the time-to-live interval for the message, in seconds. The maximum
462
+ # time-to-live allowed is 7 days. If not specified, the default time-to-live is 7 days.
463
+ # * +:encode+ - Boolean. If set to true, the message will be base64 encoded.
464
+ # * +:timeout+ - Integer. A timeout in seconds.
465
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
466
+ # in the analytics logs when storage analytics logging is enabled.
467
+ #
468
+ # See http://msdn.microsoft.com/en-us/library/azure/dd179346
469
+ #
470
+ # Returns a list of Azure::Storage::Queue::Message object containing only the echo of request on success
471
+ def create_message(queue_name, message_text, options = {})
472
+ query = {}
473
+
474
+ unless options.empty?
475
+ query["visibilitytimeout"] = options[:visibility_timeout] if options[:visibility_timeout]
476
+ query["messagettl"] = options[:message_ttl] if options[:message_ttl]
477
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
478
+ end
479
+
480
+ uri = messages_uri(queue_name, query)
481
+ body = Serialization.message_to_xml(message_text, options[:encode])
482
+
483
+ response = call(:post, uri, body, {}, options)
484
+ Serialization.queue_messages_from_xml(response.body, options[:decode])
485
+ end
486
+
487
+ # Public: Deletes a specified message from the queue.
488
+ #
489
+ # ==== Attributes
490
+ #
491
+ # * +queue_name+ - String. The queue name.
492
+ # * +message_id+ - String. The id of the message.
493
+ # * +pop_receipt+ - String. The valid pop receipt value returned from an earlier call to the Get Messages or
494
+ # Update Message operation.
495
+ # * +options+ - Hash. Optional parameters.
496
+ #
497
+ # ==== Options
498
+ #
499
+ # Accepted key/value pairs in options parameter are:
500
+ # * +:timeout+ - Integer. A timeout in seconds.
501
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
502
+ # in the analytics logs when storage analytics logging is enabled.
503
+ #
504
+ # See http://msdn.microsoft.com/en-us/library/azure/dd179347
505
+ #
506
+ # Returns nil on success
507
+ #
508
+ # Remarks:
509
+ #
510
+ # When a message is successfully deleted, it is immediately marked for deletion and is no longer accessible to
511
+ # clients. The message is later removed from the queue during garbage collection.
512
+ #
513
+ # After a client retrieves a message with the Get Messages operation, the client is expected to process and
514
+ # delete the message. To delete the message, you must have two items of data returned in the response body of
515
+ # the Get Messages operation:
516
+ #
517
+ # * The message ID, an opaque GUID value that identifies the message in the queue.
518
+ #
519
+ # * A valid pop receipt, an opaque value that indicates that the message has been retrieved.
520
+ #
521
+ # The message ID is returned from the previous Get Messages operation. The pop receipt is returned from the most
522
+ # recent Get Messages or Update Message operation. In order for the Delete Message operation to succeed, the pop
523
+ # receipt specified on the request must match the pop receipt returned from the Get Messages or Update Message
524
+ # operation.
525
+ #
526
+ # Pop receipts remain valid until one of the following events occurs:
527
+ #
528
+ # * The message has expired.
529
+ #
530
+ # * The message has been deleted using the last pop receipt received either from Get Messages or Update Message.
531
+ #
532
+ # * The invisibility time has elapsed and the message has been dequeued by a Get Messages request. When the
533
+ # invisibility time elapses, the message becomes visible again. If it is retrieved by another Get Messages
534
+ # request, the returned pop receipt can be used to delete or update the message.
535
+ #
536
+ # * The message has been updated with a new visibility timeout. When the message is updated, a new pop receipt
537
+ # will be returned.
538
+ #
539
+ # If the message has already been deleted when Delete Message is called, the Queue service returns status code
540
+ # 404 (Not Found).
541
+ #
542
+ # If a message with a matching pop receipt is not found, the service returns status code 400 (Bad Request), with
543
+ # additional error information indicating that the cause of the failure was a mismatched pop receipt.
544
+ #
545
+ def delete_message(queue_name, message_id, pop_receipt, options = {})
546
+ query = { "popreceipt" => pop_receipt }
547
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
548
+
549
+ uri = message_uri(queue_name, message_id, query)
550
+
551
+ call(:delete, uri, nil, {}, options)
552
+ nil
553
+ end
554
+
555
+ # Public: Retrieves one or more messages from the front of the queue, without changing the message visibility.
556
+ #
557
+ # ==== Attributes
558
+ #
559
+ # * +queue_name+ - String. The queue name.
560
+ # * +options+ - Hash. Optional parameters.
561
+ #
562
+ # ==== Options
563
+ #
564
+ # Accepted key/value pairs in options parameter are:
565
+ # * +:number_of_messages+ - Integer. How many messages to return. (optional, Default: 1)
566
+ # * +:decode+ - Boolean. Boolean value indicating if the message should be base64 decoded.
567
+ # * +:timeout+ - Integer. A timeout in seconds.
568
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
569
+ # in the analytics logs when storage analytics logging is enabled.
570
+ # * +:location_mode+ - LocationMode. Specifies the location mode used to decide
571
+ # which location the request should be sent to.
572
+ #
573
+ # See http://msdn.microsoft.com/en-us/library/azure/dd179472
574
+ #
575
+ # Returns a list of Azure::Storage::Entity::Queue::Message instances
576
+ def peek_messages(queue_name, options = {})
577
+ number_of_messages = 1
578
+ number_of_messages = options[:number_of_messages] if options[:number_of_messages]
579
+
580
+ query = { "peekonly" => "true", "numofmessages" => number_of_messages.to_s }
581
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
582
+
583
+ options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY
584
+ uri = messages_uri(queue_name, query, options)
585
+ response = call(:get, uri, nil, {}, options)
586
+
587
+ messages = Serialization.queue_messages_from_xml(response.body, options[:decode])
588
+ messages
589
+ end
590
+
591
+ # Public: Retrieves one or more messages from the front of the queue.
592
+ #
593
+ # ==== Attributes
594
+ #
595
+ # * +queue_name+ - String. The queue name.
596
+ # * +visibility_timeout+ - Integer. The new visibility timeout value, in seconds, relative to server time.
597
+ # * +options+ - Hash. Optional parameters.
598
+ #
599
+ # ==== Options
600
+ #
601
+ # Accepted key/value pairs in options parameter are:
602
+ # * +:number_of_messages+ - Integer. How many messages to return. (optional, Default: 1)
603
+ # * +:timeout+ - Integer. A timeout in seconds.
604
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
605
+ # in the analytics logs when storage analytics logging is enabled.
606
+ # * +:decode+ - Boolean. Boolean value indicating if the message should be base64 decoded.
607
+ #
608
+ # See http://msdn.microsoft.com/en-us/library/azure/dd179474
609
+ #
610
+ # Returns a list of Azure::Storage::Entity::Queue::Message instances
611
+ def list_messages(queue_name, visibility_timeout, options = {})
612
+ number_of_messages = 1
613
+ number_of_messages = options[:number_of_messages] if options[:number_of_messages]
614
+
615
+ query = { "visibilitytimeout" => visibility_timeout.to_s, "numofmessages" => number_of_messages.to_s }
616
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
617
+
618
+ uri = messages_uri(queue_name, query)
619
+ response = call(:get, uri, nil, {}, options)
620
+
621
+ messages = Serialization.queue_messages_from_xml(response.body, options[:decode])
622
+ messages
623
+ end
624
+
625
+ # Public: Adds a message to the queue and optionally sets a visibility timeout for the message.
626
+ #
627
+ # ==== Attributes
628
+ #
629
+ # * +queue_name+ - String. The queue name.
630
+ # * +message_id+ - String. The id of the message.
631
+ # * +pop_receipt+ - String. The valid pop receipt value returned from an earlier call to the Get Messages or
632
+ # update Message operation.
633
+ # * +message_text+ - String. The message contents. Note that the message content must be in a format that may
634
+ # be encoded with UTF-8.
635
+ # * +visibility_timeout+ - Integer. The new visibility timeout value, in seconds, relative to server time.
636
+ # * +options+ - Hash. Optional parameters.
637
+ #
638
+ # ==== Options
639
+ #
640
+ # Accepted key/value pairs in options parameter are:
641
+ # * +:encode+ - Boolean. If set to true, the message will be base64 encoded.
642
+ # * +:timeout+ - Integer. A timeout in seconds.
643
+ # * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
644
+ # in the analytics logs when storage analytics logging is enabled.
645
+ #
646
+ # See http://msdn.microsoft.com/en-us/library/azure/hh452234
647
+ #
648
+ # Returns a tuple of (pop_receipt, time_next_visible)
649
+ # * pop_receipt - String. The pop receipt of the queue message.
650
+ # * time_next_visible - String. A UTC date/time value that represents when the message will be visible on the queue.
651
+ #
652
+ # Remarks:
653
+ #
654
+ # An Update Message operation will fail if the specified message does not exist in the queue, or if the
655
+ # specified pop receipt does not match the message.
656
+ #
657
+ # A pop receipt is returned by the Get Messages operation or the Update Message operation. Pop receipts
658
+ # remain valid until one of the following events occurs:
659
+ #
660
+ # * The message has expired.
661
+ #
662
+ # * The message has been deleted using the last pop receipt received either from Get Messages or
663
+ # Update Message.
664
+ #
665
+ # * The invisibility time has elapsed and the message has been dequeued by a Get Messages request. When
666
+ # the invisibility time elapses, the message becomes visible again. If it is retrieved by another
667
+ # Get Messages request, the returned pop receipt can be used to delete or update the message.
668
+ #
669
+ # * The message has been updated with a new visibility timeout. When the message is updated, a new pop
670
+ # receipt will be returned.
671
+ #
672
+ # The Update Message operation can be used to continually extend the invisibility of a queue message. This
673
+ # functionality can be useful if you want a worker role to "lease" a queue message. For example, if a worker
674
+ # role calls Get Messages and recognizes that it needs more time to process a message, it can continually
675
+ # extend the message's invisibility until it is processed. If the worker role were to fail during processing,
676
+ # eventually the message would become visible again and another worker role could process it.
677
+ #
678
+ def update_message(queue_name, message_id, pop_receipt, message_text, visibility_timeout, options = {})
679
+ query = { "visibilitytimeout" => visibility_timeout.to_s, "popreceipt" => pop_receipt }
680
+ query["timeout"] = options[:timeout].to_s if options[:timeout]
681
+
682
+ uri = message_uri(queue_name, message_id, query)
683
+ body = Serialization.message_to_xml(message_text, options[:encode])
684
+
685
+ response = call(:put, uri, body, {}, options)
686
+ new_pop_receipt = response.headers["x-ms-popreceipt"]
687
+ time_next_visible = response.headers["x-ms-time-next-visible"]
688
+ return new_pop_receipt, time_next_visible
689
+ end
690
+
691
+ # Protected: Generate the URI for the collection of queues.
692
+ #
693
+ # ==== Attributes
694
+ #
695
+ # * +query+ - A Hash of query parameters (default: {}).
696
+ #
697
+ # Returns a URI.
698
+ protected
699
+ def collection_uri(query = {}, options = {})
700
+ query.update(comp: "list", include: "metadata")
701
+ generate_uri("", query, options)
702
+ end
703
+
704
+ # Protected: Generate the URI for a given queue.
705
+ #
706
+ # ==== Attributes
707
+ #
708
+ # * +queue_name+ - The name of the queue.
709
+ # * +query+ - A Hash of query parameters (default: {}).
710
+ #
711
+ # Returns a URI.
712
+ protected
713
+ def queue_uri(queue_name, query = {}, options = {})
714
+ return queue_name if queue_name.kind_of? ::URI
715
+ generate_uri(queue_name, query, options)
716
+ end
717
+
718
+ # Protected: Generate the messages URI for the given queue.
719
+ #
720
+ # ==== Attributes
721
+ #
722
+ # * +queue_name+ - The name of the queue.
723
+ # * +query+ - A Hash of query parameters (default: {}).
724
+ #
725
+ # Returns a URI.
726
+ protected
727
+ def messages_uri(queue_name, query = {}, options = {})
728
+ generate_uri("#{queue_name}/messages", query, options)
729
+ end
730
+
731
+ # Protected: Generate the URI for a given message
732
+ #
733
+ # ==== Attributes
734
+ #
735
+ # * +queue_name+ - The name of the queue.
736
+ # * +message_id+ - The id of the message.
737
+ # * +query+ - A Hash of query parameters (default: {}).
738
+ #
739
+ # Returns a URI.
740
+ protected
741
+ def message_uri(queue_name, message_id, query = {}, options = {})
742
+ generate_uri("#{queue_name}/messages/#{message_id}", query, options)
743
+ end
744
+
745
+ protected
746
+ def call(method, uri, body = nil, headers = {}, options = {})
747
+ headers["x-ms-version"] = @api_version ? @api_version : Default::STG_VERSION
748
+ headers["User-Agent"] = @user_agent_prefix ? "#{@user_agent_prefix}; #{Default::USER_AGENT}" : Default::USER_AGENT
749
+ super
750
+ end
751
+ end
752
+ end
753
+ end
754
+
755
+ Azure::Storage::QueueService = Azure::Storage::Queue::QueueService