gitlab-fog-azure-rm 1.4.0 → 1.7.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: 26308fac90191e41fa3a0cfe59f7c02159c5ac5c846c2fc958038d1fbaa9bf34
4
- data.tar.gz: 9b382c3381a912f1c847c7757576f467750d9fedfb08304fa47e663fb7f34ad0
3
+ metadata.gz: 96a2a16b2feac00c533b0489e6572ccd808c11e44f9f3efab5b69bdc392aea04
4
+ data.tar.gz: 8e7a5d519fa7002896efb7c00fe7bb73440f875cc0a428dba625695ed6c385bb
5
5
  SHA512:
6
- metadata.gz: f54b5e063064523fbb79ea1aea50ad6847a20c9ffc47a81ae95d1869d2c487b75b8205b567e7d9cf08d10ac1b0c083661003aef4df3762f81382805d2e950c02
7
- data.tar.gz: fa98f14295c821d0d07321adc42080163fc774684a0f8e87611a1921b4a22cbd20d68e3938177840b12f2b96e30d377addd379841161657d704343602de8fcb4
6
+ metadata.gz: 36e3c183ee97204706d901c25c3791b760980d0dcf84440d2370dddff622f54670db85a11e1badec9853341e661d057d519b990912b626c9d86e16c9461e2ebf
7
+ data.tar.gz: b20976bdfab522b172572194e2f6f0693129c3f6315910fb9d8331cd11e9855ecce53292f22d982b7d6c7811267bce716cf6e680a04d3bf9e703988ee21b2f1e
data/.gitlab-ci.yml CHANGED
@@ -14,7 +14,7 @@ test:
14
14
  - bundle exec rake test
15
15
  parallel:
16
16
  matrix:
17
- - RUBY_VERSION: [ "2.7", "3.0", "3.1" ]
17
+ - RUBY_VERSION: [ "2.7", "3.0", "3.1", "3.2" ]
18
18
 
19
19
  rubocop:
20
20
  script:
data/.rubocop.yml CHANGED
@@ -2,4 +2,4 @@ inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
4
  NewCops: enable
5
-
5
+ TargetRubyVersion: 2.7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 1.7.0
4
+
5
+ - Fix #get_object return type to be consistent with other Fog providers !36
6
+ - Require Ruby 2.7+ !36
7
+
8
+ ## 1.6.0
9
+
10
+ - Add get_object request method !34
11
+ - Fix uninitialized constant errors !35
12
+
13
+ ## 1.5.0
14
+
15
+ - Add delete_object request method !32
16
+
3
17
  ## 1.4.0
4
18
 
5
19
  - Move all top-level constants and functions to Fog::AzureRM !30
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
15
15
  spec.homepage = 'https://gitlab.com/gitlab-org/gitlab-fog-azure-rm'
16
16
  spec.rdoc_options = %w[--charset=UTF-8]
17
17
  spec.extra_rdoc_files = %w[README.md]
18
- spec.required_ruby_version = '>= 2.0.0'
18
+ spec.required_ruby_version = '>= 2.7.0'
19
19
  spec.post_install_message = 'Thanks for installing!'
20
20
  spec.add_development_dependency 'codeclimate-test-reporter' , '~> 1.0.0'
21
21
  spec.add_development_dependency 'minitest', '~> 5.8.4'
@@ -2,7 +2,11 @@ module Fog
2
2
  module Credentials
3
3
  # This class is managing credentials token
4
4
  class AzureRM
5
- def self.get_credentials(tenant_id, client_id, client_secret, environment = ENVIRONMENT_AZURE_CLOUD)
5
+ class << self
6
+ include Fog::AzureRM::Utilities::General
7
+ end
8
+
9
+ def self.get_credentials(tenant_id, client_id, client_secret, environment = Fog::AzureRM::ENVIRONMENT_AZURE_CLOUD)
6
10
  if @credentials.nil? || new_management_credential?(tenant_id, client_id, client_secret, environment)
7
11
  get_new_credentials(tenant_id, client_id, client_secret, environment)
8
12
  else
@@ -10,7 +14,7 @@ module Fog
10
14
  end
11
15
  end
