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
@@ -7,7 +7,7 @@ module Fog
|
|
7
7
|
msg = "Deleting SQL Firewall Rule: #{rule_name}."
|
8
8
|
Fog::Logger.debug msg
|
9
9
|
|
10
|
-
resource_url = "#{
|
10
|
+
resource_url = "#{resource_manager_endpoint_url}/subscriptions/#{@subscription_id}/resourceGroups/#{resource_group}/providers/Microsoft.Sql/servers/#{server_name}/firewallRules/#{rule_name}?api-version=2014-04-01-preview"
|
11
11
|
begin
|
12
12
|
token = Fog::Credentials::AzureRM.get_token(@tenant_id, @client_id, @client_secret)
|
13
13
|
RestClient.delete(
|
@@ -16,11 +16,11 @@ module Fog
|
|
16
16
|
content_type: :json,
|
17
17
|
authorization: token
|
18
18
|
)
|
19
|
-
Fog::Logger.debug "SQL Firewall Rule: #{rule_name} deleted successfully."
|
20
|
-
true
|
21
19
|
rescue RestClient::Exception => e
|
22
|
-
|
20
|
+
raise_azure_exception(e, msg)
|
23
21
|
end
|
22
|
+
Fog::Logger.debug "SQL Firewall Rule: #{rule_name} deleted successfully."
|
23
|
+
true
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -6,7 +6,7 @@ module Fog
|
|
6
6
|
def delete_sql_server(resource_group, name)
|
7
7
|
msg = "Deleting SQL Server: #{name}."
|
8
8
|
Fog::Logger.debug msg
|
9
|
-
resource_url = "#{
|
9
|
+
resource_url = "#{resource_manager_endpoint_url}/subscriptions/#{@subscription_id}/resourceGroups/#{resource_group}/providers/Microsoft.Sql/servers/#{name}?api-version=2014-04-01-preview"
|
10
10
|
begin
|
11
11
|
token = Fog::Credentials::AzureRM.get_token(@tenant_id, @client_id, @client_secret)
|
12
12
|
RestClient.delete(
|
@@ -15,11 +15,11 @@ module Fog
|
|
15
15
|
content_type: :json,
|
16
16
|
authorization: token
|
17
17
|
)
|
18
|
-
Fog::Logger.debug "SQL Server: #{name} deleted successfully."
|
19
|
-
true
|
20
18
|
rescue RestClient::Exception => e
|
21
|
-
|
19
|
+
raise_azure_exception(e, msg)
|
22
20
|
end
|
21
|
+
Fog::Logger.debug "SQL Server: #{name} deleted successfully."
|
22
|
+
true
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -6,7 +6,7 @@ module Fog
|
|
6
6
|
def get_database(resource_group, server_name, name)
|
7
7
|
msg = "Getting Sql Database: #{name} in Resource Group: #{resource_group}."
|
8
8
|
Fog::Logger.debug msg
|
9
|
-
resource_url = "#{
|
9
|
+
resource_url = "#{resource_manager_endpoint_url}/subscriptions/#{@subscription_id}/resourceGroups/#{resource_group}/providers/Microsoft.Sql/servers/#{server_name}/databases/#{name}?api-version=2014-04-01-preview"
|
10
10
|
begin
|
11
11
|
token = Fog::Credentials::AzureRM.get_token(@tenant_id, @client_id, @client_secret)
|
12
12
|
response = RestClient.get(
|
@@ -16,10 +16,10 @@ module Fog
|
|
16
16
|
authorization: token
|
17
17
|
)
|
18
18
|
rescue RestClient::Exception => e
|
19
|
-
|
19
|
+
raise_azure_exception(e, msg)
|
20
20
|
end
|
21
21
|
Fog::Logger.debug "Sql Database fetched successfully in Resource Group: #{resource_group}"
|
22
|
-
JSON.
|
22
|
+
Fog::JSON.decode(response)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -6,7 +6,7 @@ module Fog
|
|
6
6
|
def get_firewall_rule(resource_group, server_name, rule_name)
|
7
7
|
msg = "Getting Sql Server Firewall Rule: #{rule_name} from SQL Server: #{server_name} in Resource Group: #{resource_group}..."
|
8
8
|
Fog::Logger.debug msg
|
9
|
-
resource_url = "#{
|
9
|
+
resource_url = "#{resource_manager_endpoint_url}/subscriptions/#{@subscription_id}/resourceGroups/#{resource_group}/providers/Microsoft.Sql/servers/#{server_name}/firewallRules/#{rule_name}?api-version=2014-04-01-preview"
|
10
10
|
begin
|
11
11
|
token = Fog::Credentials::AzureRM.get_token(@tenant_id, @client_id, @client_secret)
|
12
12
|
response = RestClient.get(
|
@@ -16,10 +16,10 @@ module Fog
|
|
16
16
|
authorization: token
|
17
17
|
)
|
18
18
|
rescue RestClient::Exception => e
|
19
|
-
|
19
|
+
raise_azure_exception(e, msg)
|
20
20
|
end
|
21
21
|
Fog::Logger.debug "Sql Server Firewall Rule fetched successfully from Server: #{server_name}, Resource Group: #{resource_group}"
|
22
|
-
JSON.
|
22
|
+
Fog::JSON.decode(response)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -6,7 +6,7 @@ module Fog
|
|
6
6
|
def get_sql_server(resource_group, server_name)
|
7
7
|
msg = "Getting Sql Server: #{server_name} in Resource Group: #{resource_group}..."
|
8
8
|
Fog::Logger.debug msg
|
9
|
-
resource_url = "#{
|
9
|
+
resource_url = "#{resource_manager_endpoint_url}/subscriptions/#{@subscription_id}/resourceGroups/#{resource_group}/providers/Microsoft.Sql/servers/#{server_name}?api-version=2014-04-01-preview"
|
10
10
|
begin
|
11
11
|
token = Fog::Credentials::AzureRM.get_token(@tenant_id, @client_id, @client_secret)
|
12
12
|
response = RestClient.get(
|
@@ -16,10 +16,10 @@ module Fog
|
|
16
16
|
authorization: token
|
17
17
|
)
|
18
18
|
rescue RestClient::Exception => e
|
19
|
-
|
19
|
+
raise_azure_exception(e, msg)
|
20
20
|
end
|
21
21
|
Fog::Logger.debug "Sql Server fetched successfully in Resource Group: #{resource_group}"
|
22
|
-
JSON.
|
22
|
+
Fog::JSON.decode(response)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -6,7 +6,7 @@ module Fog
|
|
6
6
|
def list_databases(resource_group, server_name)
|
7
7
|
msg = "Listing Sql Databases in Resource Group: #{resource_group}."
|
8
8
|
Fog::Logger.debug msg
|
9
|
-
resource_url = "#{
|
9
|
+
resource_url = "#{resource_manager_endpoint_url}/subscriptions/#{@subscription_id}/resourceGroups/#{resource_group}/providers/Microsoft.Sql/servers/#{server_name}/databases?api-version=2014-04-01-preview"
|
10
10
|
begin
|
11
11
|
token = Fog::Credentials::AzureRM.get_token(@tenant_id, @client_id, @client_secret)
|
12
12
|
response = RestClient.get(
|
@@ -16,10 +16,10 @@ module Fog
|
|
16
16
|
authorization: token
|
17
17
|
)
|
18
18
|
rescue RestClient::Exception => e
|
19
|
-
|
19
|
+
raise_azure_exception(e, msg)
|
20
20
|
end
|
21
21
|
Fog::Logger.debug "Sql Databases listed successfully in Resource Group: #{resource_group}"
|
22
|
-
JSON.
|
22
|
+
Fog::JSON.decode(response)['value']
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -6,7 +6,7 @@ module Fog
|
|
6
6
|
def list_firewall_rules(resource_group, server_name)
|
7
7
|
msg = "Listing Sql Server Firewall rules on server: #{server_name} in Resource Group: #{resource_group}."
|
8
8
|
Fog::Logger.debug msg
|
9
|
-
resource_url = "#{
|
9
|
+
resource_url = "#{resource_manager_endpoint_url}/subscriptions/#{@subscription_id}/resourceGroups/#{resource_group}/providers/Microsoft.Sql/servers/#{server_name}/firewallRules/?api-version=2014-04-01-preview"
|
10
10
|
begin
|
11
11
|
token = Fog::Credentials::AzureRM.get_token(@tenant_id, @client_id, @client_secret)
|
12
12
|
response = RestClient.get(
|
@@ -16,10 +16,10 @@ module Fog
|
|
16
16
|
authorization: token
|
17
17
|
)
|
18
18
|
rescue RestClient::Exception => e
|
19
|
-
|
19
|
+
raise_azure_exception(e, msg)
|
20
20
|
end
|
21
21
|
Fog::Logger.debug "Sql Server Firewall Rules listed successfully on server: #{server_name} in Resource Group: #{resource_group}"
|
22
|
-
JSON.
|
22
|
+
Fog::JSON.decode(response)['value']
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -6,7 +6,7 @@ module Fog
|
|
6
6
|
def list_sql_servers(resource_group)
|
7
7
|
msg = "Listing Sql Servers in Resource Group: #{resource_group}."
|
8
8
|
Fog::Logger.debug msg
|
9
|
-
resource_url = "#{
|
9
|
+
resource_url = "#{resource_manager_endpoint_url}/subscriptions/#{@subscription_id}/resourceGroups/#{resource_group}/providers/Microsoft.Sql/servers?api-version=2014-04-01-preview"
|
10
10
|
begin
|
11
11
|
token = Fog::Credentials::AzureRM.get_token(@tenant_id, @client_id, @client_secret)
|
12
12
|
response = RestClient.get(
|
@@ -16,10 +16,10 @@ module Fog
|
|
16
16
|
authorization: token
|
17
17
|
)
|
18
18
|
rescue RestClient::Exception => e
|
19
|
-
|
19
|
+
raise_azure_exception(e, msg)
|
20
20
|
end
|
21
21
|
Fog::Logger.debug "Sql Servers listed successfully in Resource Group: #{resource_group}"
|
22
|
-
JSON.
|
22
|
+
Fog::JSON.decode(response)['value']
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -3,14 +3,17 @@ module Fog
|
|
3
3
|
class AzureRM
|
4
4
|
# This class provides the actual implementation for service calls.
|
5
5
|
class Real
|
6
|
-
def acquire_blob_lease(container_name, name, options={})
|
7
|
-
|
6
|
+
def acquire_blob_lease(container_name, name, options = {})
|
7
|
+
options[:request_id] = SecureRandom.uuid
|
8
|
+
msg = "Leasing blob: #{name} of container #{container_name} options: #{options}"
|
8
9
|
Fog::Logger.debug msg
|
10
|
+
|
9
11
|
begin
|
10
12
|
lease_id = @blob_client.acquire_blob_lease(container_name, name, options)
|
11
13
|
rescue Azure::Core::Http::HTTPError => ex
|
12
14
|
raise_azure_exception(ex, msg)
|
13
15
|
end
|
16
|
+
|
14
17
|
Fog::Logger.debug "Blob #{name} leased successfully."
|
15
18
|
lease_id
|
16
19
|
end
|
@@ -3,14 +3,17 @@ module Fog
|
|
3
3
|
class AzureRM
|
4
4
|
# This class provides the actual implementation for service calls.
|
5
5
|
class Real
|
6
|
-
def acquire_container_lease(name, options={})
|
7
|
-
|
6
|
+
def acquire_container_lease(name, options = {})
|
7
|
+
options[:request_id] = SecureRandom.uuid
|
8
|
+
msg = "Leasing container: #{name} options: #{options}"
|
8
9
|
Fog::Logger.debug msg
|
10
|
+
|
9
11
|
begin
|
10
12
|
lease_id = @blob_client.acquire_container_lease(name, options)
|
11
13
|
rescue Azure::Core::Http::HTTPError => ex
|
12
14
|
raise_azure_exception(ex, msg)
|
13
15
|
end
|
16
|
+
|
14
17
|
Fog::Logger.debug "Container #{name} leased successfully."
|
15
18
|
lease_id
|
16
19
|
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 commit_blob_blocks(container_name, blob_name, blocks, options = {})
|
7
|
+
options[:request_id] = SecureRandom.uuid
|
8
|
+
msg = "commit_blob_blocks: Complete uploading #{blob_name} to the container #{container_name}. options: #{options}"
|
9
|
+
Fog::Logger.debug msg
|
10
|
+
|
11
|
+
begin
|
12
|
+
@blob_client.commit_blob_blocks(container_name, blob_name, blocks, options)
|
13
|
+
rescue Azure::Core::Http::HTTPError => ex
|
14
|
+
raise_azure_exception(ex, msg)
|
15
|
+
end
|
16
|
+
|
17
|
+
Fog::Logger.debug "Block blob #{blob_name} is uploaded successfully."
|
18
|
+
true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# This class provides the mock implementation for unit tests.
|
23
|
+
class Mock
|
24
|
+
def commit_blob_blocks(*)
|
25
|
+
true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,148 @@
|
|
1
|
+
module Fog
|
2
|
+
module Storage
|
3
|
+
class AzureRM
|
4
|
+
# This class provides the actual implementation for service calls.
|
5
|
+
class Real
|
6
|
+
def compare_container_blobs(container1, container2)
|
7
|
+
msg = "Comparing blobs from container #{container1} to container #{container2}"
|
8
|
+
Fog::Logger.debug msg
|
9
|
+
begin
|
10
|
+
identical_blobs = get_identical_blobs_from_containers(container1, container2)
|
11
|
+
rescue Azure::Core::Http::HTTPError => ex
|
12
|
+
raise_azure_exception(ex, msg)
|
13
|
+
end
|
14
|
+
identical_blobs
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def get_identical_blobs_from_containers(container1, container2)
|
20
|
+
container1_blobs = list_blobs(container1)
|
21
|
+
container2_blobs = list_blobs(container2)
|
22
|
+
|
23
|
+
identical_blobs = []
|
24
|
+
container1_blobs[:blobs].each do |container1_blob|
|
25
|
+
container2_blobs[:blobs].each do |container2_blob|
|
26
|
+
if container1_blob.name == container2_blob.name && container1_blob.properties[:content_md5] == container2_blob.properties[:content_md5]
|
27
|
+
identical_blobs.push(container1_blob)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
identical_blobs
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# This class provides the mock implementation for unit tests.
|
36
|
+
class Mock
|
37
|
+
def compare_container_blobs(*)
|
38
|
+
[
|
39
|
+
{
|
40
|
+
'name' => 'test_blob1',
|
41
|
+
'metadata' => {},
|
42
|
+
'properties' => {
|
43
|
+
'last_modified' => 'Mon, 04 Jul 2016 02:50:20 GMT',
|
44
|
+
'etag' => '0x8D3A3B5F017F52D',
|
45
|
+
'lease_status' => 'unlocked',
|
46
|
+
'lease_state' => 'available',
|
47
|
+
'content_length' => 4_194_304,
|
48
|
+
'content_type' => 'application/octet-stream',
|
49
|
+
'content_encoding' => nil,
|
50
|
+
'content_language' => nil,
|
51
|
+
'content_disposition' => nil,
|
52
|
+
'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==',
|
53
|
+
'cache_control' => nil,
|
54
|
+
'sequence_number' => 0,
|
55
|
+
'blob_type' => 'PageBlob',
|
56
|
+
'copy_id' => '095adc3b-e277-4c3d-97e0-0abca881f60c',
|
57
|
+
'copy_status' => 'success',
|
58
|
+
'copy_source' => 'https://testaccount.blob.core.windows.net/test_container/test_blob?snapshot=2016-02-04T08%3A35%3A50.3256874Z',
|
59
|
+
'copy_progress' => '4194304/4194304',
|
60
|
+
'copy_completion_time' => 'Thu, 04 Feb 2016 08:35:52 GMT',
|
61
|
+
'copy_status_description' => nil,
|
62
|
+
'accept_ranges' => 0
|
63
|
+
}
|
64
|
+
},
|
65
|
+
{
|
66
|
+
'name' => 'test_blob2',
|
67
|
+
'metadata' => {},
|
68
|
+
'properties' => {
|
69
|
+
'last_modified' => 'Tue, 04 Aug 2015 06:02:08 GMT',
|
70
|
+
'etag' => '0x8D29C92173526C8',
|
71
|
+
'lease_status' => 'unlocked',
|
72
|
+
'lease_state' => 'available',
|
73
|
+
'content_length' => 4_194_304,
|
74
|
+
'content_type' => 'application/octet-stream',
|
75
|
+
'content_encoding' => nil,
|
76
|
+
'content_language' => nil,
|
77
|
+
'content_disposition' => nil,
|
78
|
+
'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==',
|
79
|
+
'cache_control' => nil,
|
80
|
+
'sequence_number' => 0,
|
81
|
+
'blob_type' => 'PageBlob',
|
82
|
+
'copy_id' => '0abcdc3b-4c3d-e277-97e0-0abca881f60c',
|
83
|
+
'copy_status' => 'success',
|
84
|
+
'copy_source' => 'https://testaccount.blob.core.windows.net/test_container/test_blob?snapshot=2016-02-04T08%3A35%3A55.3157696Z',
|
85
|
+
'copy_progress' => '4194304/4194304',
|
86
|
+
'copy_completion_time' => 'Thu, 04 Feb 2016 08:40:52 GMT',
|
87
|
+
'copy_status_description' => nil,
|
88
|
+
'accept_ranges' => 0
|
89
|
+
}
|
90
|
+
},
|
91
|
+
{
|
92
|
+
'name' => 'test_blob3',
|
93
|
+
'metadata' => {},
|
94
|
+
'properties' => {
|
95
|
+
'last_modified' => 'Tue, 04 Aug 2015 06:02:08 GMT',
|
96
|
+
'etag' => '0x8D29C92173526C8',
|
97
|
+
'lease_status' => 'unlocked',
|
98
|
+
'lease_state' => 'available',
|
99
|
+
'content_length' => 4_194_304,
|
100
|
+
'content_type' => 'application/octet-stream',
|
101
|
+
'content_encoding' => nil,
|
102
|
+
'content_language' => nil,
|
103
|
+
'content_disposition' => nil,
|
104
|
+
'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==',
|
105
|
+
'cache_control' => nil,
|
106
|
+
'sequence_number' => 0,
|
107
|
+
'blob_type' => 'PageBlob',
|
108
|
+
'copy_id' => '0abcdc3b-4c3d-e277-97e0-0abca881f60c',
|
109
|
+
'copy_status' => 'success',
|
110
|
+
'copy_source' => 'https://testaccount.blob.core.windows.net/test_container/test_blob?snapshot=2016-02-04T08%3A35%3A55.3157696Z',
|
111
|
+
'copy_progress' => '4194304/4194304',
|
112
|
+
'copy_completion_time' => 'Thu, 04 Feb 2016 08:40:52 GMT',
|
113
|
+
'copy_status_description' => nil,
|
114
|
+
'accept_ranges' => 0
|
115
|
+
}
|
116
|
+
},
|
117
|
+
{
|
118
|
+
'name' => 'test_blob4',
|
119
|
+
'metadata' => {},
|
120
|
+
'properties' => {
|
121
|
+
'last_modified' => 'Tue, 04 Aug 2015 06:02:08 GMT',
|
122
|
+
'etag' => '0x8D29C92173526C8',
|
123
|
+
'lease_status' => 'unlocked',
|
124
|
+
'lease_state' => 'available',
|
125
|
+
'content_length' => 4_194_304,
|
126
|
+
'content_type' => 'application/octet-stream',
|
127
|
+
'content_encoding' => nil,
|
128
|
+
'content_language' => nil,
|
129
|
+
'content_disposition' => nil,
|
130
|
+
'content_md5' => 'tXAohIyxuu/t94Lp/ujeRw==',
|
131
|
+
'cache_control' => nil,
|
132
|
+
'sequence_number' => 0,
|
133
|
+
'blob_type' => 'PageBlob',
|
134
|
+
'copy_id' => '0abcdc3b-4c3d-e277-97e0-0abca881f60c',
|
135
|
+
'copy_status' => 'success',
|
136
|
+
'copy_source' => 'https://testaccount.blob.core.windows.net/test_container/test_blob?snapshot=2016-02-04T08%3A35%3A55.3157696Z',
|
137
|
+
'copy_progress' => '4194304/4194304',
|
138
|
+
'copy_completion_time' => 'Thu, 04 Feb 2016 08:40:52 GMT',
|
139
|
+
'copy_status_description' => nil,
|
140
|
+
'accept_ranges' => 0
|
141
|
+
}
|
142
|
+
}
|
143
|
+
]
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
@@ -4,25 +4,25 @@ module Fog
|
|
4
4
|
# This class provides the actual implementation for service calls.
|
5
5
|
class Real
|
6
6
|
def copy_blob(destination_container, destination_blob, source_container, source_blob, options = {})
|
7
|
-
|
7
|
+
options[:request_id] = SecureRandom.uuid
|
8
|
+
msg = "Copying blob: #{source_blob} from container #{source_container} to container #{destination_container} options: #{options}"
|
8
9
|
Fog::Logger.debug msg
|
10
|
+
|
9
11
|
begin
|
10
|
-
copy_status = @blob_client.copy_blob(destination_container, destination_blob, source_container, source_blob, options)
|
12
|
+
copy_id, copy_status = @blob_client.copy_blob(destination_container, destination_blob, source_container, source_blob, options)
|
11
13
|
rescue Azure::Core::Http::HTTPError => ex
|
12
14
|
raise_azure_exception(ex, msg)
|
13
15
|
end
|
14
|
-
|
15
|
-
copy_status
|
16
|
+
|
17
|
+
Fog::Logger.debug "Copying blob: x-ms-copy-id: #{copy_id}, x-ms-copy-status: #{copy_status}"
|
18
|
+
[copy_id, copy_status]
|
16
19
|
end
|
17
20
|
end
|
18
21
|
|
19
22
|
# This class provides the mock implementation for unit tests.
|
20
23
|
class Mock
|
21
24
|
def copy_blob(*)
|
22
|
-
|
23
|
-
'copyId' => 'abc123',
|
24
|
-
'copyStatus' => 'pending'
|
25
|
-
}
|
25
|
+
%w(abc123 pending)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -4,25 +4,25 @@ module Fog
|
|
4
4
|
# This class provides the actual implementation for service calls.
|
5
5
|
class Real
|
6
6
|
def copy_blob_from_uri(destination_container, destination_blob, source_blob_uri, options = {})
|
7
|
-
|
7
|
+
options[:request_id] = SecureRandom.uuid
|
8
|
+
msg = "Copying blob: #{source_blob_uri} to container #{destination_container} options: #{options}"
|
8
9
|
Fog::Logger.debug msg
|
10
|
+
|
9
11
|
begin
|
10
|
-
copy_status = @blob_client.copy_blob_from_uri(destination_container, destination_blob, source_blob_uri, options)
|
12
|
+
copy_id, copy_status = @blob_client.copy_blob_from_uri(destination_container, destination_blob, source_blob_uri, options)
|
11
13
|
rescue Azure::Core::Http::HTTPError => ex
|
12
14
|
raise_azure_exception(ex, msg)
|
13
15
|
end
|
14
|
-
|
15
|
-
copy_status
|
16
|
+
|
17
|
+
Fog::Logger.debug "Copying blob: x-ms-copy-id: #{copy_id}, x-ms-copy-status: #{copy_status}"
|
18
|
+
[copy_id, copy_status]
|
16
19
|
end
|
17
20
|
end
|
18
21
|
|
19
22
|
# This class provides the mock implementation for unit tests.
|
20
23
|
class Mock
|
21
24
|
def copy_blob_from_uri(*)
|
22
|
-
|
23
|
-
'copyId' => 'abc123',
|
24
|
-
'copyStatus' => 'pending'
|
25
|
-
}
|
25
|
+
%w(abc123 pending)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|