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
@@ -25,7 +25,7 @@ module Fog
|
|
25
25
|
def save
|
26
26
|
requires :name, :location, :resource_group
|
27
27
|
recovery_vault = service.create_or_update_recovery_vault(resource_group, location, name)
|
28
|
-
merge_attributes(RecoveryVault.parse(recovery_vault))
|
28
|
+
merge_attributes(Fog::Storage::AzureRM::RecoveryVault.parse(recovery_vault))
|
29
29
|
end
|
30
30
|
|
31
31
|
def enable_backup_protection(vm_name, vm_resource_group)
|
@@ -3,7 +3,7 @@ module Fog
|
|
3
3
|
class AzureRM
|
4
4
|
# This class is giving implementation of all/get for Recovery Vaults
|
5
5
|
class RecoveryVaults < Fog::Collection
|
6
|
-
model RecoveryVault
|
6
|
+
model Fog::Storage::AzureRM::RecoveryVault
|
7
7
|
attribute :resource_group
|
8
8
|
attribute :name
|
9
9
|
|
@@ -11,15 +11,15 @@ module Fog
|
|
11
11
|
requires :resource_group
|
12
12
|
recovery_vaults = []
|
13
13
|
service.list_recovery_vaults(resource_group).each do |recovery_vault|
|
14
|
-
recovery_vaults << RecoveryVault.parse(recovery_vault)
|
14
|
+
recovery_vaults << Fog::Storage::AzureRM::RecoveryVault.parse(recovery_vault)
|
15
15
|
end
|
16
16
|
load(recovery_vaults)
|
17
17
|
end
|
18
18
|
|
19
19
|
def get(resource_group, name)
|
20
20
|
recovery_vault = service.get_recovery_vault(resource_group, name)
|
21
|
-
|
22
|
-
|
21
|
+
recovery_vault_fog = Fog::Storage::AzureRM::RecoveryVault.new(service: service)
|
22
|
+
recovery_vault_fog.merge_attributes(Fog::Storage::AzureRM::RecoveryVault.parse(recovery_vault))
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -32,11 +32,11 @@ module Fog
|
|
32
32
|
self.sku_name = STANDARD_STORAGE if sku_name.nil?
|
33
33
|
self.replication = ALLOWED_STANDARD_REPLICATION.first if replication.nil?
|
34
34
|
validate_sku_name!
|
35
|
-
storage_account = service.create_storage_account(
|
36
|
-
merge_attributes(StorageAccount.parse(storage_account))
|
35
|
+
storage_account = service.create_storage_account(storage_account_params)
|
36
|
+
merge_attributes(Fog::Storage::AzureRM::StorageAccount.parse(storage_account))
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
39
|
+
def storage_account_params
|
40
40
|
{
|
41
41
|
resource_group: resource_group,
|
42
42
|
name: name,
|
@@ -52,7 +52,7 @@ module Fog
|
|
52
52
|
storage_account_params = merge_attributes(storage_account_params).all_attributes
|
53
53
|
|
54
54
|
storage_account = service.update_storage_account(storage_account_params)
|
55
|
-
merge_attributes(StorageAccount.parse(storage_account))
|
55
|
+
merge_attributes(Fog::Storage::AzureRM::StorageAccount.parse(storage_account))
|
56
56
|
end
|
57
57
|
|
58
58
|
def validate_sku_name!
|
@@ -82,7 +82,7 @@ module Fog
|
|
82
82
|
raise 'Cannot modify the given attribute' unless result.empty?
|
83
83
|
end
|
84
84
|
|
85
|
-
private :
|
85
|
+
private :storage_account_params, :validate_sku_name!
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
@@ -4,7 +4,7 @@ module Fog
|
|
4
4
|
# This class is giving implementation of all/list, get and
|
5
5
|
# check name availability for storage account.
|
6
6
|
class StorageAccounts < Fog::Collection
|
7
|
-
model StorageAccount
|
7
|
+
model Fog::Storage::AzureRM::StorageAccount
|
8
8
|
attribute :resource_group
|
9
9
|
|
10
10
|
def all
|
@@ -16,15 +16,15 @@ module Fog
|
|
16
16
|
hash_of_storage_accounts = service.list_storage_accounts
|
17
17
|
end
|
18
18
|
hash_of_storage_accounts.each do |account|
|
19
|
-
accounts << StorageAccount.parse(account)
|
19
|
+
accounts << Fog::Storage::AzureRM::StorageAccount.parse(account)
|
20
20
|
end
|
21
21
|
load(accounts)
|
22
22
|
end
|
23
23
|
|
24
24
|
def get(resource_group_name, storage_account_name)
|
25
25
|
storage_account = service.get_storage_account(resource_group_name, storage_account_name)
|
26
|
-
|
27
|
-
|
26
|
+
storage_account_fog = Fog::Storage::AzureRM::StorageAccount.new(service: service)
|
27
|
+
storage_account_fog.merge_attributes(Fog::Storage::AzureRM::StorageAccount.parse(storage_account))
|
28
28
|
end
|
29
29
|
|
30
30
|
def check_name_availability(name)
|
@@ -50,7 +50,7 @@ module Fog
|
|
50
50
|
def create_or_update
|
51
51
|
if %w(azureEndpoints externalEndpoints nestedEndpoints).select { |type| type if type.eql?(type) }.any?
|
52
52
|
traffic_manager_endpoint = service.create_or_update_traffic_manager_endpoint(traffic_manager_endpoint_hash)
|
53
|
-
merge_attributes(TrafficManagerEndPoint.parse(traffic_manager_endpoint))
|
53
|
+
merge_attributes(Fog::TrafficManager::AzureRM::TrafficManagerEndPoint.parse(traffic_manager_endpoint))
|
54
54
|
else
|
55
55
|
raise(ArgumentError, ":type should be '#{AZURE_ENDPOINTS}', '#{EXTERNAL_ENDPOINTS}' or '#{NESTED_ENDPOINTS}'")
|
56
56
|
end
|
@@ -5,20 +5,20 @@ module Fog
|
|
5
5
|
class TrafficManagerEndPoints < Fog::Collection
|
6
6
|
attribute :resource_group
|
7
7
|
attribute :traffic_manager_profile_name
|
8
|
-
model TrafficManagerEndPoint
|
8
|
+
model Fog::TrafficManager::AzureRM::TrafficManagerEndPoint
|
9
9
|
|
10
10
|
def all
|
11
11
|
requires :resource_group, :traffic_manager_profile_name
|
12
12
|
|
13
13
|
end_points = service.get_traffic_manager_profile(resource_group, traffic_manager_profile_name).endpoints
|
14
|
-
traffic_manager_endpoints = end_points.map { |endpoint| TrafficManagerEndPoint.parse(endpoint) }
|
14
|
+
traffic_manager_endpoints = end_points.map { |endpoint| Fog::TrafficManager::AzureRM::TrafficManagerEndPoint.parse(endpoint) }
|
15
15
|
load(traffic_manager_endpoints)
|
16
16
|
end
|
17
17
|
|
18
18
|
def get(resource_group, traffic_manager_profile_name, end_point_name, type)
|
19
19
|
endpoint = service.get_traffic_manager_end_point(resource_group, traffic_manager_profile_name, end_point_name, type)
|
20
|
-
|
21
|
-
|
20
|
+
endpoint_fog = Fog::TrafficManager::AzureRM::TrafficManagerEndPoint.new(service: service)
|
21
|
+
endpoint_fog.merge_attributes(Fog::TrafficManager::AzureRM::TrafficManagerEndPoint.parse(endpoint))
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -36,8 +36,8 @@ module Fog
|
|
36
36
|
traffic_manager_profile['resource_group'] = get_resource_group_from_id(profile.id)
|
37
37
|
traffic_manager_profile['endpoints'] = []
|
38
38
|
profile.endpoints.each do |endpoint|
|
39
|
-
end_point = TrafficManagerEndPoint.new
|
40
|
-
traffic_manager_profile['endpoints'] << end_point.merge_attributes(TrafficManagerEndPoint.parse(endpoint))
|
39
|
+
end_point = Fog::TrafficManager::AzureRM::TrafficManagerEndPoint.new
|
40
|
+
traffic_manager_profile['endpoints'] << end_point.merge_attributes(Fog::TrafficManager::AzureRM::TrafficManagerEndPoint.parse(endpoint))
|
41
41
|
end
|
42
42
|
traffic_manager_profile
|
43
43
|
end
|
@@ -46,7 +46,7 @@ module Fog
|
|
46
46
|
requires :name, :resource_group, :traffic_routing_method, :relative_name, :ttl,
|
47
47
|
:protocol, :port, :path
|
48
48
|
traffic_manager_profile = service.create_or_update_traffic_manager_profile(traffic_manager_profile_hash)
|
49
|
-
merge_attributes(TrafficManagerProfile.parse(traffic_manager_profile))
|
49
|
+
merge_attributes(Fog::TrafficManager::AzureRM::TrafficManagerProfile.parse(traffic_manager_profile))
|
50
50
|
end
|
51
51
|
|
52
52
|
def destroy
|
@@ -57,7 +57,7 @@ module Fog
|
|
57
57
|
validate_input(profile_params)
|
58
58
|
merge_attributes(profile_params)
|
59
59
|
profile = service.create_or_update_traffic_manager_profile(traffic_manager_profile_hash)
|
60
|
-
merge_attributes(TrafficManagerProfile.parse(profile))
|
60
|
+
merge_attributes(Fog::TrafficManager::AzureRM::TrafficManagerProfile.parse(profile))
|
61
61
|
end
|
62
62
|
|
63
63
|
private
|
@@ -4,18 +4,18 @@ module Fog
|
|
4
4
|
# Traffic Manager Profile Collection for TrafficManager Service
|
5
5
|
class TrafficManagerProfiles < Fog::Collection
|
6
6
|
attribute :resource_group
|
7
|
-
model TrafficManagerProfile
|
7
|
+
model Fog::TrafficManager::AzureRM::TrafficManagerProfile
|
8
8
|
|
9
9
|
def all
|
10
10
|
requires :resource_group
|
11
|
-
traffic_manager_profiles = service.list_traffic_manager_profiles(resource_group).map { |profile| TrafficManagerProfile.parse(profile) }
|
11
|
+
traffic_manager_profiles = service.list_traffic_manager_profiles(resource_group).map { |profile| Fog::TrafficManager::AzureRM::TrafficManagerProfile.parse(profile) }
|
12
12
|
load(traffic_manager_profiles)
|
13
13
|
end
|
14
14
|
|
15
15
|
def get(resource_group, traffic_manager_profile_name)
|
16
16
|
profile = service.get_traffic_manager_profile(resource_group, traffic_manager_profile_name)
|
17
|
-
|
18
|
-
|
17
|
+
profile_fog = Fog::TrafficManager::AzureRM::TrafficManagerProfile.new(service: service)
|
18
|
+
profile_fog.merge_attributes(Fog::TrafficManager::AzureRM::TrafficManagerProfile.parse(profile))
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
data/lib/fog/azurerm/network.rb
CHANGED
@@ -145,7 +145,7 @@ module Fog
|
|
145
145
|
end
|
146
146
|
|
147
147
|
credentials = Fog::Credentials::AzureRM.get_credentials(options[:tenant_id], options[:client_id], options[:client_secret])
|
148
|
-
@network_client = ::Azure::ARM::Network::NetworkManagementClient.new(credentials)
|
148
|
+
@network_client = ::Azure::ARM::Network::NetworkManagementClient.new(credentials, resource_manager_endpoint_url)
|
149
149
|
@network_client.subscription_id = options[:subscription_id]
|
150
150
|
@tenant_id = options[:tenant_id]
|
151
151
|
@client_id = options[:client_id]
|
@@ -66,30 +66,34 @@ module Fog
|
|
66
66
|
hw_profile
|
67
67
|
end
|
68
68
|
|
69
|
+
def image_reference(publisher, offer, sku, version)
|
70
|
+
image_reference = Azure::ARM::Compute::Models::ImageReference.new
|
71
|
+
image_reference.publisher = publisher
|
72
|
+
image_reference.offer = offer
|
73
|
+
image_reference.sku = sku
|
74
|
+
image_reference.version = version
|
75
|
+
image_reference
|
76
|
+
end
|
77
|
+
|
69
78
|
def define_storage_profile(vm_name, storage_account_name, publisher, offer, sku, version, vhd_path, platform, resource_group)
|
70
79
|
storage_profile = Azure::ARM::Compute::Models::StorageProfile.new
|
71
80
|
os_disk = Azure::ARM::Compute::Models::OSDisk.new
|
72
81
|
vhd = Azure::ARM::Compute::Models::VirtualHardDisk.new
|
73
82
|
|
74
|
-
vhd.uri = "
|
83
|
+
vhd.uri = get_blob_link(storage_account_name) + "/vhds/#{vm_name}_os_disk.vhd"
|
75
84
|
|
76
85
|
if vhd_path.nil?
|
77
|
-
image_reference =
|
78
|
-
image_reference.publisher = publisher
|
79
|
-
image_reference.offer = offer
|
80
|
-
image_reference.sku = sku
|
81
|
-
image_reference.version = version
|
82
|
-
storage_profile.image_reference = image_reference
|
86
|
+
storage_profile.image_reference = image_reference(publisher, offer, sku, version)
|
83
87
|
else
|
84
88
|
# Copy if VHD does not exist belongs to same storage account.
|
85
89
|
vhd_storage_account = (vhd_path.split('/')[2]).split('.')[0]
|
86
90
|
if storage_account_name != vhd_storage_account
|
87
91
|
storage_account = @storage_service.storage_accounts.get(resource_group, storage_account_name)
|
88
|
-
access_key = storage_account.get_access_keys
|
89
|
-
storage_data = Fog::Storage.new(provider: 'AzureRM', azure_storage_account_name: storage_account_name, azure_storage_access_key: access_key)
|
90
|
-
|
91
|
-
container_name =
|
92
|
-
blob_name =
|
92
|
+
access_key = storage_account.get_access_keys.first.value
|
93
|
+
storage_data = Fog::Storage::AzureRM.new(provider: 'AzureRM', azure_storage_account_name: storage_account_name, azure_storage_access_key: access_key)
|
94
|
+
new_time = get_time
|
95
|
+
container_name = "customvhd#{new_time}"
|
96
|
+
blob_name = "vhd_image#{new_time}.vhd"
|
93
97
|
storage_data.directories.create(
|
94
98
|
key: container_name
|
95
99
|
)
|
@@ -99,7 +103,7 @@ module Fog
|
|
99
103
|
Fog::Logger.debug 'Waiting disk to ready'
|
100
104
|
sleep(10)
|
101
105
|
end
|
102
|
-
new_vhd_path = "
|
106
|
+
new_vhd_path = get_blob_link(storage_account_name) + "/#{container_name}/#{blob_name}"
|
103
107
|
Fog::Logger.debug "Path:#{new_vhd_path}. | Copy done"
|
104
108
|
else
|
105
109
|
new_vhd_path = vhd_path
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Fog
|
2
2
|
module Network
|
3
3
|
class AzureRM
|
4
|
-
# This class provides the actual
|
4
|
+
# This class provides the actual implementation for service calls.
|
5
5
|
class Real
|
6
6
|
def list_virtual_networks(resource_group)
|
7
7
|
msg = "Listing Virtual Networks in Resource Group #{resource_group}"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Fog
|
2
2
|
module Resources
|
3
3
|
class AzureRM
|
4
|
-
# This class provides the actual
|
4
|
+
# This class provides the actual implementation for service calls.
|
5
5
|
class Real
|
6
6
|
def create_deployment(resource_group, deployment_name, template_link, parameters_link)
|
7
7
|
msg = "Creating Deployment: #{deployment_name} in Resource Group: #{resource_group}"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Fog
|
2
2
|
module Resources
|
3
3
|
class AzureRM
|
4
|
-
# This class provides the actual
|
4
|
+
# This class provides the actual implementation for service calls.
|
5
5
|
class Real
|
6
6
|
def create_resource_group(name, location)
|
7
7
|
msg = "Creating Resource Group: #{name}."
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Fog
|
2
2
|
module Resources
|
3
3
|
class AzureRM
|
4
|
-
# This class provides the actual
|
4
|
+
# This class provides the actual implementation for service calls.
|
5
5
|
class Real
|
6
6
|
def delete_deployment(resource_group, deployment_name)
|
7
7
|
msg = "Deleting Deployment: #{deployment_name} in Resource Group: #{resource_group}"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Fog
|
2
2
|
module Resources
|
3
3
|
class AzureRM
|
4
|
-
# This class provides the actual
|
4
|
+
# This class provides the actual implementation for service calls.
|
5
5
|
class Real
|
6
6
|
def delete_resource_group(name)
|
7
7
|
msg = "Deleting Resource Group: #{name}."
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Fog
|
2
2
|
module Resources
|
3
3
|
class AzureRM
|
4
|
-
# This class provides the actual
|
4
|
+
# This class provides the actual implementation for service calls.
|
5
5
|
class Real
|
6
6
|
def get_deployment(resource_group, deployment_name)
|
7
7
|
msg = "Getting Deployment #{deployment_name} in Resource Group: #{resource_group}"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Fog
|
2
2
|
module Resources
|
3
3
|
class AzureRM
|
4
|
-
# This class provides the actual
|
4
|
+
# This class provides the actual implementation for service calls.
|
5
5
|
class Real
|
6
6
|
def get_resource_group(resource_group_name)
|
7
7
|
msg = "Getting Resource Group #{resource_group_name}"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Fog
|
2
2
|
module Resources
|
3
3
|
class AzureRM
|
4
|
-
# This class provides the actual
|
4
|
+
# This class provides the actual implementation for service calls.
|
5
5
|
class Real
|
6
6
|
def list_deployments(resource_group)
|
7
7
|
msg = "Listing Deployments in Resource Group: #{resource_group}"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Fog
|
2
2
|
module Resources
|
3
3
|
class AzureRM
|
4
|
-
# This class provides the actual
|
4
|
+
# This class provides the actual implementation for service calls.
|
5
5
|
class Real
|
6
6
|
def list_tagged_resources(tag_name, tag_value = nil)
|
7
7
|
msg = "Listing Resources with tagname: #{tag_name}"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Fog
|
2
2
|
module Resources
|
3
3
|
class AzureRM
|
4
|
-
# This class provides the actual
|
4
|
+
# This class provides the actual implementation for service calls.
|
5
5
|
class Real
|
6
6
|
def tag_resource(resource_id, tag_name, tag_value)
|
7
7
|
split_resource = resource_id.split('/') unless resource_id.nil?
|
@@ -6,7 +6,7 @@ module Fog
|
|
6
6
|
def create_or_update_database(database_hash)
|
7
7
|
msg = "Creating SQL Database: #{database_hash[:name]}."
|
8
8
|
Fog::Logger.debug msg
|
9
|
-
resource_url = "#{
|
9
|
+
resource_url = "#{resource_manager_endpoint_url}/subscriptions/#{@subscription_id}/resourceGroups/#{database_hash[:resource_group]}/providers/Microsoft.Sql/servers/#{database_hash[:server_name]}/databases/#{database_hash[:name]}?api-version=2014-04-01-preview"
|
10
10
|
request_parameters = get_database_parameters(database_hash[:location], database_hash[:create_mode], database_hash[:edition], database_hash[:source_database_id], database_hash[:collation], database_hash[:max_size_bytes], database_hash[:requested_service_objective_name], database_hash[:restore_point_in_time], database_hash[:source_database_deletion_date], database_hash[:elastic_pool_name], database_hash[:requested_service_objective_id])
|
11
11
|
begin
|
12
12
|
token = Fog::Credentials::AzureRM.get_token(@tenant_id, @client_id, @client_secret)
|
@@ -18,10 +18,10 @@ module Fog
|
|
18
18
|
authorization: token
|
19
19
|
)
|
20
20
|
rescue RestClient::Exception => e
|
21
|
-
|
21
|
+
raise_azure_exception(e, msg)
|
22
22
|
end
|
23
23
|
Fog::Logger.debug "SQL Database: #{database_hash[:name]} created successfully."
|
24
|
-
JSON.
|
24
|
+
Fog::JSON.decode(response)
|
25
25
|
end
|
26
26
|
|
27
27
|
private
|
@@ -7,7 +7,7 @@ module Fog
|
|
7
7
|
msg = "Creating SQL Firewall Rule : #{firewall_hash[:name]}."
|
8
8
|
Fog::Logger.debug msg
|
9
9
|
|
10
|
-
resource_url = "#{
|
10
|
+
resource_url = "#{resource_manager_endpoint_url}/subscriptions/#{@subscription_id}/resourceGroups/#{firewall_hash[:resource_group]}/providers/Microsoft.Sql/servers/#{firewall_hash[:server_name]}/firewallRules/#{firewall_hash[:name]}?api-version=2014-04-01-preview"
|
11
11
|
request_parameters = get_server_firewall_parameters(firewall_hash[:start_ip], firewall_hash[:end_ip])
|
12
12
|
begin
|
13
13
|
token = Fog::Credentials::AzureRM.get_token(@tenant_id, @client_id, @client_secret)
|
@@ -19,10 +19,10 @@ module Fog
|
|
19
19
|
authorization: token
|
20
20
|
)
|
21
21
|
rescue RestClient::Exception => e
|
22
|
-
|
22
|
+
raise_azure_exception(e, msg)
|
23
23
|
end
|
24
24
|
Fog::Logger.debug "SQL Firewall Rule : #{firewall_hash[:name]} created successfully."
|
25
|
-
JSON.
|
25
|
+
Fog::JSON.decode(response)
|
26
26
|
end
|
27
27
|
|
28
28
|
private
|
@@ -6,7 +6,7 @@ module Fog
|
|
6
6
|
def create_or_update_sql_server(server_hash)
|
7
7
|
msg = "Creating SQL Server: #{server_hash[:name]}."
|
8
8
|
Fog::Logger.debug msg
|
9
|
-
resource_url = "#{
|
9
|
+
resource_url = "#{resource_manager_endpoint_url}/subscriptions/#{@subscription_id}/resourceGroups/#{server_hash[:resource_group]}/providers/Microsoft.Sql/servers/#{server_hash[:name]}?api-version=2014-04-01-preview"
|
10
10
|
request_parameters = get_server_parameters(server_hash[:location], server_hash[:version], server_hash[:administrator_login], server_hash[:administrator_login_password])
|
11
11
|
begin
|
12
12
|
token = Fog::Credentials::AzureRM.get_token(@tenant_id, @client_id, @client_secret)
|
@@ -18,10 +18,10 @@ module Fog
|
|
18
18
|
authorization: token
|
19
19
|
)
|
20
20
|
rescue RestClient::Exception => e
|
21
|
-
|
21
|
+
raise_azure_exception(e, msg)
|
22
22
|
end
|
23
23
|
Fog::Logger.debug "SQL Server: #{server_hash[:name]} created successfully."
|
24
|
-
JSON.
|
24
|
+
Fog::JSON.decode(response)
|
25
25
|
end
|
26
26
|
|
27
27
|
private
|
@@ -6,7 +6,7 @@ module Fog
|
|
6
6
|
def delete_database(resource_group, server_name, name)
|
7
7
|
msg = "Deleting SQL Database: #{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/#{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
|
RestClient.delete(
|
@@ -16,7 +16,7 @@ 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: #{name} deleted successfully."
|
22
22
|
true
|