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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff94ab3a5881a3709300b1a88ee3861f602a56aa675053e92a8b00f2fd9079a2
4
- data.tar.gz: e7dbd521f7c7b0d1984ec6aa33005b12b7653741aaa4e9c80f46c66083180713
3
+ metadata.gz: 4bd2316f969712b2c31599625d5dda1b32b86a14f15eeacfc1c592cb52caf685
4
+ data.tar.gz: d5d9e38bed8754e15bfb2addd9ff3700b2f55163ea7c9af0c234e506844ee757
5
5
  SHA512:
6
- metadata.gz: c93fcf5a6bbaedceb13c75c3b19e75e1ce0f78c2d8909f6bb84ab9eedf08390520a69e0071667fdf0ac8c618b2476706b6e1a3231daa2f9671f5c0bb654125f7
7
- data.tar.gz: 94abb45649b7c9d88f2a916a1a39887ad44a991c3f890df84e9ad3fb4aa73af02c5ea0f968fc1947a64e2af671fc73d53ed7f88ae0fea2196f9810c61e8e88e7
6
+ metadata.gz: 61aed8b7727288feee5ff45b3e6a20d7819d474b45a0a0e966f1990e09ac9936f7762a2d0c589051e6149eee7088f558b0c9a12ba26e95a917630da8665a37b9
7
+ data.tar.gz: 3d6e9585c720b587ebcf3bc3336a27a3e77eec76aa787f581600f492a16edb40e13d97b3277c21e85060e83f397552341acbfa07a271b3a86bbf78a4e1142dfc
@@ -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**
@@ -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 = get_blob_endpoint(@azure_storage_account_name, true, @environment)
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
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module AzureRM
3
- VERSION = '0.7.0'.freeze
3
+ VERSION = '0.8.0'.freeze
4
4
  end
5
5
  end
data/rakefile CHANGED
@@ -1,4 +1,6 @@
1
1
  require 'rake/testtask'
2
+ require 'bundler/gem_tasks'
3
+
2
4
  task default: :cc_coverage
3
5
  task :test do
4
6
  ENV['COVERAGE'] = nil
@@ -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)
@@ -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.7.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-07 00:00:00.000000000 Z
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