azure-storage 0.14.0.preview → 0.15.0.preview
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/azure/storage/blob/append.rb +6 -0
- data/lib/azure/storage/blob/blob.rb +80 -3
- data/lib/azure/storage/blob/blob_service.rb +29 -8
- data/lib/azure/storage/blob/block.rb +22 -2
- data/lib/azure/storage/blob/container.rb +57 -6
- data/lib/azure/storage/blob/page.rb +25 -2
- data/lib/azure/storage/client.rb +10 -10
- data/lib/azure/storage/client_options.rb +6 -3
- data/lib/azure/storage/configurable.rb +50 -17
- data/lib/azure/storage/core/auth/anonymous_signer.rb +44 -0
- data/lib/azure/storage/core/filter/retry_filter.rb +123 -12
- data/lib/azure/storage/default.rb +10 -1
- data/lib/azure/storage/file/directory.rb +13 -3
- data/lib/azure/storage/file/file.rb +17 -4
- data/lib/azure/storage/file/file_service.rb +19 -12
- data/lib/azure/storage/file/share.rb +16 -4
- data/lib/azure/storage/queue/queue_service.rb +26 -13
- data/lib/azure/storage/service/geo_replication.rb +40 -0
- data/lib/azure/storage/service/serialization.rb +26 -0
- data/lib/azure/storage/service/storage_service.rb +144 -20
- data/lib/azure/storage/service/storage_service_stats.rb +39 -0
- data/lib/azure/storage/table/table_service.rb +33 -14
- data/lib/azure/storage/version.rb +1 -1
- metadata +5 -2
| @@ -84,6 +84,8 @@ module Azure::Storage | |
| 84 84 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to create a new blob
         | 
| 85 85 | 
             
                #                                  only if the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 86 86 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 87 | 
            +
                # * +:lease_id+                  - String. Required if the blob has an active lease. To perform this operation on a blob with an active lease,
         | 
| 88 | 
            +
                #                                  specify the valid lease ID for this header.
         | 
| 87 89 | 
             
                #
         | 
| 88 90 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/dd179451.aspx
         | 
| 89 91 | 
             
                #
         | 
| @@ -110,6 +112,7 @@ module Azure::Storage | |
| 110 112 |  | 
| 111 113 | 
             
                  StorageService.add_metadata_to_headers options[:metadata], headers
         | 
| 112 114 | 
             
                  add_blob_conditional_headers options, headers
         | 
| 115 | 
            +
                  headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
         | 
| 113 116 |  | 
| 114 117 | 
             
                  # call PutBlob with empty body
         | 
| 115 118 | 
             
                  response = call(:put, uri, content, headers, options)
         | 
| @@ -138,6 +141,8 @@ module Azure::Storage | |
| 138 141 | 
             
                # * +:timeout+               - Integer. A timeout in seconds.
         | 
| 139 142 | 
             
                # * +:request_id+            - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
         | 
| 140 143 | 
             
                #                              in the analytics logs when storage analytics logging is enabled.
         | 
| 144 | 
            +
                # * +:lease_id+              - String. Required if the blob has an active lease. To perform this operation on a blob with an
         | 
| 145 | 
            +
                #                              active lease, specify the valid lease ID for this header.
         | 
| 141 146 | 
             
                #
         | 
| 142 147 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/dd135726.aspx
         | 
| 143 148 | 
             
                #
         | 
| @@ -151,6 +156,7 @@ module Azure::Storage | |
| 151 156 |  | 
| 152 157 | 
             
                  headers = StorageService.common_headers
         | 
| 153 158 | 
             
                  StorageService.with_header headers, "Content-MD5", options[:content_md5]
         | 
| 159 | 
            +
                  headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
         | 
| 154 160 |  | 
| 155 161 | 
             
                  response = call(:put, uri, content, headers, options)
         | 
| 156 162 | 
             
                  response.headers["Content-MD5"]
         | 
| @@ -194,6 +200,8 @@ module Azure::Storage | |
| 194 200 | 
             
                # * +:timeout+                   - Integer. A timeout in seconds.
         | 
| 195 201 | 
             
                # * +:request_id+                - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
         | 
| 196 202 | 
             
                #                                  in the analytics logs when storage analytics logging is enabled.
         | 
| 203 | 
            +
                # * +:lease_id+                  - String. Required if the blob has an active lease. To perform this operation on a blob with an
         | 
| 204 | 
            +
                #                                  active lease, specify the valid lease ID for this header.
         | 
| 197 205 | 
             
                #
         | 
| 198 206 | 
             
                # This operation also supports the use of conditional headers to commit the block list if a specified condition is met.
         | 
| 199 207 | 
             
                # For more information, see https://msdn.microsoft.com/en-us/library/azure/dd179371.aspx
         | 
| @@ -219,6 +227,7 @@ module Azure::Storage | |
| 219 227 |  | 
| 220 228 | 
             
                    StorageService.add_metadata_to_headers(options[:metadata], headers)
         | 
| 221 229 | 
             
                    add_blob_conditional_headers(options, headers)
         | 
| 230 | 
            +
                    headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
         | 
