fog-azure-rm 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/lib/fog/azurerm/compute.rb +6 -0
- data/lib/fog/azurerm/docs/compute.md +67 -11
- data/lib/fog/azurerm/docs/network.md +59 -0
- data/lib/fog/azurerm/docs/storage.md +107 -35
- data/lib/fog/azurerm/models/compute/server.rb +15 -9
- data/lib/fog/azurerm/models/compute/virtual_machine_extension.rb +78 -0
- data/lib/fog/azurerm/models/compute/virtual_machine_extensions.rb +30 -0
- data/lib/fog/azurerm/models/network/express_route_circuit.rb +21 -21
- data/lib/fog/azurerm/models/network/express_route_circuit_peering.rb +21 -21
- data/lib/fog/azurerm/models/network/express_route_service_provider.rb +8 -8
- data/lib/fog/azurerm/models/network/network_security_rule.rb +27 -0
- data/lib/fog/azurerm/models/network/network_security_rules.rb +31 -0
- data/lib/fog/azurerm/models/network/subnet.rb +16 -12
- data/lib/fog/azurerm/models/network/virtual_network_gateway.rb +6 -6
- data/lib/fog/azurerm/models/storage/{containers.rb → directories.rb} +10 -10
- data/lib/fog/azurerm/models/storage/{container.rb → directory.rb} +13 -13
- data/lib/fog/azurerm/models/storage/file.rb +151 -0
- data/lib/fog/azurerm/models/storage/files.rb +31 -0
- data/lib/fog/azurerm/network.rb +6 -0
- data/lib/fog/azurerm/requests/compute/create_or_update_vm_extension.rb +63 -0
- data/lib/fog/azurerm/requests/compute/create_virtual_machine.rb +45 -8
- data/lib/fog/azurerm/requests/compute/delete_vm_extension.rb +28 -0
- data/lib/fog/azurerm/requests/compute/get_vm_extension.rb +46 -0
- data/lib/fog/azurerm/requests/network/create_or_update_express_route_circuit.rb +44 -31
- data/lib/fog/azurerm/requests/network/create_or_update_express_route_circuit_peering.rb +23 -13
- data/lib/fog/azurerm/requests/network/create_or_update_network_security_rule.rb +59 -0
- data/lib/fog/azurerm/requests/network/create_or_update_virtual_network_gateway.rb +23 -15
- data/lib/fog/azurerm/requests/network/delete_network_security_rule.rb +30 -0
- data/lib/fog/azurerm/requests/network/get_available_ipaddresses_count.rb +23 -0
- data/lib/fog/azurerm/requests/network/get_network_security_rule.rb +47 -0
- data/lib/fog/azurerm/requests/network/list_network_security_groups.rb +1 -1
- data/lib/fog/azurerm/requests/network/list_network_security_rules.rb +51 -0
- data/lib/fog/azurerm/requests/storage/acquire_blob_lease.rb +29 -0
- data/lib/fog/azurerm/requests/storage/acquire_container_lease.rb +29 -0
- data/lib/fog/azurerm/requests/storage/check_blob_exist.rb +25 -0
- data/lib/fog/azurerm/requests/storage/compare_blob.rb +73 -0
- data/lib/fog/azurerm/requests/storage/copy_blob.rb +30 -0
- data/lib/fog/azurerm/requests/storage/copy_blob_from_uri.rb +30 -0
- data/lib/fog/azurerm/requests/storage/delete_blob.rb +27 -0
- data/lib/fog/azurerm/requests/storage/download_blob_to_file.rb +56 -0
- data/lib/fog/azurerm/requests/storage/get_blob_metadata.rb +37 -9
- data/lib/fog/azurerm/requests/storage/get_blob_properties.rb +53 -0
- data/lib/fog/azurerm/requests/storage/get_container_metadata.rb +2 -2
- data/lib/fog/azurerm/requests/storage/list_blobs.rb +82 -0
- data/lib/fog/azurerm/requests/storage/list_containers.rb +1 -1
- data/lib/fog/azurerm/requests/storage/release_blob_lease.rb +27 -0
- data/lib/fog/azurerm/requests/storage/release_container_lease.rb +27 -0
- data/lib/fog/azurerm/requests/storage/set_blob_metadata.rb +4 -4
- data/lib/fog/azurerm/requests/storage/set_blob_properties.rb +26 -0
- data/lib/fog/azurerm/requests/storage/set_container_metadata.rb +3 -3
- data/lib/fog/azurerm/requests/storage/upload_block_blob_from_file.rb +60 -0
- data/lib/fog/azurerm/storage.rb +26 -8
- data/lib/fog/azurerm/utilities/general.rb +14 -1
- data/lib/fog/azurerm/version.rb +1 -1
- data/test/api_stub.rb +8 -4
- data/test/api_stub/models/compute/virtual_machine_extension.rb +31 -0
- data/test/api_stub/models/network/network_security_rule.rb +30 -0
- data/test/api_stub/models/storage/{container.rb → directory.rb} +1 -1
- data/test/api_stub/models/storage/file.rb +178 -0
- data/test/api_stub/requests/compute/virtual_machine.rb +119 -0
- data/test/api_stub/requests/compute/virtual_machine_extension.rb +46 -0
- data/test/api_stub/requests/network/network_security_rule.rb +72 -0
- data/test/api_stub/requests/storage/{container.rb → directory.rb} +2 -2
- data/test/api_stub/requests/storage/file.rb +164 -0
- data/test/integration/availability_set.rb +6 -0
- data/test/integration/blob.rb +205 -0
- data/test/integration/credentials/azure.yml +4 -4
- data/test/integration/deployment.rb +9 -0
- data/test/integration/external_load_balancer.rb +9 -0
- data/test/integration/internal_load_balancer.rb +8 -0
- data/test/integration/network_security_group.rb +9 -0
- data/test/integration/network_security_rule.rb +86 -0
- data/test/integration/server.rb +62 -9
- data/test/integration/server_custom_image.rb +118 -0
- data/test/integration/subnet.rb +12 -1
- data/test/integration/virtual_machine_extension.rb +148 -0
- data/test/integration/virtual_network.rb +9 -1
- data/test/integration/virtual_network_gateway.rb +7 -29
- data/test/integration/virtual_network_gateway_connection_to_express_route.rb +116 -0
- data/test/models/compute/test_virtual_machine_extension.rb +61 -0
- data/test/models/compute/test_virtual_machine_extensions.rb +36 -0
- data/test/models/network/test_express_route_circuit.rb +4 -10
- data/test/models/network/test_express_route_circuit_peering.rb +4 -10
- data/test/models/network/test_network_interface.rb +4 -8
- data/test/models/network/test_network_security_rule.rb +14 -0
- data/test/models/network/test_network_security_rules.rb +42 -0
- data/test/models/network/test_subnet.rb +5 -0
- data/test/models/storage/test_directories.rb +106 -0
- data/test/models/storage/test_directory.rb +125 -0
- data/test/models/storage/test_file.rb +258 -0
- data/test/models/storage/test_files.rb +67 -0
- data/test/models/storage/test_storage_account.rb +2 -4
- data/test/requests/compute/test_create_virtual_machine.rb +19 -5
- data/test/requests/compute/test_create_vm_extension.rb +35 -0
- data/test/requests/compute/test_get_vm_extension.rb +26 -0
- data/test/requests/compute/test_update_vm_extension.rb +35 -0
- data/test/requests/network/test_create_or_update_network_security_rule.rb +28 -0
- data/test/requests/network/test_delete_network_security_rule.rb +25 -0
- data/test/requests/network/test_get_available_ipaddresses_count.rb +18 -0
- data/test/requests/network/test_get_network_security_rule.rb +26 -0
- data/test/requests/network/test_list_network_security_groups.rb +2 -2
- data/test/requests/network/test_list_network_security_rules.rb +26 -0
- data/test/requests/storage/test_acquire_blob_lease.rb +17 -0
- data/test/requests/storage/test_acquire_container_lease.rb +17 -0
- data/test/requests/storage/test_check_blob_exist.rb +17 -0
- data/test/requests/storage/test_compare_blob.rb +17 -0
- data/test/requests/storage/test_copy_blob.rb +17 -0
- data/test/requests/storage/test_copy_blob_from_uri.rb +17 -0
- data/test/requests/storage/test_create_container.rb +2 -2
- data/test/requests/storage/test_delete_blob.rb +22 -0
- data/test/requests/storage/test_delete_container.rb +1 -1
- data/test/requests/storage/test_download_blob_to_file.rb +25 -0
- data/test/requests/storage/test_get_blob_metadata.rb +2 -2
- data/test/requests/storage/test_get_blob_properties.rb +23 -0
- data/test/requests/storage/test_get_container_access_control_list.rb +2 -2
- data/test/requests/storage/test_get_container_metadata.rb +2 -2
- data/test/requests/storage/test_get_container_properties.rb +2 -2
- data/test/requests/storage/test_list_blobs_in_container.rb +23 -0
- data/test/requests/storage/test_list_containers.rb +2 -2
- data/test/requests/storage/test_release_blob_lease.rb +16 -0
- data/test/requests/storage/test_release_container_lease.rb +16 -0
- data/test/requests/storage/test_set_blob_metadata.rb +1 -1
- data/test/requests/storage/test_set_blob_properties.rb +16 -0
- data/test/requests/storage/test_set_container_metadata.rb +1 -1
- data/test/requests/storage/test_upload_block_blob_from_file.rb +23 -0
- data/test/test_helper.rb +116 -3
- metadata +73 -15
- data/.DS_Store +0 -0
- data/lib/fog/azurerm/fog_azure_rm_exception.rb +0 -13
- data/lib/fog/azurerm/models/storage/blob.rb +0 -13
- data/lib/fog/azurerm/models/storage/blobs.rb +0 -22
- data/test/api_stub/models/storage/blob.rb +0 -17
- data/test/api_stub/requests/storage/blob.rb +0 -24
- data/test/models/storage/test_blobs.rb +0 -32
- data/test/models/storage/test_container.rb +0 -67
- data/test/models/storage/test_containers.rb +0 -56
@@ -0,0 +1,30 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class AzureRM
|
4
|
+
# This class provides the actual implementation for service calls.
|
5
|
+
class Real
|
6
|
+
def copy_blob(destination_container, destination_blob, source_container, source_blob, options = {})
|
7
|
+
msg = "Copying blob: #{source_blob} from container #{source_container} to container #{destination_container}"
|
8
|
+
Fog::Logger.debug msg
|
9
|
+
begin
|
10
|
+
copy_status = @blob_client.copy_blob(destination_container, destination_blob, source_container, source_blob, options)
|
11
|
+
rescue Azure::Core::Http::HTTPError => ex
|
12
|
+
raise_azure_exception(ex, msg)
|
13
|
+
end
|
14
|
+
Fog::Logger.debug "Blob #{destination_blob} copied successfully."
|
15
|
+
copy_status
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# This class provides the mock implementation for unit tests.
|
20
|
+
class Mock
|
21
|
+
def copy_blob(*)
|
22
|
+
{
|
23
|
+
'copyId' => 'abc123',
|
24
|
+
'copyStatus' => 'pending'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class AzureRM
|
4
|
+
# This class provides the actual implementation for service calls.
|
5
|
+
class Real
|
6
|
+
def copy_blob_from_uri(destination_container, destination_blob, source_blob_uri, options = {})
|
7
|
+
msg = "Copying blob: #{source_blob_uri} to container #{destination_container}"
|
8
|
+
Fog::Logger.debug msg
|
9
|
+
begin
|
10
|
+
copy_status = @blob_client.copy_blob_from_uri(destination_container, destination_blob, source_blob_uri, options)
|
11
|
+
rescue Azure::Core::Http::HTTPError => ex
|
12
|
+
raise_azure_exception(ex, msg)
|
13
|
+
end
|
14
|
+
Fog::Logger.debug "Blob #{destination_blob} copied successfully."
|
15
|
+
copy_status
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# This class provides the mock implementation for unit tests.
|
20
|
+
class Mock
|
21
|
+
def copy_blob_from_uri(*)
|
22
|
+
{
|
23
|
+
'copyId' => 'abc123',
|
24
|
+
'copyStatus' => 'pending'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class AzureRM
|
4
|
+
# This class provides the actual implemention for service calls.
|
5
|
+
class Real
|
6
|
+
def delete_blob(container_name, blob_name, options = {})
|
7
|
+
Fog::Logger.debug "Deleting blob: #{blob_name} in container #{container_name}."
|
8
|
+
begin
|
9
|
+
@blob_client.delete_blob(container_name, blob_name, options)
|
10
|
+
Fog::Logger.debug "Blob #{blob_name} deleted successfully."
|
11
|
+
true
|
12
|
+
rescue Azure::Core::Http::HTTPError => ex
|
13
|
+
raise "Exception in deleting the blob #{blob_name}: #{ex.inspect}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# This class provides the mock implementation for unit tests.
|
19
|
+
class Mock
|
20
|
+
def delete_blob(*)
|
21
|
+
Fog::Logger.debug 'Blob deleted successfully.'
|
22
|
+
true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class AzureRM
|
4
|
+
# This class provides the actual implemention for service calls.
|
5
|
+
class Real
|
6
|
+
def download_blob_to_file(container_name, blob_name, file_path, options = {})
|
7
|
+
Fog::Logger.debug "Downloading file #{file_path} from blob #{blob_name} in the container #{container_name}."
|
8
|
+
|
9
|
+
begin
|
10
|
+
blob, content = @blob_client.get_blob(container_name, blob_name, options)
|
11
|
+
IO.binwrite(::File.expand_path(file_path), content)
|
12
|
+
Fog::Logger.debug "File #{file_path} downloaded successfully."
|
13
|
+
blob
|
14
|
+
rescue IOError => ex
|
15
|
+
raise "Exception in writing #{file_path}: #{ex.inspect}"
|
16
|
+
rescue Azure::Core::Http::HTTPError => ex
|
17
|
+
raise "Exception in downloading blob #{blob_name}: #{ex.inspect}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
# This class provides the mock implementation for unit tests.
|
22
|
+
class Mock
|
23
|
+
def download_blob_to_file(_container_name, blob_name, _file_path, _options = {})
|
24
|
+
Fog::Logger.debug 'File downloaded successfully.'
|
25
|
+
{
|
26
|
+
'name' => blob_name,
|
27
|
+
'metadata' => {},
|
28
|
+
'properties' =>
|
29
|
+
{
|
30
|
+
'last_modified' => 'Thu, 28 Jul 2016 06:53:05 GMT',
|
31
|
+
'etag' => '0x8D3B6B3D353FFCA',
|
32
|
+
'lease_status' => 'unlocked',
|
33
|
+
'lease_state' => 'available',
|
34
|
+
'lease_duration' => nil,
|
35
|
+
'content_length' => 4_194_304,
|
36
|
+
'content_type' => 'application/atom+xml; charset=utf-8',
|
37
|
+
'content_encoding' => 'ASCII-8BIT',
|
38
|
+
'content_language' => nil,
|
39
|
+
'content_disposition' => nil,
|
40
|
+
'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==',
|
41
|
+
'cache_control' => nil,
|
42
|
+
'blob_type' => 'BlockBlob',
|
43
|
+
'copy_id' => nil,
|
44
|
+
'copy_status' => nil,
|
45
|
+
'copy_source' => nil,
|
46
|
+
'copy_progress' => nil,
|
47
|
+
'copy_completion_time' => nil,
|
48
|
+
'copy_status_description' => nil,
|
49
|
+
'accept_ranges' => 0
|
50
|
+
}
|
51
|
+
}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -3,13 +3,13 @@ module Fog
|
|
3
3
|
class AzureRM
|
4
4
|
# This class provides the actual implementation for service calls.
|
5
5
|
class Real
|
6
|
-
def get_blob_metadata(container_name, name)
|
6
|
+
def get_blob_metadata(container_name, name, options = {})
|
7
7
|
msg = "Getting Blob #{name} metadata in container #{container_name}."
|
8
8
|
Fog::Logger.debug msg
|
9
9
|
begin
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
blob = @blob_client.get_blob_metadata(container_name, name, options)
|
11
|
+
rescue Azure::Core::Http::HTTPError => ex
|
12
|
+
raise_azure_exception(ex, msg)
|
13
13
|
end
|
14
14
|
Fog::Logger.debug "Getting metadata of blob #{name} successfully."
|
15
15
|
blob.metadata
|
@@ -17,12 +17,40 @@ module Fog
|
|
17
17
|
end
|
18
18
|
# This class provides the mock implementation for unit tests.
|
19
19
|
class Mock
|
20
|
-
def get_blob_metadata(
|
20
|
+
def get_blob_metadata(container_name, name, _options = {})
|
21
21
|
{
|
22
|
-
'
|
23
|
-
'
|
24
|
-
'
|
25
|
-
|
22
|
+
'name' => name,
|
23
|
+
'snapshot' => nil,
|
24
|
+
'metadata' => {
|
25
|
+
'container-name' => container_name,
|
26
|
+
'blob-name' => name,
|
27
|
+
'category' => 'Images',
|
28
|
+
'resolution' => 'High'
|
29
|
+
},
|
30
|
+
'properties' =>
|
31
|
+
{
|
32
|
+
'last_modified' => 'Mon, 04 Jul 2016 09:30:31 GMT',
|
33
|
+
'etag' => '0x8D3A3EDD7C2B777',
|
34
|
+
'lease_status' => 'unlocked',
|
35
|
+
'lease_state' => 'available',
|
36
|
+
'lease_duration' => nil,
|
37
|
+
'content_length' => 4_194_304,
|
38
|
+
'content_type' => 'application/octet-stream',
|
39
|
+
'content_encoding' => nil,
|
40
|
+
'content_language' => nil,
|
41
|
+
'content_disposition' => nil,
|
42
|
+
'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==',
|
43
|
+
'cache_control' => nil,
|
44
|
+
'sequence_number' => 0,
|
45
|
+
'blob_type' => 'PageBlob',
|
46
|
+
'copy_id' => '095adc3b-e277-4c3d-97e0-0abca881f60c',
|
47
|
+
'copy_status' => 'success',
|
48
|
+
'copy_source' => 'https://testaccount.blob.core.windows.net/testblob/4m?snapshot=2016-02-04T08%3A35%3A50.3157696Z',
|
49
|
+
'copy_progress' => '4194304/4194304',
|
50
|
+
'copy_completion_time' => 'Thu, 04 Feb 2016 08:35:52 GMT',
|
51
|
+
'copy_status_description' => nil,
|
52
|
+
'accept_ranges' => 0
|
53
|
+
}
|
26
54
|
}
|
27
55
|
end
|
28
56
|
end
|
@@ -0,0 +1,53 @@
|
|
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_blob_properties(container_name, name, options = {})
|
7
|
+
Fog::Logger.debug "Get Blob #{name} properties in container #{container_name}."
|
8
|
+
begin
|
9
|
+
blob_properties = @blob_client.get_blob_properties(container_name, name, options)
|
10
|
+
Fog::Logger.debug "Getting properties of blob #{name} successfully."
|
11
|
+
blob_properties
|
12
|
+
rescue Azure::Core::Http::HTTPError => ex
|
13
|
+
raise "Exception in getting properties of blob #{name}: #{ex.inspect}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
# This class provides the mock implementation for unit tests.
|
18
|
+
class Mock
|
19
|
+
def get_blob_properties(_container_name, name, _options = {})
|
20
|
+
{
|
21
|
+
'name' => name,
|
22
|
+
'snapshot' => nil,
|
23
|
+
'metadata' => {},
|
24
|
+
'properties' =>
|
25
|
+
{
|
26
|
+
'last_modified' => 'Mon, 04 Jul 2016 09:30:31 GMT',
|
27
|
+
'etag' => '0x8D3A3EDD7C2B777',
|
28
|
+
'lease_status' => 'unlocked',
|
29
|
+
'lease_state' => 'available',
|
30
|
+
'lease_duration' => nil,
|
31
|
+
'content_length' => 4_194_304,
|
32
|
+
'content_type' => 'application/octet-stream',
|
33
|
+
'content_encoding' => nil,
|
34
|
+
'content_language' => nil,
|
35
|
+
'content_disposition' => nil,
|
36
|
+
'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==',
|
37
|
+
'cache_control' => nil,
|
38
|
+
'sequence_number' => 0,
|
39
|
+
'blob_type' => 'PageBlob',
|
40
|
+
'copy_id' => '095adc3b-e277-4c3d-97e0-0abca881f60c',
|
41
|
+
'copy_status' => 'success',
|
42
|
+
'copy_source' => 'https://testaccount.blob.core.windows.net/testblob/4m?snapshot=2016-02-04T08%3A35%3A50.3157696Z',
|
43
|
+
'copy_progress' => '4194304/4194304',
|
44
|
+
'copy_completion_time' => 'Thu, 04 Feb 2016 08:35:52 GMT',
|
45
|
+
'copy_status_description' => nil,
|
46
|
+
'accept_ranges' => 0
|
47
|
+
}
|
48
|
+
}
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -3,11 +3,11 @@ module Fog
|
|
3
3
|
class AzureRM
|
4
4
|
# This class provides the actual implementation for service calls.
|
5
5
|
class Real
|
6
|
-
def get_container_metadata(name)
|
6
|
+
def get_container_metadata(name, options = {})
|
7
7
|
msg = "Getting Container #{name} metadata."
|
8
8
|
Fog::Logger.debug msg
|
9
9
|
begin
|
10
|
-
container = @blob_client.get_container_metadata(name)
|
10
|
+
container = @blob_client.get_container_metadata(name, options)
|
11
11
|
rescue Azure::Core::Http::HTTPError => ex
|
12
12
|
raise_azure_exception(ex, msg)
|
13
13
|
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class AzureRM
|
4
|
+
# This class provides the actual implemention for service calls.
|
5
|
+
class Real
|
6
|
+
def list_blobs(container_name, options = {})
|
7
|
+
Fog::Logger.debug "Listing blobs in container: #{container_name}"
|
8
|
+
begin
|
9
|
+
blobs = @blob_client.list_blobs(container_name, options)
|
10
|
+
Fog::Logger.debug "Listing blobs in container: #{container_name} successfully."
|
11
|
+
blobs
|
12
|
+
rescue Azure::Core::Http::HTTPError => ex
|
13
|
+
raise "Exception in listing blobs: #{ex.inspect}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# This class provides the mock implementation for unit tests.
|
19
|
+
class Mock
|
20
|
+
def list_blobs(*)
|
21
|
+
Fog::Logger.debug 'Listing blobs in container successfully.'
|
22
|
+
[
|
23
|
+
{
|
24
|
+
'name' => 'testblob1',
|
25
|
+
'properties' =>
|
26
|
+
{
|
27
|
+
'last_modified' => 'Mon, 04 Jul 2016 02:50:20 GMT',
|
28
|
+
'etag' => '0x8D3A3B5F017F52D',
|
29
|
+
'lease_status' => 'unlocked',
|
30
|
+
'lease_state' => 'available',
|
31
|
+
'content_length' => 4_194_304,
|
32
|
+
'content_type' => 'application/octet-stream',
|
33
|
+
'content_encoding' => nil,
|
34
|
+
'content_language' => nil,
|
35
|
+
'content_disposition' => nil,
|
36
|
+
'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==',
|
37
|
+
'cache_control' => nil,
|
38
|
+
'sequence_number' => 0,
|
39
|
+
'blob_type' => 'PageBlob',
|
40
|
+
'copy_id' => '095adc3b-e277-4c3d-97e0-0abca881f60c',
|
41
|
+
'copy_status' => 'success',
|
42
|
+
'copy_source' => 'https://testaccount.blob.core.windows.net/testblob/testblob1?snapshot=2016-02-04T08%3A35%3A50.3256874Z',
|
43
|
+
'copy_progress' => '4194304/4194304',
|
44
|
+
'copy_completion_time' => 'Thu, 04 Feb 2016 08:35:52 GMT',
|
45
|
+
'copy_status_description' => nil,
|
46
|
+
'accept_ranges' => 0
|
47
|
+
},
|
48
|
+
'metadata' => {}
|
49
|
+
},
|
50
|
+
{
|
51
|
+
'name' => 'testblob2',
|
52
|
+
'properties' =>
|
53
|
+
{
|
54
|
+
'last_modified' => 'Tue, 04 Aug 2015 06:02:08 GMT',
|
55
|
+
'etag' => '0x8D29C92173526C8',
|
56
|
+
'lease_status' => 'unlocked',
|
57
|
+
'lease_state' => 'available',
|
58
|
+
'content_length' => 4_194_304,
|
59
|
+
'content_type' => 'application/octet-stream',
|
60
|
+
'content_encoding' => nil,
|
61
|
+
'content_language' => nil,
|
62
|
+
'content_disposition' => nil,
|
63
|
+
'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==',
|
64
|
+
'cache_control' => nil,
|
65
|
+
'sequence_number' => 0,
|
66
|
+
'blob_type' => 'PageBlob',
|
67
|
+
'copy_id' => '0abcdc3b-4c3d-e277-97e0-0abca881f60c',
|
68
|
+
'copy_status' => 'success',
|
69
|
+
'copy_source' => 'https://testaccount.blob.core.windows.net/testblob/testblob2?snapshot=2016-02-04T08%3A35%3A55.3157696Z',
|
70
|
+
'copy_progress' => '4194304/4194304',
|
71
|
+
'copy_completion_time' => 'Thu, 04 Feb 2016 08:40:52 GMT',
|
72
|
+
'copy_status_description' => nil,
|
73
|
+
'accept_ranges' => 0
|
74
|
+
},
|
75
|
+
'metadata' => {}
|
76
|
+
}
|
77
|
+
]
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -4,7 +4,7 @@ module Fog
|
|
4
4
|
# This class provides the actual implementation for service calls.
|
5
5
|
class Real
|
6
6
|
def list_containers(options = {})
|
7
|
-
msg =
|
7
|
+
msg = 'Listing containers.'
|
8
8
|
Fog::Logger.debug msg
|
9
9
|
begin
|
10
10
|
containers = @blob_client.list_containers(options)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class AzureRM
|
4
|
+
# This class provides the actual implementation for service calls.
|
5
|
+
class Real
|
6
|
+
def release_blob_lease(container_name, name, lease_id, options = {})
|
7
|
+
msg = "Releasing blob: #{name} of container #{container_name} having lease_id #{lease_id}"
|
8
|
+
Fog::Logger.debug msg
|
9
|
+
begin
|
10
|
+
@blob_client.release_blob_lease(container_name, name, lease_id, options)
|
11
|
+
rescue Azure::Core::Http::HTTPError => ex
|
12
|
+
raise_azure_exception(ex, msg)
|
13
|
+
end
|
14
|
+
Fog::Logger.debug "Blob #{name} released successfully."
|
15
|
+
true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# This class provides the mock implementation for unit tests.
|
20
|
+
class Mock
|
21
|
+
def release_blob_lease(*)
|
22
|
+
true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class AzureRM
|
4
|
+
# This class provides the actual implementation for service calls.
|
5
|
+
class Real
|
6
|
+
def release_container_lease(name, lease_id, options={})
|
7
|
+
msg = "Releasing container: #{name} having lease_id #{lease_id}"
|
8
|
+
Fog::Logger.debug msg
|
9
|
+
begin
|
10
|
+
@blob_client.release_container_lease(name, lease_id, options)
|
11
|
+
rescue Azure::Core::Http::HTTPError => ex
|
12
|
+
raise_azure_exception(ex, msg)
|
13
|
+
end
|
14
|
+
Fog::Logger.debug "Container #{name} released successfully."
|
15
|
+
true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# This class provides the mock implementation for unit tests.
|
20
|
+
class Mock
|
21
|
+
def release_container_lease(*)
|
22
|
+
true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -3,11 +3,11 @@ module Fog
|
|
3
3
|
class AzureRM
|
4
4
|
# This class provides the actual implementation for service calls.
|
5
5
|
class Real
|
6
|
-
def set_blob_metadata(container_name, name, metadata)
|
6
|
+
def set_blob_metadata(container_name, name, metadata, options = {})
|
7
7
|
msg = "Setting Blob #{name} metadata in a container #{container_name}."
|
8
8
|
Fog::Logger.debug msg
|
9
9
|
begin
|
10
|
-
@blob_client.set_blob_metadata(container_name, name, metadata)
|
10
|
+
@blob_client.set_blob_metadata(container_name, name, metadata, options)
|
11
11
|
rescue Azure::Core::Http::HTTPError => ex
|
12
12
|
raise_azure_exception(ex, msg)
|
13
13
|
end
|
@@ -17,8 +17,8 @@ module Fog
|
|
17
17
|
end
|
18
18
|
# This class provides the mock implementation for unit tests.
|
19
19
|
class Mock
|
20
|
-
def set_blob_metadata(
|
21
|
-
Fog::Logger.debug "Set Blob metadata in a container successfully."
|
20
|
+
def set_blob_metadata(container_name, name, metadata, _options = {})
|
21
|
+
Fog::Logger.debug "Set Blob #{name} metadata #{metadata} in a container #{container_name} successfully."
|
22
22
|
true
|
23
23
|
end
|
24
24
|
end
|