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
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: e5c12c44729bf416e20e2a983f88fce629e58982
         | 
| 4 | 
            +
              data.tar.gz: d589d29762029eccf660cd0fca41bb2e18b49082
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 109b153f84da28f24892241fe953ab93f7c4e6d1664fd4c5ed723000902ac6af508ea5523bb688a5783d6f52a5ceac5dedd00637ea480388fc552f896a59be95
         | 
| 7 | 
            +
              data.tar.gz: b0186d8eec0537b52ec24647a994813e867dfa6b23b34e9ad69224fe46e4719d46a978130cf24e67480689002f6b743d84a9b35b901a75f80b7957b7cb0681bb
         | 
| @@ -63,6 +63,8 @@ module Azure::Storage | |
| 63 63 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to create a new blob
         | 
| 64 64 | 
             
                #                                  only if the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 65 65 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 66 | 
            +
                # * +:lease_id+                  - String. Required if the blob has an active lease. To perform this operation on a blob with an active lease,
         | 
| 67 | 
            +
                #                                  specify the valid lease ID for this header.
         | 
| 66 68 | 
             
                #
         | 
| 67 69 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/dd179451.aspx
         | 
| 68 70 | 
             
                #
         | 
| @@ -92,6 +94,7 @@ module Azure::Storage | |
| 92 94 |  | 
| 93 95 | 
             
                  StorageService.add_metadata_to_headers options[:metadata], headers
         | 
| 94 96 | 
             
                  add_blob_conditional_headers options, headers
         | 
| 97 | 
            +
                  headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
         | 
| 95 98 |  | 
| 96 99 | 
             
                  # call PutBlob with empty body
         | 
| 97 100 | 
             
                  response = call(:put, uri, nil, headers, options)
         | 
| @@ -135,6 +138,8 @@ module Azure::Storage | |
| 135 138 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to append a block only if
         | 
| 136 139 | 
             
                #                                  the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 137 140 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 141 | 
            +
                # * +:lease_id+                  - String. Required if the blob has an active lease. To perform this operation on a blob with an
         | 
| 142 | 
            +
                #                                  active lease, specify the valid lease ID for this header.
         | 
| 138 143 | 
             
                #
         | 
| 139 144 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/mt427365.aspx
         | 
| 140 145 | 
             
                #
         | 
| @@ -150,6 +155,7 @@ module Azure::Storage | |
| 150 155 | 
             
                  StorageService.with_header headers, "x-ms-lease-id", options[:lease_id]
         | 
| 151 156 |  | 
| 152 157 | 
             
                  add_blob_conditional_headers options, headers
         | 
| 158 | 
            +
                  headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
         | 
| 153 159 |  | 
| 154 160 | 
             
                  response = call(:put, uri, content, headers, options)
         | 
| 155 161 | 
             
                  result = Serialization.blob_from_headers(response.headers)
         | 
| @@ -61,6 +61,8 @@ module Azure::Storage | |
| 61 61 | 
             
                # * +:timeout+                   - Integer. A timeout in seconds.
         | 
| 62 62 | 
             
                # * +:request_id+                - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
         | 
| 63 63 | 
             
                #                                  in the analytics logs when storage analytics logging is enabled.
         | 
| 64 | 
            +
                # * +:location_mode+             - LocationMode. Specifies the location mode used to decide 
         | 
| 65 | 
            +
                #                                  which location the request should be sent to.
         | 
| 64 66 | 
             
                # * +:if_modified_since+         - String. A DateTime value. Specify this conditional header to get the blob
         | 
| 65 67 | 
             
                #                                  only if the blob has been modified since the specified date/time. If the blob has not been modified,
         | 
| 66 68 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| @@ -73,6 +75,12 @@ module Azure::Storage | |
| 73 75 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to get the blob
         | 
| 74 76 | 
             
                #                                  only if the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 75 77 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 78 | 
            +
                # * +:lease_id+                  - String. If this header is specified, the operation will be performed only if both of the
         | 
| 79 | 
            +
                #                                  following conditions are met:
         | 
| 80 | 
            +
                #                                   - The blob's lease is currently active.
         | 
| 81 | 
            +
                #                                   - The lease ID specified in the request matches that of the blob.
         | 
| 82 | 
            +
                #                                  If this header is specified and both of these conditions are not met, the request will fail
         | 
| 83 | 
            +
                #                                  and the Get Blob operation will fail with status code 412 (Precondition Failed).
         | 