12
16
 
13
- def self.get_token(tenant_id, client_id, client_secret, environment = ENVIRONMENT_AZURE_CLOUD)
17
+ def self.get_token(tenant_id, client_id, client_secret, environment = Fog::AzureRM::ENVIRONMENT_AZURE_CLOUD)
14
18
  get_credentials(tenant_id, client_id, client_secret, environment) if @credentials.nil?
15
19
  @token_provider.get_authentication_header
16
20
  end
@@ -0,0 +1,15 @@
1
+ module Fog
2
+ module Storage
3
+ class AzureRM
4
+ # This class provides the actual implementation for service calls.
5
+ class Real
6
+ alias delete_object delete_blob
7
+ end
8
+
9
+ # This class provides the mock implementation for unit tests.
10
+ class Mock
11
+ alias delete_object delete_blob
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,25 @@
1
+ module Fog
2
+ module Storage
3
+ class AzureRM
4
+ # This class provides the actual implemention for service calls.
5
+ class Real
6
+ def get_object(...)
7
+ blob, body = get_blob(...)
8
+
9
+ blob[:body] = body
10
+ blob
11
+ end
12
+ end
13
+
14
+ # This class provides the mock implementation for unit tests.
15
+ class Mock
16
+ def get_object(...)
17
+ blob, body = get_blob(...)
18
+
19
+ blob[:body] = body
20
+ blob
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -40,9 +40,9 @@ module Fog
40
40
  request :compare_container_blobs
41
41
  request :acquire_blob_lease
42
42
  request :release_blob_lease
43
- request :delete_blob
44
43
  request :get_blob
45
44
  request :get_blob_url
45
+ request :get_object
46
46
  request :get_object_url
47
47
  request :get_blob_http_url
48
48
  request :get_blob_https_url
@@ -50,8 +50,10 @@ module Fog
50
50
  request :put_blob_block
51
51
  request :put_blob_https_url
52
52
  request :put_object_url
53
+ request :delete_blob
53
54
  request :delete_blob_https_url
54
55
  request :delete_object_url
56
+ request :delete_object
55
57
  request :commit_blob_blocks
56
58
  request :create_page_blob
57
59
  request :put_blob_pages
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module AzureRM
3
- VERSION = '1.4.0'.freeze
3
+ VERSION = '1.7.0'.freeze
4
4
  end
5
5
  end
data/rakefile CHANGED
@@ -5,6 +5,7 @@ task default: :cc_coverage
5
5
  task :test do
6
6
  ENV['COVERAGE'] = nil
7
7
  ENV['CODECLIMATE_REPO_TOKEN'] = nil
8
+ Dir.glob('test/test_*.rb').each { |file| require File.expand_path file, __dir__ }
8
9
  Dir.glob('test/models/**/test_*.rb').each { |file| require File.expand_path file, __dir__ }
9
10
  Dir.glob('test/requests/**/test_*.rb').each { |file| require File.expand_path file, __dir__ }
10
11
  end
@@ -13,6 +14,7 @@ desc 'Generates a coverage report for minitest-cases using simple-cov'
13
14
  task :coverage do
14
15
  ENV['CODECLIMATE_REPO_TOKEN'] = nil
15
16
  ENV['COVERAGE'] = 'true'
17
+ Dir.glob('test/test_*.rb').each { |file| require File.expand_path file, __dir__ }
16
18
  Dir.glob('test/models/**/test_*.rb').each { |file| require File.expand_path file, __dir__ }
17
19
  Dir.glob('test/requests/**/test_*.rb').each { |file| require File.expand_path file, __dir__ }
18
20
  end
@@ -21,6 +23,7 @@ desc 'Generates a coverage report for minitest-cases using code-climate'
21
23
  task :cc_coverage do
22
24
  ENV['COVERAGE'] = nil
23
25
  ENV['CODECLIMATE_REPO_TOKEN'] = 'b1401494baa004d90402414cb33a7fc6420fd3693e60c677a120ddefd7d84cfd'
26
+ Dir.glob('test/test_*.rb').each { |file| require File.expand_path file, __dir__ }
24
27
  Dir.glob('test/models/**/test_*.rb').each { |file| require File.expand_path file, __dir__ }
