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
data/test/integration/subnet.rb
CHANGED
@@ -26,77 +26,90 @@ network = Fog::Network::AzureRM.new(
|
|
26
26
|
###################### Prerequisites ######################
|
27
27
|
########################################################################################################################
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
)
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
########################################################################################################################
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
########################################################################################################################
|
71
|
-
|
72
|
-
########################################################################################################################
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
########################################################################################################################
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
########################################################################################################################
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
29
|
+
begin
|
30
|
+
resource_group = rs.resource_groups.create(
|
31
|
+
name: 'TestRG-SN',
|
32
|
+
location: LOCATION
|
33
|
+
)
|
34
|
+
|
35
|
+
virtual_network = network.virtual_networks.create(
|
36
|
+
name: 'testVnet',
|
37
|
+
location: LOCATION,
|
38
|
+
resource_group: 'TestRG-SN',
|
39
|
+
dns_servers: %w(10.1.0.0 10.2.0.0),
|
40
|
+
address_prefixes: %w(10.1.0.0/16 10.2.0.0/16)
|
41
|
+
)
|
42
|
+
|
43
|
+
network_security_group = network.network_security_groups.create(
|
44
|
+
name: 'testGroup',
|
45
|
+
resource_group: resource_group.name,
|
46
|
+
location: LOCATION
|
47
|
+
)
|
48
|
+
|
49
|
+
########################################################################################################################
|
50
|
+
###################### Create Subnet ######################
|
51
|
+
########################################################################################################################
|
52
|
+
|
53
|
+
subnet = network.subnets.create(
|
54
|
+
name: 'mysubnet',
|
55
|
+
resource_group: resource_group.name,
|
56
|
+
virtual_network_name: virtual_network.name,
|
57
|
+
address_prefix: '10.1.0.0/24'
|
58
|
+
)
|
59
|
+
puts "Created subnet: #{subnet.name}"
|
60
|
+
|
61
|
+
########################################################################################################################
|
62
|
+
###################### Attach/Detach Network Security Group ######################
|
63
|
+
########################################################################################################################
|
64
|
+
|
65
|
+
subnet.attach_network_security_group(network_security_group.id)
|
66
|
+
puts 'Attached network_security_group'
|
67
|
+
subnet.detach_network_security_group
|
68
|
+
puts 'Detached network_security_group'
|
69
|
+
|
70
|
+
########################################################################################################################
|
71
|
+
##################### Attach/Detach Route Table(Pending because Route Table is not implemented yet) ###################
|
72
|
+
########################################################################################################################
|
73
|
+
|
74
|
+
########################################################################################################################
|
75
|
+
###################### List Subnets ######################
|
76
|
+
########################################################################################################################
|
77
|
+
|
78
|
+
subnets = network.subnets(resource_group: resource_group.name, virtual_network_name: virtual_network.name)
|
79
|
+
puts 'List subnets:'
|
80
|
+
subnets.each do |a_subnet|
|
81
|
+
puts a_subnet.name
|
82
|
+
end
|
83
|
+
|
84
|
+
########################################################################################################################
|
85
|
+
###################### Get Subnet ######################
|
86
|
+
########################################################################################################################
|
87
|
+
|
88
|
+
subnet = network.subnets.get(resource_group.name, virtual_network.name, subnet.name)
|
89
|
+
puts "Get subnet: #{subnet.name}"
|
90
|
+
|
91
|
+
########################################################################################################################
|
92
|
+
###################### List Free Ip Addresses in Subnet ######################
|
93
|
+
########################################################################################################################
|
94
|
+
|
95
|
+
puts "Free ip addresses in subnet: #{subnet.get_available_ipaddresses_count(false)}"
|
96
|
+
|
97
|
+
########################################################################################################################
|
98
|
+
###################### Delete Subnet ######################
|
99
|
+
########################################################################################################################
|
100
|
+
|
101
|
+
puts "Deleted subnet: #{subnet.destroy}"
|
102
|
+
|
103
|
+
########################################################################################################################
|
104
|
+
###################### CleanUp ######################
|
105
|
+
########################################################################################################################
|
106
|
+
|
107
|
+
network_security_group.destroy
|
108
|
+
|
109
|
+
virtual_network.destroy
|
110
|
+
|
111
|
+
resource_group.destroy
|
112
|
+
rescue
|
113
|
+
puts 'Integration Test for subnet is failing'
|
114
|
+
resource_group.destroy unless resource_group.nil?
|
115
|
+
end
|
@@ -26,77 +26,89 @@ traffic_manager = Fog::TrafficManager::AzureRM.new(
|
|
26
26
|
###################### Prerequisites ######################
|
27
27
|
########################################################################################################################
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
########################################################################################################################
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
29
|
+
begin
|
30
|
+
resource_group = resources.resource_groups.create(
|
31
|
+
name: 'TestRG-TM',
|
32
|
+
location: LOCATION
|
33
|
+
)
|
34
|
+
|
35
|
+
########################################################################################################################
|
36
|
+
###################### Create Traffic Manager Profile ######################
|
37
|
+
########################################################################################################################
|
38
|
+
|
39
|
+
traffic_manager_profile = traffic_manager.traffic_manager_profiles.create(
|
40
|
+
name: 'test-tmp',
|
41
|
+
resource_group: 'TestRG-TM',
|
42
|
+
traffic_routing_method: 'Performance',
|
43
|
+
relative_name: 'testapplication',
|
44
|
+
ttl: '30',
|
45
|
+
protocol: 'http',
|
46
|
+
port: '80',
|
47
|
+
path: '/monitorpage.aspx'
|
48
|
+
)
|
49
|
+
puts "Created traffic manager profile: #{traffic_manager_profile.name}"
|
50
|
+
|
51
|
+
########################################################################################################################
|
52
|
+
###################### Create Traffic Manager Endpoint ######################
|
53
|
+
########################################################################################################################
|
54
|
+
|
55
|
+
traffic_manager_end_point = traffic_manager.traffic_manager_end_points.create(
|
56
|
+
name: 'myendpoint',
|
57
|
+
traffic_manager_profile_name: 'test-tmp',
|
58
|
+
resource_group: 'TestRG-TM',
|
59
|
+
type: 'externalEndpoints',
|
60
|
+
target: 'test-app.com',
|
61
|
+
endpoint_location: 'eastus'
|
62
|
+
)
|
63
|
+
puts "Created traffic manager endpoint: #{traffic_manager_end_point.name}"
|
64
|
+
|
65
|
+
########################################################################################################################
|
66
|
+
###################### Get and Update Traffic Manager Endpoint ######################
|
67
|
+
########################################################################################################################
|
68
|
+
|
69
|
+
end_point = traffic_manager.traffic_manager_end_points.get('TestRG-TM', 'test-tmp', 'myendpoint', 'externalEndpoints')
|
70
|
+
puts "Get traffic manager endpoint: #{end_point.name}"
|
71
|
+
end_point.update(
|
72
|
+
type: 'externalEndpoints',
|
73
|
+
target: 'test-app1.com',
|
74
|
+
endpoint_location: 'centralus'
|
75
|
+
)
|
76
|
+
puts 'Updated traffic manager endpoint'
|
77
|
+
|
78
|
+
########################################################################################################################
|
79
|
+
###################### Get and Destroy Traffic Manager Endpoint ######################
|
80
|
+
########################################################################################################################
|
81
|
+
|
82
|
+
end_point = traffic_manager.traffic_manager_end_points.get('TestRG-TM', 'test-tmp', 'myendpoint', 'externalEndpoints')
|
83
|
+
puts "Deleted traffic manager endpoint: #{end_point.destroy}"
|
84
|
+
|
85
|
+
########################################################################################################################
|
86
|
+
###################### Get and Update Traffic Manager Profile ######################
|
87
|
+
########################################################################################################################
|
88
|
+
|
89
|
+
traffic_manager_profile = traffic_manager.traffic_manager_profiles.get('TestRG-TM', 'test-tmp')
|
90
|
+
puts "Get traffic manager profile: #{traffic_manager_profile.name}"
|
91
|
+
traffic_manager_profile.update(traffic_routing_method: 'Weighted',
|
92
|
+
ttl: '35',
|
93
|
+
protocol: 'https',
|
94
|
+
port: '90',
|
95
|
+
path: '/monitorpage1.aspx')
|
96
|
+
puts 'Updated traffic manager profile'
|
97
|
+
|
98
|
+
########################################################################################################################
|
99
|
+
###################### Get and Destroy Traffic Manager Profile ######################
|
100
|
+
########################################################################################################################
|
101
|
+
|
102
|
+
traffic_manager_profile = traffic_manager.traffic_manager_profiles.get('TestRG-TM', 'test-tmp')
|
103
|
+
puts "Deleted traffic manager profile: #{traffic_manager_profile.destroy}"
|
104
|
+
|
105
|
+
########################################################################################################################
|
106
|
+
###################### CleanUp ######################
|
107
|
+
########################################################################################################################
|
108
|
+
|
109
|
+
resource_group = resources.resource_groups.get('TestRG-TM')
|
110
|
+
resource_group.destroy
|
111
|
+
rescue
|
112
|
+
puts 'Integration Test for traffic manager is failing'
|
113
|
+
resource_group.destroy unless resource_group.nil?
|
114
|
+
end
|
@@ -40,109 +40,118 @@ network = Fog::Network::AzureRM.new(
|
|
40
40
|
###################### Prerequisites ######################
|
41
41
|
########################################################################################################################
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
########################################################################################################################
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
########################################################################################################################
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
43
|
+
begin
|
44
|
+
resource_group = rs.resource_groups.create(
|
45
|
+
name: 'TestRG-VME',
|
46
|
+
location: LOCATION
|
47
|
+
)
|
48
|
+
|
49
|
+
storage_account_name = "fog#{get_time}storageac"
|
50
|
+
storage.storage_accounts.create(
|
51
|
+
name: storage_account_name,
|
52
|
+
location: LOCATION,
|
53
|
+
resource_group: 'TestRG-VME',
|
54
|
+
account_type: 'Standard',
|
55
|
+
replication: 'LRS'
|
56
|
+
)
|
57
|
+
|
58
|
+
network.virtual_networks.create(
|
59
|
+
name: 'testVnet',
|
60
|
+
location: LOCATION,
|
61
|
+
resource_group: 'TestRG-VME',
|
62
|
+
network_address_list: '10.1.0.0/16,10.2.0.0/16'
|
63
|
+
)
|
64
|
+
|
65
|
+
network.subnets.create(
|
66
|
+
name: 'mysubnet',
|
67
|
+
resource_group: 'TestRG-VME',
|
68
|
+
virtual_network_name: 'testVnet',
|
69
|
+
address_prefix: '10.2.0.0/24'
|
70
|
+
)
|
71
|
+
|
72
|
+
network.network_interfaces.create(
|
73
|
+
name: 'NetInt',
|
74
|
+
resource_group: 'TestRG-VME',
|
75
|
+
location: LOCATION,
|
76
|
+
subnet_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-VME/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/mysubnet",
|
77
|
+
ip_configuration_name: 'testIpConfiguration',
|
78
|
+
private_ip_allocation_method: 'Dynamic'
|
79
|
+
)
|
80
|
+
|
81
|
+
compute.servers.create(
|
82
|
+
name: 'TestVM',
|
83
|
+
location: LOCATION,
|
84
|
+
resource_group: 'TestRG-VME',
|
85
|
+
vm_size: 'Basic_A0',
|
86
|
+
storage_account_name: storage_account_name,
|
87
|
+
username: 'testuser',
|
88
|
+
password: 'Confiz=123',
|
89
|
+
disable_password_authentication: false,
|
90
|
+
network_interface_card_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-VME/providers/Microsoft.Network/networkInterfaces/NetInt",
|
91
|
+
publisher: 'MicrosoftWindowsServer',
|
92
|
+
offer: 'WindowsServer',
|
93
|
+
sku: '2008-R2-SP1',
|
94
|
+
version: 'latest',
|
95
|
+
platform: 'Windows'
|
96
|
+
)
|
97
|
+
|
98
|
+
########################################################################################################################
|
99
|
+
###################### Attach Extension To Server ######################
|
100
|
+
########################################################################################################################
|
101
|
+
|
102
|
+
vm_extension = compute.virtual_machine_extensions.create(
|
103
|
+
resource_group: 'TestRG-VME',
|
104
|
+
location: LOCATION,
|
105
|
+
vm_name: 'TestVM',
|
106
|
+
name: 'IaaSAntimalware',
|
107
|
+
publisher: 'Microsoft.Azure.Security',
|
108
|
+
type: 'IaaSAntimalware',
|
109
|
+
type_handler_version: '1.3',
|
110
|
+
auto_upgrade_minor_version: true,
|
111
|
+
settings: { 'AntimalwareEnabled' => 'true', 'RealtimeProtectionEnabled' => 'false', 'ScheduledScanSettings' => { 'isEnabled' => 'false', 'day' => '7', 'time' => '120', 'scanType' => 'Quick' }, 'Exclusions' => { 'Extensions' => '', 'Paths' => '', 'Processes' => '' } },
|
112
|
+
protected_settings: {}
|
113
|
+
)
|
114
|
+
puts "Attached virtual machine extension: #{vm_extension.name}"
|
115
|
+
|
116
|
+
########################################################################################################################
|
117
|
+
###################### Get Extension From Server ######################
|
118
|
+
########################################################################################################################
|
119
|
+
|
120
|
+
vm_extension = compute.virtual_machine_extensions.get('TestRG-VME', 'TestVM', 'IaasAntimalware')
|
121
|
+
puts "Get vm extension: #{vm_extension.name}"
|
122
|
+
|
123
|
+
########################################################################################################################
|
124
|
+
###################### Update Extension ######################
|
125
|
+
########################################################################################################################
|
126
|
+
|
127
|
+
vm_extension.update(auto_upgrade_minor_version: false)
|
128
|
+
puts 'Updated vm extension'
|
129
|
+
|
130
|
+
########################################################################################################################
|
131
|
+
###################### Delete Extension ######################
|
132
|
+
########################################################################################################################
|
133
|
+
|
134
|
+
puts "Deleted vm extension: #{vm_extension.destroy}"
|
135
|
+
|
136
|
+
########################################################################################################################
|
137
|
+
###################### CleanUp ######################
|
138
|
+
########################################################################################################################
|
139
|
+
|
140
|
+
virtual_machine = compute.servers.get('TestRG-VME', 'TestVM')
|
141
|
+
virtual_machine.destroy
|
142
|
+
|
143
|
+
nic = network.network_interfaces.get('TestRG-VME', 'NetInt')
|
144
|
+
nic.destroy
|
145
|
+
|
146
|
+
vnet = network.virtual_networks.get('TestRG-VME', 'testVnet')
|
147
|
+
vnet.destroy
|
148
|
+
|
149
|
+
storage = storage.storage_accounts.get('TestRG-VME', storage_account_name)
|
150
|
+
storage.destroy
|
151
|
+
|
152
|
+
resource_group = rs.resource_groups.get('TestRG-VME')
|
153
|
+
resource_group.destroy
|
154
|
+
rescue
|
155
|
+
puts 'Integration Test for vm extension is failing'
|
156
|
+
resource_group.destroy unless resource_group.nil?
|
157
|
+
end
|