| 76 84 | 
             
                #
         | 
| 77 85 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/dd179440.aspx
         | 
| 78 86 | 
             
                #
         | 
| @@ -81,7 +89,9 @@ module Azure::Storage | |
| 81 89 | 
             
                  query = {}
         | 
| 82 90 | 
             
                  StorageService.with_query query, "snapshot", options[:snapshot]
         | 
| 83 91 | 
             
                  StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
         | 
| 84 | 
            -
                   | 
| 92 | 
            +
                  
         | 
| 93 | 
            +
                  options[:request_location_mode] = RequestLocationMode::PRIMARY_OR_SECONDARY
         | 
| 94 | 
            +
                  uri = blob_uri(container, blob, query, options)
         | 
| 85 95 |  | 
| 86 96 | 
             
                  headers = StorageService.common_headers
         | 
| 87 97 | 
             
                  options[:start_range] = 0 if options[:end_range] && (not options[:start_range])
         | 
| @@ -90,6 +100,7 @@ module Azure::Storage | |
| 90 100 | 
             
                    StorageService.with_header headers, "x-ms-range-get-content-md5", "true" if options[:get_content_md5]
         | 
| 91 101 | 
             
                  end
         | 
| 92 102 | 
             
                  add_blob_conditional_headers options, headers
         | 
| 103 | 
            +
                  headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
         | 
| 93 104 |  | 
| 94 105 | 
             
                  response = call(:get, uri, nil, headers, options)
         | 
| 95 106 | 
             
                  result = Serialization.blob_from_headers(response.headers)
         | 
| @@ -114,6 +125,8 @@ module Azure::Storage | |
| 114 125 | 
             
                # * +:timeout+                   - Integer. A timeout in seconds.
         | 
| 115 126 | 
             
                # * +:request_id+                - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
         | 
| 116 127 | 
             
                #                                  in the analytics logs when storage analytics logging is enabled.
         | 
| 128 | 
            +
                # * +:location_mode+             - LocationMode. Specifies the location mode used to decide 
         | 
| 129 | 
            +
                #                                  which location the request should be sent to.
         | 
| 117 130 | 
             
                # * +:if_modified_since+         - String. A DateTime value. Specify this conditional header to get the blob properties
         | 
| 118 131 | 
             
                #                                  only if the blob has been modified since the specified date/time. If the blob has not been modified,
         | 
| 119 132 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| @@ -126,6 +139,14 @@ module Azure::Storage | |
| 126 139 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to get the blob properties
         | 
| 127 140 | 
             
                #                                  only if the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 128 141 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 142 | 
            +
                # * +:lease_id+                  - String. If this header is specified, the operation will be performed only if both of the
         | 
| 143 | 
            +
                #                                  following conditions are met:
         | 
| 144 | 
            +
                #
         | 
| 145 | 
            +
                #                                   - The blob's lease is currently active.
         | 
| 146 | 
            +
                #                                   - The lease ID specified in the request matches that of the blob.
         | 
| 147 | 
            +
                #
         | 
| 148 | 
            +
                #                                  If this header is specified and both of these conditions are not met, the request will fail
         | 
| 149 | 
            +
                #                                  and the Get Blob Properties operation will fail with status code 412 (Precondition Failed).
         | 
| 129 150 | 
             
                #
         | 
| 130 151 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/dd179394.aspx
         | 
| 131 152 | 
             
                #
         | 
| @@ -139,8 +160,10 @@ module Azure::Storage | |
| 139 160 | 
             
                  unless options.empty?
         | 
| 140 161 | 
             
                    add_blob_conditional_headers options, headers
         | 
| 141 162 | 
             
                  end
         | 
| 163 | 
            +
                  headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
         | 
| 142 164 |  | 
| 143 | 
            -
                   | 
| 165 | 
            +
                  options[:request_location_mode] = RequestLocationMode::PRIMARY_OR_SECONDARY
         | 
| 166 | 
            +
                  uri = blob_uri(container, blob, query, options)
         | 
| 144 167 |  | 
| 145 168 | 
             
                  response = call(:head, uri, nil, headers, options)
         | 
| 146 169 |  | 
| @@ -217,6 +240,8 @@ module Azure::Storage | |
| 217 240 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to set the blob properties
         | 
