fog-azure-rm 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/README.md +2 -1
- data/fog-azure-rm.gemspec +11 -9
- data/lib/fog/azurerm.rb +1 -0
- data/lib/fog/azurerm/compute.rb +3 -3
- data/lib/fog/azurerm/config.rb +33 -0
- data/lib/fog/azurerm/credentials.rb +1 -1
- data/lib/fog/azurerm/dns.rb +2 -2
- data/lib/fog/azurerm/docs/storage.md +120 -66
- data/lib/fog/azurerm/models/application_gateway/gateway.rb +30 -31
- data/lib/fog/azurerm/models/application_gateway/gateways.rb +4 -4
- data/lib/fog/azurerm/models/compute/availability_sets.rb +4 -4
- data/lib/fog/azurerm/models/compute/server.rb +14 -14
- data/lib/fog/azurerm/models/compute/servers.rb +4 -4
- data/lib/fog/azurerm/models/compute/virtual_machine_extension.rb +3 -5
- data/lib/fog/azurerm/models/compute/virtual_machine_extensions.rb +5 -5
- data/lib/fog/azurerm/models/dns/record_sets.rb +4 -4
- data/lib/fog/azurerm/models/dns/zones.rb +4 -4
- data/lib/fog/azurerm/models/network/express_route_circuit.rb +2 -5
- data/lib/fog/azurerm/models/network/express_route_circuit_authorization.rb +1 -1
- data/lib/fog/azurerm/models/network/express_route_circuit_authorizations.rb +4 -4
- data/lib/fog/azurerm/models/network/express_route_circuit_peering.rb +3 -5
- data/lib/fog/azurerm/models/network/express_route_circuit_peerings.rb +4 -4
- data/lib/fog/azurerm/models/network/express_route_circuits.rb +4 -4
- data/lib/fog/azurerm/models/network/express_route_service_providers.rb +2 -2
- data/lib/fog/azurerm/models/network/load_balancers.rb +5 -5
- data/lib/fog/azurerm/models/network/local_network_gateway.rb +1 -1
- data/lib/fog/azurerm/models/network/local_network_gateways.rb +4 -4
- data/lib/fog/azurerm/models/network/network_interfaces.rb +5 -5
- data/lib/fog/azurerm/models/network/network_security_groups.rb +5 -5
- data/lib/fog/azurerm/models/network/network_security_rule.rb +3 -4
- data/lib/fog/azurerm/models/network/network_security_rules.rb +4 -4
- data/lib/fog/azurerm/models/network/public_ips.rb +4 -4
- data/lib/fog/azurerm/models/network/subnets.rb +4 -4
- data/lib/fog/azurerm/models/network/virtual_network_gateway.rb +6 -7
- data/lib/fog/azurerm/models/network/virtual_network_gateway_connection.rb +5 -5
- data/lib/fog/azurerm/models/network/virtual_network_gateway_connections.rb +4 -4
- data/lib/fog/azurerm/models/network/virtual_network_gateways.rb +4 -4
- data/lib/fog/azurerm/models/network/virtual_networks.rb +4 -4
- data/lib/fog/azurerm/models/resources/azure_resources.rb +2 -2
- data/lib/fog/azurerm/models/resources/deployments.rb +4 -4
- data/lib/fog/azurerm/models/resources/resource_groups.rb +4 -4
- data/lib/fog/azurerm/models/sql/firewall_rule.rb +1 -1
- data/lib/fog/azurerm/models/sql/firewall_rules.rb +4 -4
- data/lib/fog/azurerm/models/sql/sql_database.rb +28 -24
- data/lib/fog/azurerm/models/sql/sql_databases.rb +5 -6
- data/lib/fog/azurerm/models/sql/sql_servers.rb +4 -4
- data/lib/fog/azurerm/models/storage/directories.rb +49 -24
- data/lib/fog/azurerm/models/storage/directory.rb +126 -40
- data/lib/fog/azurerm/models/storage/file.rb +226 -114
- data/lib/fog/azurerm/models/storage/files.rb +168 -13
- data/lib/fog/azurerm/models/storage/recovery_vault.rb +1 -1
- data/lib/fog/azurerm/models/storage/recovery_vaults.rb +4 -4
- data/lib/fog/azurerm/models/storage/storage_account.rb +5 -5
- data/lib/fog/azurerm/models/storage/storage_accounts.rb +4 -4
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_end_point.rb +1 -1
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_end_points.rb +4 -4
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb +4 -4
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profiles.rb +4 -4
- data/lib/fog/azurerm/network.rb +1 -1
- data/lib/fog/azurerm/requests/compute/create_virtual_machine.rb +17 -13
- data/lib/fog/azurerm/requests/network/list_virtual_networks.rb +1 -1
- data/lib/fog/azurerm/requests/resources/create_deployment.rb +1 -1
- data/lib/fog/azurerm/requests/resources/create_resource_group.rb +1 -1
- data/lib/fog/azurerm/requests/resources/delete_deployment.rb +1 -1
- data/lib/fog/azurerm/requests/resources/delete_resource_group.rb +1 -1
- data/lib/fog/azurerm/requests/resources/get_deployment.rb +1 -1
- data/lib/fog/azurerm/requests/resources/get_resource_group.rb +1 -1
- data/lib/fog/azurerm/requests/resources/list_deployments.rb +1 -1
- data/lib/fog/azurerm/requests/resources/list_resource_groups.rb +1 -1
- data/lib/fog/azurerm/requests/resources/list_tagged_resources.rb +1 -1
- data/lib/fog/azurerm/requests/resources/tag_resource.rb +1 -1
- data/lib/fog/azurerm/requests/sql/create_or_update_database.rb +3 -3
- data/lib/fog/azurerm/requests/sql/create_or_update_firewall_rule.rb +3 -3
- data/lib/fog/azurerm/requests/sql/create_or_update_sql_server.rb +3 -3
- data/lib/fog/azurerm/requests/sql/delete_database.rb +2 -2
- data/lib/fog/azurerm/requests/sql/delete_firewall_rule.rb +4 -4
- data/lib/fog/azurerm/requests/sql/delete_sql_server.rb +4 -4
- data/lib/fog/azurerm/requests/sql/get_database.rb +3 -3
- data/lib/fog/azurerm/requests/sql/get_firewall_rule.rb +3 -3
- data/lib/fog/azurerm/requests/sql/get_sql_server.rb +3 -3
- data/lib/fog/azurerm/requests/sql/list_databases.rb +3 -3
- data/lib/fog/azurerm/requests/sql/list_firewall_rules.rb +3 -3
- data/lib/fog/azurerm/requests/sql/list_sql_servers.rb +3 -3
- data/lib/fog/azurerm/requests/storage/acquire_blob_lease.rb +5 -2
- data/lib/fog/azurerm/requests/storage/acquire_container_lease.rb +5 -2
- data/lib/fog/azurerm/requests/storage/commit_blob_blocks.rb +30 -0
- data/lib/fog/azurerm/requests/storage/compare_container_blobs.rb +148 -0
- data/lib/fog/azurerm/requests/storage/copy_blob.rb +8 -8
- data/lib/fog/azurerm/requests/storage/copy_blob_from_uri.rb +8 -8
- data/lib/fog/azurerm/requests/storage/create_block_blob.rb +108 -0
- data/lib/fog/azurerm/requests/storage/create_container.rb +12 -10
- data/lib/fog/azurerm/requests/storage/create_disk.rb +45 -19
- data/lib/fog/azurerm/requests/storage/create_or_update_recovery_vault.rb +2 -2
- data/lib/fog/azurerm/requests/storage/create_page_blob.rb +31 -0
- data/lib/fog/azurerm/requests/storage/create_storage_account.rb +2 -2
- data/lib/fog/azurerm/requests/storage/delete_blob.rb +10 -5
- data/lib/fog/azurerm/requests/storage/delete_container.rb +6 -2
- data/lib/fog/azurerm/requests/storage/delete_disk.rb +19 -16
- data/lib/fog/azurerm/requests/storage/get_all_backup_jobs.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_backup_container.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_backup_item.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_backup_job_for_vm.rb +1 -1
- data/lib/fog/azurerm/requests/storage/get_backup_protection_policy.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_blob.rb +163 -0
- data/lib/fog/azurerm/requests/storage/get_blob_http_url.rb +39 -0
- data/lib/fog/azurerm/requests/storage/get_blob_https_url.rb +39 -0
- data/lib/fog/azurerm/requests/storage/get_blob_properties.rb +37 -35
- data/lib/fog/azurerm/requests/storage/get_blob_url.rb +28 -0
- data/lib/fog/azurerm/requests/storage/get_container_acl.rb +30 -0
- data/lib/fog/azurerm/requests/storage/get_container_properties.rb +16 -12
- data/lib/fog/azurerm/requests/storage/get_container_url.rb +34 -0
- data/lib/fog/azurerm/requests/storage/get_recovery_vault.rb +2 -2
- data/lib/fog/azurerm/requests/storage/get_storage_access_keys.rb +4 -3
- data/lib/fog/azurerm/requests/storage/get_storage_account.rb +2 -2
- data/lib/fog/azurerm/requests/storage/list_blobs.rb +110 -24
- data/lib/fog/azurerm/requests/storage/list_containers.rb +46 -23
- data/lib/fog/azurerm/requests/storage/list_recovery_vaults.rb +2 -2
- data/lib/fog/azurerm/requests/storage/list_storage_account_for_rg.rb +2 -2
- data/lib/fog/azurerm/requests/storage/list_storage_accounts.rb +2 -2
- data/lib/fog/azurerm/requests/storage/multipart_save_block_blob.rb +110 -0
- data/lib/fog/azurerm/requests/storage/put_blob_block.rb +30 -0
- data/lib/fog/azurerm/requests/storage/{set_blob_metadata.rb → put_blob_metadata.rb} +7 -3
- data/lib/fog/azurerm/requests/storage/put_blob_pages.rb +30 -0
- data/lib/fog/azurerm/requests/storage/put_blob_properties.rb +31 -0
- data/lib/fog/azurerm/requests/storage/put_container_acl.rb +31 -0
- data/lib/fog/azurerm/requests/storage/{set_container_metadata.rb → put_container_metadata.rb} +7 -3
- data/lib/fog/azurerm/requests/storage/release_blob_lease.rb +4 -1
- data/lib/fog/azurerm/requests/storage/release_container_lease.rb +4 -1
- data/lib/fog/azurerm/requests/storage/save_page_blob.rb +111 -0
- data/lib/fog/azurerm/requests/storage/start_backup.rb +1 -1
- data/lib/fog/azurerm/requests/storage/wait_blob_copy_operation_to_finish.rb +56 -0
- data/lib/fog/azurerm/resources.rb +2 -2
- data/lib/fog/azurerm/storage.rb +33 -19
- data/lib/fog/azurerm/traffic_manager.rb +1 -1
- data/lib/fog/azurerm/utilities/general.rb +70 -3
- data/lib/fog/azurerm/version.rb +1 -1
- data/rake-script.sh +5 -2
- data/test/api_stub/models/application_gateway/gateway.rb +1 -1
- data/test/api_stub/models/compute/server.rb +1 -1
- data/test/api_stub/models/dns/record_set.rb +2 -2
- data/test/api_stub/models/dns/zone.rb +1 -1
- data/test/api_stub/models/network/express_route_circuit.rb +1 -1
- data/test/api_stub/models/network/express_route_circuit_authorization.rb +1 -1
- data/test/api_stub/models/network/express_route_circuit_peering.rb +1 -1
- data/test/api_stub/models/network/express_route_service_provider.rb +1 -1
- data/test/api_stub/models/network/load_balancer.rb +1 -1
- data/test/api_stub/models/network/network_interface.rb +1 -1
- data/test/api_stub/models/network/network_security_group.rb +1 -1
- data/test/api_stub/models/network/network_security_rule.rb +1 -1
- data/test/api_stub/models/network/public_ip.rb +1 -1
- data/test/api_stub/models/network/subnet.rb +1 -1
- data/test/api_stub/models/network/virtual_network.rb +1 -1
- data/test/api_stub/models/network/virtual_network_gateway.rb +1 -1
- data/test/api_stub/models/network/virtual_network_gateway_connection.rb +1 -1
- data/test/api_stub/models/resources/resource.rb +2 -2
- data/test/api_stub/models/resources/resource_group.rb +1 -1
- data/test/api_stub/models/storage/directory.rb +148 -62
- data/test/api_stub/models/storage/file.rb +122 -119
- data/test/api_stub/models/traffic_manager/traffic_manager_end_point.rb +1 -1
- data/test/api_stub/models/traffic_manager/traffic_manager_profile.rb +1 -1
- data/test/api_stub/requests/application_gateway/gateway.rb +2 -2
- data/test/api_stub/requests/compute/availability_set.rb +3 -3
- data/test/api_stub/requests/compute/virtual_machine.rb +9 -9
- data/test/api_stub/requests/dns/record_set.rb +3 -3
- data/test/api_stub/requests/dns/zone.rb +18 -18
- data/test/api_stub/requests/network/express_route_circuit.rb +2 -2
- data/test/api_stub/requests/network/express_route_circuit_authorization.rb +1 -1
- data/test/api_stub/requests/network/express_route_circuit_peering.rb +2 -2
- data/test/api_stub/requests/network/express_route_service_provider.rb +1 -1
- data/test/api_stub/requests/network/load_balancer.rb +2 -2
- data/test/api_stub/requests/network/network_interface.rb +4 -4
- data/test/api_stub/requests/network/network_security_group.rb +3 -3
- data/test/api_stub/requests/network/network_security_rule.rb +2 -2
- data/test/api_stub/requests/network/public_ip.rb +2 -2
- data/test/api_stub/requests/network/subnet.rb +2 -2
- data/test/api_stub/requests/network/virtual_network.rb +2 -2
- data/test/api_stub/requests/network/virtual_network_gateway.rb +2 -2
- data/test/api_stub/requests/network/virtual_network_gateway_connection.rb +3 -3
- data/test/api_stub/requests/resources/resource.rb +2 -2
- data/test/api_stub/requests/resources/resource_group.rb +2 -2
- data/test/api_stub/requests/storage/directory.rb +59 -65
- data/test/api_stub/requests/storage/file.rb +183 -113
- data/test/api_stub/requests/storage/storageaccount.rb +1 -1
- data/test/api_stub/requests/traffic_manager/traffic_manager_endpoint.rb +1 -1
- data/test/api_stub/requests/traffic_manager/traffic_manager_profile.rb +2 -2
- data/test/integration/Virtual_network_gateway_connection.rb +189 -182
- data/test/integration/application_gateway.rb +208 -183
- data/test/integration/availability_set.rb +44 -27
- data/test/integration/blob.rb +293 -169
- data/test/integration/container.rb +93 -42
- data/test/integration/data_disk.rb +57 -46
- data/test/integration/deployment.rb +40 -32
- data/test/integration/express_route_circuit.rb +86 -82
- data/test/integration/external_load_balancer.rb +108 -100
- data/test/integration/internal_load_balancer.rb +115 -106
- data/test/integration/local_network_gateway.rb +46 -39
- data/test/integration/network_interface.rb +119 -107
- data/test/integration/network_security_group.rb +86 -74
- data/test/integration/network_security_rule.rb +65 -57
- data/test/integration/public_ip.rb +50 -42
- data/test/integration/record_set.rb +90 -78
- data/test/integration/resource_group.rb +26 -14
- data/test/integration/resource_tag.rb +56 -45
- data/test/integration/server.rb +152 -135
- data/test/integration/server_custom_image.rb +85 -76
- data/test/integration/sql_server.rb +130 -117
- data/test/integration/storage_account.rb +82 -70
- data/test/integration/subnet.rb +87 -74
- data/test/integration/traffic_manager.rb +86 -74
- data/test/integration/virtual_machine_extension.rb +115 -106
- data/test/integration/virtual_network.rb +121 -100
- data/test/integration/virtual_network_gateway.rb +86 -79
- data/test/integration/virtual_network_gateway_connection_to_express_route.rb +94 -87
- data/test/integration/zone.rb +36 -28
- data/test/models/storage/test_directories.rb +26 -71
- data/test/models/storage/test_directory.rb +111 -58
- data/test/models/storage/test_file.rb +179 -143
- data/test/models/storage/test_files.rb +197 -30
- data/test/models/storage/test_storage_account.rb +1 -1
- data/test/requests/compute/test_attach_data_disk_to_vm.rb +15 -17
- data/test/requests/storage/test_acquire_blob_lease.rb +23 -4
- data/test/requests/storage/test_acquire_container_lease.rb +24 -5
- data/test/requests/storage/test_commit_blob_blocks.rb +34 -0
- data/test/requests/storage/test_compare_container_blobs.rb +36 -0
- data/test/requests/storage/test_copy_blob.rb +22 -3
- data/test/requests/storage/test_copy_blob_from_uri.rb +23 -4
- data/test/requests/storage/test_create_block_blob.rb +80 -0
- data/test/requests/storage/test_create_container.rb +18 -13
- data/test/requests/storage/test_create_disk.rb +57 -4
- data/test/requests/storage/test_create_page_blob.rb +34 -0
- data/test/requests/storage/test_delete_blob.rb +25 -5
- data/test/requests/storage/test_delete_container.rb +21 -9
- data/test/requests/storage/test_delete_disk.rb +14 -7
- data/test/requests/storage/test_get_blob.rb +141 -0
- data/test/requests/storage/test_get_blob_http_url.rb +30 -0
- data/test/requests/storage/test_get_blob_https_url.rb +30 -0
- data/test/requests/storage/test_get_blob_properties.rb +29 -7
- data/test/requests/storage/test_get_blob_url.rb +33 -0
- data/test/requests/storage/test_get_container_acl.rb +37 -0
- data/test/requests/storage/test_get_container_properties.rb +25 -11
- data/test/requests/storage/test_get_container_url.rb +33 -0
- data/test/requests/storage/test_list_blobs.rb +77 -0
- data/test/requests/storage/test_list_containers.rb +38 -7
- data/test/requests/storage/test_multipart_save_block_blob.rb +105 -0
- data/test/requests/storage/test_put_blob_block.rb +34 -0
- data/test/requests/storage/test_put_blob_metadata.rb +36 -0
- data/test/requests/storage/test_put_blob_pages.rb +34 -0
- data/test/requests/storage/test_put_blob_properties.rb +39 -0
- data/test/requests/storage/test_put_container_acl.rb +34 -0
- data/test/requests/storage/test_put_container_metadata.rb +36 -0
- data/test/requests/storage/test_release_blob_lease.rb +20 -2
- data/test/requests/storage/test_release_container_lease.rb +21 -3
- data/test/requests/storage/test_save_page_blob.rb +115 -0
- data/test/requests/storage/test_wait_blob_copy_operation_to_finish.rb +148 -0
- data/test/test_helper.rb +34 -21
- metadata +92 -46
- data/lib/fog/azurerm/requests/storage/check_blob_exist.rb +0 -25
- data/lib/fog/azurerm/requests/storage/compare_blob.rb +0 -73
- data/lib/fog/azurerm/requests/storage/download_blob_to_file.rb +0 -56
- data/lib/fog/azurerm/requests/storage/get_blob_metadata.rb +0 -59
- data/lib/fog/azurerm/requests/storage/get_container_access_control_list.rb +0 -30
- data/lib/fog/azurerm/requests/storage/get_container_metadata.rb +0 -32
- data/lib/fog/azurerm/requests/storage/set_blob_properties.rb +0 -26
- data/lib/fog/azurerm/requests/storage/upload_block_blob_from_file.rb +0 -60
- data/test/requests/storage/test_check_blob_exist.rb +0 -17
- data/test/requests/storage/test_compare_blob.rb +0 -17
- data/test/requests/storage/test_download_blob_to_file.rb +0 -25
- data/test/requests/storage/test_get_blob_metadata.rb +0 -18
- data/test/requests/storage/test_get_container_access_control_list.rb +0 -31
- data/test/requests/storage/test_get_container_metadata.rb +0 -18
- data/test/requests/storage/test_list_blobs_in_container.rb +0 -23
- data/test/requests/storage/test_set_blob_metadata.rb +0 -17
- data/test/requests/storage/test_set_blob_properties.rb +0 -16
- data/test/requests/storage/test_set_container_metadata.rb +0 -17
- data/test/requests/storage/test_upload_block_blob_from_file.rb +0 -23
@@ -35,7 +35,7 @@ module Fog
|
|
35
35
|
end
|
36
36
|
|
37
37
|
credentials = Fog::Credentials::AzureRM.get_credentials(options[:tenant_id], options[:client_id], options[:client_secret])
|
38
|
-
@traffic_mgmt_client = ::Azure::ARM::TrafficManager::TrafficManagerManagementClient.new(credentials)
|
38
|
+
@traffic_mgmt_client = ::Azure::ARM::TrafficManager::TrafficManagerManagementClient.new(credentials, resource_manager_endpoint_url)
|
39
39
|
@traffic_mgmt_client.subscription_id = options[:subscription_id]
|
40
40
|
end
|
41
41
|
end
|
@@ -10,7 +10,7 @@ end
|
|
10
10
|
|
11
11
|
# Pick Virtual Machine name from Virtual Machine Extension Id(String)
|
12
12
|
def get_virtual_machine_from_id(vme_id)
|
13
|
-
vme_id.split('/')[
|
13
|
+
vme_id.split('/')[VM_NAME_POSITION]
|
14
14
|
end
|
15
15
|
|
16
16
|
# Extract Endpoint type from (String)
|
@@ -53,9 +53,9 @@ end
|
|
53
53
|
|
54
54
|
def raise_azure_exception(exception, msg)
|
55
55
|
message = if exception.respond_to? 'body'
|
56
|
-
"Exception in #{msg} #{exception.body['error']['message'] unless exception.body['error']['message'].nil?} Type: #{exception.class}
|
56
|
+
"Exception in #{msg} #{exception.body['error']['message'] unless exception.body['error']['message'].nil?} Type: #{exception.class}\n#{exception.backtrace.join("\n")}"
|
57
57
|
else
|
58
|
-
exception.inspect
|
58
|
+
"#{exception.inspect}\n#{exception.backtrace.join("\n")}"
|
59
59
|
end
|
60
60
|
Fog::Logger.debug exception.backtrace
|
61
61
|
raise message
|
@@ -81,3 +81,70 @@ end
|
|
81
81
|
def random_string(length)
|
82
82
|
(0...length).map { ('a'..'z').to_a[rand(26)] }.join
|
83
83
|
end
|
84
|
+
|
85
|
+
def get_blob_link(storage_account_name)
|
86
|
+
"http://#{storage_account_name}.blob.core.windows.net"
|
87
|
+
end
|
88
|
+
|
89
|
+
def active_directory_service_settings
|
90
|
+
case CLOUD
|
91
|
+
when 'AzureChina'
|
92
|
+
MsRestAzure::ActiveDirectoryServiceSettings.get_azure_china_settings
|
93
|
+
when 'AzureGermanCloud'
|
94
|
+
MsRestAzure::ActiveDirectoryServiceSettings.get_azure_german_settings
|
95
|
+
when 'AzureUSGovernment'
|
96
|
+
MsRestAzure::ActiveDirectoryServiceSettings.get_azure_us_government_settings
|
97
|
+
else
|
98
|
+
MsRestAzure::ActiveDirectoryServiceSettings.get_azure_settings
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def resource_manager_endpoint_url
|
103
|
+
case CLOUD
|
104
|
+
when 'AzureChina'
|
105
|
+
AZURE_CHINA_RM_ENDPOINT_URL
|
106
|
+
when 'AzureGermanCloud'
|
107
|
+
GERMAN_CLOUD_RM_ENDPOINT_URL
|
108
|
+
when 'AzureUSGovernment'
|
109
|
+
US_GOVERNMENT_RM_ENDPOINT_URL
|
110
|
+
else
|
111
|
+
AZURE_GLOBAL_RM_ENDPOINT_URL
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def current_time
|
116
|
+
time = Time.now.to_f.to_s
|
117
|
+
time.split(/\W+/).join
|
118
|
+
end
|
119
|
+
|
120
|
+
# Parse storage blob/container to a hash
|
121
|
+
def parse_storage_object(object)
|
122
|
+
data = {}
|
123
|
+
if object.is_a? Hash
|
124
|
+
object.each do |k, v|
|
125
|
+
if k == 'properties'
|
126
|
+
v.each do |j, l|
|
127
|
+
data[j] = l
|
128
|
+
end
|
129
|
+
else
|
130
|
+
data[k] = v
|
131
|
+
end
|
132
|
+
end
|
133
|
+
else
|
134
|
+
object.instance_variables.each do |p|
|
135
|
+
kname = p.to_s.delete('@')
|
136
|
+
if kname == 'properties'
|
137
|
+
properties = object.instance_variable_get(p)
|
138
|
+
properties.each do |k, v|
|
139
|
+
data[k.to_s] = v
|
140
|
+
end
|
141
|
+
else
|
142
|
+
data[kname] = object.instance_variable_get(p)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
data['last_modified'] = Time.parse(data['last_modified'])
|
148
|
+
data['etag'].delete!('"')
|
149
|
+
data
|
150
|
+
end
|
data/lib/fog/azurerm/version.rb
CHANGED
data/rake-script.sh
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
#!/bin/bash
|
2
|
-
if [ $TRAVIS_PULL_REQUEST != "true"]
|
2
|
+
if [ $TRAVIS_PULL_REQUEST != "true" ]
|
3
3
|
then
|
4
4
|
rake cc_coverage
|
5
|
-
|
5
|
+
export CODECLIMATE_REPO_TOKEN="b1401494baa004d90402414cb33a7fc6420fd3693e60c677a120ddefd7d84cfd"
|
6
|
+
codeclimate-test-reporter --directory /home/travis/build/fog/fog-azure-rm/coverage
|
6
7
|
else
|
7
8
|
rake cc_coverage
|
9
|
+
export CODECLIMATE_REPO_TOKEN="b1401494baa004d90402414cb33a7fc6420fd3693e60c677a120ddefd7d84cfd"
|
10
|
+
codeclimate-test-reporter --directory /home/travis/build/fog/fog-azure-rm/coverage
|
8
11
|
fi
|
@@ -129,7 +129,7 @@ module ApiStub
|
|
129
129
|
}
|
130
130
|
}'
|
131
131
|
gateway_mapper = Azure::ARM::Network::Models::ApplicationGateway.mapper
|
132
|
-
gateway_client.deserialize(gateway_mapper, JSON.
|
132
|
+
gateway_client.deserialize(gateway_mapper, Fog::JSON.decode(gateway), 'result.body')
|
133
133
|
end
|
134
134
|
|
135
135
|
def self.ssl_certifcate
|
@@ -121,7 +121,7 @@ module ApiStub
|
|
121
121
|
]
|
122
122
|
}'
|
123
123
|
vm_mapper = Azure::ARM::Compute::Models::VirtualMachineSizeListResult.mapper
|
124
|
-
compute_client.deserialize(vm_mapper, JSON.
|
124
|
+
compute_client.deserialize(vm_mapper, Fog::JSON.decode(body), 'result.body').value
|
125
125
|
end
|
126
126
|
|
127
127
|
def self.attach_data_disk_response(compute_client)
|
@@ -27,7 +27,7 @@ module ApiStub
|
|
27
27
|
}
|
28
28
|
}'
|
29
29
|
record_set_mapper = Azure::ARM::Dns::Models::RecordSet.mapper
|
30
|
-
dns_client.deserialize(record_set_mapper, JSON.
|
30
|
+
dns_client.deserialize(record_set_mapper, Fog::JSON.decode(record_set), 'result.body')
|
31
31
|
end
|
32
32
|
|
33
33
|
def self.response_for_cname(dns_client)
|
@@ -49,7 +49,7 @@ module ApiStub
|
|
49
49
|
}
|
50
50
|
}'
|
51
51
|
cname_record_mapper = Azure::ARM::Dns::Models::RecordSet.mapper
|
52
|
-
dns_client.deserialize(cname_record_mapper, JSON.
|
52
|
+
dns_client.deserialize(cname_record_mapper, Fog::JSON.decode(cname_record), 'result.body')
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -21,7 +21,7 @@ module ApiStub
|
|
21
21
|
"resource_group": "fog-test-rg"
|
22
22
|
}'
|
23
23
|
zone_mapper = Azure::ARM::Dns::Models::Zone.mapper
|
24
|
-
dns_client.deserialize(zone_mapper, JSON.
|
24
|
+
dns_client.deserialize(zone_mapper, Fog::JSON.decode(zone), 'result.body')
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -39,7 +39,7 @@ module ApiStub
|
|
39
39
|
}
|
40
40
|
}'
|
41
41
|
express_route_circuit_mapper = Azure::ARM::Network::Models::ExpressRouteCircuit.mapper
|
42
|
-
network_client.deserialize(express_route_circuit_mapper, JSON.
|
42
|
+
network_client.deserialize(express_route_circuit_mapper, Fog::JSON.decode(circuit), 'result.body')
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -14,7 +14,7 @@ module ApiStub
|
|
14
14
|
}'
|
15
15
|
|
16
16
|
express_route_circuit_authorization_mapper = Azure::ARM::Network::Models::ExpressRouteCircuitAuthorization.mapper
|
17
|
-
network_client.deserialize(express_route_circuit_authorization_mapper, JSON.
|
17
|
+
network_client.deserialize(express_route_circuit_authorization_mapper, Fog::JSON.decode(authorization), 'result.body')
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -25,7 +25,7 @@ module ApiStub
|
|
25
25
|
}
|
26
26
|
}'
|
27
27
|
express_route_circuit_peering_mapper = Azure::ARM::Network::Models::ExpressRouteCircuitPeering.mapper
|
28
|
-
network_client.deserialize(express_route_circuit_peering_mapper, JSON.
|
28
|
+
network_client.deserialize(express_route_circuit_peering_mapper, Fog::JSON.decode(peering), 'result.body')
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -21,7 +21,7 @@ module ApiStub
|
|
21
21
|
}
|
22
22
|
]}'
|
23
23
|
express_route_servcie_provider_mapper = Azure::ARM::Network::Models::ExpressRouteServiceProviderListResult.mapper
|
24
|
-
network_client.deserialize(express_route_servcie_provider_mapper, JSON.
|
24
|
+
network_client.deserialize(express_route_servcie_provider_mapper, Fog::JSON.decode(service_provider), 'result.body').value
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -146,7 +146,7 @@ module ApiStub
|
|
146
146
|
}
|
147
147
|
}'
|
148
148
|
load_balancer_mapper = Azure::ARM::Network::Models::LoadBalancer.mapper
|
149
|
-
network_client.deserialize(load_balancer_mapper, JSON.
|
149
|
+
network_client.deserialize(load_balancer_mapper, Fog::JSON.decode(load_balancer), 'result.body')
|
150
150
|
end
|
151
151
|
end
|
152
152
|
end
|
@@ -64,7 +64,7 @@ module ApiStub
|
|
64
64
|
}
|
65
65
|
}'
|
66
66
|
network_interface_mapper = Azure::ARM::Network::Models::NetworkInterface.mapper
|
67
|
-
network_client.deserialize(network_interface_mapper, JSON.
|
67
|
+
network_client.deserialize(network_interface_mapper, Fog::JSON.decode(nic), 'result.body')
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
@@ -69,7 +69,7 @@ module ApiStub
|
|
69
69
|
}
|
70
70
|
}'
|
71
71
|
result_mapper = Azure::ARM::Network::Models::NetworkSecurityGroup.mapper
|
72
|
-
network_client.deserialize(result_mapper, JSON.
|
72
|
+
network_client.deserialize(result_mapper, Fog::JSON.decode(nsg), 'result.body')
|
73
73
|
end
|
74
74
|
|
75
75
|
def self.security_rules_array
|
@@ -22,7 +22,7 @@ module ApiStub
|
|
22
22
|
}
|
23
23
|
}'
|
24
24
|
nsr_mapper = Azure::ARM::Network::Models::SecurityRule.mapper
|
25
|
-
network_client.deserialize(nsr_mapper, JSON.
|
25
|
+
network_client.deserialize(nsr_mapper, Fog::JSON.decode(nsr), 'result.body')
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -28,7 +28,7 @@ module ApiStub
|
|
28
28
|
}
|
29
29
|
}'
|
30
30
|
public_ip_mapper = Azure::ARM::Network::Models::PublicIPAddress.mapper
|
31
|
-
network_client.deserialize(public_ip_mapper, JSON.
|
31
|
+
network_client.deserialize(public_ip_mapper, Fog::JSON.decode(public_ip), 'result.body')
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -28,7 +28,7 @@ module ApiStub
|
|
28
28
|
}
|
29
29
|
}'
|
30
30
|
subnet_mapper = Azure::ARM::Network::Models::Subnet.mapper
|
31
|
-
network_client.deserialize(subnet_mapper, JSON.
|
31
|
+
network_client.deserialize(subnet_mapper, Fog::JSON.decode(subnet), 'result.body')
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -54,7 +54,7 @@ module ApiStub
|
|
54
54
|
}
|
55
55
|
}'
|
56
56
|
vnet_mapper = Azure::ARM::Network::Models::VirtualNetwork.mapper
|
57
|
-
network_client.deserialize(vnet_mapper, JSON.
|
57
|
+
network_client.deserialize(vnet_mapper, Fog::JSON.decode(vnet), 'result.body')
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
@@ -18,7 +18,7 @@ module ApiStub
|
|
18
18
|
}
|
19
19
|
}'
|
20
20
|
gateway_mapper = Azure::ARM::Network::Models::VirtualNetworkGateway.mapper
|
21
|
-
network_client.deserialize(gateway_mapper, JSON.
|
21
|
+
network_client.deserialize(gateway_mapper, Fog::JSON.decode(network_gateway), 'result.body')
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -23,7 +23,7 @@ module ApiStub
|
|
23
23
|
}
|
24
24
|
}'
|
25
25
|
connection_mapper = Azure::ARM::Network::Models::VirtualNetworkGatewayConnection.mapper
|
26
|
-
network_client.deserialize(connection_mapper, JSON.
|
26
|
+
network_client.deserialize(connection_mapper, Fog::JSON.decode(gateway_connection), 'result.body')
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -16,7 +16,7 @@ module ApiStub
|
|
16
16
|
"name": "free"
|
17
17
|
}
|
18
18
|
}'
|
19
|
-
JSON.
|
19
|
+
Fog::JSON.decode(body)
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.list_resources_response(client)
|
@@ -35,7 +35,7 @@ module ApiStub
|
|
35
35
|
}]
|
36
36
|
}'
|
37
37
|
result_mapper = Azure::ARM::Resources::Models::ResourceListResult.mapper
|
38
|
-
client.deserialize(result_mapper, JSON.
|
38
|
+
client.deserialize(result_mapper, Fog::JSON.decode(resources), 'result.body').value
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -16,7 +16,7 @@ module ApiStub
|
|
16
16
|
}
|
17
17
|
}'
|
18
18
|
result_mapper = Azure::ARM::Resources::Models::ResourceGroup.mapper
|
19
|
-
client.deserialize(result_mapper, JSON.
|
19
|
+
client.deserialize(result_mapper, Fog::JSON.decode(resource_group), 'result.body')
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -3,89 +3,175 @@ module ApiStub
|
|
3
3
|
module Storage
|
4
4
|
# Mock class for Data Disk Model
|
5
5
|
class Directory
|
6
|
-
def self.
|
6
|
+
def self.container
|
7
7
|
{
|
8
|
-
'
|
9
|
-
'
|
10
|
-
'
|
11
|
-
'
|
12
|
-
|
8
|
+
'name' => 'test_container',
|
9
|
+
'public_access_level' => nil,
|
10
|
+
'metadata' => {},
|
11
|
+
'properties' => {
|
12
|
+
'last_modified' => 'Mon, 04 Jul 2016 02:50:20 GMT',
|
13
|
+
'etag' => '"0x8D3A3B5F017F52D"',
|
14
|
+
'lease_status' => 'unlocked',
|
15
|
+
'lease_state' => 'available'
|
16
|
+
}
|
13
17
|
}
|
14
18
|
end
|
15
19
|
|
16
|
-
def self.
|
17
|
-
{
|
18
|
-
'name' => 'testcontainer1',
|
19
|
-
'properties' =>
|
20
|
-
{
|
21
|
-
'last_modified' => 'Mon, 04 Jul 2016 02:50:20 GMT',
|
22
|
-
'etag' => '0x8D3A3B5F017F52D',
|
23
|
-
'lease_status' => 'unlocked',
|
24
|
-
'lease_state' => 'available'
|
25
|
-
},
|
26
|
-
'public_access_level' => nil,
|
27
|
-
'metadata' => {}
|
28
|
-
}
|
20
|
+
def self.container_acl
|
21
|
+
['container', {}]
|
29
22
|
end
|
30
23
|
|
31
|
-
def self.
|
24
|
+
def self.container_https_url
|
25
|
+
'https://sa.blob.core.windows.net/test_container?comp=list&restype=container'
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.container_list
|
32
29
|
[
|
33
30
|
{
|
34
|
-
'name' => '
|
35
|
-
'
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
'metadata' => {}
|
31
|
+
'name' => 'test_container1',
|
32
|
+
'metadata' => {},
|
33
|
+
'properties' => {
|
34
|
+
'last_modified' => 'Mon, 04 Jul 2016 02:50:20 GMT',
|
35
|
+
'etag' => '"0x8D3A3B5F017F52D"',
|
36
|
+
'lease_status' => 'unlocked',
|
37
|
+
'lease_state' => 'available'
|
38
|
+
}
|
43
39
|
},
|
44
40
|
{
|
45
|
-
'name' => '
|
46
|
-
'
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
'metadata' => {}
|
41
|
+
'name' => 'test_container2',
|
42
|
+
'metadata' => {},
|
43
|
+
'properties' => {
|
44
|
+
'last_modified' => 'Tue, 04 Aug 2015 06:01:08 GMT',
|
45
|
+
'etag' => '"0x8D29C92176C8352"',
|
46
|
+
'lease_status' => 'unlocked',
|
47
|
+
'lease_state' => 'available'
|
48
|
+
}
|
54
49
|
},
|
55
50
|
{
|
56
|
-
'name' => '
|
57
|
-
'
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
'metadata' => {}
|
51
|
+
'name' => 'test_container3',
|
52
|
+
'metadata' => {},
|
53
|
+
'properties' => {
|
54
|
+
'last_modified' => 'Tue, 01 Sep 2015 05:15:36 GMT',
|
55
|
+
'etag' => '"0x8D2B28C5EB36458"',
|
56
|
+
'lease_status' => 'unlocked',
|
57
|
+
'lease_state' => 'available'
|
58
|
+
}
|
65
59
|
}
|
66
60
|
]
|
67
61
|
end
|
68
62
|
|
69
|
-
def self.
|
63
|
+
def self.blob_list
|
70
64
|
{
|
71
|
-
|
72
|
-
|
65
|
+
next_marker: 'marker',
|
66
|
+
blobs:
|
67
|
+
[
|
73
68
|
{
|
74
|
-
'
|
75
|
-
'
|
76
|
-
'
|
77
|
-
|
69
|
+
'name' => 'test_blob1',
|
70
|
+
'metadata' => {},
|
71
|
+
'properties' => {
|
72
|
+
'last_modified' => 'Mon, 04 Jul 2016 02:50:20 GMT',
|
73
|
+
'etag' => '"0x8D3A3B5F017F52D"',
|
74
|
+
'lease_status' => 'unlocked',
|
75
|
+
'lease_state' => 'available',
|
76
|
+
'content_length' => 4_194_304,
|
77
|
+
'content_type' => 'application/octet-stream',
|
78
|
+
'content_encoding' => nil,
|
79
|
+
'content_language' => nil,
|
80
|
+
'content_disposition' => nil,
|
81
|
+
'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==',
|
82
|
+
'cache_control' => nil,
|
83
|
+
'sequence_number' => 0,
|
84
|
+
'blob_type' => 'PageBlob',
|
85
|
+
'copy_id' => '095adc3b-e277-4c3d-97e0-0abca881f60c',
|
86
|
+
'copy_status' => 'success',
|
87
|
+
'copy_source' => 'https://testaccount.blob.core.windows.net/test_container/test_blob?snapshot=2016-02-04T08%3A35%3A50.3256874Z',
|
88
|
+
'copy_progress' => '4194304/4194304',
|
89
|
+
'copy_completion_time' => 'Thu, 04 Feb 2016 08:35:52 GMT',
|
90
|
+
'copy_status_description' => nil,
|
91
|
+
'accept_ranges' => 0
|
92
|
+
}
|
78
93
|
},
|
79
|
-
|
94
|
+
{
|
95
|
+
'name' => 'test_blob2',
|
96
|
+
'metadata' => {},
|
97
|
+
'properties' => {
|
98
|
+
'last_modified' => 'Tue, 04 Aug 2015 06:02:08 GMT',
|
99
|
+
'etag' => '"0x8D29C92173526C8"',
|
100
|
+
'lease_status' => 'unlocked',
|
101
|
+
'lease_state' => 'available',
|
102
|
+
'content_length' => 4_194_304,
|
103
|
+
'content_type' => 'application/octet-stream',
|
104
|
+
'content_encoding' => nil,
|
105
|
+
'content_language' => nil,
|
106
|
+
'content_disposition' => nil,
|
107
|
+
'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==',
|
108
|
+
'cache_control' => nil,
|
109
|
+
'sequence_number' => 0,
|
110
|
+
'blob_type' => 'PageBlob',
|
111
|
+
'copy_id' => '0abcdc3b-4c3d-e277-97e0-0abca881f60c',
|
112
|
+
'copy_status' => 'success',
|
113
|
+
'copy_source' => 'https://testaccount.blob.core.windows.net/test_container/test_blob?snapshot=2016-02-04T08%3A35%3A55.3157696Z',
|
114
|
+
'copy_progress' => '4194304/4194304',
|
115
|
+
'copy_completion_time' => 'Thu, 04 Feb 2016 08:40:52 GMT',
|
116
|
+
'copy_status_description' => nil,
|
117
|
+
'accept_ranges' => 0
|
118
|
+
}
|
119
|
+
},
|
120
|
+
{
|
121
|
+
'name' => 'test_blob3',
|
122
|
+
'metadata' => {},
|
123
|
+
'properties' => {
|
124
|
+
'last_modified' => 'Tue, 04 Aug 2015 06:02:08 GMT',
|
125
|
+
'etag' => '"0x8D29C92173526C8"',
|
126
|
+
'lease_status' => 'unlocked',
|
127
|
+
'lease_state' => 'available',
|
128
|
+
'content_length' => 4_194_304,
|
129
|
+
'content_type' => 'application/octet-stream',
|
130
|
+
'content_encoding' => nil,
|
131
|
+
'content_language' => nil,
|
132
|
+
'content_disposition' => nil,
|
133
|
+
'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==',
|
134
|
+
'cache_control' => nil,
|
135
|
+
'sequence_number' => 0,
|
136
|
+
'blob_type' => 'PageBlob',
|
137
|
+
'copy_id' => '0abcdc3b-4c3d-e277-97e0-0abca881f60c',
|
138
|
+
'copy_status' => 'success',
|
139
|
+
'copy_source' => 'https://testaccount.blob.core.windows.net/test_container/test_blob?snapshot=2016-02-04T08%3A35%3A55.3157696Z',
|
140
|
+
'copy_progress' => '4194304/4194304',
|
141
|
+
'copy_completion_time' => 'Thu, 04 Feb 2016 08:40:52 GMT',
|
142
|
+
'copy_status_description' => nil,
|
143
|
+
'accept_ranges' => 0
|
144
|
+
}
|
145
|
+
},
|
146
|
+
{
|
147
|
+
'name' => 'test_blob4',
|
148
|
+
'metadata' => {},
|
149
|
+
'properties' => {
|
150
|
+
'last_modified' => 'Tue, 04 Aug 2015 06:02:08 GMT',
|
151
|
+
'etag' => '"0x8D29C92173526C8"',
|
152
|
+
'lease_status' => 'unlocked',
|
153
|
+
'lease_state' => 'available',
|
154
|
+
'content_length' => 4_194_304,
|
155
|
+
'content_type' => 'application/octet-stream',
|
156
|
+
'content_encoding' => nil,
|
157
|
+
'content_language' => nil,
|
158
|
+
'content_disposition' => nil,
|
159
|
+
'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==',
|
160
|
+
'cache_control' => nil,
|
161
|
+
'sequence_number' => 0,
|
162
|
+
'blob_type' => 'PageBlob',
|
163
|
+
'copy_id' => '0abcdc3b-4c3d-e277-97e0-0abca881f60c',
|
164
|
+
'copy_status' => 'success',
|
165
|
+
'copy_source' => 'https://testaccount.blob.core.windows.net/test_container/test_blob?snapshot=2016-02-04T08%3A35%3A55.3157696Z',
|
166
|
+
'copy_progress' => '4194304/4194304',
|
167
|
+
'copy_completion_time' => 'Thu, 04 Feb 2016 08:40:52 GMT',
|
168
|
+
'copy_status_description' => nil,
|
169
|
+
'accept_ranges' => 0
|
170
|
+
}
|
171
|
+
}
|
172
|
+
]
|
80
173
|
}
|
81
174
|
end
|
82
|
-
|
83
|
-
def self.get_container_access_control_list
|
84
|
-
[{
|
85
|
-
'name' => 'testcontainer1',
|
86
|
-
'public_access_level' => 'blob'
|
87
|
-
}, {}]
|
88
|
-
end
|
89
175
|
end
|
90
176
|
end
|
91
177
|
end
|