gitlab-fog-azure-rm 0.7.0 → 0.8.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 +21 -0
- data/lib/fog/azurerm/storage.rb +11 -1
- data/lib/fog/azurerm/utilities/general.rb +5 -0
- data/lib/fog/azurerm/version.rb +1 -1
- data/rakefile +2 -0
- data/test/requests/storage/test_get_blob_https_url.rb +16 -0
- data/test/test_helper.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bd2316f969712b2c31599625d5dda1b32b86a14f15eeacfc1c592cb52caf685
|
4
|
+
data.tar.gz: d5d9e38bed8754e15bfb2addd9ff3700b2f55163ea7c9af0c234e506844ee757
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61aed8b7727288feee5ff45b3e6a20d7819d474b45a0a0e966f1990e09ac9936f7762a2d0c589051e6149eee7088f558b0c9a12ba26e95a917630da8665a37b9
|
7
|
+
data.tar.gz: 3d6e9585c720b587ebcf3bc3336a27a3e77eec76aa787f581600f492a16edb40e13d97b3277c21e85060e83f397552341acbfa07a271b3a86bbf78a4e1142dfc
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
+
## Unreleased
|
2
|
+
|
3
|
+
## 0.8.0
|
4
|
+
|
5
|
+
- Add `azure_storage_domain` for specifying custom domain
|
6
|
+
|
7
|
+
## 0.7.0
|
8
|
+
|
9
|
+
- Loosen mime-types version dependency !9
|
10
|
+
- Drop azure_mgmt_storage and other dependencies !8
|
11
|
+
|
12
|
+
## 0.6.0
|
13
|
+
|
14
|
+
- Fix get_object_url !7
|
15
|
+
- Add get_object_url method !6
|
16
|
+
- Add support for copy_object !5
|
17
|
+
- Add support for DELETE blob !4
|
18
|
+
- Add support for PUT blobs !3
|
19
|
+
- Add and update Rubocop files !2
|
20
|
+
- Delete all code except blob storage-related functionality !1
|
21
|
+
|
1
22
|
## 0.5.2
|
2
23
|
|
3
24
|
**Added**
|
data/lib/fog/azurerm/storage.rb
CHANGED
@@ -12,6 +12,8 @@ module Fog
|
|
12
12
|
# Recognizes when creating data client
|
13
13
|
recognizes :azure_storage_account_name
|
14
14
|
recognizes :azure_storage_access_key
|
15
|
+
recognizes :azure_storage_domain
|
16
|
+
|
15
17
|
recognizes :debug
|
16
18
|
|
17
19
|
request_path 'fog/azurerm/requests/storage'
|
@@ -104,10 +106,18 @@ module Fog
|
|
104
106
|
|
105
107
|
@azure_storage_account_name = options[:azure_storage_account_name]
|
106
108
|
@azure_storage_access_key = options[:azure_storage_access_key]
|
109
|
+
@azure_storage_domain = options[:azure_storage_domain]
|
110
|
+
|
111
|
+
domain =
|
112
|
+
if @azure_storage_domain.nil? || @azure_storage_domain.empty?
|
113
|
+
get_blob_endpoint(@azure_storage_account_name, true, @environment)
|
114
|
+
else
|
115
|
+
get_blob_endpoint_with_domain(@azure_storage_account_name, true, @azure_storage_domain)
|
116
|
+
end
|
107
117
|
|
108
118
|
azure_client = Azure::Storage::Client.create(storage_account_name: @azure_storage_account_name,
|
109
119
|
storage_access_key: @azure_storage_access_key)
|
110
|
-
azure_client.storage_blob_host =
|
120
|
+
azure_client.storage_blob_host = domain
|
111
121
|
@blob_client = azure_client.blob_client
|
112
122
|
@blob_client.with_filter(Azure::Storage::Core::Filter::ExponentialRetryPolicyFilter.new)
|
113
123
|
@blob_client.with_filter(Azure::Core::Http::DebugFilter.new) if @debug
|
@@ -125,6 +125,11 @@ def get_blob_endpoint(storage_account_name, enable_https = false, environment =
|
|
125
125
|
"#{protocol}://#{storage_account_name}.blob#{storage_endpoint_suffix(environment)}"
|
126
126
|
end
|
127
127
|
|
128
|
+
def get_blob_endpoint_with_domain(storage_account_name, enable_https = false, domain = 'blob.core.windows.net')
|
129
|
+
protocol = enable_https ? 'https' : 'http'
|
130
|
+
"#{protocol}://#{storage_account_name}.#{domain}"
|
131
|
+
end
|
132
|
+
|
128
133
|
def current_time
|
129
134
|
time = Time.now.to_f.to_s
|
130
135
|
time.split(/\W+/).join
|
data/lib/fog/azurerm/version.rb
CHANGED
data/rakefile
CHANGED
@@ -25,6 +25,22 @@ class TestGetBlobHttpsUrl < Minitest::Test
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
def test_get_blob_https_url_with_domain_success
|
29
|
+
service = Fog::Storage::AzureRM.new(storage_account_credentials_with_domain)
|
30
|
+
blob_client = service.instance_variable_get(:@blob_client)
|
31
|
+
signature_client = service.instance_variable_get(:@signature_client)
|
32
|
+
|
33
|
+
url = 'https://mockaccount.test.example.com/test_container/test_blob'
|
34
|
+
token = ApiStub::Requests::Storage::File.blob_url_token
|
35
|
+
|
36
|
+
blob_client.stub :generate_uri, url do
|
37
|
+
signature_client.stub :generate_service_sas_token, token do
|
38
|
+
assert_equal "#{url}?#{token}", service.get_blob_https_url('test_container', 'test_blob', Time.now.utc + 3600)
|
39
|
+
assert_equal "#{url}?#{token}", service.get_object_url('test_container', 'test_blob', Time.now.utc + 3600)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
28
44
|
def test_get_blob_https_url_mock
|
29
45
|
assert_equal "#{@url}?#{@token}", @mock_service.get_blob_https_url('test_container', 'test_blob', Time.now.utc + 3600)
|
30
46
|
assert_equal "#{@url}?#{@token}", @mock_service.get_object_url('test_container', 'test_blob', Time.now.utc + 3600)
|
data/test/test_helper.rb
CHANGED
@@ -36,6 +36,14 @@ def storage_account_credentials
|
|
36
36
|
}
|
37
37
|
end
|
38
38
|
|
39
|
+
def storage_account_credentials_with_domain
|
40
|
+
storage_account_credentials.merge(
|
41
|
+
{
|
42
|
+
azure_storage_domain: 'test.example.com'
|
43
|
+
}
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
39
47
|
# Mock Class for Blob
|
40
48
|
class MockBlob
|
41
49
|
def initialize
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-fog-azure-rm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shaffan Chaudhry
|
@@ -18,7 +18,7 @@ authors:
|
|
18
18
|
autorequire:
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
|
-
date: 2020-08-
|
21
|
+
date: 2020-08-28 00:00:00.000000000 Z
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
24
24
|
name: codeclimate-test-reporter
|