| 218 241 | 
             
                #                                  only if the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 219 242 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 243 | 
            +
                # * +:lease_id+                  - String. Required if the blob has an active lease. To perform this operation on a blob with an active
         | 
| 244 | 
            +
                #                                  lease, specify the valid lease ID for this header.
         | 
| 220 245 | 
             
                #
         | 
| 221 246 | 
             
                # Remarks:
         | 
| 222 247 | 
             
                #
         | 
| @@ -271,6 +296,7 @@ module Azure::Storage | |
| 271 296 | 
             
                    end
         | 
| 272 297 |  | 
| 273 298 | 
             
                    add_blob_conditional_headers options, headers
         | 
| 299 | 
            +
                    headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
         | 
| 274 300 | 
             
                  end
         | 
| 275 301 |  | 
| 276 302 | 
             
                  call(:put, uri, nil, headers, options)
         | 
| @@ -293,6 +319,8 @@ module Azure::Storage | |
| 293 319 | 
             
                # * +:timeout+                   - Integer. A timeout in seconds.
         | 
| 294 320 | 
             
                # * +:request_id+                - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
         | 
| 295 321 | 
             
                #                                  in the analytics logs when storage analytics logging is enabled.
         | 
| 322 | 
            +
                # * +:location_mode+             - LocationMode. Specifies the location mode used to decide 
         | 
| 323 | 
            +
                #                                  which location the request should be sent to.
         | 
| 296 324 | 
             
                # * +:if_modified_since+         - String. A DateTime value. Specify this conditional header to get the blob metadata
         | 
| 297 325 | 
             
                #                                  only if the blob has been modified since the specified date/time. If the blob has not been modified,
         | 
| 298 326 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| @@ -305,6 +333,14 @@ module Azure::Storage | |
| 305 333 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to get the blob metadata
         | 
| 306 334 | 
             
                #                                  only if the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 307 335 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 336 | 
            +
                # * +:lease_id+                  - String. If this header is specified, the operation will be performed only if both of the
         | 
| 337 | 
            +
                #                                  following conditions are met:
         | 
| 338 | 
            +
                #
         | 
| 339 | 
            +
                #                                   - The blob's lease is currently active.
         | 
| 340 | 
            +
                #                                   - The lease ID specified in the request matches that of the blob.
         | 
| 341 | 
            +
                #
         | 
| 342 | 
            +
                #                                  If this header is specified and both of these conditions are not met, the request will fail
         | 
| 343 | 
            +
                #                                  and the Get Blob Metadata operation will fail with status code 412 (Precondition Failed).
         | 
| 308 344 | 
             
                #
         | 
| 309 345 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/dd179350.aspx
         | 
| 310 346 | 
             
                #
         | 
| @@ -317,9 +353,11 @@ module Azure::Storage | |
| 317 353 | 
             
                  headers = StorageService.common_headers
         | 
| 318 354 | 
             
                  unless options.empty?
         | 
| 319 355 | 
             
                    add_blob_conditional_headers options, headers
         | 
| 356 | 
            +
                    headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
         | 
| 320 357 | 
             
                  end
         | 
| 321 358 |  | 
| 322 | 
            -
                   | 
| 359 | 
            +
                  options[:request_location_mode] = RequestLocationMode::PRIMARY_OR_SECONDARY
         | 
| 360 | 
            +
                  uri = blob_uri(container, blob, query, options)
         | 
| 323 361 | 
             
                  response = call(:get, uri, nil, headers, options)
         | 
| 324 362 | 
             
                  result = Serialization.blob_from_headers(response.headers)
         | 
| 325 363 |  | 
| @@ -356,6 +394,8 @@ module Azure::Storage | |
| 356 394 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to set the blob metadata
         | 
| 357 395 | 
             
                #                                  only if the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 358 396 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 397 | 
            +
                # * +:lease_id+                  - String. Required if the blob has an active lease. To perform this operation on a blob with an active
         | 
| 398 | 
            +
                #                                  lease, specify the valid lease ID for this header.
         | 
| 359 399 | 
             
                #
         | 
| 360 400 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/dd179414.aspx
         | 
| 361 401 | 
             
                #
         | 
| @@ -370,6 +410,7 @@ module Azure::Storage | |
| 370 410 | 
             
                  StorageService.add_metadata_to_headers metadata, headers
         | 
| 371 411 | 
             
                  unless options.empty?
         | 
| 372 412 | 
             
                    add_blob_conditional_headers options, headers
         | 
