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
@@ -26,107 +26,128 @@ 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
|
-
vnet.
|
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
|
-
vnet.update(
|
104
|
-
subnets:
|
29
|
+
begin
|
30
|
+
resource_group = rs.resource_groups.create(
|
31
|
+
name: 'TestRG-VN',
|
32
|
+
location: LOCATION
|
33
|
+
)
|
34
|
+
|
35
|
+
########################################################################################################################
|
36
|
+
###################### Check Virtual Network name Availability ######################
|
37
|
+
########################################################################################################################
|
38
|
+
|
39
|
+
virtual_network = network.virtual_networks.check_if_exists('testVnet', 'TestRG-VN')
|
40
|
+
puts 'Virtual network exists' if virtual_network
|
41
|
+
puts 'Virtual network does not exists' unless virtual_network
|
42
|
+
|
43
|
+
########################################################################################################################
|
44
|
+
###################### Create Virtual Network with complete parameters list ######################
|
45
|
+
########################################################################################################################
|
46
|
+
|
47
|
+
virtual_network = network.virtual_networks.create(
|
48
|
+
name: 'testVnet',
|
49
|
+
location: LOCATION,
|
50
|
+
resource_group: resource_group.name,
|
51
|
+
subnets: [{
|
52
|
+
name: 'mysubnet',
|
53
|
+
address_prefix: '10.1.0.0/24'
|
54
|
+
}],
|
55
|
+
dns_servers: %w(10.1.0.0 10.2.0.0),
|
56
|
+
address_prefixes: %w(10.1.0.0/16 10.2.0.0/16)
|
57
|
+
)
|
58
|
+
puts "Created virtual network: #{virtual_network.name}"
|
59
|
+
|
60
|
+
########################################################################################################################
|
61
|
+
###################### List Virtual Network #################################
|
62
|
+
########################################################################################################################
|
63
|
+
|
64
|
+
virtual_networks = network.virtual_networks(resource_group: resource_group.name)
|
65
|
+
puts 'List virtual_networks:'
|
66
|
+
virtual_networks.each do |a_virtual_network|
|
67
|
+
puts a_virtual_network.name
|
68
|
+
end
|
69
|
+
|
70
|
+
########################################################################################################################
|
71
|
+
###################### Get Virtual Network ##################################
|
72
|
+
########################################################################################################################
|
73
|
+
|
74
|
+
vnet = network.virtual_networks.get('TestRG-VN', 'testvnet')
|
75
|
+
puts "Get virtual network: #{vnet.name}"
|
76
|
+
|
77
|
+
########################################################################################################################
|
78
|
+
###################### Add/Remove DNS Servers to/from Virtual Network #########################
|
79
|
+
########################################################################################################################
|
80
|
+
|
81
|
+
vnet.add_dns_servers(%w(10.3.0.0 10.4.0.0))
|
82
|
+
puts 'Added dns servers to virtual network'
|
83
|
+
|
84
|
+
vnet.remove_dns_servers(%w(10.3.0.0 10.4.0.0))
|
85
|
+
puts 'Remove dns servers from virtual network'
|
86
|
+
|
87
|
+
########################################################################################################################
|
88
|
+
###################### Add/Remove Address Prefixes to/from Virtual Network #########################
|
89
|
+
########################################################################################################################
|
90
|
+
|
91
|
+
vnet.add_address_prefixes(%w(10.2.0.0/16 10.3.0.0/16))
|
92
|
+
puts 'Added address prefixes to virtual network'
|
93
|
+
|
94
|
+
vnet.remove_address_prefixes(['10.2.0.0/16'])
|
95
|
+
puts 'Removed address prefixes from virtual network'
|
96
|
+
|
97
|
+
########################################################################################################################
|
98
|
+
###################### Add/Remove Subnets to/from Virtual Network #############################
|
99
|
+
########################################################################################################################
|
100
|
+
|
101
|
+
vnet.add_subnets(
|
105
102
|
[
|
106
103
|
{
|
107
|
-
name: '
|
108
|
-
address_prefix: '10.3.0.0/
|
104
|
+
name: 'test-subnet',
|
105
|
+
address_prefix: '10.3.0.0/24'
|
109
106
|
}
|
110
|
-
]
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
107
|
+
]
|
108
|
+
)
|
109
|
+
puts 'Added subnet to virtual network'
|
110
|
+
|
111
|
+
vnet.remove_subnets(['test-subnet'])
|
112
|
+
puts 'Removed subnet from virtual network'
|
113
|
+
|
114
|
+
########################################################################################################################
|
115
|
+
###################### Update Virtual Network ##########################
|
116
|
+
########################################################################################################################
|
117
|
+
|
118
|
+
vnet.update(
|
119
|
+
subnets:
|
120
|
+
[
|
121
|
+
{
|
122
|
+
name: 'fog-subnet',
|
123
|
+
address_prefix: '10.3.0.0/16'
|
124
|
+
}
|
125
|
+
],
|
126
|
+
dns_servers: %w(10.3.0.0 10.4.0.0)
|
127
|
+
)
|
128
|
+
puts 'Updated virtual network'
|
129
|
+
|
130
|
+
########################################################################################################################
|
131
|
+
###################### List Free IP Address count in Subnets ##########################
|
132
|
+
########################################################################################################################
|
133
|
+
|
134
|
+
puts 'List free ip address count in subnets:'
|
135
|
+
vnet.subnets.each do |subnet|
|
136
|
+
puts network.subnets.get('TestRG-VN', 'testVnet', subnet.name).get_available_ipaddresses_count(false)
|
137
|
+
end
|
138
|
+
|
139
|
+
########################################################################################################################
|
140
|
+
###################### Destroy Virtual Network #########################
|
141
|
+
########################################################################################################################
|
142
|
+
|
143
|
+
puts "Deleted virtual network: #{vnet.destroy}"
|
144
|
+
|
145
|
+
########################################################################################################################
|
146
|
+
###################### CleanUp ######################
|
147
|
+
########################################################################################################################
|
148
|
+
|
149
|
+
resource_group.destroy
|
150
|
+
rescue
|
151
|
+
puts 'Integration Test for virtual network is failing'
|
152
|
+
resource_group.destroy unless resource_group.nil?
|
120
153
|
end
|
121
|
-
|
122
|
-
########################################################################################################################
|
123
|
-
###################### Destroy Virtual Network #########################
|
124
|
-
########################################################################################################################
|
125
|
-
|
126
|
-
vnet.destroy
|
127
|
-
|
128
|
-
########################################################################################################################
|
129
|
-
###################### CleanUp ######################
|
130
|
-
########################################################################################################################
|
131
|
-
|
132
|
-
resource_group.destroy
|
@@ -26,83 +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
|
-
|
29
|
+
begin
|
30
|
+
resource_group = resource.resource_groups.create(
|
31
|
+
name: 'TestRG-VNG',
|
32
|
+
location: LOCATION
|
33
|
+
)
|
34
|
+
|
35
|
+
network.virtual_networks.create(
|
36
|
+
name: 'testVnet',
|
37
|
+
location: LOCATION,
|
38
|
+
resource_group: 'TestRG-VNG',
|
39
|
+
network_address_list: '10.1.0.0/16,10.2.0.0/16'
|
40
|
+
)
|
41
|
+
|
42
|
+
network.subnets.create(
|
43
|
+
name: 'GatewaySubnet',
|
44
|
+
resource_group: 'TestRG-VNG',
|
45
|
+
virtual_network_name: 'testVnet',
|
46
|
+
address_prefix: '10.2.0.0/24'
|
47
|
+
)
|
48
|
+
|
49
|
+
network.public_ips.create(
|
50
|
+
name: 'mypubip',
|
51
|
+
resource_group: 'TestRG-VNG',
|
52
|
+
location: LOCATION,
|
53
|
+
public_ip_allocation_method: 'Dynamic'
|
54
|
+
)
|
55
|
+
|
56
|
+
########################################################################################################################
|
57
|
+
###################### Create Virtual Network Gateway ######################
|
58
|
+
########################################################################################################################
|
59
|
+
|
60
|
+
virtual_network_gateway = network.virtual_network_gateways.create(
|
61
|
+
name: 'testnetworkgateway',
|
62
|
+
location: LOCATION,
|
63
|
+
tags: {
|
64
|
+
key1: 'value1',
|
65
|
+
key2: 'value2'
|
66
|
+
},
|
67
|
+
ip_configurations: [
|
68
|
+
{
|
69
|
+
name: 'default',
|
70
|
+
private_ipallocation_method: 'Dynamic',
|
71
|
+
public_ipaddress_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-VNG/providers/Microsoft.Network/publicIPAddresses/mypubip",
|
72
|
+
subnet_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-VNG/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/GatewaySubnet",
|
73
|
+
private_ipaddress: nil
|
74
|
+
}
|
75
|
+
],
|
76
|
+
resource_group: 'TestRG-VNG',
|
77
|
+
sku_name: 'Basic',
|
78
|
+
sku_tier: 'Basic',
|
79
|
+
sku_capacity: 2,
|
80
|
+
gateway_type: 'ExpressRoute',
|
81
|
+
enable_bgp: false,
|
82
|
+
gateway_size: nil,
|
83
|
+
vpn_type: 'RouteBased',
|
84
|
+
vpn_client_address_pool: nil
|
85
|
+
)
|
86
|
+
puts "Created virtual network gateway: #{virtual_network_gateway.name}"
|
87
|
+
|
88
|
+
########################################################################################################################
|
89
|
+
###################### List Virtual Network Gateways ######################
|
90
|
+
########################################################################################################################
|
91
|
+
|
92
|
+
network_gateways = network.virtual_network_gateways(resource_group: 'TestRG-VNG')
|
93
|
+
puts 'List virtual network gateways:'
|
94
|
+
network_gateways.each do |gateway|
|
95
|
+
puts gateway.name
|
96
|
+
end
|
97
|
+
|
98
|
+
########################################################################################################################
|
99
|
+
###################### Get Virtual Network Gateway and CleanUp ######################
|
100
|
+
########################################################################################################################
|
101
|
+
|
102
|
+
network_gateway = network.virtual_network_gateways.get('TestRG-VNG', 'testnetworkgateway')
|
103
|
+
puts "Get virtual network gateway: #{network_gateway.name}"
|
104
|
+
|
105
|
+
puts "Deleted virtual network gateway: #{network_gateway.destroy}"
|
106
|
+
|
107
|
+
pubip = network.public_ips.get('TestRG-VNG', 'mypubip')
|
108
|
+
pubip.destroy
|
109
|
+
|
110
|
+
rg = resource.resource_groups.get('TestRG-VNG')
|
111
|
+
rg.destroy
|
112
|
+
rescue
|
113
|
+
puts 'Integration Test for virtual network gateway is failing'
|
114
|
+
resource_group.destroy unless resource_group.nil?
|
93
115
|
end
|
94
|
-
|
95
|
-
########################################################################################################################
|
96
|
-
###################### Get Virtual Network Gateway and CleanUp ######################
|
97
|
-
########################################################################################################################
|
98
|
-
|
99
|
-
network_gateway = network.virtual_network_gateways.get('TestRG-VNG', 'testnetworkgateway')
|
100
|
-
Fog::Logger.debug network_gateway.name.to_s
|
101
|
-
|
102
|
-
network_gateway.destroy
|
103
|
-
|
104
|
-
pubip = network.public_ips.get('TestRG-VNG', 'mypubip')
|
105
|
-
pubip.destroy
|
106
|
-
|
107
|
-
rg = resource.resource_groups.get('TestRG-VNG')
|
108
|
-
rg.destroy
|
@@ -26,91 +26,98 @@ 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
|
-
location: 'eastus',
|
58
|
-
tags: {
|
59
|
-
key1: 'value1',
|
60
|
-
key2: 'value2'
|
61
|
-
},
|
62
|
-
ip_configurations: [
|
63
|
-
{
|
64
|
-
name: 'default',
|
65
|
-
private_ipallocation_method: 'Dynamic',
|
66
|
-
public_ipaddress_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-GCE/providers/Microsoft.Network/publicIPAddresses/mypubip",
|
67
|
-
subnet_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-GCE/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/GatewaySubnet",
|
68
|
-
private_ipaddress: nil
|
69
|
-
}
|
70
|
-
],
|
71
|
-
resource_group: 'TestRG-GCE',
|
72
|
-
sku_name: 'Basic',
|
73
|
-
sku_tier: 'Basic',
|
74
|
-
sku_capacity: 2,
|
75
|
-
gateway_type: 'ExpressRoute',
|
76
|
-
enable_bgp: false,
|
77
|
-
gateway_size: nil,
|
78
|
-
vpn_type: 'RouteBased',
|
79
|
-
vpn_client_address_pool: nil
|
80
|
-
)
|
81
|
-
|
82
|
-
########################################################################################################################
|
83
|
-
############### Create Virtual Network Gateway Connection to Express Route Circuit ###########
|
84
|
-
########################################################################################################################
|
85
|
-
|
86
|
-
network.virtual_network_gateway_connections.create(
|
87
|
-
name: 'testnetworkgateway-to-expressroute',
|
88
|
-
location: 'eastus',
|
89
|
-
resource_group: 'TestRG-GCE',
|
90
|
-
virtual_network_gateway1: {
|
29
|
+
begin
|
30
|
+
resource_group = resource.resource_groups.create(
|
31
|
+
name: 'TestRG-GCE',
|
32
|
+
location: LOCATION
|
33
|
+
)
|
34
|
+
|
35
|
+
network.virtual_networks.create(
|
36
|
+
name: 'testVnet',
|
37
|
+
location: LOCATION,
|
38
|
+
resource_group: 'TestRG-GCE',
|
39
|
+
network_address_list: '10.1.0.0/16,10.2.0.0/16'
|
40
|
+
)
|
41
|
+
|
42
|
+
network.subnets.create(
|
43
|
+
name: 'GatewaySubnet',
|
44
|
+
resource_group: 'TestRG-GCE',
|
45
|
+
virtual_network_name: 'testVnet',
|
46
|
+
address_prefix: '10.2.0.0/24'
|
47
|
+
)
|
48
|
+
|
49
|
+
network.public_ips.create(
|
50
|
+
name: 'mypubip',
|
51
|
+
resource_group: 'TestRG-GCE',
|
52
|
+
location: LOCATION,
|
53
|
+
public_ip_allocation_method: 'Dynamic'
|
54
|
+
)
|
55
|
+
|
56
|
+
network.virtual_network_gateways.create(
|
91
57
|
name: 'testnetworkgateway',
|
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
|
-
|
58
|
+
location: LOCATION,
|
59
|
+
tags: {
|
60
|
+
key1: 'value1',
|
61
|
+
key2: 'value2'
|
62
|
+
},
|
63
|
+
ip_configurations: [
|
64
|
+
{
|
65
|
+
name: 'default',
|
66
|
+
private_ipallocation_method: 'Dynamic',
|
67
|
+
public_ipaddress_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-GCE/providers/Microsoft.Network/publicIPAddresses/mypubip",
|
68
|
+
subnet_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-GCE/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/GatewaySubnet",
|
69
|
+
private_ipaddress: nil
|
70
|
+
}
|
71
|
+
],
|
72
|
+
resource_group: 'TestRG-GCE',
|
73
|
+
sku_name: 'Basic',
|
74
|
+
sku_tier: 'Basic',
|
75
|
+
sku_capacity: 2,
|
76
|
+
gateway_type: 'ExpressRoute',
|
77
|
+
enable_bgp: false,
|
78
|
+
gateway_size: nil,
|
79
|
+
vpn_type: 'RouteBased',
|
80
|
+
vpn_client_address_pool: nil
|
81
|
+
)
|
82
|
+
|
83
|
+
########################################################################################################################
|
84
|
+
############### Create Virtual Network Gateway Connection to Express Route Circuit ###########
|
85
|
+
########################################################################################################################
|
86
|
+
|
87
|
+
connection = network.virtual_network_gateway_connections.create(
|
88
|
+
name: 'testnetworkgateway-to-expressroute',
|
89
|
+
location: LOCATION,
|
90
|
+
resource_group: 'TestRG-GCE',
|
91
|
+
virtual_network_gateway1: {
|
92
|
+
name: 'testnetworkgateway',
|
93
|
+
resource_group: 'TestRG-GCE'
|
94
|
+
},
|
95
|
+
# Please provide Provisioned Express Route Circuit resource id below
|
96
|
+
peer: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroup/TestRG-GCE/providers/Microsoft.Network/expressRouteCircuits/[circuit_name]",
|
97
|
+
connection_type: 'ExpressRoute'
|
98
|
+
)
|
99
|
+
puts "Created virtual network gateway connection to express route circuit: #{connection.name}"
|
100
|
+
|
101
|
+
########################################################################################################################
|
102
|
+
###################### CleanUp #######################
|
103
|
+
########################################################################################################################
|
104
|
+
|
105
|
+
gateway_connection = network.virtual_network_gateway_connections.get('TestRG-GCE', 'testnetworkgateway-to-expressroute')
|
106
|
+
puts "Get virtual network gateway connection to express route circuit: #{gateway_connection.name}"
|
107
|
+
puts "Deleted virtual network gateway connection to express route circuit: #{gateway_connection.destroy}"
|
108
|
+
|
109
|
+
network_gateway = network.virtual_network_gateways.get('TestRG-GCE', 'testnetworkgateway')
|
110
|
+
network_gateway.destroy
|
111
|
+
|
112
|
+
pubip = network.public_ips.get('TestRG-GCE', 'mypubip')
|
113
|
+
pubip.destroy
|
114
|
+
|
115
|
+
vnet = network.virtual_networks.get('TestRG-GCE', 'testVnet')
|
116
|
+
vnet.destroy
|
117
|
+
|
118
|
+
resource_group = resource.resource_groups.get('TestRG-GCE')
|
119
|
+
resource_group.destroy
|
120
|
+
rescue
|
121
|
+
puts 'Integration Test for virtual network gateway connection to express route circuit is failing'
|
122
|
+
resource_group.destroy unless resource_group.nil?
|
123
|
+
end
|