25
28
  Dir.glob('test/requests/**/test_*.rb').each { |file| require File.expand_path file, __dir__ }
26
29
  end
@@ -0,0 +1,42 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Storage Blob Class
4
+ class TestDeleteObject < Minitest::Test
5
+ # This class posesses the test cases for the requests of deleting storage blobs.
6
+ def setup
7
+ Fog.mock!
8
+ @mock_service = Fog::Storage::AzureRM.new(storage_account_credentials)
9
+ Fog.unmock!
10
+ @mocked_response = mocked_storage_http_error
11
+ @mocked_not_found_response = mocked_storage_http_not_found_error
12
+
13
+ @service = Fog::Storage::AzureRM.new(storage_account_credentials)
14
+ @blob_client = @service.instance_variable_get(:@blob_client)
15
+ end
16
+
17
+ def test_delete_object_success
18
+ @blob_client.stub :delete_blob, true do
19
+ assert @service.delete_object('test_container', 'test_blob')
20
+ end
21
+ end
22
+
23
+ def test_delete_object_with_not_found_success
24
+ http_exception = ->(*) { raise Azure::Core::Http::HTTPError.new(@mocked_not_found_response) }
25
+ @blob_client.stub :delete_blob, http_exception do
26
+ assert @service.delete_object('test_container', 'test_blob')
27
+ end
28
+ end
29
+
30
+ def test_delete_object_http_exception
31
+ http_exception = ->(*) { raise Azure::Core::Http::HTTPError.new(@mocked_response) }
32
+ @blob_client.stub :delete_blob, http_exception do
33
+ assert_raises(Azure::Core::Http::HTTPError) do
34
+ @service.delete_object('test_container', 'test_blob')
35
+ end
36
+ end
37
+ end
38
+
39
+ def test_delete_object_mock
40
+ assert @mock_service.delete_blob('test_container', 'test_blob')
41
+ end
42
+ end
@@ -0,0 +1,34 @@
1
+ require File.expand_path '../../test_helper', __dir__
2
+
3
+ # Storage Blob Class
4
+ class TestGetObject < Minitest::Test
5
+ # This class posesses the test cases for the requests of getting storage blob.
6
+ def setup
7
+ Fog.mock!
8
+ @mock_service = Fog::Storage::AzureRM.new(storage_account_credentials)
9
+ Fog.unmock!
10
+ @mocked_response = mocked_storage_http_error
11
+
12
+ @service = Fog::Storage::AzureRM.new(storage_account_credentials)
13
+ @blob_client = @service.instance_variable_get(:@blob_client)
14
+
15
+ @raw_cloud_blob = storage_blob
16
+ @blob = ApiStub::Requests::Storage::File.blob_as_hash
17
+ @blob_with_content = @blob.merge(body: 'content')
18
+ end
19
+
20
+ def test_get_object_success
21
+ @blob_client.stub :get_blob, @blob_with_content do
22
+ assert_equal @blob_with_content, @service.get_object('test_container', 'test_blob')
23
+ end
24
+ end
25
+
26
+ def test_get_object_not_found
27
+ exception = ->(*) { raise StandardError.new('Not found(404). Not exist') }
28
+ @blob_client.stub :get_blob, exception do
29
+ assert_raises('NotFound') do
30
+ @service.get_object('test_container', 'test_blob')
31
+ end
32
+ end
33
+ end
34
+ end
@@ -38,7 +38,7 @@ class TestCredentials < Minitest::Test
38
38
  end
39
39
 
40
40
  def test_get_token_method_with_china_environment
41
- Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret], ENVIRONMENT_AZURE_CHINA_CLOUD)
41
+ Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret], Fog::AzureRM::ENVIRONMENT_AZURE_CHINA_CLOUD)
42
42
  token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
43
43
  token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
44
44
  assert_equal Fog::Credentials::AzureRM.get_token(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret]), 'Bearer <some-token>'
@@ -46,7 +46,7 @@ class TestCredentials < Minitest::Test
46
46
  end
47
47
 
48
48
  def test_get_token_method_with_us_government_environment