| 413 | 
            +
                    headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
         | 
| 373 414 | 
             
                  end
         | 
| 374 415 |  | 
| 375 416 | 
             
                  call(:put, uri, nil, headers, options)
         | 
| @@ -407,6 +448,8 @@ module Azure::Storage | |
| 407 448 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to acquire the lease
         | 
| 408 449 | 
             
                #                                  only if the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 409 450 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 451 | 
            +
                # * +:origin+                    - String. Optional. Specifies the origin from which the request is issued. The presence of this header results
         | 
| 452 | 
            +
                #                                  in cross-origin resource sharing headers on the response.
         | 
| 410 453 | 
             
                #
         | 
| 411 454 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
         | 
| 412 455 | 
             
                #
         | 
| @@ -447,6 +490,8 @@ module Azure::Storage | |
| 447 490 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to renew the lease
         | 
| 448 491 | 
             
                #                                  only if the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 449 492 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 493 | 
            +
                # * +:origin+                    - String. Optional. Specifies the origin from which the request is issued. The presence of this header results
         | 
| 494 | 
            +
                #                                  in cross-origin resource sharing headers on the response.
         | 
| 450 495 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
         | 
| 451 496 | 
             
                #
         | 
| 452 497 | 
             
                # Returns the renewed lease id
         | 
| @@ -483,6 +528,8 @@ module Azure::Storage | |
| 483 528 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to change the lease
         | 
| 484 529 | 
             
                #                                  only if the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 485 530 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 531 | 
            +
                # * +:origin+                    - String. Optional. Specifies the origin from which the request is issued. The presence of this header results
         | 
| 532 | 
            +
                #                                  in cross-origin resource sharing headers on the response.
         | 
| 486 533 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
         | 
| 487 534 | 
             
                #
         | 
| 488 535 | 
             
                # Returns the changed lease id
         | 
| @@ -519,6 +566,8 @@ module Azure::Storage | |
| 519 566 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to release the lease
         | 
| 520 567 | 
             
                #                                  only if the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 521 568 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 569 | 
            +
                # * +:origin+                    - String. Optional. Specifies the origin from which the request is issued. The presence of this header results
         | 
| 570 | 
            +
                #                                  in cross-origin resource sharing headers on the response.
         | 
| 522 571 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
         | 
| 523 572 | 
             
                #
         | 
| 524 573 | 
             
                # Returns nil on success
         | 
| @@ -567,6 +616,8 @@ module Azure::Storage | |
| 567 616 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to break the lease
         | 
| 568 617 | 
             
                #                                  only if the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 569 618 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 619 | 
            +
                # * +:origin+                    - String. Optional. Specifies the origin from which the request is issued. The presence of this header results
         | 
| 620 | 
            +
                #                                  in cross-origin resource sharing headers on the response.
         | 
| 570 621 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
         | 
| 571 622 | 
             
                #
         | 
| 572 623 | 
             
                # Returns an Integer of the remaining lease time. This value is the approximate time remaining in the lease
         | 
| @@ -603,6 +654,12 @@ module Azure::Storage | |
| 603 654 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to create the blob snapshot
         | 
| 604 655 | 
             
                #                                  only if the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 605 656 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 657 | 
            +
                # * +:lease_id+                  - String. If this header is specified, the operation will be performed only if both of the
         | 
| 658 | 
            +
                #                                  following conditions are met:
         | 
| 659 | 
            +
                #                                   - The blob's lease is currently active.
         | 
| 660 | 
            +
                #                                   - The lease ID specified in the request matches that of the blob.
         | 
| 661 | 
            +
                #                                  If this header is specified and both of these conditions are not met, the request will fail
         | 
| 662 | 
            +
                #                                  and the Snapshot Blob operation will fail with status code 412 (Precondition Failed).
         | 
| 606 663 | 
             
                #
         | 
| 607 664 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/ee691971.aspx
         | 
| 608 665 | 
             
                #
         | 
| @@ -617,6 +674,7 @@ module Azure::Storage | |
| 617 674 | 
             
                  unless options.empty?
         | 
| 618 675 | 
             
                    StorageService.add_metadata_to_headers(options[:metadata], headers)
         | 
| 619 676 | 
             
                    add_blob_conditional_headers(options, headers)
         | 
| 677 | 
            +
                    headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
         | 
| 620 678 | 
             
                  end
         | 
