azure-storage-queue 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1def77eea3b5163ca5548f25f33d8cf9bdada402
4
+ data.tar.gz: 8c4b4b2a27a836c87062cfb76354193bbac653e2
5
+ SHA512:
6
+ metadata.gz: 3ff8574d4e5870f5ebffcc47ee466c2869d7cefd973261b0bb1a9126ed89fcb11d39ce14c7802429659e4176d3e02c1b40b1b8b9600a0ffd7c75c5e11fbbd680
7
+ data.tar.gz: 5c3337ae2c95d51859c347b7175790073af7ef2049d5f5ed2676ef9ec726b3736818880bb67ad37e19eedb20a0ba9f80df5e49590117256d85928a80d6e5f730
@@ -0,0 +1,26 @@
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
+ require "azure/storage/queue/autoload"
@@ -0,0 +1,43 @@
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
+ require "rubygems"
27
+ require "nokogiri"
28
+ require "base64"
29
+
30
+ require "azure/storage/common"
31
+
32
+ module Azure
33
+ module Storage
34
+ module Queue
35
+ autoload :Default, "azure/storage/queue/default"
36
+ autoload :Version, "azure/storage/queue/version"
37
+ autoload :QueueService, "azure/storage/queue/queue_service"
38
+ autoload :Message, "azure/storage/queue/message"
39
+ autoload :Serialization, "azure/storage/queue/serialization"
40
+ autoload :Queue, "azure/storage/queue/queue"
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,84 @@
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
+
27
+ require "rbconfig"
28
+ require "azure/storage/queue/version"
29
+
30
+ module Azure::Storage::Queue
31
+ module Default
32
+ # Default REST service (STG) version number
33
+ STG_VERSION = "2016-05-31"
34
+
35
+ # The number of default concurrent requests for parallel operation.
36
+ DEFAULT_PARALLEL_OPERATION_THREAD_COUNT = 1
37
+
38
+ # Constant representing a kilobyte (Non-SI version).
39
+ KB = 1024
40
+ # Constant representing a megabyte (Non-SI version).
41
+ MB = 1024 * 1024
42
+ # Constant representing a gigabyte (Non-SI version).
43
+ GB = 1024 * 1024 * 1024
44
+
45
+ # Specifies HTTP.
46
+ HTTP = "http"
47
+ # Specifies HTTPS.
48
+ HTTPS = "https"
49
+ # Default HTTP port.
50
+ DEFAULT_HTTP_PORT = 80
51
+ # Default HTTPS port.
52
+ DEFAULT_HTTPS_PORT = 443
53
+
54
+ # Marker for atom metadata.
55
+ XML_METADATA_MARKER = "$"
56
+ # Marker for atom value.
57
+ XML_VALUE_MARKER = "_"
58
+
59
+ # Default User Agent header string
60
+ USER_AGENT = "Azure-Storage/#{Azure::Storage::Queue::Version.to_uas}-#{Azure::Storage::Common::Version.to_uas} (Ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}; #{Azure::Storage::Common::Default.os})".freeze
61
+ end
62
+
63
+ # Defines constants for use with queue storage.
64
+ module QueueConstants
65
+ # XML element for QueueMessage.
66
+ QUEUE_MESSAGE_ELEMENT = "QueueMessage"
67
+
68
+ # XML element for MessageText.
69
+ MESSAGE_TEXT_ELEMENT = "MessageText"
70
+ end
71
+
72
+ module QueueErrorCodeStrings
73
+ QUEUE_NOT_FOUND = "QueueNotFound"
74
+ QUEUE_DISABLED = "QueueDisabled"
75
+ QUEUE_ALREADY_EXISTS = "QueueAlreadyExists"
76
+ QUEUE_NOT_EMPTY = "QueueNotEmpty"
77
+ QUEUE_BEING_DELETED = "QueueBeingDeleted"
78
+ POP_RECEIPT_MISMATCH = "PopReceiptMismatch"
79
+ INVALID_PARAMETER = "InvalidParameter"
80
+ MESSAGE_NOT_FOUND = "MessageNotFound"
81
+ MESSAGE_TOO_LARGE = "MessageTooLarge"
82
+ INVALID_MARKER = "InvalidMarker"
83
+ end
84
+ end
@@ -0,0 +1,41 @@
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
+ module Queue
28
+ class Message
29
+ def initialize
30
+ yield self if block_given?
31
+ end
32
+ attr_accessor :id
33
+ attr_accessor :insertion_time
34
+ attr_accessor :expiration_time
35
+ attr_accessor :dequeue_count
36
+ attr_accessor :message_text
37
+ attr_accessor :time_next_visible
38
+ attr_accessor :pop_receipt
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,38 @@
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
+ module Queue
28
+ class Queue
29
+ def initialize
30
+ @metadata = {}
31
+ yield self if block_given?
32
+ end
33
+
34
+ attr_accessor :name
35
+ attr_accessor :metadata
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,749 @@
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