49
- Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret], ENVIRONMENT_AZURE_US_GOVERNMENT)
49
+ Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret], Fog::AzureRM::ENVIRONMENT_AZURE_US_GOVERNMENT)
50
50
  token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
51
51
  token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
52
52
  assert_equal Fog::Credentials::AzureRM.get_token(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret]), 'Bearer <some-token>'
@@ -54,7 +54,7 @@ class TestCredentials < Minitest::Test
54
54
  end
55
55
 
56
56
  def test_get_token_method_with_german_environment
57
- Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret], ENVIRONMENT_AZURE_GERMAN_CLOUD)
57
+ Fog::Credentials::AzureRM.get_credentials(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret], Fog::AzureRM::ENVIRONMENT_AZURE_GERMAN_CLOUD)
58
58
  token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
59
59
  token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
60
60
  assert_equal Fog::Credentials::AzureRM.get_token(@creds[:tenant_id], @creds[:client_id], @creds[:client_secret]), 'Bearer <some-token>'
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: 1.4.0
4
+ version: 1.7.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: 2022-11-07 00:00:00.000000000 Z
21
+ date: 2023-02-27 00:00:00.000000000 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: codeclimate-test-reporter
@@ -237,6 +237,7 @@ files:
237
237
  - lib/fog/azurerm/requests/storage/delete_blob.rb
238
238
  - lib/fog/azurerm/requests/storage/delete_blob_https_url.rb
239
239
  - lib/fog/azurerm/requests/storage/delete_container.rb
240
+ - lib/fog/azurerm/requests/storage/delete_object.rb
240
241
  - lib/fog/azurerm/requests/storage/delete_object_url.rb
241
242
  - lib/fog/azurerm/requests/storage/get_blob.rb
242
243
  - lib/fog/azurerm/requests/storage/get_blob_http_url.rb
@@ -246,6 +247,7 @@ files:
246
247
  - lib/fog/azurerm/requests/storage/get_container_acl.rb
247
248
  - lib/fog/azurerm/requests/storage/get_container_properties.rb
248
249
  - lib/fog/azurerm/requests/storage/get_container_url.rb
250
+ - lib/fog/azurerm/requests/storage/get_object.rb
249
251
  - lib/fog/azurerm/requests/storage/get_object_url.rb
250
252
  - lib/fog/azurerm/requests/storage/list_blobs.rb
251
253
  - lib/fog/azurerm/requests/storage/list_containers.rb
@@ -294,6 +296,7 @@ files:
294
296
  - test/requests/storage/test_delete_blob.rb
295
297
  - test/requests/storage/test_delete_blob_https_url.rb
296
298
  - test/requests/storage/test_delete_container.rb
299
+ - test/requests/storage/test_delete_object.rb
297
300
  - test/requests/storage/test_get_blob.rb
298
301
  - test/requests/storage/test_get_blob_http_url.rb
299
302
  - test/requests/storage/test_get_blob_https_url.rb
@@ -302,6 +305,7 @@ files:
302
305
  - test/requests/storage/test_get_container_acl.rb
303
306
  - test/requests/storage/test_get_container_properties.rb
304
307
  - test/requests/storage/test_get_container_url.rb
308
+ - test/requests/storage/test_get_object.rb
305
309
  - test/requests/storage/test_list_blobs.rb
306
310
  - test/requests/storage/test_list_containers.rb
307
311
  - test/requests/storage/test_put_blob_block.rb
@@ -331,14 +335,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
331
335
  requirements:
332
336
  - - ">="
333
337
  - !ruby/object:Gem::Version
334
- version: 2.0.0
338
+ version: 2.7.0
335
339
  required_rubygems_version: !ruby/object:Gem::Requirement
336
340
  requirements:
337
341
  - - ">="
338
342
  - !ruby/object:Gem::Version
339
343
  version: '0'
340
344
  requirements: []
341
- rubygems_version: 3.2.22
345
+ rubygems_version: 3.4.7
342
346
  signing_key:
343
347
  specification_version: 4
344
348
  summary: Module for the 'fog' gem to support Azure Blob Storage with CarrierWave and