| 621 679 |  | 
| 622 680 | 
             
                  response = call(:put, uri, nil, headers, options)
         | 
| @@ -668,6 +726,13 @@ module Azure::Storage | |
| 668 726 | 
             
                # * +:timeout+                    - Integer. A timeout in seconds.
         | 
| 669 727 | 
             
                # * +:request_id+                 - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
         | 
| 670 728 | 
             
                #                                   in the analytics logs when storage analytics logging is enabled.
         | 
| 729 | 
            +
                # * +:lease_id+                   - String. Required if the destination blob has an active lease. The lease ID specified for
         | 
| 730 | 
            +
                #                                   this header must match the lease ID of the destination blob. If the request does not include
         | 
| 731 | 
            +
                #                                   the lease ID or it is not valid, the operation fails with status code 412 (Precondition Failed).
         | 
| 732 | 
            +
                #                                   If this header is specified and the destination blob does not currently have an active lease,
         | 
| 733 | 
            +
                #                                   the operation will also fail with status code 412 (Precondition Failed).
         | 
| 734 | 
            +
                #                                   In version 2012-02-12 and newer, this value must specify an active, infinite lease for a
         | 
| 735 | 
            +
                #                                   leased blob. A finite-duration lease ID fails with 412 (Precondition Failed).
         | 
| 671 736 | 
             
                #
         | 
| 672 737 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/dd894037.aspx
         | 
| 673 738 | 
             
                #
         | 
| @@ -690,6 +755,7 @@ module Azure::Storage | |
| 690 755 | 
             
                  unless options.empty?
         | 
| 691 756 | 
             
                    add_blob_conditional_headers options, headers
         | 
| 692 757 | 
             
                    StorageService.add_metadata_to_headers options[:metadata], headers
         | 
| 758 | 
            +
                    headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
         | 
| 693 759 | 
             
                  end
         | 
| 694 760 |  | 
| 695 761 | 
             
                  response = call(:put, uri, nil, headers, options)
         | 
| @@ -741,6 +807,13 @@ module Azure::Storage | |
| 741 807 | 
             
                # * +:timeout+                    - Integer. A timeout in seconds.
         | 
| 742 808 | 
             
                # * +:request_id+                 - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
         | 
| 743 809 | 
             
                #                                   in the analytics logs when storage analytics logging is enabled.
         | 
| 810 | 
            +
                # * +:lease_id+                   - String. Required if the destination blob has an active lease. The lease ID specified for
         | 
| 811 | 
            +
                #                                   this header must match the lease ID of the destination blob. If the request does not include
         | 
| 812 | 
            +
                #                                   the lease ID or it is not valid, the operation fails with status code 412 (Precondition Failed).
         | 
| 813 | 
            +
                #                                   If this header is specified and the destination blob does not currently have an active lease,
         | 
| 814 | 
            +
                #                                   the operation will also fail with status code 412 (Precondition Failed).
         | 
| 815 | 
            +
                #                                   In version 2012-02-12 and newer, this value must specify an active, infinite lease for a
         | 
| 816 | 
            +
                #                                   leased blob. A finite-duration lease ID fails with 412 (Precondition Failed).
         | 
| 744 817 | 
             
                #
         | 
| 745 818 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/dd894037.aspx
         | 
| 746 819 | 
             
                #
         | 
| @@ -830,6 +903,9 @@ module Azure::Storage | |
| 830 903 | 
             
                # * +:if_none_match+             - String. An ETag value. Specify an ETag value for this conditional header to create the blob snapshot
         | 
| 831 904 | 
             
                #                                  only if the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 832 905 | 
             
                #                                  the Blob service returns status code 412 (Precondition Failed).
         | 
| 906 | 
            +
                # * +:lease_id+                  - String. Required if the blob has an active lease. To perform this operation on a blob with an
         | 
| 907 | 
            +
                #                                  active lease, specify the valid lease ID for this header. If a valid lease ID is not specified
         | 
| 908 | 
            +
                #                                  on the request, the operation will fail with status code 403 (Forbidden).
         | 
| 833 909 | 
             
                #
         | 
| 834 910 | 
             
                # See http://msdn.microsoft.com/en-us/library/azure/dd179440.aspx
         | 
| 835 911 | 
             
                #
         | 
| @@ -846,6 +922,7 @@ module Azure::Storage | |
| 846 922 | 
             
                  headers = StorageService.common_headers
         | 