| 222 231 | 
             
                  end
         | 
| 223 232 |  | 
| 224 233 | 
             
                  body = Serialization.block_list_to_xml(block_list)
         | 
| @@ -251,6 +260,14 @@ module Azure::Storage | |
| 251 260 | 
             
                # * +:timeout+                  - Integer. A timeout in seconds.
         | 
| 252 261 | 
             
                # * +:request_id+               - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
         | 
| 253 262 | 
             
                #                                 in the analytics logs when storage analytics logging is enabled.
         | 
| 263 | 
            +
                # * +:location_mode+            - LocationMode. Specifies the location mode used to decide 
         | 
| 264 | 
            +
                #                                 which location the request should be sent to.
         | 
| 265 | 
            +
                # * +:lease_id+                 - String. If this header is specified, the operation will be performed only if both of the
         | 
| 266 | 
            +
                #                                 following conditions are met:
         | 
| 267 | 
            +
                #                                   - The blob's lease is currently active.
         | 
| 268 | 
            +
                #                                   - The lease ID specified in the request matches that of the blob.
         | 
| 269 | 
            +
                #                                 If this header is specified and both of these conditions are not met, the request will fail
         | 
| 270 | 
            +
                #                                 and the operation will fail with status code 412 (Precondition Failed).
         | 
| 254 271 | 
             
                #
         | 
| 255 272 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/dd179400.aspx
         | 
| 256 273 | 
             
                #
         | 
| @@ -263,9 +280,12 @@ module Azure::Storage | |
| 263 280 | 
             
                  StorageService.with_query query, "blocklisttype", options[:blocklist_type].to_s if options[:blocklist_type]
         | 
| 264 281 | 
             
                  StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
         | 
| 265 282 |  | 
| 266 | 
            -
                   | 
| 283 | 
            +
                  headers = options[:lease_id] ? { "x-ms-lease-id" => options[:lease_id] } : {}
         | 
| 284 | 
            +
             | 
| 285 | 
            +
                  options[:request_location_mode] = RequestLocationMode::PRIMARY_OR_SECONDARY
         | 
| 286 | 
            +
                  uri = blob_uri(container, blob, query, options)
         | 
