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,216 @@
|
|
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 "rake/testtask"
|
27
|
+
require "rubygems/package_task"
|
28
|
+
require "dotenv/tasks"
|
29
|
+
require "yard"
|
30
|
+
|
31
|
+
task :build_common do
|
32
|
+
Dir.chdir("./common") do
|
33
|
+
abort "[ABORTING] build gem failed" unless system "gem build azure-storage-common.gemspec"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
task :build_blob do
|
38
|
+
Dir.chdir("./blob") do
|
39
|
+
abort "[ABORTING] build gem failed" unless system "gem build azure-storage-blob.gemspec"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
task :build_table do
|
44
|
+
Dir.chdir("./table") do
|
45
|
+
abort "[ABORTING] build gem failed" unless system "gem build azure-storage-table.gemspec"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
task :build_file do
|
50
|
+
Dir.chdir("./file") do
|
51
|
+
abort "[ABORTING] build gem failed" unless system "gem build azure-storage-file.gemspec"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
task :build_queue do
|
56
|
+
Dir.chdir("./queue") do
|
57
|
+
abort "[ABORTING] build gem failed" unless system "gem build azure-storage-queue.gemspec"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
YARD::Rake::YardocTask.new do |t|
|
62
|
+
t.files = ["blob/lib/**/*.rb", "table/lib/**/*.rb", "file/lib/**/*.rb", "queue/lib/**/*.rb"]
|
63
|
+
t.options = [""]
|
64
|
+
t.stats_options = ["--list-undoc"]
|
65
|
+
end
|
66
|
+
|
67
|
+
task :publishDoc do
|
68
|
+
desc "Generate documents and publish to GitHub Pages"
|
69
|
+
repo = %x(git config remote.origin.url).gsub(/^git:/, "https:")
|
70
|
+
deploy_branch = "gh-pages"
|
71
|
+
if repo.match(/github\.com\.git$/)
|
72
|
+
deploy_branch = "master"
|
73
|
+
end
|
74
|
+
system "git remote set-url --push origin #{repo}"
|
75
|
+
system "git remote set-branches --add origin #{deploy_branch}"
|
76
|
+
system "git fetch -q"
|
77
|
+
if ("#{ENV['GIT_NAME']}" != "")
|
78
|
+
system "git config user.name '#{ENV['GIT_NAME']}'"
|
79
|
+
end
|
80
|
+
if ("#{ENV['GIT_EMAIL']}" != "")
|
81
|
+
system "git config user.email '#{ENV['GIT_EMAIL']}'"
|
82
|
+
end
|
83
|
+
system 'git config credential.helper "store --file=.git/credentials"'
|
84
|
+
File.open(".git/credentials", "w") do |f|
|
85
|
+
f.write("https://#{ENV['GH_TOKEN']}:x-oauth-basic@github.com")
|
86
|
+
end
|
87
|
+
system "rake yard"
|
88
|
+
system "git checkout gh-pages"
|
89
|
+
system "mv doc/* ./ -f"
|
90
|
+
system "rm doc -rf"
|
91
|
+
system "git add *"
|
92
|
+
system "git commit -m \"update document\""
|
93
|
+
system "git push"
|
94
|
+
system "git checkout master"
|
95
|
+
File.delete ".git/credentials"
|
96
|
+
end
|
97
|
+
|
98
|
+
namespace :test do
|
99
|
+
task require_environment: :dotenv do
|
100
|
+
unset_environment = [
|
101
|
+
ENV.fetch("AZURE_STORAGE_ACCOUNT", nil),
|
102
|
+
ENV.fetch("AZURE_STORAGE_ACCESS_KEY", nil),
|
103
|
+
ENV.fetch("AZURE_STORAGE_CONNECTION_STRING", nil)
|
104
|
+
].include?(nil)
|
105
|
+
|
106
|
+
abort "[ABORTING] Configure your environment to run the integration tests" if unset_environment
|
107
|
+
end
|
108
|
+
|
109
|
+
Rake::TestTask.new :unit do |t|
|
110
|
+
t.pattern = "test/unit/**/*_test.rb"
|
111
|
+
t.verbose = true
|
112
|
+
t.libs = %w(./blob/lib ./table/lib ./queue/lib ./file/lib ./common/lib test)
|
113
|
+
end
|
114
|
+
|
115
|
+
namespace :unit do
|
116
|
+
def component_task(component)
|
117
|
+
Rake::TestTask.new component do |t|
|
118
|
+
t.pattern = "test/unit/#{component}/**/*_test.rb"
|
119
|
+
t.verbose = true
|
120
|
+
t.libs = %w(./blob/lib ./table/lib ./queue/lib ./file/lib ./common/lib test)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
component_task :storage
|
125
|
+
end
|
126
|
+
|
127
|
+
Rake::TestTask.new :integration do |t|
|
128
|
+
t.test_files = Dir["test/integration/**/*_test.rb"].reject do |path|
|
129
|
+
path.include?("database")
|
130
|
+
end
|
131
|
+
t.verbose = true
|
132
|
+
t.libs = %w(./blob/lib ./table/lib ./queue/lib ./file/lib ./common/lib test)
|
133
|
+
end
|
134
|
+
|
135
|
+
task integration: :require_environment
|
136
|
+
|
137
|
+
namespace :integration do
|
138
|
+
def component_task(component)
|
139
|
+
Rake::TestTask.new component do |t|
|
140
|
+
t.pattern = "test/integration/#{component}/**/*_test.rb"
|
141
|
+
t.verbose = true
|
142
|
+
t.libs = %w(./blob/lib ./table/lib ./queue/lib ./file/lib ./common/lib test)
|
143
|
+
end
|
144
|
+
|
145
|
+
task component => "test:require_environment"
|
146
|
+
end
|
147
|
+
|
148
|
+
component_task :storage
|
149
|
+
end
|
150
|
+
|
151
|
+
namespace :storage do
|
152
|
+
|
153
|
+
Rake::TestTask.new :unit do |t|
|
154
|
+
t.pattern = "test/unit/storage/**/*_test.rb"
|
155
|
+
t.verbose = true
|
156
|
+
t.libs = %w(./blob/lib ./table/lib ./queue/lib ./file/lib ./common/lib test)
|
157
|
+
end
|
158
|
+
|
159
|
+
task require_storage_env: :dotenv do
|
160
|
+
unset_environment = [
|
161
|
+
ENV.fetch("AZURE_STORAGE_ACCOUNT", nil),
|
162
|
+
ENV.fetch("AZURE_STORAGE_ACCESS_KEY", nil),
|
163
|
+
ENV.fetch("AZURE_STORAGE_CONNECTION_STRING", nil)
|
164
|
+
].include?(nil)
|
165
|
+
|
166
|
+
abort "[ABORTING] Configure your environment to run the storage integration tests" if unset_environment
|
167
|
+
end
|
168
|
+
|
169
|
+
|
170
|
+
Rake::TestTask.new :integration do |t|
|
171
|
+
t.pattern = "test/integration/storage/**/*_test.rb"
|
172
|
+
t.verbose = true
|
173
|
+
t.libs = %w(./blob/lib ./table/lib ./queue/lib ./file/lib ./common/lib test)
|
174
|
+
end
|
175
|
+
|
176
|
+
task integration: :require_storage_env
|
177
|
+
end
|
178
|
+
|
179
|
+
task cleanup: :require_environment do
|
180
|
+
$:.unshift "lib"
|
181
|
+
require "azure/storage"
|
182
|
+
|
183
|
+
Azure.configure do |config|
|
184
|
+
config.access_key = ENV.fetch("AZURE_STORAGE_ACCESS_KEY")
|
185
|
+
config.account_name = ENV.fetch("AZURE_STORAGE_ACCOUNT")
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
task test: %w(test:unit test:integration)
|
191
|
+
|
192
|
+
task :sanity_check do
|
193
|
+
abort "[ABORTING] build common gem failed" unless system "rake build_common"
|
194
|
+
abort "[ABORTING] build blob gem failed" unless system "rake build_blob"
|
195
|
+
abort "[ABORTING] build file gem failed" unless system "rake build_file"
|
196
|
+
abort "[ABORTING] build table gem failed" unless system "rake build_table"
|
197
|
+
abort "[ABORTING] build qeueue gem failed" unless system "rake build_queue"
|
198
|
+
Dir.chdir("./common") do
|
199
|
+
abort "[ABORTING] installing common gem failed" unless system "gem install azure-storage-common -l"
|
200
|
+
end
|
201
|
+
Dir.chdir("./blob") do
|
202
|
+
abort "[ABORTING] installing blob gem failed" unless system "gem install azure-storage-blob -l"
|
203
|
+
end
|
204
|
+
Dir.chdir("./table") do
|
205
|
+
abort "[ABORTING] installing table gem failed" unless system "gem install azure-storage-table -l"
|
206
|
+
end
|
207
|
+
Dir.chdir("./queue") do
|
208
|
+
abort "[ABORTING] installing queue gem failed" unless system "gem install azure-storage-queue -l"
|
209
|
+
end
|
210
|
+
Dir.chdir("./file") do
|
211
|
+
abort "[ABORTING] installing file gem failed" unless system "gem install azure-storage-file -l"
|
212
|
+
end
|
213
|
+
abort "[ABORTING] run sanity_check.rb failed" unless system "ruby ./test/sanity_check.rb"
|
214
|
+
end
|
215
|
+
|
216
|
+
task default: :test
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.8 BLOCK -->
|
2
|
+
|
3
|
+
## Security
|
4
|
+
|
5
|
+
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
|
6
|
+
|
7
|
+
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
|
8
|
+
|
9
|
+
## Reporting Security Issues
|
10
|
+
|
11
|
+
**Please do not report security vulnerabilities through public GitHub issues.**
|
12
|
+
|
13
|
+
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
|
14
|
+
|
15
|
+
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
|
16
|
+
|
17
|
+
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
|
18
|
+
|
19
|
+
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
20
|
+
|
21
|
+
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
22
|
+
* Full paths of source file(s) related to the manifestation of the issue
|
23
|
+
* The location of the affected source code (tag/branch/commit or direct URL)
|
24
|
+
* Any special configuration required to reproduce the issue
|
25
|
+
* Step-by-step instructions to reproduce the issue
|
26
|
+
* Proof-of-concept or exploit code (if possible)
|
27
|
+
* Impact of the issue, including how an attacker might exploit the issue
|
28
|
+
|
29
|
+
This information will help us triage your report more quickly.
|
30
|
+
|
31
|
+
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
|
32
|
+
|
33
|
+
## Preferred Languages
|
34
|
+
|
35
|
+
We prefer all communications to be in English.
|
36
|
+
|
37
|
+
## Policy
|
38
|
+
|
39
|
+
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
|
40
|
+
|
41
|
+
<!-- END MICROSOFT SECURITY.MD BLOCK -->
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Tracking Breaking Changes in 2.0.0
|
2
|
+
|
3
|
+
* This module now supports Ruby versions to 2.3 through 2.7
|
4
|
+
|
5
|
+
Tracking Breaking Changes in 1.0.0
|
6
|
+
|
7
|
+
* This module now only consists of functionalities to access Azure Storage Blob Service.
|
8
|
+
* Creating Blob Client using `Azure::Storage::Client.create` is now deprecated. To create a Blob client, users have to choose from `Azure::Storage::Blob::BlobService::create`, `Azure::Storage::Blob::BlobService::create_development`, ``Azure::Storage::Blob::BlobService::create_from_env`, `Azure::Storage::Blob::BlobService::create_from_connection_string` or `Azure::Storage::Blob::BlobService.new`. The parameters remain unchanged.
|
9
|
+
* The default `Content-Type` for a newly created page blob or append blob will now be `application/octet-stream`, which matches the description of [REST doc](https://docs.microsoft.com/en-us/rest/api/storageservices/put-blob)
|
10
|
+
* The API "Azure::Storage::Blob::BlobService::create_block_blob" can now upload content that is larger than 256MB instead of reporting failure.
|
@@ -0,0 +1,33 @@
|
|
1
|
+
2021.12 - version 2.0.3
|
2
|
+
* Lifted Ruby-version-based restrictions on Nokogiri version.
|
3
|
+
|
4
|
+
2021.10 - version 2.0.2
|
5
|
+
* Allowed to use any version 1.x of Nokogiri for Ruby version later than or equal to 2.5.0.
|
6
|
+
* Added access tier information and creation time of blob in response.
|
7
|
+
|
8
|
+
2020.8 - version 2.0.1
|
9
|
+
* Bumped up Nokogiri version to 1.11.0.rc2 for Ruby version later than or equal to 2.4.0.
|
10
|
+
|
11
|
+
2020.3 - version 2.0.0
|
12
|
+
* This module now supports Ruby versions to 2.3 through 2.7.
|
13
|
+
* Service version is upgraded to 2018-11-09.
|
14
|
+
* Add support for generating user delegation shared access signatures.
|
15
|
+
|
16
|
+
2018.11 - version 1.1.0
|
17
|
+
* Added the support for sending a request with a bearer token.
|
18
|
+
|
19
|
+
2018.1 - version 1.0.1
|
20
|
+
* Resolved an issue where user cannot use Gem package using `gem install`.
|
21
|
+
|
22
|
+
2018.1 - version 1.0.0
|
23
|
+
|
24
|
+
* This module now only consists of functionalities to access Azure Storage Blob Service.
|
25
|
+
* Creating Blob Client using `Azure::Storage::Client.create` is now deprecated. To create a Blob client, users have to choose from `Azure::Storage::Blob::BlobService::create`, `Azure::Storage::Blob::BlobService::create_development`, ``Azure::Storage::Blob::BlobService::create_from_env`, `Azure::Storage::Blob::BlobService::create_from_connection_string` or `Azure::Storage::Blob::BlobService.new`. The parameters remain unchanged.
|
26
|
+
* Added following convenience APIs to support large payload upload from given content to append or page blob, to make block blob consistent with API name, added an alias for `create_block_blob` as well.
|
27
|
+
- Azure::Storage::Blob::BlobService::create_block_blob_from_content
|
28
|
+
- Azure::Storage::Blob::BlobService::create_page_blob_from_content
|
29
|
+
- Azure::Storage::Blob::BlobService::create_append_blob_from_content
|
30
|
+
* Added the support for `Azure::Storage::Blob::BlobService::create_block_blob` to handle large payload that used to require making multiple `Azure::Storage::Blob::BlobService::put_blob_block` calls and calling `Azure::Storage::Blob::BlobService::commit_blob_blocks`.
|
31
|
+
* The default `Content-Type` for a newly created page blob or append blob will now be `application/octet-stream`, which matches the description of [REST doc](https://docs.microsoft.com/en-us/rest/api/storageservices/put-blob)
|
32
|
+
* Resolved an issue where parsing XML content would sometimes throw unexpected failures.
|
33
|
+
* Resolved an issue where users send "increment" as `:sequence_number_action` option for `Azure::Storage::Blob::BlobService::set_blob_properties` would not be recognized.
|
@@ -0,0 +1,30 @@
|
|
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
|
+
source "https://rubygems.org"
|
27
|
+
|
28
|
+
gemspec name: "azure-storage-blob"
|
29
|
+
|
30
|
+
gem "coveralls", require: false
|
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Microsoft Corporation
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
@@ -0,0 +1,188 @@
|
|
1
|
+
# Microsoft Azure Storage Blob Client Library for Ruby
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/azure-storage-blob.svg)](https://badge.fury.io/rb/azure-storage-blob)
|
4
|
+
* Master: [![Master Build Status](https://travis-ci.org/Azure/azure-storage-ruby.svg?branch=master)](https://travis-ci.org/Azure/azure-storage-ruby/branches) [![Coverage Status](https://coveralls.io/repos/github/Azure/azure-storage-ruby/badge.svg?branch=master)](https://coveralls.io/github/Azure/azure-storage-ruby?branch=master)
|
5
|
+
* Dev: [![Dev Build Status](https://travis-ci.org/Azure/azure-storage-ruby.svg?branch=dev)](https://travis-ci.org/Azure/azure-storage-ruby/branches) [![Coverage Status](https://coveralls.io/repos/github/Azure/azure-storage-ruby/badge.svg?branch=dev)](https://coveralls.io/github/Azure/azure-storage-ruby?branch=dev)
|
6
|
+
|
7
|
+
This project provides a Ruby package that makes it easy to access and manage Microsoft Azure Storage Blob Services.
|
8
|
+
|
9
|
+
|
10
|
+
# Supported Ruby Versions
|
11
|
+
|
12
|
+
* Ruby 2.3 to 2.7
|
13
|
+
|
14
|
+
Note:
|
15
|
+
|
16
|
+
* x64 Ruby for Windows is known to have some compatibility issues.
|
17
|
+
* azure-storage-blob depends on gem nokogiri.
|
18
|
+
|
19
|
+
# Getting Started
|
20
|
+
|
21
|
+
## Install the rubygem package
|
22
|
+
|
23
|
+
You can install the azure storage blob rubygem package directly.
|
24
|
+
|
25
|
+
```bash
|
26
|
+
gem install azure-storage-blob
|
27
|
+
```
|
28
|
+
|
29
|
+
## Setup Connection
|
30
|
+
|
31
|
+
You can use this Client Library against the Microsoft Azure Storage Blob Services in the cloud, or against the local Storage Emulator if you are on Windows.
|
32
|
+
|
33
|
+
There are two ways you can set up the connections:
|
34
|
+
|
35
|
+
1. [via code](#via-code)
|
36
|
+
2. [via environment variables](#via-environment-variables)
|
37
|
+
|
38
|
+
<a name="via-code"></a>
|
39
|
+
### Via Code
|
40
|
+
* Against Microsoft Azure Services in the cloud
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
|
44
|
+
require 'azure/storage/blob'
|
45
|
+
|
46
|
+
# Setup a specific instance of an Azure::Storage::Blob::BlobService
|
47
|
+
blob_client = Azure::Storage::Blob::BlobService.create(storage_account_name: <your account name>, storage_access_key: <your access key>)
|
48
|
+
|
49
|
+
# Or create a client and initialize with it.
|
50
|
+
require 'azure/storage/common'
|
51
|
+
common_client = Azure::Storage::Common::Client.create(storage_account_name: <your account name>, storage_access_key: <your access key>)
|
52
|
+
blob_client = Azure::Storage::Blob::BlobService.new(client: common_client)
|
53
|
+
|
54
|
+
# Configure a ca_cert.pem file if you are having issues with ssl peer verification
|
55
|
+
blob_client.ca_file = './ca_file.pem'
|
56
|
+
|
57
|
+
```
|
58
|
+
|
59
|
+
* Against local Emulator (Windows Only)
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
|
63
|
+
require 'azure/storage/blob'
|
64
|
+
client = Azure::Storage::Blob::BlobService.create_development
|
65
|
+
|
66
|
+
# Or create by options and provide your own proxy_uri
|
67
|
+
client = Azure::Storage::Blob::BlobService.create(use_development_storage: true, development_storage_proxy_uri: <your proxy uri>)
|
68
|
+
|
69
|
+
```
|
70
|
+
|
71
|
+
<a name="via-environment-variables"></a>
|
72
|
+
### Via Environment Variables
|
73
|
+
|
74
|
+
* Against Microsoft Azure Storage Blob Services in the cloud
|
75
|
+
|
76
|
+
```bash
|
77
|
+
export AZURE_STORAGE_ACCOUNT = <your azure storage account name>
|
78
|
+
export AZURE_STORAGE_ACCESS_KEY = <your azure storage access key>
|
79
|
+
```
|
80
|
+
|
81
|
+
* Against local Emulator (Windows Only)
|
82
|
+
|
83
|
+
```bash
|
84
|
+
export EMULATED = true
|
85
|
+
```
|
86
|
+
|
87
|
+
* [SSL Certificate File](https://gist.github.com/fnichol/867550) if having issues with ssl peer verification
|
88
|
+
|
89
|
+
```bash
|
90
|
+
SSL_CERT_FILE=<path to *.pem>
|
91
|
+
```
|
92
|
+
|
93
|
+
# Usage
|
94
|
+
|
95
|
+
<a name="usage"></a>
|
96
|
+
## Usage
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
|
100
|
+
# Require the azure storage blob rubygem
|
101
|
+
require 'azure/storage/blob'
|
102
|
+
|
103
|
+
# Setup a specific instance of an Azure::Storage::Blob::BlobService
|
104
|
+
client = Azure::Storage::Blob::BlobService.create(storage_account_name: <your account name>, storage_access_key: <your access key>)
|
105
|
+
|
106
|
+
# Alternatively, create a client that can anonymously access public containers for read operations
|
107
|
+
client = Azure::Storage::Blob::BlobService.create(storage_blob_host: "https://youraccountname.blob.core.windows.net")
|
108
|
+
|
109
|
+
# Add retry filter to the service object
|
110
|
+
require "azure/storage/common"
|
111
|
+
client.with_filter(Azure::Storage::Common::Core::Filter::ExponentialRetryPolicyFilter.new)
|
112
|
+
|
113
|
+
# Create a container
|
114
|
+
container = client.create_container('test-container')
|
115
|
+
|
116
|
+
# Upload a Blob
|
117
|
+
content = ::File.open('test.jpg', 'rb') { |file| file.read }
|
118
|
+
client.create_block_blob(container.name, 'image-blob', content)
|
119
|
+
|
120
|
+
# List containers
|
121
|
+
client.list_containers()
|
122
|
+
|
123
|
+
# List Blobs
|
124
|
+
client.list_blobs(container.name)
|
125
|
+
|
126
|
+
# Download a Blob
|
127
|
+
blob, content = client.get_blob(container.name, 'image-blob')
|
128
|
+
::File.open('download.png', 'wb') {|f| f.write(content)}
|
129
|
+
|
130
|
+
# Delete a Blob
|
131
|
+
client.delete_blob(container.name, 'image-blob')
|
132
|
+
|
133
|
+
```
|
134
|
+
|
135
|
+
<a name="token"></a>
|
136
|
+
## Access Token
|
137
|
+
|
138
|
+
Please refer to the below links for obtaining an access token:
|
139
|
+
* [Authenticate with Azure Active Directory](https://docs.microsoft.com/en-us/rest/api/storageservices/authenticate-with-azure-active-directory)
|
140
|
+
* [Getting a MSI access token](https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/tutorial-linux-vm-access-storage#get-an-access-token-and-use-it-to-call-azure-storage)
|
141
|
+
|
142
|
+
```ruby
|
143
|
+
require "azure/storage/common"
|
144
|
+
|
145
|
+
access_token = <your initial access token>
|
146
|
+
|
147
|
+
# Creating an instance of `Azure::Storage::Common::Core::TokenCredential`
|
148
|
+
token_credential = Azure::Storage::Common::Core::TokenCredential.new access_token
|
149
|
+
token_signer = Azure::Storage::Common::Core::Auth::TokenSigner.new token_credential
|
150
|
+
blob_token_client = Azure::Storage::Blob::BlobService.new(storage_account_name: <your_account_name>, signer: token_signer)
|
151
|
+
|
152
|
+
# Refresh internal is 50 minutes
|
153
|
+
refresh_interval = 50 * 60
|
154
|
+
# The user-defined thread that renews the access token
|
155
|
+
cancelled = false
|
156
|
+
renew_token = Thread.new do
|
157
|
+
Thread.stop
|
158
|
+
while !cancelled
|
159
|
+
sleep(refresh_interval)
|
160
|
+
|
161
|
+
# Renew the access token here
|
162
|
+
|
163
|
+
# Update the access token to the credential
|
164
|
+
token_credential.renew_token <new_access_token>
|
165
|
+
end
|
166
|
+
end
|
167
|
+
sleep 0.1 while renew_token.status != 'sleep'
|
168
|
+
renew_token.run
|
169
|
+
|
170
|
+
# Call blob client functions as usaual
|
171
|
+
|
172
|
+
```
|
173
|
+
|
174
|
+
<a name="Customize the user-agent"></a>
|
175
|
+
## Customize the user-agent
|
176
|
+
|
177
|
+
You can customize the user-agent string by setting your user agent prefix when creating the service client.
|
178
|
+
|
179
|
+
```ruby
|
180
|
+
# Require the azure storage blob rubygem
|
181
|
+
require "azure/storage/blob"
|
182
|
+
|
183
|
+
# Setup a specific instance of an Azure::Storage::Client with :user_agent_prefix option
|
184
|
+
client = Azure::Storage::Blob::BlobService.create(storage_account_name: <your account name>, storage_access_key: <your access key>, user_agent_prefix: <your application name>)
|
185
|
+
```
|
186
|
+
|
187
|
+
# Code of Conduct
|
188
|
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
@@ -0,0 +1,52 @@
|
|
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 "date"
|
27
|
+
|
28
|
+
require_relative "./lib/azure/storage/blob/version"
|
29
|
+
|
30
|
+
Gem::Specification.new do |s|
|
31
|
+
s.name = "azure-storage-blob"
|
32
|
+
s.version = Azure::Storage::Blob::Version
|
33
|
+
s.authors = ["Microsoft Corporation"]
|
34
|
+
s.email = "ascl@microsoft.com"
|
35
|
+
s.description = "Microsoft Azure Storage Blob Client Library for Ruby"
|
36
|
+
s.summary = "Official Ruby client library to consume Azure Storage Blob service"
|
37
|
+
s.homepage = "http://github.com/azure/azure-storage-ruby"
|
38
|
+
s.license = "MIT"
|
39
|
+
s.files = `git ls-files ./lib/azure/storage/blob/`.split("\n") << "./lib/azure/storage/blob.rb"
|
40
|
+
|
41
|
+
s.required_ruby_version = ">= 2.3.0"
|
42
|
+
|
43
|
+
s.add_runtime_dependency("azure-storage-common", "~> 2.0")
|
44
|
+
s.add_runtime_dependency("nokogiri", "~> 1", ">= 1.10.8")
|
45
|
+
s.add_development_dependency("dotenv", "~> 2.0")
|
46
|
+
s.add_development_dependency("minitest", "~> 5")
|
47
|
+
s.add_development_dependency("minitest-reporters", "~> 1")
|
48
|
+
s.add_development_dependency("mocha", "~> 1.0")
|
49
|
+
s.add_development_dependency("rake", "~> 13.0")
|
50
|
+
s.add_development_dependency("timecop", "~> 0.7")
|
51
|
+
s.add_development_dependency("yard", "~> 0.9", ">= 0.9.11")
|
52
|
+
end
|