| 847 923 | 
             
                  StorageService.with_header headers, "x-ms-delete-snapshots", options[:delete_snapshots].to_s if options[:delete_snapshots] && options[:snapshot] == nil
         | 
| 848 924 | 
             
                  add_blob_conditional_headers options, headers
         | 
| 925 | 
            +
                  headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
         | 
| 849 926 |  | 
| 850 927 | 
             
                  call(:delete, uri, nil, headers, options)
         | 
| 851 928 | 
             
                  nil
         | 
| @@ -44,7 +44,8 @@ module Azure::Storage | |
| 44 44 | 
             
                    client_config = options[:client] || Azure::Storage
         | 
| 45 45 | 
             
                    signer = options[:signer] || client_config.signer || Azure::Storage::Core::Auth::SharedKey.new(client_config.storage_account_name, client_config.storage_access_key)
         | 
| 46 46 | 
             
                    super(signer, client_config.storage_account_name, options, &block)
         | 
| 47 | 
            -
                    @ | 
| 47 | 
            +
                    @storage_service_host[:primary] = client.storage_blob_host
         | 
| 48 | 
            +
                    @storage_service_host[:secondary] = client.storage_blob_host true
         | 
| 48 49 | 
             
                  end
         | 
| 49 50 |  | 
| 50 51 | 
             
                  def call(method, uri, body = nil, headers = {}, options = {})
         | 
| @@ -103,6 +104,9 @@ module Azure::Storage | |
| 103 104 | 
             
                  # * +:request_id+              - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
         | 
| 104 105 | 
             
                  #                                in the analytics logs when storage analytics logging is enabled.
         | 
| 105 106 | 
             
                  #
         | 
| 107 | 
            +
                  # * +:location_mode+           - LocationMode. Specifies the location mode used to decide 
         | 
| 108 | 
            +
                  #                                which location the request should be sent to.
         | 
| 109 | 
            +
                  #
         | 
| 106 110 | 
             
                  # See: https://msdn.microsoft.com/en-us/library/azure/dd179352.aspx
         | 
| 107 111 | 
             
                  #
         | 
| 108 112 | 
             
                  # NOTE: Metadata requested with the :metadata parameter must have been stored in
         | 
| @@ -126,7 +130,8 @@ module Azure::Storage | |
| 126 130 | 
             
                      StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
         | 
| 127 131 | 
             
                    end
         | 
| 128 132 |  | 
| 129 | 
            -
                     | 
| 133 | 
            +
                    options[:request_location_mode] = RequestLocationMode::PRIMARY_OR_SECONDARY
         | 
| 134 | 
            +
                    uri = containers_uri(query, options)
         | 
| 130 135 | 
             
                    response = call(:get, uri, nil, {}, options)
         | 
| 131 136 |  | 
| 132 137 | 
             
                    Serialization.container_enumeration_results_from_xml(response.body)
         | 
| @@ -163,6 +168,8 @@ module Azure::Storage | |
| 163 168 | 
             
                  # * +:if_none_match+           - String. An ETag value. Specify an ETag value for this conditional header to acquire the lease
         | 
| 164 169 | 
             
                  #                                only if the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 165 170 | 
             
                  #                                the Blob service returns status code 412 (Precondition Failed).
         | 
| 171 | 
            +
                  # * +:origin+                  - String. Optional. Specifies the origin from which the request is issued. The presence of this header results
         | 
| 172 | 
            +
                  #                                in cross-origin resource sharing headers on the response.
         | 
| 166 173 | 
             
                  #
         | 
| 167 174 | 
             
                  # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
         | 
| 168 175 | 
             
                  #
         | 
| @@ -187,6 +194,7 @@ module Azure::Storage | |
| 187 194 | 
             
                      Service::StorageService.with_header headers, "x-ms-lease-action", "acquire"
         | 
| 188 195 | 
             
                      Service::StorageService.with_header headers, "x-ms-lease-duration", duration.to_s if duration
         | 
| 189 196 | 
             
                      Service::StorageService.with_header headers, "x-ms-proposed-lease-id", options[:proposed_lease_id]
         | 
| 197 | 
            +
                      Service::StorageService.with_header headers, "Origin", options[:origin].to_s if options[:origin]
         | 
| 190 198 | 
             
                      add_blob_conditional_headers options, headers
         | 
| 191 199 |  | 
| 192 200 | 
             
                      response = call(:put, uri, nil, headers, options)
         | 
