azure-storage 0.13.0.preview → 0.14.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.rb +14 -13
- data/lib/azure/storage/autoload.rb +31 -31
- data/lib/azure/storage/blob/append.rb +43 -41
- data/lib/azure/storage/blob/blob.rb +150 -147
- data/lib/azure/storage/blob/blob_service.rb +186 -184
- data/lib/azure/storage/blob/block.rb +56 -56
- data/lib/azure/storage/blob/container.rb +93 -92
- data/lib/azure/storage/blob/page.rb +187 -104
- data/lib/azure/storage/blob/serialization.rb +32 -18
- data/lib/azure/storage/client.rb +18 -17
- data/lib/azure/storage/client_options.rb +192 -193
- data/lib/azure/storage/client_options_error.rb +5 -5
- data/lib/azure/storage/configurable.rb +39 -39
- data/lib/azure/storage/core.rb +6 -4
- data/lib/azure/storage/core/auth/shared_access_signature.rb +5 -3
- data/lib/azure/storage/core/auth/shared_access_signature_generator.rb +34 -33
- data/lib/azure/storage/core/auth/shared_access_signature_signer.rb +5 -5
- data/lib/azure/storage/core/auth/shared_key.rb +17 -15
- data/lib/azure/storage/core/autoload.rb +15 -13
- data/lib/azure/storage/core/error.rb +3 -1
- data/lib/azure/storage/core/filter/exponential_retry_filter.rb +13 -11
- data/lib/azure/storage/core/filter/linear_retry_filter.rb +10 -8
- data/lib/azure/storage/core/filter/retry_filter.rb +30 -29
- data/lib/azure/storage/core/http_client.rb +18 -16
- data/lib/azure/storage/core/sr.rb +50 -48
- data/lib/azure/storage/core/utility.rb +19 -17
- data/lib/azure/storage/default.rb +371 -361
- data/lib/azure/storage/file/directory.rb +36 -31
- data/lib/azure/storage/file/file.rb +103 -100
- data/lib/azure/storage/file/file_service.rb +42 -40
- data/lib/azure/storage/file/serialization.rb +9 -6
- data/lib/azure/storage/file/share.rb +48 -46
- data/lib/azure/storage/queue/message.rb +3 -1
- data/lib/azure/storage/queue/queue.rb +3 -2
- data/lib/azure/storage/queue/queue_service.rb +152 -151
- data/lib/azure/storage/queue/serialization.rb +7 -5
- data/lib/azure/storage/service/access_policy.rb +3 -1
- data/lib/azure/storage/service/cors.rb +4 -2
- data/lib/azure/storage/service/cors_rule.rb +3 -1
- data/lib/azure/storage/service/enumeration_results.rb +3 -1
- data/lib/azure/storage/service/logging.rb +5 -3
- data/lib/azure/storage/service/metrics.rb +5 -3
- data/lib/azure/storage/service/retention_policy.rb +3 -1
- data/lib/azure/storage/service/serialization.rb +31 -30
- data/lib/azure/storage/service/signed_identifier.rb +5 -4
- data/lib/azure/storage/service/storage_service.rb +33 -32
- data/lib/azure/storage/service/storage_service_properties.rb +6 -4
- data/lib/azure/storage/table/auth/shared_key.rb +9 -8
- data/lib/azure/storage/table/batch.rb +55 -55
- data/lib/azure/storage/table/batch_response.rb +17 -17
- data/lib/azure/storage/table/edmtype.rb +9 -7
- data/lib/azure/storage/table/entity.rb +4 -3
- data/lib/azure/storage/table/guid.rb +3 -1
- data/lib/azure/storage/table/query.rb +17 -19
- data/lib/azure/storage/table/serialization.rb +14 -12
- data/lib/azure/storage/table/table_service.rb +79 -80
- data/lib/azure/storage/version.rb +7 -5
- metadata +2 -2
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#-------------------------------------------------------------------------
|
2
4
|
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
3
5
|
#
|
@@ -21,10 +23,10 @@
|
|
21
23
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
24
|
# THE SOFTWARE.
|
23
25
|
#--------------------------------------------------------------------------
|
24
|
-
require
|
26
|
+
require "azure/storage/service/serialization"
|
25
27
|
|
26
|
-
require
|
27
|
-
require
|
28
|
+
require "azure/storage/queue/queue"
|
29
|
+
require "azure/storage/queue/message"
|
28
30
|
|
29
31
|
module Azure::Storage
|
30
32
|
module Queue
|
@@ -37,7 +39,7 @@ module Azure::Storage
|
|
37
39
|
expect_node("QueueMessagesList", xml)
|
38
40
|
results = []
|
39
41
|
return results unless (xml > "QueueMessage").any?
|
40
|
-
|
42
|
+
|
41
43
|
if xml.QueueMessage.count == 0
|
42
44
|
results.push(queue_message_from_xml(xml.QueueMessage, decode))
|
43
45
|
else
|
@@ -72,7 +74,7 @@ module Azure::Storage
|
|
72
74
|
xml.QueueMessage { xml.MessageText Base64.encode64(message_text) }
|
73
75
|
end
|
74
76
|
else
|
75
|
-
builder = Nokogiri::XML::Builder.new(:
|
77
|
+
builder = Nokogiri::XML::Builder.new(encoding: "utf-8") do |xml|
|
76
78
|
xml.QueueMessage { xml.MessageText message_text.encode("utf-8") }
|
77
79
|
end
|
78
80
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#-------------------------------------------------------------------------
|
2
4
|
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
3
5
|
#
|
@@ -32,4 +34,4 @@ module Azure::Storage
|
|
32
34
|
attr_accessor :permission
|
33
35
|
end
|
34
36
|
end
|
35
|
-
end
|
37
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#-------------------------------------------------------------------------
|
2
4
|
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
3
5
|
#
|
@@ -24,7 +26,7 @@
|
|
24
26
|
|
25
27
|
module Azure::Storage
|
26
28
|
module Service
|
27
|
-
class Cors
|
29
|
+
class Cors
|
28
30
|
def initialize
|
29
31
|
@cors_rules = []
|
30
32
|
yield self if block_given?
|
@@ -33,4 +35,4 @@ module Azure::Storage
|
|
33
35
|
attr_accessor :cors_rules
|
34
36
|
end
|
35
37
|
end
|
36
|
-
end
|
38
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#-------------------------------------------------------------------------
|
2
4
|
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
3
5
|
#
|
@@ -43,4 +45,4 @@ module Azure::Storage
|
|
43
45
|
attr_accessor :allowed_headers
|
44
46
|
end
|
45
47
|
end
|
46
|
-
end
|
48
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#-------------------------------------------------------------------------
|
2
4
|
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
3
5
|
#
|
@@ -27,4 +29,4 @@ module Azure
|
|
27
29
|
attr_accessor :continuation_token
|
28
30
|
end
|
29
31
|
end
|
30
|
-
end
|
32
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#-------------------------------------------------------------------------
|
2
4
|
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
3
5
|
#
|
@@ -21,11 +23,11 @@
|
|
21
23
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
24
|
# THE SOFTWARE.
|
23
25
|
#--------------------------------------------------------------------------
|
24
|
-
require
|
26
|
+
require "azure/storage/service/retention_policy"
|
25
27
|
|
26
28
|
module Azure::Storage
|
27
29
|
module Service
|
28
|
-
class Logging
|
30
|
+
class Logging
|
29
31
|
def initialize
|
30
32
|
@version = "1.0"
|
31
33
|
@delete = false
|
@@ -42,4 +44,4 @@ module Azure::Storage
|
|
42
44
|
attr_accessor :retention_policy
|
43
45
|
end
|
44
46
|
end
|
45
|
-
end
|
47
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#-------------------------------------------------------------------------
|
2
4
|
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
3
5
|
#
|
@@ -21,7 +23,7 @@
|
|
21
23
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
24
|
# THE SOFTWARE.
|
23
25
|
#--------------------------------------------------------------------------
|
24
|
-
require
|
26
|
+
require "azure/storage/service/retention_policy"
|
25
27
|
|
26
28
|
module Azure::Storage
|
27
29
|
module Service
|
@@ -33,11 +35,11 @@ module Azure::Storage
|
|
33
35
|
@retention_policy = RetentionPolicy.new
|
34
36
|
yield self if block_given?
|
35
37
|
end
|
36
|
-
|
38
|
+
|
37
39
|
attr_accessor :version
|
38
40
|
attr_accessor :enabled
|
39
41
|
attr_accessor :include_apis
|
40
42
|
attr_accessor :retention_policy
|
41
43
|
end
|
42
44
|
end
|
43
|
-
end
|
45
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#-------------------------------------------------------------------------
|
2
4
|
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
3
5
|
#
|
@@ -32,4 +34,4 @@ module Azure::Storage
|
|
32
34
|
attr_accessor :days
|
33
35
|
end
|
34
36
|
end
|
35
|
-
end
|
37
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#-------------------------------------------------------------------------
|
2
4
|
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
3
5
|
#
|
@@ -21,23 +23,22 @@
|
|
21
23
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
24
|
# THE SOFTWARE.
|
23
25
|
#--------------------------------------------------------------------------
|
24
|
-
require
|
25
|
-
|
26
|
-
require
|
27
|
-
require
|
28
|
-
require
|
29
|
-
require
|
30
|
-
require
|
31
|
-
require
|
32
|
-
require
|
33
|
-
require
|
34
|
-
require
|
26
|
+
require "nokogiri"
|
27
|
+
|
28
|
+
require "azure/storage/service/enumeration_results"
|
29
|
+
require "azure/storage/service/signed_identifier"
|
30
|
+
require "azure/storage/service/access_policy"
|
31
|
+
require "azure/storage/service/storage_service_properties"
|
32
|
+
require "azure/storage/service/logging"
|
33
|
+
require "azure/storage/service/metrics"
|
34
|
+
require "azure/storage/service/retention_policy"
|
35
|
+
require "azure/storage/service/cors"
|
36
|
+
require "azure/storage/service/cors_rule"
|
35
37
|
|
36
38
|
module Azure::Storage
|
37
39
|
module Service
|
38
40
|
module Serialization
|
39
41
|
module ClassMethods
|
40
|
-
|
41
42
|
def signed_identifiers_from_xml(xml)
|
42
43
|
xml = slopify(xml)
|
43
44
|
expect_node("SignedIdentifiers", xml)
|
@@ -48,7 +49,7 @@ module Azure::Storage
|
|
48
49
|
if xml.SignedIdentifier.count == 0
|
49
50
|
identifiers.push(signed_identifier_from_xml(xml.SignedIdentifier))
|
50
51
|
else
|
51
|
-
xml.SignedIdentifier.each { |identifier_node|
|
52
|
+
xml.SignedIdentifier.each { |identifier_node|
|
52
53
|
identifiers.push(signed_identifier_from_xml(identifier_node))
|
53
54
|
}
|
54
55
|
end
|
@@ -57,7 +58,7 @@ module Azure::Storage
|
|
57
58
|
end
|
58
59
|
|
59
60
|
def signed_identifiers_to_xml(signed_identifiers)
|
60
|
-
builder = Nokogiri::XML::Builder.new(:
|
61
|
+
builder = Nokogiri::XML::Builder.new(encoding: "utf-8") do |xml|
|
61
62
|
xml.SignedIdentifiers {
|
62
63
|
signed_identifiers.each do |identifier|
|
63
64
|
xml.SignedIdentifier {
|
@@ -99,7 +100,7 @@ module Azure::Storage
|
|
99
100
|
xml = slopify(xml)
|
100
101
|
expect_node("EnumerationResults", xml)
|
101
102
|
|
102
|
-
results = results || Azure::Service::EnumerationResults.new;
|
103
|
+
results = results || Azure::Service::EnumerationResults.new;
|
103
104
|
|
104
105
|
results.continuation_token = xml.NextMarker.text if (xml > "NextMarker").any?
|
105
106
|
results
|
@@ -114,7 +115,7 @@ module Azure::Storage
|
|
114
115
|
xml.children.each { |meta_node|
|
115
116
|
|
116
117
|
key = meta_node.name.downcase
|
117
|
-
if metadata.has_key? key
|
118
|
+
if metadata.has_key? key
|
118
119
|
metadata[key] = [metadata[key]] unless metadata[key].respond_to? :push
|
119
120
|
metadata[key].push(meta_node.text)
|
120
121
|
else
|
@@ -127,9 +128,9 @@ module Azure::Storage
|
|
127
128
|
def metadata_from_headers(headers)
|
128
129
|
metadata = {}
|
129
130
|
|
130
|
-
headers.each { |k, v|
|
131
|
+
headers.each { |k, v|
|
131
132
|
if key = k[/^x-ms-meta-(.*)/, 1]
|
132
|
-
if metadata.has_key? key
|
133
|
+
if metadata.has_key? key
|
133
134
|
metadata[key] = [metadata[key]] unless metadata[key].respond_to? :push
|
134
135
|
metadata[key].push(v)
|
135
136
|
else
|
@@ -167,13 +168,13 @@ module Azure::Storage
|
|
167
168
|
end
|
168
169
|
|
169
170
|
def hour_metrics_to_xml(metrics, xml)
|
170
|
-
xml.HourMetrics {
|
171
|
+
xml.HourMetrics {
|
171
172
|
metrics_to_xml_children(metrics, xml)
|
172
173
|
} if metrics
|
173
174
|
end
|
174
175
|
|
175
176
|
def minute_metrics_to_xml(metrics, xml)
|
176
|
-
xml.MinuteMetrics {
|
177
|
+
xml.MinuteMetrics {
|
177
178
|
metrics_to_xml_children(metrics, xml)
|
178
179
|
} if metrics
|
179
180
|
end
|
@@ -190,7 +191,7 @@ module Azure::Storage
|
|
190
191
|
end
|
191
192
|
|
192
193
|
def logging_to_xml(logging, xml)
|
193
|
-
xml.Logging {
|
194
|
+
xml.Logging {
|
194
195
|
xml.Version logging.version
|
195
196
|
xml.Delete logging.delete
|
196
197
|
xml.Read logging.read
|
@@ -235,7 +236,7 @@ module Azure::Storage
|
|
235
236
|
expect_node("Cors", xml)
|
236
237
|
|
237
238
|
Cors.new do |cors|
|
238
|
-
cors.cors_rules = xml.children.to_a.map {|child| cors_rule_from_xml(child)}
|
239
|
+
cors.cors_rules = xml.children.to_a.map { |child| cors_rule_from_xml(child) }
|
239
240
|
end
|
240
241
|
end
|
241
242
|
|
@@ -253,11 +254,11 @@ module Azure::Storage
|
|
253
254
|
end
|
254
255
|
|
255
256
|
def ary_from_node(node)
|
256
|
-
node.text.split(",").map {|s| s.strip}
|
257
|
+
node.text.split(",").map { |s| s.strip }
|
257
258
|
end
|
258
|
-
|
259
|
+
|
259
260
|
def service_properties_to_xml(properties)
|
260
|
-
builder = Nokogiri::XML::Builder.new(:
|
261
|
+
builder = Nokogiri::XML::Builder.new(encoding: "utf-8") do |xml|
|
261
262
|
xml.StorageServiceProperties {
|
262
263
|
xml.DefaultServiceVersion(properties.default_service_version) if properties.default_service_version
|
263
264
|
logging_to_xml(properties.logging, xml) if properties.logging
|
@@ -283,7 +284,7 @@ module Azure::Storage
|
|
283
284
|
end
|
284
285
|
|
285
286
|
def to_bool(s)
|
286
|
-
(s || "").downcase ==
|
287
|
+
(s || "").downcase == "true"
|
287
288
|
end
|
288
289
|
|
289
290
|
def slopify(xml)
|
@@ -299,10 +300,10 @@ module Azure::Storage
|
|
299
300
|
end
|
300
301
|
|
301
302
|
extend ClassMethods
|
302
|
-
|
303
|
-
def self.included(
|
304
|
-
other.extend(
|
303
|
+
|
304
|
+
def self.included(other)
|
305
|
+
other.extend(ClassMethods)
|
305
306
|
end
|
306
307
|
end
|
307
308
|
end
|
308
|
-
end
|
309
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#-------------------------------------------------------------------------
|
2
4
|
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
3
5
|
#
|
@@ -21,13 +23,12 @@
|
|
21
23
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
24
|
# THE SOFTWARE.
|
23
25
|
#--------------------------------------------------------------------------
|
24
|
-
require
|
26
|
+
require "azure/storage/service/access_policy"
|
25
27
|
|
26
28
|
module Azure::Storage
|
27
29
|
module Service
|
28
30
|
class SignedIdentifier
|
29
|
-
|
30
|
-
def initialize
|
31
|
+
def initialize
|
31
32
|
@access_policy = AccessPolicy.new
|
32
33
|
yield self if block_given?
|
33
34
|
end
|
@@ -36,4 +37,4 @@ module Azure::Storage
|
|
36
37
|
attr_accessor :access_policy
|
37
38
|
end
|
38
39
|
end
|
39
|
-
end
|
40
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#-------------------------------------------------------------------------
|
2
4
|
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
3
5
|
#
|
@@ -22,9 +24,9 @@
|
|
22
24
|
# THE SOFTWARE.
|
23
25
|
#--------------------------------------------------------------------------
|
24
26
|
|
25
|
-
require
|
26
|
-
require
|
27
|
-
require
|
27
|
+
require "azure/core/signed_service"
|
28
|
+
require "azure/storage/core"
|
29
|
+
require "azure/storage/service/storage_service_properties"
|
28
30
|
|
29
31
|
module Azure::Storage
|
30
32
|
module Service
|
@@ -36,7 +38,7 @@ module Azure::Storage
|
|
36
38
|
# (optional, Default=Azure::Storage::Auth::SharedKey.new)
|
37
39
|
# @param account_name [String] The account name (optional, Default=Azure::Storage.storage_account_name)
|
38
40
|
# @param options [Azure::Storage::Configurable] the client configuration context
|
39
|
-
def initialize(signer=nil, account_name=nil, options = {}, &block)
|
41
|
+
def initialize(signer = nil, account_name = nil, options = {}, &block)
|
40
42
|
StorageService.register_request_callback &block if block_given?
|
41
43
|
options[:client] = Azure::Storage if options[:client] == nil
|
42
44
|
client_config = options[:client]
|
@@ -49,7 +51,7 @@ module Azure::Storage
|
|
49
51
|
super(signer, account_name, options)
|
50
52
|
end
|
51
53
|
|
52
|
-
def call(method, uri, body=nil, headers={}, options = {})
|
54
|
+
def call(method, uri, body = nil, headers = {}, options = {})
|
53
55
|
super(method, uri, body, StorageService.common_headers(options).merge(headers))
|
54
56
|
end
|
55
57
|
|
@@ -61,13 +63,13 @@ module Azure::Storage
|
|
61
63
|
# ==== Options
|
62
64
|
#
|
63
65
|
# * +:timeout+ - Integer. A timeout in seconds.
|
64
|
-
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
66
|
+
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
65
67
|
# in the analytics logs when storage analytics logging is enabled.
|
66
68
|
#
|
67
69
|
# Returns a Hash with the service properties or nil if the operation failed
|
68
|
-
def get_service_properties(options={})
|
69
|
-
query = {
|
70
|
-
StorageService.with_query query,
|
70
|
+
def get_service_properties(options = {})
|
71
|
+
query = {}
|
72
|
+
StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
|
71
73
|
|
72
74
|
response = call(:get, service_properties_uri(query), nil, {}, options)
|
73
75
|
Serialization.service_properties_from_xml response.body
|
@@ -83,13 +85,13 @@ module Azure::Storage
|
|
83
85
|
# ==== Options
|
84
86
|
#
|
85
87
|
# * +:timeout+ - Integer. A timeout in seconds.
|
86
|
-
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
88
|
+
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
87
89
|
# in the analytics logs when storage analytics logging is enabled.
|
88
90
|
#
|
89
91
|
# Returns boolean indicating success.
|
90
|
-
def set_service_properties(service_properties, options={})
|
91
|
-
query = {
|
92
|
-
StorageService.with_query query,
|
92
|
+
def set_service_properties(service_properties, options = {})
|
93
|
+
query = {}
|
94
|
+
StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
|
93
95
|
|
94
96
|
body = Serialization.service_properties_to_xml service_properties
|
95
97
|
call(:put, service_properties_uri(query), body, {}, options)
|
@@ -101,9 +103,9 @@ module Azure::Storage
|
|
101
103
|
# query - see Azure::Storage::Services::GetServiceProperties#call documentation.
|
102
104
|
#
|
103
105
|
# Returns a URI.
|
104
|
-
def service_properties_uri(query={})
|
105
|
-
query.update(restype:
|
106
|
-
generate_uri(
|
106
|
+
def service_properties_uri(query = {})
|
107
|
+
query.update(restype: "service", comp: "properties")
|
108
|
+
generate_uri("", query)
|
107
109
|
end
|
108
110
|
|
109
111
|
# Overrides the base class implementation to determine the request uri
|
@@ -112,34 +114,34 @@ module Azure::Storage
|
|
112
114
|
# query - Hash. the query parameters
|
113
115
|
#
|
114
116
|
# Returns the uri hash
|
115
|
-
def generate_uri(path=
|
117
|
+
def generate_uri(path = "", query = {}, encode = false)
|
116
118
|
if self.client.is_a?(Azure::Storage::Client) && self.client.options[:use_path_style_uri]
|
117
119
|
if path.length > 0
|
118
|
-
path = self.client.options[:storage_account_name] +
|
120
|
+
path = self.client.options[:storage_account_name] + "/" + path
|
119
121
|
else
|
120
122
|
path = self.client.options[:storage_account_name]
|
121
123
|
end
|
122
124
|
end
|
123
125
|
|
124
126
|
if encode
|
125
|
-
path = CGI.escape(path.encode(
|
127
|
+
path = CGI.escape(path.encode("UTF-8"))
|
126
128
|
|
127
129
|
# decode the forward slashes to match what the server expects.
|
128
|
-
path = path.gsub(/%2F/,
|
130
|
+
path = path.gsub(/%2F/, "/")
|
129
131
|
# decode the backward slashes to match what the server expects.
|
130
|
-
path = path.gsub(/%5C/,
|
132
|
+
path = path.gsub(/%5C/, "/")
|
131
133
|
# Re-encode the spaces (encoded as space) to the % encoding.
|
132
|
-
path = path.gsub(/\+/,
|
134
|
+
path = path.gsub(/\+/, "%20")
|
133
135
|
end
|
134
136
|
|
135
137
|
super path, query
|
136
138
|
end
|
137
|
-
|
139
|
+
|
138
140
|
class << self
|
139
141
|
# @!attribute user_agent_prefix
|
140
142
|
# @return [Proc] Get or set the user agent prefix
|
141
143
|
attr_accessor :user_agent_prefix
|
142
|
-
|
144
|
+
|
143
145
|
# @!attribute request_callback
|
144
146
|
# @return [Proc] The callback before the request is signed and sent
|
145
147
|
attr_reader :request_callback
|
@@ -161,7 +163,7 @@ module Azure::Storage
|
|
161
163
|
end
|
162
164
|
end
|
163
165
|
end
|
164
|
-
|
166
|
+
|
165
167
|
# Adds a value to the Hash object
|
166
168
|
#
|
167
169
|
# object - A Hash object
|
@@ -177,26 +179,25 @@ module Azure::Storage
|
|
177
179
|
# name - The header name
|
178
180
|
# value - The value
|
179
181
|
alias with_header with_value
|
180
|
-
|
182
|
+
|
181
183
|
# Adds a query parameter
|
182
184
|
#
|
183
185
|
# query - A Hash of HTTP query
|
184
186
|
# name - The parameter name
|
185
187
|
# value - The value
|
186
188
|
alias with_query with_value
|
187
|
-
|
189
|
+
|
188
190
|
# Declares a default hash object for request headers
|
189
191
|
def common_headers(options = {})
|
190
192
|
headers = {
|
191
|
-
|
192
|
-
|
193
|
+
"x-ms-version" => Azure::Storage::Default::STG_VERSION,
|
194
|
+
"User-Agent" => user_agent_prefix ? "#{user_agent_prefix}; #{Azure::Storage::Default::USER_AGENT}" : Azure::Storage::Default::USER_AGENT
|
193
195
|
}
|
194
|
-
headers.merge!(
|
196
|
+
headers.merge!("x-ms-client-request-id" => options[:request_id]) if options[:request_id]
|
195
197
|
@request_callback.call(headers) if @request_callback
|
196
198
|
headers
|
197
199
|
end
|
198
200
|
end
|
199
|
-
|
200
201
|
end
|
201
202
|
end
|
202
|
-
end
|
203
|
+
end
|