gitlab-fog-azure-rm 1.9.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/Gemfile +3 -0
- data/gitlab-fog-azure-rm.gemspec +1 -3
- data/lib/fog/azurerm/version.rb +1 -1
- data/vendor/azure-storage-ruby/.env_sample +8 -0
- data/vendor/azure-storage-ruby/.gitignore +35 -0
- data/vendor/azure-storage-ruby/.rubocop.yml +132 -0
- data/vendor/azure-storage-ruby/.travis.yml +23 -0
- data/vendor/azure-storage-ruby/BreakingChanges.md +34 -0
- data/vendor/azure-storage-ruby/CONTRIBUTING.md +74 -0
- data/vendor/azure-storage-ruby/ChangeLog.md +198 -0
- data/vendor/azure-storage-ruby/Gemfile +41 -0
- data/vendor/azure-storage-ruby/README.md +48 -0
- data/vendor/azure-storage-ruby/Rakefile +216 -0
- data/vendor/azure-storage-ruby/SECURITY.md +41 -0
- data/vendor/azure-storage-ruby/blob/BreakingChanges.md +10 -0
- data/vendor/azure-storage-ruby/blob/ChangeLog.md +33 -0
- data/vendor/azure-storage-ruby/blob/Gemfile +30 -0
- data/vendor/azure-storage-ruby/blob/LICENSE.txt +21 -0
- data/vendor/azure-storage-ruby/blob/README.md +188 -0
- data/vendor/azure-storage-ruby/blob/azure-storage-blob.gemspec +52 -0
- data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob/append.rb +244 -0
- data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob/autoload.rb +47 -0
- data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob/blob.rb +932 -0
- data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob/blob_service.rb +720 -0
- data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob/block.rb +530 -0
- data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob/container.rb +634 -0
- data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob/default.rb +171 -0
- data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob/page.rb +566 -0
- data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob/serialization.rb +351 -0
- data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob/version.rb +49 -0
- data/vendor/azure-storage-ruby/blob/lib/azure/storage/blob.rb +26 -0
- data/vendor/azure-storage-ruby/common/BreakingChanges.md +8 -0
- data/vendor/azure-storage-ruby/common/ChangeLog.md +41 -0
- data/vendor/azure-storage-ruby/common/Gemfile +30 -0
- data/vendor/azure-storage-ruby/common/LICENSE.txt +21 -0
- data/vendor/azure-storage-ruby/common/README.md +146 -0
- data/vendor/azure-storage-ruby/common/azure-storage-common.gemspec +57 -0
- data/vendor/azure-storage-ruby/common/lib/azure/core/auth/authorizer.rb +36 -0
- data/vendor/azure-storage-ruby/common/lib/azure/core/auth/shared_key.rb +125 -0
- data/vendor/azure-storage-ruby/common/lib/azure/core/auth/shared_key_lite.rb +48 -0
- data/vendor/azure-storage-ruby/common/lib/azure/core/auth/signer.rb +51 -0
- data/vendor/azure-storage-ruby/common/lib/azure/core/default.rb +23 -0
- data/vendor/azure-storage-ruby/common/lib/azure/core/error.rb +21 -0
- data/vendor/azure-storage-ruby/common/lib/azure/core/filtered_service.rb +45 -0
- data/vendor/azure-storage-ruby/common/lib/azure/core/http/debug_filter.rb +36 -0
- data/vendor/azure-storage-ruby/common/lib/azure/core/http/http_error.rb +135 -0
- data/vendor/azure-storage-ruby/common/lib/azure/core/http/http_filter.rb +53 -0
- data/vendor/azure-storage-ruby/common/lib/azure/core/http/http_request.rb +195 -0
- data/vendor/azure-storage-ruby/common/lib/azure/core/http/http_response.rb +102 -0
- data/vendor/azure-storage-ruby/common/lib/azure/core/http/retry_policy.rb +84 -0
- data/vendor/azure-storage-ruby/common/lib/azure/core/http/signer_filter.rb +33 -0
- data/vendor/azure-storage-ruby/common/lib/azure/core/service.rb +46 -0
- data/vendor/azure-storage-ruby/common/lib/azure/core/signed_service.rb +45 -0
- data/vendor/azure-storage-ruby/common/lib/azure/core/utility.rb +244 -0
- data/vendor/azure-storage-ruby/common/lib/azure/core/version.rb +33 -0
- data/vendor/azure-storage-ruby/common/lib/azure/core.rb +48 -0
- data/vendor/azure-storage-ruby/common/lib/azure/http_response_helper.rb +38 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/autoload.rb +62 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/client.rb +162 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/client_options.rb +363 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/client_options_error.rb +41 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/configurable.rb +212 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/auth/anonymous_signer.rb +43 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/auth/shared_access_signature.rb +30 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/auth/shared_access_signature_generator.rb +399 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/auth/shared_access_signature_signer.rb +57 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/auth/shared_key.rb +60 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/auth/token_signer.rb +43 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/autoload.rb +53 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/error.rb +43 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/filter/exponential_retry_filter.rb +64 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/filter/linear_retry_filter.rb +55 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/filter/retry_filter.rb +300 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/http_client.rb +82 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/sr.rb +85 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/token_credential.rb +64 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core/utility.rb +261 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/core.rb +35 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/default.rb +868 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/access_policy.rb +37 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/cors.rb +38 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/cors_rule.rb +48 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/enumeration_results.rb +32 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/geo_replication.rb +40 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/logging.rb +47 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/metrics.rb +45 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/retention_policy.rb +37 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/serialization.rb +335 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/signed_identifier.rb +40 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/storage_service.rb +322 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/storage_service_properties.rb +48 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/storage_service_stats.rb +39 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/user_delegation_key.rb +50 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common/version.rb +49 -0
- data/vendor/azure-storage-ruby/common/lib/azure/storage/common.rb +26 -0
- metadata +95 -31
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#-------------------------------------------------------------------------
|
4
|
+
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
5
|
+
#
|
6
|
+
# The MIT License(MIT)
|
7
|
+
|
8
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
# of this software and associated documentation files(the "Software"), to deal
|
10
|
+
# in the Software without restriction, including without limitation the rights
|
11
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
12
|
+
# copies of the Software, and to permit persons to whom the Software is
|
13
|
+
# furnished to do so, subject to the following conditions :
|
14
|
+
|
15
|
+
# The above copyright notice and this permission notice shall be included in
|
16
|
+
# all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
21
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
# THE SOFTWARE.
|
25
|
+
#--------------------------------------------------------------------------
|
26
|
+
require "azure/storage/common/service/access_policy"
|
27
|
+
|
28
|
+
module Azure::Storage::Common
|
29
|
+
module Service
|
30
|
+
class SignedIdentifier
|
31
|
+
def initialize
|
32
|
+
@access_policy = AccessPolicy.new
|
33
|
+
yield self if block_given?
|
34
|
+
end
|
35
|
+
|
36
|
+
attr_accessor :id
|
37
|
+
attr_accessor :access_policy
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,322 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#-------------------------------------------------------------------------
|
4
|
+
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
5
|
+
#
|
6
|
+
# The MIT License(MIT)
|
7
|
+
|
8
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
# of this software and associated documentation files(the "Software"), to deal
|
10
|
+
# in the Software without restriction, including without limitation the rights
|
11
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
12
|
+
# copies of the Software, and to permit persons to whom the Software is
|
13
|
+
# furnished to do so, subject to the following conditions :
|
14
|
+
|
15
|
+
# The above copyright notice and this permission notice shall be included in
|
16
|
+
# all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
21
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
# THE SOFTWARE.
|
25
|
+
#--------------------------------------------------------------------------
|
26
|
+
|
27
|
+
require "azure/core/signed_service"
|
28
|
+
require "azure/storage/common/core"
|
29
|
+
require "azure/storage/common/service/storage_service_properties"
|
30
|
+
require "azure/storage/common/service/storage_service_stats"
|
31
|
+
|
32
|
+
module Azure::Storage::Common
|
33
|
+
module Service
|
34
|
+
# A base class for StorageService implementations
|
35
|
+
class StorageService < Azure::Core::SignedService
|
36
|
+
# @!attribute storage_service_host
|
37
|
+
# @return [Hash] Get or set the storage service host
|
38
|
+
attr_accessor :storage_service_host
|
39
|
+
|
40
|
+
# Create a new instance of the StorageService
|
41
|
+
#
|
42
|
+
# @param signer [Azure::Core::Auth::Signer] An implementation of Signer used for signing requests.
|
43
|
+
# (optional, Default=Azure::Storage::CommonAuth::SharedKey.new)
|
44
|
+
# @param account_name [String] The account name (optional, Default=Azure::Storage.storage_account_name)
|
45
|
+
# @param options [Azure::Storage::CommonConfigurable] the client configuration context
|
46
|
+
def initialize(signer = nil, account_name = nil, options = {}, &block)
|
47
|
+
StorageService.register_request_callback(&block) if block_given?
|
48
|
+
client_config = options[:client]
|
49
|
+
signer = signer || Azure::Storage::Common::Core::Auth::SharedKey.new(
|
50
|
+
client_config.storage_account_name,
|
51
|
+
client_config.storage_access_key) if client_config.storage_access_key
|
52
|
+
signer = signer || Azure::Storage::Common::Core::Auth::SharedAccessSignatureSigner.new(
|
53
|
+
client_config.storage_account_name,
|
54
|
+
client_config.storage_sas_token)
|
55
|
+
@storage_service_host = { primary: "", secondary: "" };
|
56
|
+
super(signer, account_name, options)
|
57
|
+
end
|
58
|
+
|
59
|
+
def call(method, uri, body = nil, headers = {}, options = {})
|
60
|
+
super(method, uri, body, StorageService.common_headers(options, body).merge(headers), options)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Public: Get Storage Service properties
|
64
|
+
#
|
65
|
+
# See http://msdn.microsoft.com/en-us/library/azure/hh452239
|
66
|
+
# See http://msdn.microsoft.com/en-us/library/azure/hh452243
|
67
|
+
#
|
68
|
+
# ==== Options
|
69
|
+
#
|
70
|
+
# * +:timeout+ - Integer. A timeout in seconds.
|
71
|
+
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
72
|
+
# in the analytics logs when storage analytics logging is enabled.
|
73
|
+
#
|
74
|
+
# Returns a Hash with the service properties or nil if the operation failed
|
75
|
+
def get_service_properties(options = {})
|
76
|
+
query = {}
|
77
|
+
StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
|
78
|
+
|
79
|
+
response = call(:get, service_properties_uri(query), nil, {}, options)
|
80
|
+
Serialization.service_properties_from_xml response.body
|
81
|
+
end
|
82
|
+
|
83
|
+
# Public: Set Storage Service properties
|
84
|
+
#
|
85
|
+
# service_properties - An instance of Azure::Storage::CommonService::StorageServiceProperties
|
86
|
+
#
|
87
|
+
# See http://msdn.microsoft.com/en-us/library/azure/hh452235
|
88
|
+
# See http://msdn.microsoft.com/en-us/library/azure/hh452232
|
89
|
+
#
|
90
|
+
# ==== Options
|
91
|
+
#
|
92
|
+
# * +:timeout+ - Integer. A timeout in seconds.
|
93
|
+
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
94
|
+
# in the analytics logs when storage analytics logging is enabled.
|
95
|
+
#
|
96
|
+
# Returns boolean indicating success.
|
97
|
+
def set_service_properties(service_properties, options = {})
|
98
|
+
query = {}
|
99
|
+
StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
|
100
|
+
|
101
|
+
body = Serialization.service_properties_to_xml service_properties
|
102
|
+
call(:put, service_properties_uri(query), body, {}, options)
|
103
|
+
nil
|
104
|
+
end
|
105
|
+
|
106
|
+
# Public: Retrieves statistics related to replication for the service.
|
107
|
+
# It is only available on the secondary location endpoint when read-access geo-redundant
|
108
|
+
# replication is enabled for the storage account.
|
109
|
+
#
|
110
|
+
# See https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-service-stats
|
111
|
+
# See https://docs.microsoft.com/en-us/rest/api/storageservices/get-queue-service-stats
|
112
|
+
# See https://docs.microsoft.com/en-us/rest/api/storageservices/get-table-service-stats
|
113
|
+
#
|
114
|
+
# ==== Options
|
115
|
+
#
|
116
|
+
# * +:timeout+ - Integer. A timeout in seconds.
|
117
|
+
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
118
|
+
# in the analytics logs when storage analytics logging is enabled.
|
119
|
+
#
|
120
|
+
# Returns a Hash with the service statistics or nil if the operation failed
|
121
|
+
def get_service_stats(options = {})
|
122
|
+
query = {}
|
123
|
+
StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
|
124
|
+
|
125
|
+
options.update(
|
126
|
+
location_mode: LocationMode::SECONDARY_ONLY,
|
127
|
+
request_location_mode: RequestLocationMode::SECONDARY_ONLY)
|
128
|
+
response = call(:get, service_stats_uri(query, options), nil, {}, options)
|
129
|
+
Serialization.service_stats_from_xml response.body
|
130
|
+
end
|
131
|
+
|
132
|
+
# Public: Generate the URI for the service properties
|
133
|
+
#
|
134
|
+
# * +:query+ - see Azure::Storage::CommonServices::GetServiceProperties#call documentation.
|
135
|
+
#
|
136
|
+
# Returns a URI.
|
137
|
+
def service_properties_uri(query = {})
|
138
|
+
query.update(restype: "service", comp: "properties")
|
139
|
+
generate_uri("", query)
|
140
|
+
end
|
141
|
+
|
142
|
+
# Public: Generate the URI for the service statistics
|
143
|
+
#
|
144
|
+
# * +:query+ - see Azure::Storage::CommonServices::GetServiceStats#call documentation.
|
145
|
+
#
|
146
|
+
# Returns a URI.
|
147
|
+
def service_stats_uri(query = {}, options = {})
|
148
|
+
query.update(restype: "service", comp: "stats")
|
149
|
+
generate_uri("", query, options)
|
150
|
+
end
|
151
|
+
|
152
|
+
# Overrides the base class implementation to determine the request uri
|
153
|
+
#
|
154
|
+
# path - String. the request path
|
155
|
+
# query - Hash. the query parameters
|
156
|
+
#
|
157
|
+
# ==== Options
|
158
|
+
#
|
159
|
+
# * +:encode+ - bool. Specifies whether to encode the path.
|
160
|
+
# * +:location_mode+ - LocationMode. Specifies the location mode used to decide
|
161
|
+
# which location the request should be sent to.
|
162
|
+
# * +:request_location_mode+ - RequestLocationMode. Specifies the location used to indicate
|
163
|
+
# which location the operation (REST API) can be performed against.
|
164
|
+
# This is determined by the API and cannot be specified by the users.
|
165
|
+
#
|
166
|
+
# Returns the uri hash
|
167
|
+
def generate_uri(path = "", query = {}, options = {})
|
168
|
+
location_mode =
|
169
|
+
if options[:location_mode].nil?
|
170
|
+
LocationMode::PRIMARY_ONLY
|
171
|
+
else
|
172
|
+
options[:location_mode]
|
173
|
+
end
|
174
|
+
|
175
|
+
request_location_mode =
|
176
|
+
if options[:request_location_mode].nil?
|
177
|
+
RequestLocationMode::PRIMARY_ONLY
|
178
|
+
else
|
179
|
+
request_location_mode = options[:request_location_mode]
|
180
|
+
end
|
181
|
+
|
182
|
+
location = StorageService.get_location location_mode, request_location_mode
|
183
|
+
|
184
|
+
if self.client.is_a?(Azure::Storage::Common::Client) && self.client.options[:use_path_style_uri]
|
185
|
+
account_path = get_account_path location
|
186
|
+
path = path.length > 0 ? account_path + "/" + path : account_path
|
187
|
+
end
|
188
|
+
|
189
|
+
@host = location == StorageLocation::PRIMARY ? @storage_service_host[:primary] : @storage_service_host[:secondary]
|
190
|
+
|
191
|
+
encode = options[:encode].nil? ? false : options[:encode]
|
192
|
+
if encode
|
193
|
+
path = CGI.escape(path.encode("UTF-8"))
|
194
|
+
|
195
|
+
# decode the forward slashes to match what the server expects.
|
196
|
+
path = path.gsub(/%2F/, "/")
|
197
|
+
# decode the backward slashes to match what the server expects.
|
198
|
+
path = path.gsub(/%5C/, "/")
|
199
|
+
# Re-encode the spaces (encoded as space) to the % encoding.
|
200
|
+
path = path.gsub(/\+/, "%20")
|
201
|
+
end
|
202
|
+
|
203
|
+
@host = storage_service_host[:primary]
|
204
|
+
options[:primary_uri] = super path, query
|
205
|
+
|
206
|
+
@host = storage_service_host[:secondary]
|
207
|
+
options[:secondary_uri] = super path, query
|
208
|
+
|
209
|
+
if location == StorageLocation::PRIMARY
|
210
|
+
@host = @storage_service_host[:primary]
|
211
|
+
return options[:primary_uri]
|
212
|
+
else
|
213
|
+
@host = @storage_service_host[:secondary]
|
214
|
+
return options[:secondary_uri]
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
# Get account path according to the location settings.
|
219
|
+
#
|
220
|
+
# * +:location+ - StorageLocation. Specifies the request location.
|
221
|
+
#
|
222
|
+
# Returns the account path
|
223
|
+
def get_account_path(location)
|
224
|
+
if location == StorageLocation::PRIMARY
|
225
|
+
self.client.options[:storage_account_name]
|
226
|
+
else
|
227
|
+
self.client.options[:storage_account_name] + "-secondary"
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
class << self
|
232
|
+
# @!attribute user_agent_prefix
|
233
|
+
# @return [Proc] Get or set the user agent prefix
|
234
|
+
attr_accessor :user_agent_prefix
|
235
|
+
|
236
|
+
# @!attribute request_callback
|
237
|
+
# @return [Proc] The callback before the request is signed and sent
|
238
|
+
attr_reader :request_callback
|
239
|
+
|
240
|
+
# Registers the callback when sending the request
|
241
|
+
# The headers in the request can be viewed or changed in the code block
|
242
|
+
def register_request_callback(&block)
|
243
|
+
@request_callback = block
|
244
|
+
end
|
245
|
+
|
246
|
+
# Get the request location.
|
247
|
+
#
|
248
|
+
# * +:location_mode+ - LocationMode. Specifies the location mode used to decide
|
249
|
+
# which location the request should be sent to.
|
250
|
+
# * +:request_location_mode+ - RequestLocationMode. Specifies the location used to indicate
|
251
|
+
# which location the operation (REST API) can be performed against.
|
252
|
+
# This is determined by the API and cannot be specified by the users.
|
253
|
+
#
|
254
|
+
# Returns the reqeust location
|
255
|
+
def get_location(location_mode, request_location_mode)
|
256
|
+
if request_location_mode == RequestLocationMode::PRIMARY_ONLY && location_mode == LocationMode::SECONDARY_ONLY
|
257
|
+
raise InvalidOptionsError, "This operation can only be executed against the primary storage location."
|
258
|
+
end
|
259
|
+
|
260
|
+
if request_location_mode == RequestLocationMode::SECONDARY_ONLY && location_mode == LocationMode::PRIMARY_ONLY
|
261
|
+
raise InvalidOptionsError, "This operation can only be executed against the secondary storage location."
|
262
|
+
end
|
263
|
+
|
264
|
+
if request_location_mode == RequestLocationMode::PRIMARY_ONLY
|
265
|
+
return StorageLocation::PRIMARY
|
266
|
+
elsif request_location_mode == RequestLocationMode::SECONDARY_ONLY
|
267
|
+
return StorageLocation::SECONDARY
|
268
|
+
end
|
269
|
+
|
270
|
+
if location_mode == LocationMode::PRIMARY_ONLY || location_mode == LocationMode::PRIMARY_THEN_SECONDARY
|
271
|
+
StorageLocation::PRIMARY
|
272
|
+
elsif location_mode == LocationMode::SECONDARY_ONLY || location_mode == LocationMode::SECONDARY_THEN_PRIMARY
|
273
|
+
StorageLocation::SECONDARY
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
# Adds metadata properties to header hash with required prefix
|
278
|
+
#
|
279
|
+
# * +:metadata+ - A Hash of metadata name/value pairs
|
280
|
+
# * +:headers+ - A Hash of HTTP headers
|
281
|
+
def add_metadata_to_headers(metadata, headers)
|
282
|
+
if metadata
|
283
|
+
metadata.each do |key, value|
|
284
|
+
headers["x-ms-meta-#{key}"] = value
|
285
|
+
end
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
# Adds a value to the Hash object
|
290
|
+
#
|
291
|
+
# * +:object+ - A Hash object
|
292
|
+
# * +:key+ - The key name
|
293
|
+
# * +:value+ - The value
|
294
|
+
def with_value(object, key, value)
|
295
|
+
object[key] = value.to_s if value
|
296
|
+
end
|
297
|
+
|
298
|
+
# Adds a header with the value
|
299
|
+
#
|
300
|
+
# * +:headers+ - A Hash of HTTP headers
|
301
|
+
# * +:name+ - The header name
|
302
|
+
# * +:value+ - The value
|
303
|
+
alias with_header with_value
|
304
|
+
|
305
|
+
# Adds a query parameter
|
306
|
+
#
|
307
|
+
# * +:query+ - A Hash of HTTP query
|
308
|
+
# * +:name+ - The parameter name
|
309
|
+
# * +:value+ - The value
|
310
|
+
alias with_query with_value
|
311
|
+
|
312
|
+
# Declares a default hash object for request headers
|
313
|
+
def common_headers(options = {}, body = nil)
|
314
|
+
headers = {}
|
315
|
+
headers.merge!("x-ms-client-request-id" => options[:request_id]) if options[:request_id]
|
316
|
+
@request_callback.call(headers) if @request_callback
|
317
|
+
headers
|
318
|
+
end
|
319
|
+
end
|
320
|
+
end
|
321
|
+
end
|
322
|
+
end
|
data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/storage_service_properties.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#-------------------------------------------------------------------------
|
4
|
+
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
5
|
+
#
|
6
|
+
# The MIT License(MIT)
|
7
|
+
|
8
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
# of this software and associated documentation files(the "Software"), to deal
|
10
|
+
# in the Software without restriction, including without limitation the rights
|
11
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
12
|
+
# copies of the Software, and to permit persons to whom the Software is
|
13
|
+
# furnished to do so, subject to the following conditions :
|
14
|
+
|
15
|
+
# The above copyright notice and this permission notice shall be included in
|
16
|
+
# all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
21
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
# THE SOFTWARE.
|
25
|
+
#--------------------------------------------------------------------------
|
26
|
+
require "azure/storage/common/service/logging"
|
27
|
+
require "azure/storage/common/service/metrics"
|
28
|
+
require "azure/storage/common/service/cors"
|
29
|
+
|
30
|
+
module Azure::Storage::Common
|
31
|
+
module Service
|
32
|
+
class StorageServiceProperties
|
33
|
+
def initialize
|
34
|
+
@logging = Logging.new
|
35
|
+
@hour_metrics = Metrics.new
|
36
|
+
@minute_metrics = Metrics.new
|
37
|
+
@cors = Cors.new
|
38
|
+
yield self if block_given?
|
39
|
+
end
|
40
|
+
|
41
|
+
attr_accessor :logging
|
42
|
+
attr_accessor :hour_metrics
|
43
|
+
attr_accessor :minute_metrics
|
44
|
+
attr_accessor :cors
|
45
|
+
attr_accessor :default_service_version
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/vendor/azure-storage-ruby/common/lib/azure/storage/common/service/storage_service_stats.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#-------------------------------------------------------------------------
|
4
|
+
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
5
|
+
#
|
6
|
+
# The MIT License(MIT)
|
7
|
+
|
8
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
# of this software and associated documentation files(the "Software"), to deal
|
10
|
+
# in the Software without restriction, including without limitation the rights
|
11
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
12
|
+
# copies of the Software, and to permit persons to whom the Software is
|
13
|
+
# furnished to do so, subject to the following conditions :
|
14
|
+
|
15
|
+
# The above copyright notice and this permission notice shall be included in
|
16
|
+
# all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
21
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
# THE SOFTWARE.
|
25
|
+
#--------------------------------------------------------------------------
|
26
|
+
require "azure/storage/common/service/geo_replication"
|
27
|
+
|
28
|
+
module Azure::Storage::Common
|
29
|
+
module Service
|
30
|
+
class StorageServiceStats
|
31
|
+
def initialize
|
32
|
+
@geo_replication = GeoReplication.new
|
33
|
+
yield self if block_given?
|
34
|
+
end
|
35
|
+
|
36
|
+
attr_accessor :geo_replication
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#-------------------------------------------------------------------------
|
4
|
+
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
5
|
+
#
|
6
|
+
# The MIT License(MIT)
|
7
|
+
|
8
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
# of this software and associated documentation files(the "Software"), to deal
|
10
|
+
# in the Software without restriction, including without limitation the rights
|
11
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
12
|
+
# copies of the Software, and to permit persons to whom the Software is
|
13
|
+
# furnished to do so, subject to the following conditions :
|
14
|
+
|
15
|
+
# The above copyright notice and this permission notice shall be included in
|
16
|
+
# all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
21
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
# THE SOFTWARE.
|
25
|
+
#--------------------------------------------------------------------------
|
26
|
+
|
27
|
+
module Azure::Storage::Common
|
28
|
+
module Service
|
29
|
+
class UserDelegationKey
|
30
|
+
def initialize
|
31
|
+
@signed_oid = nil
|
32
|
+
@signed_tid = nil
|
33
|
+
@signed_start = nil
|
34
|
+
@signed_expiry = nil
|
35
|
+
@signed_service = nil
|
36
|
+
@signed_version = nil
|
37
|
+
@value = nil
|
38
|
+
yield self if block_given?
|
39
|
+
end
|
40
|
+
|
41
|
+
attr_accessor :signed_oid
|
42
|
+
attr_accessor :signed_tid
|
43
|
+
attr_accessor :signed_start
|
44
|
+
attr_accessor :signed_expiry
|
45
|
+
attr_accessor :signed_service
|
46
|
+
attr_accessor :signed_version
|
47
|
+
attr_accessor :value
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#-------------------------------------------------------------------------
|
4
|
+
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
5
|
+
#
|
6
|
+
# The MIT License(MIT)
|
7
|
+
|
8
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
# of this software and associated documentation files(the "Software"), to deal
|
10
|
+
# in the Software without restriction, including without limitation the rights
|
11
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
12
|
+
# copies of the Software, and to permit persons to whom the Software is
|
13
|
+
# furnished to do so, subject to the following conditions :
|
14
|
+
|
15
|
+
# The above copyright notice and this permission notice shall be included in
|
16
|
+
# all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
21
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
# THE SOFTWARE.
|
25
|
+
#--------------------------------------------------------------------------
|
26
|
+
|
27
|
+
module Azure
|
28
|
+
module Storage
|
29
|
+
module Common
|
30
|
+
class Version
|
31
|
+
# Fields represent the parts defined in http://semver.org/
|
32
|
+
MAJOR = 2 unless defined? MAJOR
|
33
|
+
MINOR = 0 unless defined? MINOR
|
34
|
+
UPDATE = 4 unless defined? UPDATE
|
35
|
+
|
36
|
+
class << self
|
37
|
+
# @return [String]
|
38
|
+
def to_s
|
39
|
+
[MAJOR, MINOR, UPDATE].compact.join(".")
|
40
|
+
end
|
41
|
+
|
42
|
+
def to_uas
|
43
|
+
[MAJOR, MINOR, UPDATE].join(".")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#-------------------------------------------------------------------------
|
4
|
+
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
5
|
+
#
|
6
|
+
# The MIT License(MIT)
|
7
|
+
|
8
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
# of this software and associated documentation files(the "Software"), to deal
|
10
|
+
# in the Software without restriction, including without limitation the rights
|
11
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
12
|
+
# copies of the Software, and to permit persons to whom the Software is
|
13
|
+
# furnished to do so, subject to the following conditions :
|
14
|
+
|
15
|
+
# The above copyright notice and this permission notice shall be included in
|
16
|
+
# all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
21
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
# THE SOFTWARE.
|
25
|
+
#--------------------------------------------------------------------------
|
26
|
+
require "azure/storage/common/autoload"
|