| @@ -223,6 +231,8 @@ module Azure::Storage | |
| 223 231 | 
             
                  # * +:if_none_match+           - String. An ETag value. Specify an ETag value for this conditional header to renew the lease
         | 
| 224 232 | 
             
                  #                                only if the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 225 233 | 
             
                  #                                the Blob service returns status code 412 (Precondition Failed).
         | 
| 234 | 
            +
                  # * +:origin+                  - String. Optional. Specifies the origin from which the request is issued. The presence of this header results
         | 
| 235 | 
            +
                  #                                in cross-origin resource sharing headers on the response.
         | 
| 226 236 | 
             
                  #
         | 
| 227 237 | 
             
                  # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
         | 
| 228 238 | 
             
                  #
         | 
| @@ -242,6 +252,7 @@ module Azure::Storage | |
| 242 252 | 
             
                      headers = Service::StorageService.common_headers
         | 
| 243 253 | 
             
                      Service::StorageService.with_header headers, "x-ms-lease-action", "renew"
         | 
| 244 254 | 
             
                      Service::StorageService.with_header headers, "x-ms-lease-id", lease
         | 
| 255 | 
            +
                      Service::StorageService.with_header headers, "Origin", options[:origin].to_s if options[:origin]
         | 
| 245 256 | 
             
                      add_blob_conditional_headers options, headers
         | 
| 246 257 |  | 
| 247 258 | 
             
                      response = call(:put, uri, nil, headers, options)
         | 
| @@ -277,6 +288,8 @@ module Azure::Storage | |
| 277 288 | 
             
                  # * +:if_none_match+           - String. An ETag value. Specify an ETag value for this conditional header to change the lease
         | 
| 278 289 | 
             
                  #                                only if the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 279 290 | 
             
                  #                                the Blob service returns status code 412 (Precondition Failed).
         | 
| 291 | 
            +
                  # * +:origin+                  - String. Optional. Specifies the origin from which the request is issued. The presence of this header results
         | 
| 292 | 
            +
                  #                                in cross-origin resource sharing headers on the response.
         | 
| 280 293 | 
             
                  #
         | 
| 281 294 | 
             
                  # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
         | 
| 282 295 | 
             
                  #
         | 
| @@ -298,6 +311,7 @@ module Azure::Storage | |
| 298 311 | 
             
                      Service::StorageService.with_header headers, "x-ms-lease-action", "change"
         | 
| 299 312 | 
             
                      Service::StorageService.with_header headers, "x-ms-lease-id", lease
         | 
| 300 313 | 
             
                      Service::StorageService.with_header headers, "x-ms-proposed-lease-id", proposed_lease
         | 
| 314 | 
            +
                      Service::StorageService.with_header headers, "Origin", options[:origin].to_s if options[:origin]
         | 
| 301 315 | 
             
                      add_blob_conditional_headers options, headers
         | 
| 302 316 |  | 
| 303 317 | 
             
                      response = call(:put, uri, nil, headers, options)
         | 
| @@ -333,6 +347,8 @@ module Azure::Storage | |
| 333 347 | 
             
                  # * +:if_none_match+           - String. An ETag value. Specify an ETag value for this conditional header to release the lease
         | 
| 334 348 | 
             
                  #                                only if the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 335 349 | 
             
                  #                                the Blob service returns status code 412 (Precondition Failed).
         | 
| 350 | 
            +
                  # * +:origin+                  - String. Optional. Specifies the origin from which the request is issued. The presence of this header results
         | 
| 351 | 
            +
                  #                                in cross-origin resource sharing headers on the response.
         | 
| 336 352 | 
             
                  #
         | 
| 337 353 | 
             
                  # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
         | 
| 338 354 | 
             
                  #
         | 
| @@ -352,6 +368,7 @@ module Azure::Storage | |
| 352 368 | 
             
                      headers = Service::StorageService.common_headers
         | 
| 353 369 | 
             
                      Service::StorageService.with_header headers, "x-ms-lease-action", "release"
         | 
| 354 370 | 
             
                      Service::StorageService.with_header headers, "x-ms-lease-id", lease
         | 
| 371 | 
            +
                      Service::StorageService.with_header headers, "Origin", options[:origin].to_s if options[:origin]
         | 
| 355 372 | 
             
                      add_blob_conditional_headers options, headers
         | 
| 356 373 |  | 
| 357 374 | 
             
                      call(:put, uri, nil, headers, options)
         | 
