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,244 @@
|
|
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
|
28
|
+
module Blob
|
29
|
+
# Public: Creates a new append blob. Note that calling create_append_blob to create an append
|
30
|
+
# blob only initializes the blob. To add content to an append blob, call append_blob_blocks method.
|
31
|
+
#
|
32
|
+
# ==== Attributes
|
33
|
+
#
|
34
|
+
# * +container+ - String. The container name.
|
35
|
+
# * +blob+ - String. The blob name.
|
36
|
+
# * +options+ - Hash. Optional parameters.
|
37
|
+
#
|
38
|
+
# ==== Options
|
39
|
+
#
|
40
|
+
# Accepted key/value pairs in options parameter are:
|
41
|
+
# * +:content_type+ - String. Content type for the blob. Will be saved with blob.
|
42
|
+
# * +:content_encoding+ - String. Content encoding for the blob. Will be saved with blob.
|
43
|
+
# * +:content_language+ - String. Content language for the blob. Will be saved with blob.
|
44
|
+
# * +:content_md5+ - String. Content MD5 for the blob. Will be saved with blob.
|
45
|
+
# * +:cache_control+ - String. Cache control for the blob. Will be saved with blob.
|
46
|
+
# * +:content_disposition+ - String. Conveys additional information about how to process the response payload,
|
47
|
+
# and also can be used to attach additional metadata
|
48
|
+
# * +:metadata+ - Hash. Custom metadata values to store with the blob.
|
49
|
+
# * +:timeout+ - Integer. A timeout in seconds.
|
50
|
+
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
51
|
+
# in the analytics logs when storage analytics logging is enabled.
|
52
|
+
# * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to create a new blob
|
53
|
+
# only if the blob has been modified since the specified date/time. If the blob has not been modified,
|
54
|
+
# the Blob service returns status code 412 (Precondition Failed).
|
55
|
+
# * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to create a new blob
|
56
|
+
# only if the blob has not been modified since the specified date/time. If the blob has been modified,
|
57
|
+
# the Blob service returns status code 412 (Precondition Failed).
|
58
|
+
# * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to create a new blob
|
59
|
+
# only if the blob's ETag value matches the value specified. If the values do not match,
|
60
|
+
# the Blob service returns status code 412 (Precondition Failed).
|
61
|
+
# * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to create a new blob
|
62
|
+
# only if the blob's ETag value does not match the value specified. If the values are identical,
|
63
|
+
# the Blob service returns status code 412 (Precondition Failed).
|
64
|
+
# * +:lease_id+ - String. Required if the blob has an active lease. To perform this operation on a blob with an active lease,
|
65
|
+
# specify the valid lease ID for this header.
|
66
|
+
#
|
67
|
+
# See http://msdn.microsoft.com/en-us/library/azure/dd179451.aspx
|
68
|
+
#
|
69
|
+
# Returns a Blob
|
70
|
+
def create_append_blob(container, blob, options = {})
|
71
|
+
query = {}
|
72
|
+
StorageService.with_query query, "timeout", options[:timeout] if options[:timeout]
|
73
|
+
|
74
|
+
uri = blob_uri(container, blob, query)
|
75
|
+
|
76
|
+
headers = {}
|
77
|
+
|
78
|
+
# set x-ms-blob-type to AppendBlob
|
79
|
+
StorageService.with_header headers, "x-ms-blob-type", "AppendBlob"
|
80
|
+
|
81
|
+
# ensure content-length is 0
|
82
|
+
StorageService.with_header headers, "Content-Length", 0
|
83
|
+
|
84
|
+
# set the rest of the optional headers
|
85
|
+
StorageService.with_header headers, "x-ms-blob-content-type", options[:content_type]
|
86
|
+
StorageService.with_header headers, "x-ms-blob-content-encoding", options[:content_encoding]
|
87
|
+
StorageService.with_header headers, "x-ms-blob-content-language", options[:content_language]
|
88
|
+
StorageService.with_header headers, "x-ms-blob-content-md5", options[:content_md5]
|
89
|
+
StorageService.with_header headers, "x-ms-blob-cache-control", options[:cache_control]
|
90
|
+
StorageService.with_header headers, "x-ms-blob-content-disposition", options[:content_disposition]
|
91
|
+
|
92
|
+
StorageService.add_metadata_to_headers options[:metadata], headers
|
93
|
+
add_blob_conditional_headers options, headers
|
94
|
+
headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
|
95
|
+
headers["x-ms-blob-content-type"] = Default::CONTENT_TYPE_VALUE unless headers["x-ms-blob-content-type"]
|
96
|
+
|
97
|
+
# call PutBlob with empty body
|
98
|
+
response = call(:put, uri, nil, headers, options)
|
99
|
+
|
100
|
+
result = Serialization.blob_from_headers(response.headers)
|
101
|
+
result.name = blob
|
102
|
+
result.metadata = options[:metadata] if options[:metadata]
|
103
|
+
|
104
|
+
result
|
105
|
+
end
|
106
|
+
|
107
|
+
# Public: Commits a new block of data to the end of an existing append blob.
|
108
|
+
# This operation is permitted only on blobs created with the create_append_blob API.
|
109
|
+
#
|
110
|
+
# ==== Attributes
|
111
|
+
#
|
112
|
+
# * +container+ - String. The container name.
|
113
|
+
# * +blob+ - String. The blob name.
|
114
|
+
# * +content+ - IO or String. The content of the blob.
|
115
|
+
# * +options+ - Hash. Optional parameters.
|
116
|
+
#
|
117
|
+
# ==== Options
|
118
|
+
#
|
119
|
+
# Accepted key/value pairs in options parameter are:
|
120
|
+
# * +:content_md5+ - String. Content MD5 for the request contents.
|
121
|
+
# * +:max_size+ - Integer. The max length in bytes permitted for the append blob
|
122
|
+
# * +:append_position+ - Integer. A number indicating the byte offset to compare. It will succeed only if the append position is equal to this number
|
123
|
+
# * +:timeout+ - Integer. A timeout in seconds.
|
124
|
+
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
125
|
+
# in the analytics logs when storage analytics logging is enabled.
|
126
|
+
# * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to append a block only if
|
127
|
+
# the blob has been modified since the specified date/time. If the blob has not been modified,
|
128
|
+
# the Blob service returns status code 412 (Precondition Failed).
|
129
|
+
# * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to append a block only if
|
130
|
+
# the blob has not been modified since the specified date/time. If the blob has been modified,
|
131
|
+
# the Blob service returns status code 412 (Precondition Failed).
|
132
|
+
# * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to append a block only if
|
133
|
+
# the blob's ETag value matches the value specified. If the values do not match,
|
134
|
+
# the Blob service returns status code 412 (Precondition Failed).
|
135
|
+
# * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to append a block only if
|
136
|
+
# the blob's ETag value does not match the value specified. If the values are identical,
|
137
|
+
# the Blob service returns status code 412 (Precondition Failed).
|
138
|
+
# * +:lease_id+ - String. Required if the blob has an active lease. To perform this operation on a blob with an
|
139
|
+
# active lease, specify the valid lease ID for this header.
|
140
|
+
#
|
141
|
+
# See http://msdn.microsoft.com/en-us/library/azure/mt427365.aspx
|
142
|
+
#
|
143
|
+
# Returns a Blob
|
144
|
+
def append_blob_block(container, blob, content, options = {})
|
145
|
+
query = { "comp" => "appendblock" }
|
146
|
+
StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
|
147
|
+
|
148
|
+
uri = blob_uri(container, blob, query)
|
149
|
+
|
150
|
+
headers = {}
|
151
|
+
StorageService.with_header headers, "Content-MD5", options[:content_md5]
|
152
|
+
StorageService.with_header headers, "x-ms-lease-id", options[:lease_id]
|
153
|
+
StorageService.with_header headers, "x-ms-blob-condition-maxsize", options[:max_size]
|
154
|
+
StorageService.with_header headers, "x-ms-blob-condition-appendpos", options[:append_position]
|
155
|
+
|
156
|
+
add_blob_conditional_headers options, headers
|
157
|
+
headers["x-ms-lease-id"] = options[:lease_id] if options[:lease_id]
|
158
|
+
|
159
|
+
response = call(:put, uri, content, headers, options)
|
160
|
+
result = Serialization.blob_from_headers(response.headers)
|
161
|
+
result.name = blob
|
162
|
+
|
163
|
+
result
|
164
|
+
end
|
165
|
+
|
166
|
+
# Public: Creates a new append blob with given content
|
167
|
+
#
|
168
|
+
# ==== Attributes
|
169
|
+
#
|
170
|
+
# * +container+ - String. The container name.
|
171
|
+
# * +blob+ - String. The blob name.
|
172
|
+
# * +content+ - IO or String. Content to write.
|
173
|
+
# * +options+ - Hash. Optional parameters.
|
174
|
+
#
|
175
|
+
# ==== Options
|
176
|
+
#
|
177
|
+
# Accepted key/value pairs in options parameter are:
|
178
|
+
# * +:content_type+ - String. Content type for the blob. Will be saved with blob.
|
179
|
+
# * +:content_encoding+ - String. Content encoding for the blob. Will be saved with blob.
|
180
|
+
# * +:content_language+ - String. Content language for the blob. Will be saved with blob.
|
181
|
+
# * +:content_md5+ - String. Content MD5 for the blob. Will be saved with blob.
|
182
|
+
# * +:cache_control+ - String. Cache control for the blob. Will be saved with blob.
|
183
|
+
# * +:content_disposition+ - String. Conveys additional information about how to process the response payload,
|
184
|
+
# and also can be used to attach additional metadata
|
185
|
+
# * +:max_size+ - Integer. The max length in bytes permitted for the append blob.
|
186
|
+
# * +:metadata+ - Hash. Custom metadata values to store with the blob.
|
187
|
+
# * +:timeout+ - Integer. A timeout in seconds.
|
188
|
+
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
189
|
+
# in the analytics logs when storage analytics logging is enabled.
|
190
|
+
# * +:if_modified_since+ - String. A DateTime value. Specify this conditional header to create a new blob
|
191
|
+
# only if the blob has been modified since the specified date/time. If the blob has not been modified,
|
192
|
+
# the Blob service returns status code 412 (Precondition Failed).
|
193
|
+
# * +:if_unmodified_since+ - String. A DateTime value. Specify this conditional header to create a new blob
|
194
|
+
# only if the blob has not been modified since the specified date/time. If the blob has been modified,
|
195
|
+
# the Blob service returns status code 412 (Precondition Failed).
|
196
|
+
# * +:if_match+ - String. An ETag value. Specify an ETag value for this conditional header to create a new blob
|
197
|
+
# only if the blob's ETag value matches the value specified. If the values do not match,
|
198
|
+
# the Blob service returns status code 412 (Precondition Failed).
|
199
|
+
# * +:if_none_match+ - String. An ETag value. Specify an ETag value for this conditional header to create a new blob
|
200
|
+
# only if the blob's ETag value does not match the value specified. If the values are identical,
|
201
|
+
# the Blob service returns status code 412 (Precondition Failed).
|
202
|
+
# * +:lease_id+ - String. Required if the blob has an active lease. To perform this operation on a blob with an active lease,
|
203
|
+
# specify the valid lease ID for this header.
|
204
|
+
#
|
205
|
+
# See http://msdn.microsoft.com/en-us/library/azure/dd179451.aspx
|
206
|
+
#
|
207
|
+
# Returns a Blob
|
208
|
+
def create_append_blob_from_content(container, blob, content, options = {})
|
209
|
+
# Fail fast if content has larger size than max_size
|
210
|
+
max_size = options.delete :max_size
|
211
|
+
if max_size
|
212
|
+
if content.respond_to?(:size) && max_size < content.size
|
213
|
+
raise Azure::Storage::Common::Core::StorageError.new("Given content has exceeded the specified maximum size for the blob.")
|
214
|
+
end
|
215
|
+
end
|
216
|
+
options[:content_type] = get_or_apply_content_type(content, options[:content_type])
|
217
|
+
create_append_blob(container, blob, options)
|
218
|
+
content = StringIO.new(content) if content.is_a? String
|
219
|
+
# initialize the append block options.
|
220
|
+
append_block_options = {}
|
221
|
+
append_block_options[:if_modified_since] = options[:if_modified_since] if options[:if_modified_since]
|
222
|
+
append_block_options[:if_unmodified_since] = options[:if_unmodified_since] if options[:if_unmodified_since]
|
223
|
+
append_block_options[:if_match] = options[:if_match] if options[:if_match]
|
224
|
+
append_block_options[:if_none_match] = options[:if_none_match] if options[:if_none_match]
|
225
|
+
append_block_options[:lease_id] = options[:lease_id] if options[:lease_id]
|
226
|
+
append_block_options[:max_size] = max_size if max_size
|
227
|
+
position = 0
|
228
|
+
while !content.eof?
|
229
|
+
payload = content.read(BlobConstants::DEFAULT_WRITE_BLOCK_SIZE_IN_BYTES)
|
230
|
+
# set the append position to make sure that each append is going to the correct offset.
|
231
|
+
append_block_options[:append_position] = position
|
232
|
+
append_blob_block(container, blob, payload, append_block_options)
|
233
|
+
# calculate the position after the append.
|
234
|
+
position += payload.size
|
235
|
+
end
|
236
|
+
|
237
|
+
get_properties_options = {}
|
238
|
+
get_properties_options[:lease_id] = options[:lease_id] if options[:lease_id]
|
239
|
+
|
240
|
+
# Get the blob properties
|
241
|
+
get_blob_properties(container, blob, get_properties_options)
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|
@@ -0,0 +1,47 @@
|
|
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 "rubygems"
|
28
|
+
require "nokogiri"
|
29
|
+
require "base64"
|
30
|
+
|
31
|
+
require "azure/storage/common"
|
32
|
+
|
33
|
+
module Azure
|
34
|
+
module Storage
|
35
|
+
module Blob
|
36
|
+
autoload :Default, "azure/storage/blob/default"
|
37
|
+
autoload :Version, "azure/storage/blob/version"
|
38
|
+
autoload :Blob, "azure/storage/blob/blob"
|
39
|
+
autoload :Block, "azure/storage/blob/block"
|
40
|
+
autoload :Page, "azure/storage/blob/page"
|
41
|
+
autoload :Append, "azure/storage/blob/append"
|
42
|
+
autoload :Container, "azure/storage/blob/container"
|
43
|
+
autoload :Serialization, "azure/storage/blob/serialization"
|
44
|
+
autoload :BlobService, "azure/storage/blob/blob_service"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|