gitlab-fog-azure-rm 1.7.0 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +12 -0
- data/.rubocop_todo.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/gitlab-fog-azure-rm.gemspec +3 -3
- data/lib/fog/azurerm/constants.rb +0 -6
- data/lib/fog/azurerm/custom_fog_errors.rb +0 -41
- data/lib/fog/azurerm/docs/storage.md +1 -1
- data/lib/fog/azurerm/identity_encoding_filter.rb +12 -0
- data/lib/fog/azurerm/models/storage/directories.rb +6 -6
- data/lib/fog/azurerm/models/storage/directory.rb +4 -4
- data/lib/fog/azurerm/models/storage/file.rb +6 -3
- data/lib/fog/azurerm/models/storage/files.rb +8 -8
- data/lib/fog/azurerm/models/storage/storage_account.rb +4 -4
- data/lib/fog/azurerm/models/storage/storage_accounts.rb +6 -6
- data/lib/fog/azurerm/requests/storage/acquire_blob_lease.rb +2 -2
- data/lib/fog/azurerm/requests/storage/acquire_container_lease.rb +2 -2
- data/lib/fog/azurerm/requests/storage/check_container_exists.rb +2 -2
- data/lib/fog/azurerm/requests/storage/commit_blob_blocks.rb +2 -2
- data/lib/fog/azurerm/requests/storage/compare_container_blobs.rb +2 -2
- data/lib/fog/azurerm/requests/storage/copy_blob.rb +2 -2
- data/lib/fog/azurerm/requests/storage/copy_blob_from_uri.rb +2 -2
- data/lib/fog/azurerm/requests/storage/copy_object.rb +2 -2
- data/lib/fog/azurerm/requests/storage/create_block_blob.rb +2 -2
- data/lib/fog/azurerm/requests/storage/create_container.rb +2 -2
- data/lib/fog/azurerm/requests/storage/create_page_blob.rb +2 -2
- data/lib/fog/azurerm/requests/storage/delete_blob.rb +2 -2
- data/lib/fog/azurerm/requests/storage/delete_blob_https_url.rb +4 -4
- data/lib/fog/azurerm/requests/storage/delete_container.rb +2 -2
- data/lib/fog/azurerm/requests/storage/delete_object.rb +2 -2
- data/lib/fog/azurerm/requests/storage/delete_object_url.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_blob.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_blob_http_url.rb +5 -5
- data/lib/fog/azurerm/requests/storage/get_blob_https_url.rb +6 -5
- data/lib/fog/azurerm/requests/storage/get_blob_properties.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_blob_url.rb +4 -4
- data/lib/fog/azurerm/requests/storage/get_container_acl.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_container_properties.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_container_url.rb +4 -4
- data/lib/fog/azurerm/requests/storage/get_object.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_object_url.rb +2 -2
- data/lib/fog/azurerm/requests/storage/list_blobs.rb +2 -2
- data/lib/fog/azurerm/requests/storage/list_containers.rb +2 -2
- data/lib/fog/azurerm/requests/storage/put_blob_block.rb +2 -2
- data/lib/fog/azurerm/requests/storage/put_blob_http_url.rb +39 -0
- data/lib/fog/azurerm/requests/storage/put_blob_https_url.rb +4 -4
- data/lib/fog/azurerm/requests/storage/put_blob_metadata.rb +2 -2
- data/lib/fog/azurerm/requests/storage/put_blob_pages.rb +2 -2
- data/lib/fog/azurerm/requests/storage/put_blob_properties.rb +2 -2
- data/lib/fog/azurerm/requests/storage/put_container_acl.rb +2 -2
- data/lib/fog/azurerm/requests/storage/put_container_metadata.rb +2 -2
- data/lib/fog/azurerm/requests/storage/put_object_url.rb +2 -2
- data/lib/fog/azurerm/requests/storage/release_blob_lease.rb +2 -2
- data/lib/fog/azurerm/requests/storage/release_container_lease.rb +2 -2
- data/lib/fog/azurerm/requests/storage/save_page_blob.rb +2 -2
- data/lib/fog/azurerm/requests/storage/wait_blob_copy_operation_to_finish.rb +2 -2
- data/lib/fog/azurerm/storage.rb +62 -27
- data/lib/fog/azurerm/utilities/general.rb +2 -58
- data/lib/fog/azurerm/version.rb +1 -1
- data/lib/fog/azurerm.rb +4 -11
- data/rakefile +4 -5
- data/test/api_stub/models/storage/directory.rb +1 -1
- data/test/api_stub/models/storage/file.rb +1 -1
- data/test/api_stub/requests/storage/directory.rb +1 -1
- data/test/api_stub/requests/storage/file.rb +4 -4
- data/test/integration/README.md +5 -7
- data/test/integration/blob.rb +28 -36
- data/test/integration/container.rb +8 -39
- data/test/integration/credentials/azure.yml +4 -5
- data/test/models/storage/test_directories.rb +5 -5
- data/test/models/storage/test_directory.rb +2 -2
- data/test/models/storage/test_file.rb +16 -4
- data/test/models/storage/test_files.rb +8 -8
- data/test/requests/storage/test_acquire_blob_lease.rb +2 -2
- data/test/requests/storage/test_acquire_container_lease.rb +2 -2
- data/test/requests/storage/test_check_container_exists.rb +1 -1
- data/test/requests/storage/test_commit_blob_blocks.rb +2 -2
- data/test/requests/storage/test_compare_container_blobs.rb +2 -2
- data/test/requests/storage/test_copy_blob.rb +2 -2
- data/test/requests/storage/test_copy_blob_from_uri.rb +2 -2
- data/test/requests/storage/test_create_block_blob.rb +2 -2
- data/test/requests/storage/test_create_container.rb +2 -2
- data/test/requests/storage/test_create_page_blob.rb +2 -2
- data/test/requests/storage/test_delete_blob.rb +2 -2
- data/test/requests/storage/test_delete_blob_https_url.rb +7 -10
- data/test/requests/storage/test_delete_container.rb +2 -2
- data/test/requests/storage/test_delete_object.rb +2 -2
- data/test/requests/storage/test_get_blob.rb +2 -2
- data/test/requests/storage/test_get_blob_encoding.rb +45 -0
- data/test/requests/storage/test_get_blob_http_url.rb +13 -9
- data/test/requests/storage/test_get_blob_https_url.rb +95 -13
- data/test/requests/storage/test_get_blob_properties.rb +2 -2
- data/test/requests/storage/test_get_blob_url.rb +15 -24
- data/test/requests/storage/test_get_container_acl.rb +2 -2
- data/test/requests/storage/test_get_container_properties.rb +2 -2
- data/test/requests/storage/test_get_container_url.rb +5 -8
- data/test/requests/storage/test_get_object.rb +2 -2
- data/test/requests/storage/test_list_blobs.rb +2 -2
- data/test/requests/storage/test_list_containers.rb +2 -2
- data/test/requests/storage/test_put_blob_block.rb +2 -2
- data/test/requests/storage/test_put_blob_http_url.rb +33 -0
- data/test/requests/storage/test_put_blob_https_url.rb +8 -11
- data/test/requests/storage/test_put_blob_metadata.rb +2 -2
- data/test/requests/storage/test_put_blob_pages.rb +2 -2
- data/test/requests/storage/test_put_blob_properties.rb +2 -2
- data/test/requests/storage/test_put_container_acl.rb +2 -2
- data/test/requests/storage/test_put_container_metadata.rb +2 -2
- data/test/requests/storage/test_release_blob_lease.rb +2 -2
- data/test/requests/storage/test_release_container_lease.rb +2 -2
- data/test/requests/storage/test_save_page_blob.rb +2 -2
- data/test/requests/storage/test_wait_blob_copy_operation_to_finish.rb +15 -6
- data/test/test_helper.rb +38 -698
- metadata +27 -36
- data/lib/fog/azurerm/credentials.rb +0 -44
- data/lib/fog/azurerm/models/resources/azure_resource.rb +0 -25
- data/lib/fog/azurerm/models/resources/azure_resources.rb +0 -40
- data/lib/fog/azurerm/models/resources/dependency.rb +0 -27
- data/lib/fog/azurerm/models/resources/deployment.rb +0 -65
- data/lib/fog/azurerm/models/resources/deployments.rb +0 -30
- data/lib/fog/azurerm/models/resources/provider.rb +0 -27
- data/lib/fog/azurerm/models/resources/provider_resource_type.rb +0 -22
- data/lib/fog/azurerm/models/resources/resource_group.rb +0 -34
- data/lib/fog/azurerm/models/resources/resource_groups.rb +0 -29
- data/test/integration/storage_account.rb +0 -135
- data/test/smoke_tests/compute/test_resource_group_smoke.rb +0 -37
- data/test/test_credentials.rb +0 -63
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dee64342b22c3eb8a2a9ef9798f78a2b29ca94754f8cd5989cdd54f85e02fa2e
|
4
|
+
data.tar.gz: fca636a203da2fb799fca4b3a9728a70c79c064d4501af0e9ab161e3b0d2f220
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e67e3cd13e9e244e49048b173d07b979a582da5c1fe371740e0609baecb47caf87d4f02886d1951ce108fe392f9d0520178540e3b7aeb96f4a00f18da0b50571
|
7
|
+
data.tar.gz: 21c78c8d3407104297f2ed6d9cbf841188d2d87e03f10c35a6bd3fae67baee3cfd7661d5c69251bc1a3b6d01b7a2add98cbbed0bd6d67910fcfae489a6ac28b4
|
data/.gitlab-ci.yml
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
include:
|
2
|
+
- component: gitlab.com/gitlab-org/components/gem-release/gem-release@~latest
|
3
|
+
|
1
4
|
default:
|
2
5
|
image: "ruby:${RUBY_VERSION}"
|
3
6
|
|
@@ -21,3 +24,12 @@ rubocop:
|
|
21
24
|
- bundle exec rubocop
|
22
25
|
variables:
|
23
26
|
RUBY_VERSION: "2.7"
|
27
|
+
|
28
|
+
integration:
|
29
|
+
services:
|
30
|
+
- alias: azurite
|
31
|
+
name: mcr.microsoft.com/azure-storage/azurite
|
32
|
+
script:
|
33
|
+
- bundle exec rake integration
|
34
|
+
variables:
|
35
|
+
RUBY_VERSION: "3.2"
|
data/.rubocop_todo.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/gitlab-fog-azure-rm.gemspec
CHANGED
@@ -22,10 +22,10 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency 'rake', '~> 13.0'
|
23
23
|
spec.add_development_dependency 'rubocop', '~> 0.89.1'
|
24
24
|
spec.add_development_dependency 'simplecov'
|
25
|
+
spec.add_development_dependency 'webrick', '~> 1.8'
|
25
26
|
spec.add_dependency 'azure-storage-blob', '~> 2.0'
|
26
27
|
spec.add_dependency 'azure-storage-common', '~> 2.0'
|
27
|
-
spec.add_dependency 'fog-core', '
|
28
|
-
spec.add_dependency 'fog-json', '~> 1.2
|
28
|
+
spec.add_dependency 'fog-core', '~> 2.1'
|
29
|
+
spec.add_dependency 'fog-json', '~> 1.2'
|
29
30
|
spec.add_dependency 'mime-types'
|
30
|
-
spec.add_dependency 'ms_rest_azure', '~> 0.12.0'
|
31
31
|
end
|
@@ -34,12 +34,6 @@ module Fog
|
|
34
34
|
ENVIRONMENT_AZURE_US_GOVERNMENT = 'AzureUSGovernment'.freeze
|
35
35
|
ENVIRONMENT_AZURE_GERMAN_CLOUD = 'AzureGermanCloud'.freeze
|
36
36
|
|
37
|
-
# MsRestAzure::AzureOperationError class Error Codes
|
38
|
-
ERROR_CODE_RESOURCE_NOT_FOUND = 'ResourceNotFound'.freeze
|
39
|
-
ERROR_CODE_NOT_FOUND = 'NotFound'.freeze
|
40
|
-
ERROR_CODE_RESOURCE_GROUP_NOT_FOUND = 'ResourceGroupNotFound'.freeze
|
41
|
-
ERROR_CODE_PARENT_RESOURCE_NOT_FOUND = 'ParentResourceNotFound'.freeze
|
42
|
-
|
43
37
|
PLATFORM_LINUX = 'linux'.freeze
|
44
38
|
|
45
39
|
# State of the copy operation
|
@@ -1,47 +1,6 @@
|
|
1
1
|
# This file contains any or all custom Fog errors that we create
|
2
2
|
module Fog
|
3
3
|
module AzureRM
|
4
|
-
# This is a custom Fog exception inherited from MsRestAzure::AzureOperationError
|
5
|
-
class CustomAzureOperationError < MsRestAzure::AzureOperationError
|
6
|
-
def initialize(message, azure_exception)
|
7
|
-
super(azure_exception.request, azure_exception.response, azure_exception.body, "Exception in #{message}")
|
8
|
-
end
|
9
|
-
|
10
|
-
def print_subscription_limits_information
|
11
|
-
request_method = @request.method
|
12
|
-
subscription_id = @request.path_params['subscriptionId']
|
13
|
-
|
14
|
-
limit_value = remaining_subscription_request_limits(@response)
|
15
|
-
|
16
|
-
puts "Subscription: '#{subscription_id}'. Request Method: '#{request_method}'. \nLimit Value: #{limit_value['header']}: #{limit_value['value']}\n" unless limit_value.empty?
|
17
|
-
end
|
18
|
-
|
19
|
-
def remaining_subscription_request_limits(response)
|
20
|
-
limit = {}
|
21
|
-
# handles both read and write limits
|
22
|
-
if response.headers.key? 'x-ms-ratelimit-remaining-subscription-resource-requests'
|
23
|
-
limit['header'] = 'x-ms-ratelimit-remaining-subscription-resource-requests'
|
24
|
-
limit['value'] = response.headers['x-ms-ratelimit-remaining-subscription-resource-requests']
|
25
|
-
|
26
|
-
# limit for collection API calls
|
27
|
-
elsif response.headers.key? 'x-ms-ratelimit-remaining-subscription-resource-entities-read'
|
28
|
-
limit['header'] = 'x-ms-ratelimit-remaining-subscription-resource-entities-read'
|
29
|
-
limit['value'] = response.headers['x-ms-ratelimit-remaining-subscription-resource-entities-read']
|
30
|
-
|
31
|
-
# read requests limit
|
32
|
-
elsif response.headers.key? 'x-ms-ratelimit-remaining-subscription-reads'
|
33
|
-
limit['header'] = 'x-ms-ratelimit-remaining-subscription-reads'
|
34
|
-
limit['value'] = response.headers['x-ms-ratelimit-remaining-subscription-reads']
|
35
|
-
|
36
|
-
# write requests limit
|
37
|
-
elsif response.headers.key? 'x-ms-ratelimit-remaining-subscription-writes'
|
38
|
-
limit['header'] = 'x-ms-ratelimit-remaining-subscription-writes'
|
39
|
-
limit['value'] = response.headers['x-ms-ratelimit-remaining-subscription-writes']
|
40
|
-
end
|
41
|
-
limit
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
4
|
# This is a custom Fog exception inherited from Azure::Core::Http::HTTPError
|
46
5
|
class CustomAzureCoreHttpError < Azure::Core::Http::HTTPError
|
47
6
|
def initialize(azure_exception)
|
@@ -15,7 +15,7 @@ require 'fog/azurerm'
|
|
15
15
|
If you only want to manage the storage data, you can create the connection without the Azure subscription information:
|
16
16
|
|
17
17
|
```ruby
|
18
|
-
fog_storage_service = Fog::Storage
|
18
|
+
fog_storage_service = Fog::AzureRM::Storage.new(
|
19
19
|
azure_storage_account_name: '<Storage Account Name>', # Name of an Azure Storage Account
|
20
20
|
azure_storage_access_key: '<Storage Account Key>', # Key of an Azure Storage Account
|
21
21
|
environment: '<AzureCloud/AzureChinaCloud/AzureUSGovernment/AzureGermanCloud>' # Azure cloud environment. Default is AzureCloud.
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Fog
|
2
|
+
module AzureRM
|
3
|
+
# This filter prevents Net::HTTP from inflating compressed response bodies
|
4
|
+
class IdentityEncodingFilter
|
5
|
+
def call(request, next_filter)
|
6
|
+
request.headers['Accept-Encoding'] ||= 'identity'
|
7
|
+
|
8
|
+
next_filter.call
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module AzureRM
|
3
|
+
class Storage
|
4
4
|
# This class is giving implementation of listing containers.
|
5
5
|
class Directories < Fog::Collection
|
6
6
|
include Fog::AzureRM::Utilities::General
|
7
7
|
|
8
|
-
model Fog::Storage::
|
8
|
+
model Fog::AzureRM::Storage::Directory
|
9
9
|
|
10
10
|
# List all directories(containers) in the storage account.
|
11
11
|
#
|
12
|
-
# @return [Fog::Storage::
|
12
|
+
# @return [Fog::AzureRM::Storage::Directories]
|
13
13
|
#
|
14
14
|
def all
|
15
15
|
containers = service.list_containers
|
@@ -35,7 +35,7 @@ module Fog
|
|
35
35
|
# @option options [String] marker Sets the identifier that specifies the portion of the list to be returned.
|
36
36
|
# @option options [String] prefix Sets filters the results to return only files whose name begins with the specified prefix.
|
37
37
|
#
|
38
|
-
# @return [Fog::Storage::
|
38
|
+
# @return [Fog::AzureRM::Storage::Directory] A directory. Return nil if the directory does not exist.
|
39
39
|
#
|
40
40
|
def get(identity, options = {})
|
41
41
|
remap_attributes(options, max_keys: :max_results)
|
@@ -64,7 +64,7 @@ module Fog
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def delete_temporary_container(storage_account_name, access_key, container_name)
|
67
|
-
storage_data = Fog::Storage
|
67
|
+
storage_data = Fog::AzureRM::Storage.new(azure_storage_account_name: storage_account_name, azure_storage_access_key: access_key)
|
68
68
|
storage_data.delete_container(container_name)
|
69
69
|
end
|
70
70
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module AzureRM
|
3
|
+
class Storage
|
4
4
|
# This class is giving implementation of create and delete a container.
|
5
5
|
class Directory < Fog::Model
|
6
6
|
VALID_ACLS = ['container', 'blob', 'unknown', nil].freeze
|
@@ -73,10 +73,10 @@ module Fog
|
|
73
73
|
# If you have set max_results or max_keys when getting this directory by directories.get,
|
74
74
|
# files may be incomplete. You need to use files.all to get all files under this directory.
|
75
75
|
#
|
76
|
-
# @return [Fog::Storage::
|
76
|
+
# @return [Fog::AzureRM::Storage::Files] Files.
|
77
77
|
#
|
78
78
|
def files
|
79
|
-
@files ||= Fog::Storage::
|
79
|
+
@files ||= Fog::AzureRM::Storage::Files.new(directory: self, service: service)
|
80
80
|
end
|
81
81
|
|
82
82
|
# Set the container permission to public or private
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'mime/types'
|
2
2
|
|
3
3
|
module Fog
|
4
|
-
module
|
5
|
-
class
|
4
|
+
module AzureRM
|
5
|
+
class Storage
|
6
6
|
# This class is giving implementation of create/save and
|
7
7
|
# delete/destroy for Blob.
|
8
8
|
class File < Fog::Model
|
@@ -149,7 +149,7 @@ module Fog
|
|
149
149
|
# @param options [Hash] options for copy_object method
|
150
150
|
# @option options [Integer] timeout Sets to raise a TimeoutError if the copy does not finish in timeout seconds.
|
151
151
|
#
|
152
|
-
# @return [Fog::Storage::
|
152
|
+
# @return [Fog::AzureRM::Storage::File] New File.
|
153
153
|
#
|
154
154
|
def copy(target_directory_key, target_file_key, options = {})
|
155
155
|
requires :directory, :key
|
@@ -252,6 +252,9 @@ module Fog
|
|
252
252
|
# as a query string, while Azure needs the content_disposition parameter
|
253
253
|
# to generate a SAS token.
|
254
254
|
options[:content_disposition] ||= options.dig(:query, 'response-content-disposition')
|
255
|
+
options[:content_type] ||= options.dig(:query, 'response-content-type')
|
256
|
+
options = options.dup
|
257
|
+
options.delete(:query)
|
255
258
|
options
|
256
259
|
end
|
257
260
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module AzureRM
|
3
|
+
class Storage
|
4
4
|
# This class is giving implementation of listing blobs.
|
5
5
|
class Files < Fog::Collection
|
6
6
|
include Fog::AzureRM::Utilities::General
|
@@ -12,7 +12,7 @@ module Fog
|
|
12
12
|
attribute :next_marker, aliases: %w(NextMarker next-marker)
|
13
13
|
attribute :prefix, aliases: 'Prefix'
|
14
14
|
|
15
|
-
model Fog::Storage::
|
15
|
+
model Fog::AzureRM::Storage::File
|
16
16
|
|
17
17
|
# List all files(blobs) under the directory.
|
18
18
|
#
|
@@ -27,7 +27,7 @@ module Fog
|
|
27
27
|
# @option options [String] marker Sets the identifier that specifies the portion of the list to be returned.
|
28
28
|
# @option options [String] prefix Sets filters the results to return only files whose name begins with the specified prefix.
|
29
29
|
#
|
30
|
-
# @return [Fog::Storage::
|
30
|
+
# @return [Fog::AzureRM::Storage::Files] Return nil if the directory does not exist.
|
31
31
|
#
|
32
32
|
def all(options = {})
|
33
33
|
requires :directory
|
@@ -52,7 +52,7 @@ module Fog
|
|
52
52
|
|
53
53
|
# Enumerate every file under the directory if block_given?
|
54
54
|
#
|
55
|
-
# @return [Fog::Storage::
|
55
|
+
# @return [Fog::AzureRM::Storage::Files]
|
56
56
|
#
|
57
57
|
alias each_file_this_page each
|
58
58
|
def each
|
@@ -77,7 +77,7 @@ module Fog
|
|
77
77
|
# @param options [Hash]
|
78
78
|
# @option options [String] block_size Sets buffer size when block_given? is true. Default is 32 MB
|
79
79
|
#
|
80
|
-
# @return [Fog::Storage::
|
80
|
+
# @return [Fog::AzureRM::Storage::File] A file. Return nil if the file does not exist.
|
81
81
|
#
|
82
82
|
def get(key, options = {}, &block)
|
83
83
|
requires :directory
|
@@ -154,7 +154,7 @@ module Fog
|
|
154
154
|
# @param key [String] Name of file
|
155
155
|
# @param options [Hash]
|
156
156
|
#
|
157
|
-
# @return [Fog::Storage::
|
157
|
+
# @return [Fog::AzureRM::Storage::File] A file. Return nil if the file does not exist.
|
158
158
|
#
|
159
159
|
def head(key, options = {})
|
160
160
|
requires :directory
|
@@ -172,7 +172,7 @@ module Fog
|
|
172
172
|
#
|
173
173
|
# required attributes: directory
|
174
174
|
#
|
175
|
-
# @return [Fog::Storage::
|
175
|
+
# @return [Fog::AzureRM::Storage::File] A file. You need to use File.save to upload this new file.
|
176
176
|
#
|
177
177
|
def new(attributes = {})
|
178
178
|
requires :directory
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module AzureRM
|
3
|
+
class Storage
|
4
4
|
# This class is giving implementation of create/save and
|
5
5
|
# delete/destroy for storage account.
|
6
6
|
class StorageAccount < Fog::Model
|
@@ -35,7 +35,7 @@ module Fog
|
|
35
35
|
self.replication = ALLOWED_STANDARD_REPLICATION.first if replication.nil?
|
36
36
|
validate_sku_name!
|
37
37
|
storage_account = service.create_storage_account(storage_account_params)
|
38
|
-
merge_attributes(Fog::Storage::
|
38
|
+
merge_attributes(Fog::AzureRM::Storage::StorageAccount.parse(storage_account))
|
39
39
|
end
|
40
40
|
|
41
41
|
def storage_account_params
|
@@ -55,7 +55,7 @@ module Fog
|
|
55
55
|
storage_account_params = merge_attributes(storage_account_params).all_attributes
|
56
56
|
|
57
57
|
storage_account = service.update_storage_account(storage_account_params)
|
58
|
-
merge_attributes(Fog::Storage::
|
58
|
+
merge_attributes(Fog::AzureRM::Storage::StorageAccount.parse(storage_account))
|
59
59
|
end
|
60
60
|
|
61
61
|
def validate_sku_name!
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module AzureRM
|
3
|
+
class Storage
|
4
4
|
# This class is giving implementation of all/list, get and
|
5
5
|
# check name availability for storage account.
|
6
6
|
class StorageAccounts < Fog::Collection
|
7
|
-
model Fog::Storage::
|
7
|
+
model Fog::AzureRM::Storage::StorageAccount
|
8
8
|
attribute :resource_group
|
9
9
|
|
10
10
|
def all
|
@@ -16,15 +16,15 @@ module Fog
|
|
16
16
|
hash_of_storage_accounts = service.list_storage_accounts
|
17
17
|
end
|
18
18
|
hash_of_storage_accounts.each do |account|
|
19
|
-
accounts << Fog::Storage::
|
19
|
+
accounts << Fog::AzureRM::Storage::StorageAccount.parse(account)
|
20
20
|
end
|
21
21
|
load(accounts)
|
22
22
|
end
|
23
23
|
|
24
24
|
def get(resource_group_name, storage_account_name)
|
25
25
|
storage_account = service.get_storage_account(resource_group_name, storage_account_name)
|
26
|
-
storage_account_fog = Fog::Storage::
|
27
|
-
storage_account_fog.merge_attributes(Fog::Storage::
|
26
|
+
storage_account_fog = Fog::AzureRM::Storage::StorageAccount.new(service: service)
|
27
|
+
storage_account_fog.merge_attributes(Fog::AzureRM::Storage::StorageAccount.parse(storage_account))
|
28
28
|
end
|
29
29
|
|
30
30
|
def check_name_availability(name, type = 'Microsoft.Storage/storageAccounts')
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module AzureRM
|
3
|
+
class Storage
|
4
4
|
# This class provides the actual implemention for service calls.
|
5
5
|
class Real
|
6
6
|
# Get a pre-signed URL to delete an object in Azure blob storage
|
@@ -22,7 +22,7 @@ module Fog
|
|
22
22
|
expiry: expires.utc.iso8601,
|
23
23
|
protocol: 'https'
|
24
24
|
}
|
25
|
-
token =
|
25
|
+
token = signature_client(expires).generate_service_sas_token(relative_path, params)
|
26
26
|
uri = @blob_client.generate_uri(relative_path, {}, { encode: true })
|
27
27
|
"#{uri}?#{token}"
|
28
28
|
end
|
@@ -31,7 +31,7 @@ module Fog
|
|
31
31
|
# This class provides the mock implementation for unit tests.
|
32
32
|
class Mock
|
33
33
|
def delete_blob_https_url(*)
|
34
|
-
'https://
|
34
|
+
'https://mockaccount.blob.core.windows.net/test_container/test_blob?token'
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module AzureRM
|
3
|
+
class Storage
|
4
4
|
# This class provides the actual implemention for service calls.
|
5
5
|
class Real
|
6
6
|
# Get an expiring http blob url from Azure blob storage
|
@@ -23,17 +23,17 @@ module Fog
|
|
23
23
|
expiry: expires.utc.iso8601,
|
24
24
|
content_disposition: options[:content_disposition]
|
25
25
|
}
|
26
|
-
token =
|
26
|
+
token = signature_client(expires).generate_service_sas_token(relative_path, params)
|
27
27
|
uri = @blob_client.generate_uri(relative_path, {}, { encode: true })
|
28
28
|
url = "#{uri}?#{token}"
|
29
|
-
url.
|
29
|
+
url.sub('https:', 'http:')
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
# This class provides the mock implementation for unit tests.
|
34
34
|
class Mock
|
35
35
|
def get_blob_http_url(*)
|
36
|
-
'http://
|
36
|
+
'http://mockaccount.blob.core.windows.net/test_container/test_blob?token'
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module AzureRM
|
3
|
+
class Storage
|
4
4
|
# This class provides the actual implemention for service calls.
|
5
5
|
class Real
|
6
6
|
# Get an expiring https blob url from Azure blob storage
|
@@ -22,9 +22,10 @@ module Fog
|
|
22
22
|
permissions: 'r',
|
23
23
|
expiry: expires.utc.iso8601,
|
24
24
|
protocol: 'https',
|
25
|
-
content_disposition: options[:content_disposition]
|
25
|
+
content_disposition: options[:content_disposition],
|
26
|
+
content_type: options[:content_type]
|
26
27
|
}
|
27
|
-
token =
|
28
|
+
token = signature_client(expires).generate_service_sas_token(relative_path, params)
|
28
29
|
uri = @blob_client.generate_uri(relative_path, {}, { encode: true })
|
29
30
|
"#{uri}?#{token}"
|
30
31
|
end
|
@@ -33,7 +34,7 @@ module Fog
|
|
33
34
|
# This class provides the mock implementation for unit tests.
|
34
35
|
class Mock
|
35
36
|
def get_blob_https_url(*)
|
36
|
-
'https://
|
37
|
+
'https://mockaccount.blob.core.windows.net/test_container/test_blob?token'
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|