| @@ -399,6 +416,8 @@ module Azure::Storage | |
| 399 416 | 
             
                  # * +:if_none_match+           - String. An ETag value. Specify an ETag value for this conditional header to acquire the lease
         | 
| 400 417 | 
             
                  #                                only if the blob's ETag value does not match the value specified. If the values are identical,
         | 
| 401 418 | 
             
                  #                                the Blob service returns status code 412 (Precondition Failed).
         | 
| 419 | 
            +
                  # * +:origin+                  - String. Optional. Specifies the origin from which the request is issued. The presence of this header results
         | 
| 420 | 
            +
                  #                                in cross-origin resource sharing headers on the response.
         | 
| 402 421 | 
             
                  #
         | 
| 403 422 | 
             
                  # See http://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
         | 
| 404 423 | 
             
                  #
         | 
| @@ -420,6 +439,7 @@ module Azure::Storage | |
| 420 439 | 
             
                      headers = Service::StorageService.common_headers
         | 
| 421 440 | 
             
                      Service::StorageService.with_header headers, "x-ms-lease-action", "break"
         | 
| 422 441 | 
             
                      Service::StorageService.with_header headers, "x-ms-lease-break-period", options[:break_period].to_s if options[:break_period]
         | 
| 442 | 
            +
                      Service::StorageService.with_header headers, "Origin", options[:origin].to_s if options[:origin]
         | 
| 423 443 | 
             
                      add_blob_conditional_headers options, headers
         | 
| 424 444 |  | 
| 425 445 | 
             
                      response = call(:put, uri, nil, headers, options)
         | 
| @@ -435,9 +455,9 @@ module Azure::Storage | |
| 435 455 | 
             
                  # Returns a URI.
         | 
| 436 456 | 
             
                  #
         | 
| 437 457 | 
             
                  protected
         | 
| 438 | 
            -
                    def containers_uri(query = {})
         | 
| 458 | 
            +
                    def containers_uri(query = {}, options = {})
         | 
| 439 459 | 
             
                      query = { "comp" => "list" }.merge(query)
         | 
| 440 | 
            -
                      generate_uri("", query)
         | 
| 460 | 
            +
                      generate_uri("", query, options)
         | 
| 441 461 | 
             
                    end
         | 
| 442 462 |  | 
| 443 463 | 
             
                  # Protected: Generate the URI for a specific container.
         | 
| @@ -450,10 +470,10 @@ module Azure::Storage | |
| 450 470 | 
             
                  # Returns a URI.
         | 
| 451 471 | 
             
                  #
         | 
| 452 472 | 
             
                  protected
         | 
| 453 | 
            -
                    def container_uri(name, query = {})
         | 
| 473 | 
            +
                    def container_uri(name, query = {}, options = {})
         | 
| 454 474 | 
             
                      return name if name.kind_of? ::URI
         | 
| 455 475 | 
             
                      query = { "restype" => "container" }.merge(query)
         | 
| 456 | 
            -
                      generate_uri(name, query)
         | 
| 476 | 
            +
                      generate_uri(name, query, options)
         | 
| 457 477 | 
             
                    end
         | 
| 458 478 |  | 
| 459 479 | 
             
                  # Protected: Generate the URI for a specific Blob.
         | 
| @@ -467,13 +487,14 @@ module Azure::Storage | |
| 467 487 | 
             
                  # Returns a URI.
         | 
| 468 488 | 
             
                  #
         | 
| 469 489 | 
             
                  protected
         | 
| 470 | 
            -
                    def blob_uri(container_name, blob_name, query = {})
         | 
| 490 | 
            +
                    def blob_uri(container_name, blob_name, query = {}, options = {})
         | 
| 471 491 | 
             
                      if container_name.nil? || container_name.empty?
         | 
| 472 492 | 
             
                        path = blob_name
         | 
| 473 493 | 
             
                      else
         | 
| 474 494 | 
             
                        path = ::File.join(container_name, blob_name)
         | 
| 475 495 | 
             
                      end
         | 
| 476 | 
            -
                       | 
| 496 | 
            +
                      options = { encode: true }.merge(options)
         | 
| 497 | 
            +
                      generate_uri(path, query, options)
         | 
| 477 498 | 
             
                    end
         | 
| 478 499 |  | 
| 479 500 | 
             
                  # Adds conditional header with required condition
         |