| 267 287 |  | 
| 268 | 
            -
                  response = call(:get, uri, nil,  | 
| 288 | 
            +
                  response = call(:get, uri, nil, headers, options)
         | 
| 269 289 |  | 
| 270 290 | 
             
                  Serialization.block_list_from_xml(response.body)
         | 
| 271 291 | 
             
                end
         | 
| @@ -23,7 +23,6 @@ | |
| 23 23 | 
             
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 24 24 | 
             
            # THE SOFTWARE.
         | 
| 25 25 | 
             
            #--------------------------------------------------------------------------
         | 
| 26 | 
            -
            require "azure/storage/blob/serialization"
         | 
| 27 26 |  | 
| 28 27 | 
             
            module Azure::Storage::Blob
         | 
| 29 28 | 
             
              module Container
         | 
| @@ -97,6 +96,11 @@ module Azure::Storage::Blob | |
| 97 96 | 
             
                # * +:timeout+                  - Integer. A timeout in seconds.
         | 
| 98 97 | 
             
                # * +:request_id+               - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
         | 
| 99 98 | 
             
                #                                 in the analytics logs when storage analytics logging is enabled.
         | 
| 99 | 
            +
                # * +:location_mode+            - LocationMode. Specifies the location mode used to decide 
         | 
| 100 | 
            +
                #                                 which location the request should be sent to.
         | 
| 101 | 
            +
                # * +:lease_id+                 - String. If specified, Get Container Properties only succeeds if the container’s lease is
         | 
| 102 | 
            +
                #                                 active and matches this ID. If there is no active lease or the ID does not match, 412
         | 
| 103 | 
            +
                #                                 (Precondition Failed) is returned.
         | 
| 100 104 | 
             
                #
         | 
| 101 105 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/dd179370.aspx
         | 
| 102 106 | 
             
                #
         | 
| @@ -106,8 +110,11 @@ module Azure::Storage::Blob | |
| 106 110 | 
             
                  query = {}
         | 
| 107 111 | 
             
                  query["timeout"] = options[:timeout].to_s if options[:timeout]
         | 
| 108 112 |  | 
| 113 | 
            +
                  headers = options[:lease_id] ? { "x-ms-lease-id" => options[:lease_id] } : {}
         | 
| 114 | 
            +
             | 
| 109 115 | 
             
                  # Call
         | 
| 110 | 
            -
                   | 
| 116 | 
            +
                  options[:request_location_mode] = Azure::Storage::RequestLocationMode::PRIMARY_OR_SECONDARY
         | 
| 117 | 
            +
                  response = call(:get, container_uri(name, query, options), nil, headers, options)
         | 
| 111 118 |  | 
| 112 119 | 
             
                  # result
         | 
| 113 120 | 
             
                  container = Serialization.container_from_headers(response.headers)
         | 
| @@ -128,6 +135,11 @@ module Azure::Storage::Blob | |
| 128 135 | 
             
                # * +:timeout+                  - Integer. A timeout in seconds.
         | 
| 129 136 | 
             
                # * +:request_id+               - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
         | 
| 130 137 | 
             
                #                                 in the analytics logs when storage analytics logging is enabled.
         | 
| 138 | 
            +
                # * +:location_mode+            - LocationMode. Specifies the location mode used to decide 
         | 
| 139 | 
            +
                #                                 which location the request should be sent to.
         | 
| 140 | 
            +
                # * +:lease_id+                 - String. If specified, Get Container Metadata only succeeds if the container’s lease is
         | 
| 141 | 
            +
                #                                 active and matches this ID. If there is no active lease or the ID does not match, 412
         | 
| 142 | 
            +
                #                                 (Precondition Failed) is returned.
         | 
| 131 143 | 
             
                #
         | 
| 132 144 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/ee691976.aspx
         | 
| 133 145 | 
             
                #
         | 
| @@ -137,8 +149,11 @@ module Azure::Storage::Blob | |
| 137 149 | 
             
                  query = { "comp" => "metadata" }
         | 
| 138 150 | 
             
                  query["timeout"] = options[:timeout].to_s if options[:timeout]
         | 
| 139 151 |  | 
| 152 | 
            +
                  headers = options[:lease_id] ? { "x-ms-lease-id" => options[:lease_id] } : {}
         | 
| 153 | 
            +
             | 
| 140 154 | 
             
                  # Call
         | 
| 141 | 
            -
                   | 
| 155 | 
            +
                  options[:request_location_mode] = Azure::Storage::RequestLocationMode::PRIMARY_OR_SECONDARY
         | 
| 156 | 
            +
                  response = call(:get, container_uri(name, query, options), nil, headers, options)
         | 
| 142 157 |  | 
| 143 158 | 
             
                  # result
         | 
| 144 159 | 
             
                  container = Serialization.container_from_headers(response.headers)
         | 
| @@ -160,6 +175,9 @@ module Azure::Storage::Blob | |
| 160 175 | 
             
                # * +:timeout+                  - Integer. A timeout in seconds.
         | 
| 161 176 | 
             
                # * +:request_id+               - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
         | 
| 162 177 | 
             
                #                                 in the analytics logs when storage analytics logging is enabled.
         | 
| 178 | 
            +
                # * +:lease_id+                 - String. If specified, Set Container Metadata only succeeds if the container’s lease is
         | 
| 179 | 
            +
                #                                 active and matches this ID. If there is no active lease or the ID does not match, 412
         | 
| 180 | 
            +
                #                                 (Precondition Failed) is returned.
         | 
| 163 181 | 
             
                #
         | 
| 164 182 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/dd179362.aspx
         | 
| 165 183 | 
             
                #
         | 
| @@ -172,6 +190,7 @@ module Azure::Storage::Blob | |
| 172 190 | 
             
                  # Headers
         | 
| 173 191 | 
             
                  headers = StorageService.common_headers
         | 
| 174 192 | 
             
                  StorageService.add_metadata_to_headers(metadata, headers) if metadata
         | 
| 193 | 
            +
                  headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
         | 
| 175 194 |  | 
| 176 195 | 
             
                  # Call
         | 
| 177 196 | 
             
                  call(:put, container_uri(name, query), nil, headers, options)
         | 
| @@ -194,6 +213,11 @@ module Azure::Storage::Blob | |
| 194 213 | 
             
                # * +:timeout+                  - Integer. A timeout in seconds.
         | 
| 195 214 | 
             
                # * +:request_id+               - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
         | 
| 196 215 | 
             
                #                                 in the analytics logs when storage analytics logging is enabled.
         | 
| 216 | 
            +
                # * +:location_mode+            - LocationMode. Specifies the location mode used to decide 
         | 
| 217 | 
            +
                #                                 which location the request should be sent to.
         | 
| 218 | 
            +
                # * +:lease_id+                 - String. If specified, Get Container ACL only succeeds if the container’s lease is
         | 
| 219 | 
            +
                #                                 active and matches this ID. If there is no active lease or the ID does not match, 412
         | 
| 220 | 
            +
                #                                 (Precondition Failed) is returned.
         | 
| 197 221 | 
             
                #
         | 
| 198 222 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/dd179469.aspx
         | 
| 199 223 | 
             
                #
         | 
| @@ -206,8 +230,11 @@ module Azure::Storage::Blob | |
| 206 230 | 
             
                  query = { "comp" => "acl" }
         | 
| 207 231 | 
             
                  query["timeout"] = options[:timeout].to_s if options[:timeout]
         | 
| 208 232 |  | 
| 233 | 
            +
                  headers = options[:lease_id] ? { "x-ms-lease-id" => options[:lease_id] } : {}
         | 
| 234 | 
            +
             | 
| 209 235 | 
             
                  # Call
         | 
| 210 | 
            -
                   | 
| 236 | 
            +
                  options[:request_location_mode] = Azure::Storage::RequestLocationMode::PRIMARY_OR_SECONDARY
         | 
| 237 | 
            +
                  response = call(:get, container_uri(name, query, options), nil, headers, options)
         | 
| 211 238 |  | 
| 212 239 | 
             
                  # Result
         | 
| 213 240 | 
             
                  container = Serialization.container_from_headers(response.headers)
         | 
| @@ -234,6 +261,9 @@ module Azure::Storage::Blob | |
| 234 261 | 
             
                # * +:timeout+                     - Integer. A timeout in seconds.
         | 
| 235 262 | 
             
                # * +:request_id+                  - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
         | 
| 236 263 | 
             
                #                                    in the analytics logs when storage analytics logging is enabled.
         | 
| 264 | 
            +
                # * +:lease_id+                    - String. If specified, Set Container ACL only succeeds if the container’s lease is
         | 
| 265 | 
            +
                #                                    active and matches this ID. If there is no active lease or the ID does not match, 412
         | 
| 266 | 
            +
                #                                    (Precondition Failed) is returned.
         | 
| 237 267 | 
             
                #
         | 
| 238 268 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/dd179391.aspx
         | 
| 239 269 | 
             
                #
         | 
| @@ -252,6 +282,7 @@ module Azure::Storage::Blob | |
| 252 282 | 
             
                  # Headers + body
         | 
| 253 283 | 
             
                  headers = StorageService.common_headers
         | 
| 254 284 | 
             
                  headers["x-ms-blob-public-access"] = public_access_level if public_access_level && public_access_level.to_s.length > 0
         | 
| 285 | 
            +
                  headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
         | 
| 255 286 |  | 
| 256 287 | 
             
                  signed_identifiers = nil
         | 
| 257 288 | 
             
                  signed_identifiers = options[:signed_identifiers] if options[:signed_identifiers]
         | 
| @@ -283,6 +314,11 @@ module Azure::Storage::Blob | |
| 283 314 | 
             
                # * +:timeout+                  - Integer. A timeout in seconds.
         | 
| 284 315 | 
             
                # * +:request_id+               - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
         | 
| 285 316 | 
             
                #                                 in the analytics logs when storage analytics logging is enabled.
         | 
| 317 | 
            +
                # * +:lease_id+                 - String. Required for version 2012-02-12 and newer if the container has an active lease. To call
         | 
| 318 | 
            +
                #                                 Delete Container on a container that has an active lease, specify the lease ID in this header.
         | 
| 319 | 
            +
                #                                 If this header is not specified when there is an active lease, Delete Container will return 409
         | 
| 320 | 
            +
                #                                 (Conflict). If you specify the wrong lease ID, or a lease ID on a container that does not have
         | 
| 321 | 
            +
                #                                 an active lease, Delete Container will return 412 (Precondition failed).
         | 
| 286 322 | 
             
                #
         | 
| 287 323 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/dd179408.aspx
         | 
| 288 324 | 
             
                #
         | 
| @@ -292,8 +328,10 @@ module Azure::Storage::Blob | |
| 292 328 | 
             
                  query = {}
         | 
| 293 329 | 
             
                  query["timeout"] = options[:timeout].to_s if options[:timeout]
         | 
| 294 330 |  | 
| 331 | 
            +
                  headers = options[:lease_id] ? { "x-ms-lease-id" => options[:lease_id] } : {}
         | 
| 332 | 
            +
             | 
| 295 333 | 
             
                  # Call
         | 
| 296 | 
            -
                  call(:delete, container_uri(name, query), nil,  | 
| 334 | 
            +
                  call(:delete, container_uri(name, query), nil, headers, options)
         | 
| 297 335 |  | 
| 298 336 | 
             
                  # result
         | 
| 299 337 | 
             
                  nil
         | 
| @@ -329,6 +367,8 @@ module Azure::Storage::Blob | |
| 329 367 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to acquire the lease
         | 
| 330 368 | 
             
                #                                  only if the container's ETag value does not match the value specified. If the values are identical,
         | 
| 331 369 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 370 | 
            +
                # * +:origin+                    - String. Optional. Specifies the origin from which the request is issued. The presence of this header results
         | 
| 371 | 
            +
                #                                  in cross-origin resource sharing headers on the response.
         | 
| 332 372 | 
             
                #
         | 
| 333 373 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
         | 
| 334 374 | 
             
                #
         | 
| @@ -368,6 +408,8 @@ module Azure::Storage::Blob | |
| 368 408 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to renew the lease
         | 
| 369 409 | 
             
                #                                  only if the container's ETag value does not match the value specified. If the values are identical,
         | 
| 370 410 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 411 | 
            +
                # * +:origin+                    - String. Optional. Specifies the origin from which the request is issued. The presence of this header results
         | 
| 412 | 
            +
                #                                  in cross-origin resource sharing headers on the response.
         | 
| 371 413 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
         | 
| 372 414 | 
             
                #
         | 
| 373 415 | 
             
                # Returns the renewed lease id
         | 
| @@ -403,6 +445,8 @@ module Azure::Storage::Blob | |
| 403 445 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to change the lease
         | 
| 404 446 | 
             
                #                                  only if the container's ETag value does not match the value specified. If the values are identical,
         | 
| 405 447 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 448 | 
            +
                # * +:origin+                    - String. Optional. Specifies the origin from which the request is issued. The presence of this header results
         | 
| 449 | 
            +
                #                                  in cross-origin resource sharing headers on the response.
         | 
| 406 450 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
         | 
| 407 451 | 
             
                #
         | 
| 408 452 | 
             
                # Returns the changed lease id
         | 
| @@ -438,6 +482,8 @@ module Azure::Storage::Blob | |
| 438 482 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to release the lease
         | 
| 439 483 | 
             
                #                                  only if the container's ETag value does not match the value specified. If the values are identical,
         | 
| 440 484 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 485 | 
            +
                # * +:origin+                    - String. Optional. Specifies the origin from which the request is issued. The presence of this header results
         | 
| 486 | 
            +
                #                                  in cross-origin resource sharing headers on the response.
         | 
| 441 487 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
         | 
| 442 488 | 
             
                #
         | 
| 443 489 | 
             
                # Returns nil on success
         | 
| @@ -485,6 +531,8 @@ module Azure::Storage::Blob | |
| 485 531 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to break the lease
         | 
| 486 532 | 
             
                #                                  only if the container's ETag value does not match the value specified. If the values are identical,
         | 
| 487 533 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 534 | 
            +
                # * +:origin+                    - String. Optional. Specifies the origin from which the request is issued. The presence of this header results
         | 
| 535 | 
            +
                #                                  in cross-origin resource sharing headers on the response.
         | 
| 488 536 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
         | 
| 489 537 | 
             
                #
         | 
| 490 538 | 
             
                # Returns an Integer of the remaining lease time. This value is the approximate time remaining in the lease
         | 
| @@ -536,6 +584,8 @@ module Azure::Storage::Blob | |
| 536 584 | 
             
                # * +:timeout+          - Integer. A timeout in seconds.
         | 
| 537 585 | 
             
                # * +:request_id+       - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
         | 
| 538 586 | 
             
                #                         in the analytics logs when storage analytics logging is enabled.
         | 
| 587 | 
            +
                # * +:location_mode+    - LocationMode. Specifies the location mode used to decide 
         | 
| 588 | 
            +
                #                         which location the request should be sent to.
         | 
| 539 589 | 
             
                #
         | 
| 540 590 | 
             
                # NOTE: Metadata requested with the :metadata parameter must have been stored in
         | 
| 541 591 | 
             
                # accordance with the naming restrictions imposed by the 2009-09-19 version of the Blob
         | 
| @@ -567,7 +617,8 @@ module Azure::Storage::Blob | |
| 567 617 | 
             
                  query["include"] = included_datasets.join "," if included_datasets.length > 0
         | 
| 568 618 |  | 
| 569 619 | 
             
                  # Scheme + path
         | 
| 570 | 
            -
                   | 
| 620 | 
            +
                  options[:request_location_mode] = Azure::Storage::RequestLocationMode::PRIMARY_OR_SECONDARY
         | 
| 621 | 
            +
                  uri = container_uri(name, query, options)
         | 
| 571 622 |  | 
| 572 623 | 
             
                  # Call
         | 
| 573 624 | 
             
                  response = call(:get, uri, nil, {}, options)
         | 
| @@ -69,6 +69,8 @@ module Azure::Storage | |
| 69 69 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to create a new blob
         | 
| 70 70 | 
             
                #                                  only if the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 71 71 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 72 | 
            +
                # * +:lease_id+                  - String. Required if the blob has an active lease. To perform this operation on a blob with an active lease,
         | 
| 73 | 
            +
                #                                  specify the valid lease ID for this header.
         | 
| 72 74 | 
             
                #
         | 
| 73 75 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/dd179451.aspx
         | 
| 74 76 | 
             
                #
         | 
| @@ -102,6 +104,7 @@ module Azure::Storage | |
| 102 104 |  | 
| 103 105 | 
             
                  StorageService.add_metadata_to_headers options[:metadata], headers
         | 
| 104 106 | 
             
                  add_blob_conditional_headers options, headers
         | 
| 107 | 
            +
                  headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
         | 
| 105 108 |  | 
| 106 109 | 
             
                  # call PutBlob with empty body
         | 
| 107 110 | 
             
                  response = call(:put, uri, nil, headers, options)
         | 
| @@ -150,6 +153,8 @@ module Azure::Storage | |
| 150 153 | 
             
                # * +:timeout+                   - Integer. A timeout in seconds.
         | 
| 151 154 | 
             
                # * +:request_id+                - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
         | 
| 152 155 | 
             
                #                                  in the analytics logs when storage analytics logging is enabled.
         | 
| 156 | 
            +
                # * +:lease_id+                  - String. Required if the blob has an active lease. To perform this operation on a blob with an active lease,
         | 
| 157 | 
            +
                #                                  specify the valid lease ID for this header.
         | 
| 153 158 | 
             
                #
         | 
| 154 159 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/ee691975.aspx
         | 
| 155 160 | 
             
                #
         | 
| @@ -166,6 +171,7 @@ module Azure::Storage | |
| 166 171 |  | 
| 167 172 | 
             
                  # clear default content type
         | 
| 168 173 | 
             
                  StorageService.with_header headers, "Content-Type", ""
         | 
| 174 | 
            +
                  headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
         | 
| 169 175 |  | 
| 170 176 | 
             
                  # set optional headers
         | 
| 171 177 | 
             
                  unless options.empty?
         | 
| @@ -257,7 +263,9 @@ module Azure::Storage | |
| 257 263 | 
             
                # * +:timeout+                   - Integer. A timeout in seconds.
         | 
| 258 264 | 
             
                # * +:request_id+                - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
         | 
| 259 265 | 
             
                #                                  in the analytics logs when storage analytics logging is enabled.
         | 
| 260 | 
            -
                # * +: | 
| 266 | 
            +
                # * +:location_mode+             - LocationMode. Specifies the location mode used to decide 
         | 
| 267 | 
            +
                #                                  which location the request should be sent to.
         | 
| 268 | 
            +
                # * +:if_modified_since+         - String. A DateTime value. Specify this conditional header to list the pages only if
         | 
| 261 269 | 
             
                #                                  the blob has been modified since the specified date/time. If the blob has not been modified,
         | 
| 262 270 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 263 271 | 
             
                # * +:if_unmodified_since+       - String. A DateTime value. Specify this conditional header to list the pages only if
         | 
| @@ -273,6 +281,12 @@ module Azure::Storage | |
| 273 281 | 
             
                #                                  were changed between target blob and previous snapshot. Changed pages include both updated and
         | 
| 274 282 | 
             
                #                                  cleared pages. The target blob may be a snapshot, as long as the snapshot specified by this
         | 
| 275 283 | 
             
                #                                  is the older of the two.
         | 
| 284 | 
            +
                # * +:lease_id+                  - String. If this header is specified, the operation will be performed only if both of the
         | 
| 285 | 
            +
                #                                  following conditions are met:
         | 
| 286 | 
            +
                #                                   - The blob's lease is currently active.
         | 
| 287 | 
            +
                #                                   - The lease ID specified in the request matches that of the blob.
         | 
| 288 | 
            +
                #                                  If this header is specified and both of these conditions are not met, the request will fail
         | 
| 289 | 
            +
                #                                  and the Get Blob operation will fail with status code 412 (Precondition Failed).
         | 
| 276 290 | 
             
                #
         | 
| 277 291 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/ee691973.aspx
         | 
| 278 292 | 
             
                #
         | 
| @@ -286,13 +300,15 @@ module Azure::Storage | |
| 286 300 | 
             
                  query.update("prevsnapshot" => options[:previous_snapshot]) if options[:previous_snapshot]
         | 
| 287 301 | 
             
                  StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
         | 
| 288 302 |  | 
| 289 | 
            -
                   | 
| 303 | 
            +
                  options[:request_location_mode] = RequestLocationMode::PRIMARY_OR_SECONDARY
         | 
| 304 | 
            +
                  uri = blob_uri(container, blob, query, options)
         | 
| 290 305 |  | 
| 291 306 | 
             
                  options[:start_range] = 0 if options[:end_range] && (not options[:start_range])
         | 
| 292 307 |  | 
| 293 308 | 
             
                  headers = StorageService.common_headers
         | 
| 294 309 | 
             
                  StorageService.with_header headers, "x-ms-range", "bytes=#{options[:start_range]}-#{options[:end_range]}" if options[:start_range]
         | 
| 295 310 | 
             
                  add_blob_conditional_headers options, headers
         | 
| 311 | 
            +
                  headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
         | 
| 296 312 |  | 
| 297 313 | 
             
                  response = call(:get, uri, nil, headers, options)
         | 
| 298 314 |  | 
| @@ -384,6 +400,12 @@ module Azure::Storage | |
| 384 400 | 
             
                # * +:timeout+                    - Integer. A timeout in seconds.
         | 
| 385 401 | 
             
                # * +:request_id+                 - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
         | 
| 386 402 | 
             
                #                                   in the analytics logs when storage analytics logging is enabled.
         | 
| 403 | 
            +
                # * +:lease_id+                   - String. If this header is specified, the operation will be performed only if both of the
         | 
| 404 | 
            +
                #                                   following conditions are met:
         | 
| 405 | 
            +
                #                                     - The blob's lease is currently active.
         | 
| 406 | 
            +
                #                                     - The lease ID specified in the request matches that of the blob.
         | 
| 407 | 
            +
                #                                   If this header is specified and both of these conditions are not met, the request will fail
         | 
| 408 | 
            +
                #                                   and the Snapshot Blob operation will fail with status code 412 (Precondition Failed).
         | 
| 387 409 | 
             
                #
         | 
| 388 410 | 
             
                # See https://docs.microsoft.com/en-us/rest/api/storageservices/incremental-copy-blob
         | 
| 389 411 | 
             
                #
         | 
| @@ -408,6 +430,7 @@ module Azure::Storage | |
| 408 430 | 
             
                  unless options.empty?
         | 
| 409 431 | 
             
                    add_blob_conditional_headers options, headers
         | 
| 410 432 | 
             
                    StorageService.add_metadata_to_headers options[:metadata], headers
         | 
| 433 | 
            +
                    headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
         | 
| 411 434 | 
             
                  end
         | 
| 412 435 |  | 
| 413 436 | 
             
                  response = call(:put, uri, nil, headers, options)
         | 
    
        data/lib/azure/storage/client.rb
    CHANGED
    
    | @@ -56,7 +56,7 @@ module Azure::Storage | |
| 56 56 | 
             
                # * +:storage_connection_string+      - String. The storage connection string.
         | 
| 57 57 | 
             
                # * +:storage_account_name+           - String. The name of the storage account.
         | 
| 58 58 | 
             
                # * +:storage_access_key+             - Base64 String. The access key of the storage account.
         | 
| 59 | 
            -
                # * +:storage_sas_token+              - String. The signed access  | 
| 59 | 
            +
                # * +:storage_sas_token+              - String. The signed access signature for the storage account or one of its service.
         | 
| 60 60 | 
             
                # * +:storage_blob_host+              - String. Specified Blob serivce endpoint or hostname
         | 
| 61 61 | 
             
                # * +:storage_table_host+             - String. Specified Table serivce endpoint or hostname
         | 
| 62 62 | 
             
                # * +:storage_queue_host+             - String. Specified Queue serivce endpoint or hostname
         | 
| @@ -66,7 +66,7 @@ module Azure::Storage | |
| 66 66 | 
             
                # * +:ca_file+                        - String. File path of the CA file if having issue with SSL
         | 
| 67 67 | 
             
                # * +:user_agent_prefix+              - String. The user agent prefix that can identify the application calls the library
         | 
| 68 68 | 
             
                #
         | 
| 69 | 
            -
                # The valid set of options  | 
| 69 | 
            +
                # The valid set of options include:
         | 
| 70 70 | 
             
                # * Storage Emulator: +:use_development_storage+ required, +:development_storage_proxy_uri+ optionally
         | 
| 71 71 | 
             
                # * Storage account name and key: +:storage_account_name+ and +:storage_access_key+ required, set +:storage_dns_suffix+ necessarily
         | 
| 72 72 | 
             
                # * Storage account name and SAS token: +:storage_account_name+ and +:storage_sas_token+ required, set +:storage_dns_suffix+ necessarily
         | 
| @@ -87,7 +87,7 @@ module Azure::Storage | |
| 87 87 | 
             
                    Azure::Storage::Service::StorageService.user_agent_prefix = options[:user_agent_prefix]
         | 
| 88 88 | 
             
                    options.delete :user_agent_prefix
         | 
| 89 89 | 
             
                  end
         | 
| 90 | 
            -
                  Azure::Storage::Service::StorageService.register_request_callback | 
| 90 | 
            +
                  Azure::Storage::Service::StorageService.register_request_callback(&block) if block_given?
         | 
| 91 91 | 
             
                  reset!(options)
         | 
| 92 92 | 
             
                end
         | 
| 93 93 |  | 
| @@ -130,17 +130,17 @@ module Azure::Storage | |
| 130 130 | 
             
                  # * +:development_storage_proxy_uri+  - String. Used with +:use_development_storage+ if emulator is hosted other than localhost.
         | 
| 131 131 | 
             
                  # * +:storage_account_name+           - String. The name of the storage account.
         | 
| 132 132 | 
             
                  # * +:storage_access_key+             - Base64 String. The access key of the storage account.
         | 
| 133 | 
            -
                  # * +:storage_sas_token+              - String. The signed access  | 
| 134 | 
            -
                  # * +:storage_blob_host+              - String. Specified Blob  | 
| 135 | 
            -
                  # * +:storage_table_host+             - String. Specified Table  | 
| 136 | 
            -
                  # * +:storage_queue_host+             - String. Specified Queue  | 
| 137 | 
            -
                  # * +:storage_dns_suffix+             - String. The suffix of a regional Storage  | 
| 133 | 
            +
                  # * +:storage_sas_token+              - String. The signed access signature for the storage account or one of its service.
         | 
| 134 | 
            +
                  # * +:storage_blob_host+              - String. Specified Blob service endpoint or hostname
         | 
| 135 | 
            +
                  # * +:storage_table_host+             - String. Specified Table service endpoint or hostname
         | 
| 136 | 
            +
                  # * +:storage_queue_host+             - String. Specified Queue service endpoint or hostname
         | 
| 137 | 
            +
                  # * +:storage_dns_suffix+             - String. The suffix of a regional Storage Service, to
         | 
| 138 138 | 
             
                  # * +:default_endpoints_protocol+     - String. http or https
         | 
| 139 139 | 
             
                  # * +:use_path_style_uri+             - String. Whether use path style URI for specified endpoints
         | 
| 140 140 | 
             
                  # * +:ca_file+                        - String. File path of the CA file if having issue with SSL
         | 
| 141 141 | 
             
                  # * +:user_agent_prefix+              - String. The user agent prefix that can identify the application calls the library
         | 
| 142 142 | 
             
                  #
         | 
| 143 | 
            -
                  # The valid set of options  | 
| 143 | 
            +
                  # The valid set of options include:
         | 
| 144 144 | 
             
                  # * Storage Emulator: +:use_development_storage+ required, +:development_storage_proxy_uri+ optionally
         | 
| 145 145 | 
             
                  # * Storage account name and key: +:storage_account_name+ and +:storage_access_key+ required, set +:storage_dns_suffix+ necessarily
         | 
| 146 146 | 
             
                  # * Storage account name and SAS token: +:storage_account_name+ and +:storage_sas_token+ required, set +:storage_dns_suffix+ necessarily
         | 
| @@ -176,7 +176,7 @@ module Azure::Storage | |
| 176 176 | 
             
                  #
         | 
| 177 177 | 
             
                  # @return [Azure::Storage::Client]
         | 
| 178 178 | 
             
                  def create_from_env(&block)
         | 
| 179 | 
            -
                    create | 
| 179 | 
            +
                    create(&block)
         | 
| 180 180 | 
             
                  end
         | 
| 181 181 |  | 
| 182 182 | 
             
                  # Public: Creates an instance of [Azure::Storage::Client] from Environment Variables
         | 
| @@ -26,6 +26,7 @@ | |
| 26 26 |  | 
| 27 27 | 
             
            require "uri"
         | 
| 28 28 | 
             
            require "azure/storage/client_options_error"
         | 
| 29 | 
            +
            require "azure/storage/core/auth/anonymous_signer"
         | 
| 29 30 |  | 
| 30 31 | 
             
            module Azure::Storage
         | 
| 31 32 | 
             
              module ClientOptions
         | 
| @@ -46,7 +47,7 @@ module Azure::Storage | |
| 46 47 | 
             
                # * +:storage_connection_string+      - String. The storage connection string.
         | 
| 47 48 | 
             
                # * +:storage_account_name+           - String. The name of the storage account.
         | 
| 48 49 | 
             
                # * +:storage_access_key+             - Base64 String. The access key of the storage account.
         | 
| 49 | 
            -
                # * +:storage_sas_token+              - String. The signed access  | 
| 50 | 
            +
                # * +:storage_sas_token+              - String. The signed access signature for the storage account or one of its service.
         | 
| 50 51 | 
             
                # * +:storage_blob_host+              - String. Specified Blob serivce endpoint or hostname
         | 
| 51 52 | 
             
                # * +:storage_table_host+             - String. Specified Table serivce endpoint or hostname
         | 
| 52 53 | 
             
                # * +:storage_queue_host+             - String. Specified Queue serivce endpoint or hostname
         | 
| @@ -55,7 +56,7 @@ module Azure::Storage | |
| 55 56 | 
             
                # * +:use_path_style_uri+             - String. Whether use path style URI for specified endpoints
         | 
| 56 57 | 
             
                # * +:ca_file+                        - String. File path of the CA file if having issue with SSL
         | 
| 57 58 | 
             
                #
         | 
| 58 | 
            -
                # The valid set of options  | 
| 59 | 
            +
                # The valid set of options include:
         | 
| 59 60 | 
             
                # * Storage Emulator: +:use_development_storage+ required, +:development_storage_proxy_uri+ optionally
         | 
| 60 61 | 
             
                # * Storage account name and key: +:storage_account_name+ and +:storage_access_key+ required, set +:storage_dns_suffix+ necessarily
         | 
| 61 62 | 
             
                # * Storage account name and SAS token: +:storage_account_name+ and +:storage_sas_token+ required, set +:storage_dns_suffix+ necessarily
         | 
| @@ -74,7 +75,7 @@ module Azure::Storage | |
| 74 75 | 
             
                  if options.is_a? String
         | 
| 75 76 | 
             
                    options = parse_connection_string(options)
         | 
| 76 77 | 
             
                  elsif options.is_a? Hash
         | 
| 77 | 
            -
                    # When the options are provided via  | 
| 78 | 
            +
                    # When the options are provided via singleton setup: Azure::Storage.setup()
         | 
| 78 79 | 
             
                    options = setup_options if options.length == 0
         | 
| 79 80 |  | 
| 80 81 | 
             
                    options = parse_connection_string(options[:storage_connection_string]) if options[:storage_connection_string]
         | 
| @@ -235,6 +236,8 @@ module Azure::Storage | |
| 235 236 | 
             
                                                  optional: [:use_path_style_uri, :default_endpoints_protocol, :storage_sas_token])
         | 
| 236 237 | 
             
                      results[:use_path_style_uri] = results.key?(:use_path_style_uri)
         | 
| 237 238 | 
             
                      normalize_hosts(results)
         | 
| 239 | 
            +
                      # Adds anonymous signer if no sas token
         | 
| 240 | 
            +
                      results[:signer] = Azure::Storage::Core::Auth::AnonymousSigner.new unless results.key?(:storage_sas_token)
         | 
| 238 241 | 
             
                      return results
         | 
| 239 242 | 
             
                    rescue InvalidOptionsError => e
         | 
| 240 243 | 
             
                    end
         |