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
@@ -28,193 +28,218 @@ network = Fog::Network::AzureRM.new(
|
|
28
28
|
client_secret: azure_credentials['client_secret'],
|
29
29
|
subscription_id: azure_credentials['subscription_id']
|
30
30
|
)
|
31
|
-
|
32
|
-
########################################################################################################################
|
33
|
-
###################### Prerequisites #####################
|
34
|
-
########################################################################################################################
|
35
|
-
|
36
|
-
resource.resource_groups.create(
|
37
|
-
name: 'TestRG-AG',
|
38
|
-
location: 'eastus'
|
39
|
-
)
|
40
|
-
|
41
|
-
network.virtual_networks.create(
|
42
|
-
name: 'testVnet',
|
43
|
-
location: 'eastus',
|
44
|
-
resource_group: 'TestRG-AG',
|
45
|
-
dns_servers: %w(10.1.0.0 10.2.0.0),
|
46
|
-
address_prefixes: %w(10.1.0.0/16 10.2.0.0/16)
|
47
|
-
)
|
48
|
-
|
49
|
-
network.subnets.create(
|
50
|
-
name: 'mysubnet',
|
51
|
-
resource_group: 'TestRG-AG',
|
52
|
-
virtual_network_name: 'testVnet',
|
53
|
-
address_prefix: '10.2.0.0/24'
|
54
|
-
)
|
55
|
-
|
56
|
-
network.public_ips.create(
|
57
|
-
name: 'mypubip',
|
58
|
-
resource_group: 'TestRG-AG',
|
59
|
-
location: 'eastus',
|
60
|
-
public_ip_allocation_method: 'Dynamic'
|
61
|
-
)
|
62
|
-
|
63
|
-
#######################################################################################################################
|
64
|
-
##################### Create Application Gateway ######################
|
65
|
-
#######################################################################################################################
|
66
|
-
|
67
|
-
application_gateway.gateways.create(
|
68
|
-
name: 'gateway',
|
69
|
-
location: 'eastus',
|
70
|
-
resource_group: 'TestRG-AG',
|
71
|
-
sku_name: 'Standard_Medium',
|
72
|
-
sku_tier: 'Standard',
|
73
|
-
sku_capacity: '2',
|
74
|
-
gateway_ip_configurations: [
|
75
|
-
{
|
76
|
-
name: 'gatewayIpConfigName',
|
77
|
-
subnet_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourcegroups/TestRG-AG/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/mysubnet"
|
78
|
-
}
|
79
|
-
],
|
80
|
-
frontend_ip_configurations: [
|
81
|
-
{
|
82
|
-
name: 'frontendIpConfig',
|
83
|
-
private_ip_allocation_method: 'Dynamic',
|
84
|
-
public_ip_address_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourcegroups/TestRG-AG/providers/Microsoft.Network/publicIPAddresses/mypubip",
|
85
|
-
private_ip_address: '10.0.1.5'
|
86
|
-
}
|
87
|
-
],
|
88
|
-
frontend_ports: [
|
89
|
-
{
|
90
|
-
name: 'frontendPort',
|
91
|
-
port: 443
|
92
|
-
}
|
93
|
-
],
|
94
|
-
backend_address_pools: [
|
95
|
-
{
|
96
|
-
name: 'backendAddressPool',
|
97
|
-
ip_addresses: [
|
98
|
-
{
|
99
|
-
ipAddress: '10.0.1.6'
|
100
|
-
|
101
|
-
}
|
102
|
-
]
|
103
|
-
}
|
104
|
-
],
|
105
|
-
backend_http_settings_list: [
|
106
|
-
{
|
107
|
-
name: 'gateway_settings',
|
108
|
-
port: 80,
|
109
|
-
protocol: 'Http',
|
110
|
-
cookie_based_affinity: 'Enabled',
|
111
|
-
request_timeout: '30'
|
112
|
-
}
|
113
|
-
],
|
114
|
-
http_listeners: [
|
115
|
-
{
|
116
|
-
name: 'gateway_listener',
|
117
|
-
frontend_ip_config_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-AG/providers/Microsoft.Network/applicationGateways/gateway/frontendIPConfigurations/frontendIpConfig",
|
118
|
-
frontend_port_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-AG/providers/Microsoft.Network/applicationGateways/gateway/frontendPorts/frontendPort",
|
119
|
-
protocol: 'Http',
|
120
|
-
host_name: '',
|
121
|
-
require_server_name_indication: 'false'
|
122
|
-
}
|
123
|
-
],
|
124
|
-
request_routing_rules: [
|
125
|
-
{
|
126
|
-
name: 'gateway_request_route_rule',
|
127
|
-
type: 'Basic',
|
128
|
-
http_listener_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-AG/providers/Microsoft.Network/applicationGateways/gateway/httpListeners/gateway_listener",
|
129
|
-
backend_address_pool_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-AG/providers/Microsoft.Network/applicationGateways/gateway/backendAddressPools/backendAddressPool",
|
130
|
-
backend_http_settings_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-AG/providers/Microsoft.Network/applicationGateways/gateway/backendHttpSettingsCollection/gateway_settings",
|
131
|
-
url_path_map: ''
|
132
|
-
}
|
133
|
-
]
|
134
|
-
)
|
135
|
-
########################################################################################################################
|
136
|
-
###################### Get Application Gateway ######################
|
137
|
-
########################################################################################################################
|
138
|
-
|
139
|
-
app_gateway = application_gateway.gateways.get('TestRG-AG', 'gateway')
|
140
|
-
|
141
31
|
########################################################################################################################
|
142
|
-
######################
|
32
|
+
###################### Resource names #####################
|
143
33
|
########################################################################################################################
|
144
34
|
|
145
|
-
|
35
|
+
time = current_time
|
36
|
+
resource_group_name = "AG-RG-#{time}"
|
37
|
+
virtual_network_name = "Vnet#{time}"
|
38
|
+
subnet_name = "Sub#{time}"
|
39
|
+
public_ip_name = "Pip#{time}"
|
40
|
+
app_gateway_name = "AG#{time}"
|
146
41
|
|
147
42
|
########################################################################################################################
|
148
|
-
######################
|
149
|
-
########################################################################################################################
|
150
|
-
|
151
|
-
app_gateway.stop
|
152
|
-
|
153
|
-
########################################################################################################################
|
154
|
-
###################### Update gateway ip configuration (Subnet id) #########################
|
155
|
-
########################################################################################################################
|
156
|
-
|
157
|
-
subnet_id = network.subnets.create(
|
158
|
-
name: 'mysubnet1',
|
159
|
-
resource_group: 'TestRG-AG',
|
160
|
-
virtual_network_name: 'testVnet',
|
161
|
-
address_prefix: '10.1.0.0/24'
|
162
|
-
).id
|
163
|
-
|
164
|
-
app_gateway.update_gateway_ip_configuration(subnet_id)
|
165
|
-
|
166
|
-
########################################################################################################################
|
167
|
-
###################### Start Application Gateway #########################
|
168
|
-
########################################################################################################################
|
169
|
-
|
170
|
-
app_gateway.start
|
171
|
-
|
172
|
-
########################################################################################################################
|
173
|
-
###################### Add/Remove Frontend ports #########################
|
174
|
-
########################################################################################################################
|
175
|
-
|
176
|
-
app_gateway.add_frontend_port(name: 'frontendPort1', port: 80)
|
177
|
-
|
178
|
-
app_gateway.remove_frontend_port(name: 'frontendPort1', port: 80)
|
179
|
-
|
180
|
-
#######################################################################################################################
|
181
|
-
##################### Add/Remove Probes #########################
|
182
|
-
#######################################################################################################################
|
183
|
-
|
184
|
-
app_gateway.add_probe(
|
185
|
-
name: 'Probe1',
|
186
|
-
protocol: 'http',
|
187
|
-
host: 'localhost',
|
188
|
-
path: '/fog-test',
|
189
|
-
interval: 60,
|
190
|
-
timeout: 300,
|
191
|
-
unhealthy_threshold: 5
|
192
|
-
)
|
193
|
-
app_gateway.remove_probe(
|
194
|
-
name: 'Probe1',
|
195
|
-
protocol: 'http',
|
196
|
-
host: 'localhost',
|
197
|
-
path: '/fog-test',
|
198
|
-
interval: 60,
|
199
|
-
timeout: 300,
|
200
|
-
unhealthy_threshold: 5
|
201
|
-
)
|
202
|
-
|
203
|
-
########################################################################################################################
|
204
|
-
###################### Destroy Application Gateway ######################
|
205
|
-
########################################################################################################################
|
206
|
-
|
207
|
-
app_gateway.destroy
|
208
|
-
|
209
|
-
########################################################################################################################
|
210
|
-
###################### CleanUp ######################
|
43
|
+
###################### Prerequisites #####################
|
211
44
|
########################################################################################################################
|
212
45
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
46
|
+
begin
|
47
|
+
resource_group = resource.resource_groups.create(
|
48
|
+
name: resource_group_name,
|
49
|
+
location: LOCATION
|
50
|
+
)
|
51
|
+
|
52
|
+
network.virtual_networks.create(
|
53
|
+
name: virtual_network_name,
|
54
|
+
location: LOCATION,
|
55
|
+
resource_group: resource_group_name,
|
56
|
+
dns_servers: %w(10.1.0.0 10.2.0.0),
|
57
|
+
address_prefixes: %w(10.1.0.0/16 10.2.0.0/16)
|
58
|
+
)
|
59
|
+
|
60
|
+
network.subnets.create(
|
61
|
+
name: subnet_name,
|
62
|
+
resource_group: resource_group_name,
|
63
|
+
virtual_network_name: virtual_network_name,
|
64
|
+
address_prefix: '10.2.0.0/24'
|
65
|
+
)
|
66
|
+
|
67
|
+
network.public_ips.create(
|
68
|
+
name: public_ip_name,
|
69
|
+
resource_group: resource_group_name,
|
70
|
+
location: LOCATION,
|
71
|
+
public_ip_allocation_method: 'Dynamic'
|
72
|
+
)
|
73
|
+
|
74
|
+
#######################################################################################################################
|
75
|
+
##################### Create Application Gateway ######################
|
76
|
+
#######################################################################################################################
|
77
|
+
|
78
|
+
app_gateway = application_gateway.gateways.create(
|
79
|
+
name: app_gateway_name,
|
80
|
+
location: LOCATION,
|
81
|
+
resource_group: resource_group_name,
|
82
|
+
sku_name: 'Standard_Medium',
|
83
|
+
sku_tier: 'Standard',
|
84
|
+
sku_capacity: '2',
|
85
|
+
gateway_ip_configurations: [
|
86
|
+
{
|
87
|
+
name: 'gatewayIpConfigName',
|
88
|
+
subnet_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourcegroups/#{resource_group_name}/providers/Microsoft.Network/virtualNetworks/#{virtual_network_name}/subnets/#{subnet_name}"
|
89
|
+
}
|
90
|
+
],
|
91
|
+
frontend_ip_configurations: [
|
92
|
+
{
|
93
|
+
name: 'frontendIpConfig',
|
94
|
+
private_ip_allocation_method: 'Dynamic',
|
95
|
+
public_ip_address_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourcegroups/#{resource_group_name}/providers/Microsoft.Network/publicIPAddresses/#{public_ip_name}",
|
96
|
+
private_ip_address: '10.0.1.5'
|
97
|
+
}
|
98
|
+
],
|
99
|
+
frontend_ports: [
|
100
|
+
{
|
101
|
+
name: 'frontendPort',
|
102
|
+
port: 443
|
103
|
+
}
|
104
|
+
],
|
105
|
+
backend_address_pools: [
|
106
|
+
{
|
107
|
+
name: 'backendAddressPool',
|
108
|
+
ip_addresses: [
|
109
|
+
{
|
110
|
+
ipAddress: '10.0.1.6'
|
111
|
+
|
112
|
+
}
|
113
|
+
]
|
114
|
+
}
|
115
|
+
],
|
116
|
+
backend_http_settings_list: [
|
117
|
+
{
|
118
|
+
name: 'gateway_settings',
|
119
|
+
port: 80,
|
120
|
+
protocol: 'Http',
|
121
|
+
cookie_based_affinity: 'Enabled',
|
122
|
+
request_timeout: '30'
|
123
|
+
}
|
124
|
+
],
|
125
|
+
http_listeners: [
|
126
|
+
{
|
127
|
+
name: 'gateway_listener',
|
128
|
+
frontend_ip_config_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/applicationGateways/#{app_gateway_name}/frontendIPConfigurations/frontendIpConfig",
|
129
|
+
frontend_port_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/applicationGateways/#{app_gateway_name}/frontendPorts/frontendPort",
|
130
|
+
protocol: 'Http',
|
131
|
+
host_name: '',
|
132
|
+
require_server_name_indication: 'false'
|
133
|
+
}
|
134
|
+
],
|
135
|
+
request_routing_rules: [
|
136
|
+
{
|
137
|
+
name: 'gateway_request_route_rule',
|
138
|
+
type: 'Basic',
|
139
|
+
http_listener_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/applicationGateways/#{app_gateway_name}/httpListeners/gateway_listener",
|
140
|
+
backend_address_pool_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/applicationGateways/#{app_gateway_name}/backendAddressPools/backendAddressPool",
|
141
|
+
backend_http_settings_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/#{resource_group_name}/providers/Microsoft.Network/applicationGateways/#{app_gateway_name}/backendHttpSettingsCollection/gateway_settings",
|
142
|
+
url_path_map: ''
|
143
|
+
}
|
144
|
+
]
|
145
|
+
)
|
146
|
+
puts "Created application gateway #{app_gateway.name}"
|
147
|
+
########################################################################################################################
|
148
|
+
###################### Get Application Gateway ######################
|
149
|
+
########################################################################################################################
|
150
|
+
|
151
|
+
app_gateway = application_gateway.gateways.get(resource_group_name, app_gateway_name)
|
152
|
+
puts "Get application gateway: #{app_gateway.name}"
|
153
|
+
|
154
|
+
########################################################################################################################
|
155
|
+
###################### Update sku attributes (Name and Capacity) #########################
|
156
|
+
########################################################################################################################
|
157
|
+
|
158
|
+
app_gateway.update_sku('Standard_Small', '1')
|
159
|
+
puts 'Updated application gateway sku'
|
160
|
+
|
161
|
+
########################################################################################################################
|
162
|
+
###################### Stop Application Gateway #########################
|
163
|
+
########################################################################################################################
|
164
|
+
|
165
|
+
app_gateway.stop
|
166
|
+
puts 'Application Gateway stopped!'
|
167
|
+
|
168
|
+
########################################################################################################################
|
169
|
+
###################### Update gateway ip configuration (Subnet id) #########################
|
170
|
+
########################################################################################################################
|
171
|
+
|
172
|
+
subnet_id = network.subnets.create(
|
173
|
+
name: "#{subnet_name}1",
|
174
|
+
resource_group: resource_group_name,
|
175
|
+
virtual_network_name: virtual_network_name,
|
176
|
+
address_prefix: '10.1.0.0/24'
|
177
|
+
).id
|
178
|
+
|
179
|
+
app_gateway.update_gateway_ip_configuration(subnet_id)
|
180
|
+
puts 'Updated Application Gateway ip configuration'
|
181
|
+
|
182
|
+
########################################################################################################################
|
183
|
+
###################### Start Application Gateway #########################
|
184
|
+
########################################################################################################################
|
185
|
+
|
186
|
+
app_gateway.start
|
187
|
+
puts 'Application Gateway started!'
|
188
|
+
|
189
|
+
########################################################################################################################
|
190
|
+
###################### Add/Remove Frontend ports #########################
|
191
|
+
########################################################################################################################
|
192
|
+
|
193
|
+
app_gateway.add_frontend_port(name: 'frontendPort1', port: 80)
|
194
|
+
puts 'Added Frontend port in application gateway'
|
195
|
+
|
196
|
+
app_gateway.remove_frontend_port(name: 'frontendPort1', port: 80)
|
197
|
+
puts 'Removed Frontend port in application gateway'
|
198
|
+
|
199
|
+
#######################################################################################################################
|
200
|
+
##################### Add/Remove Probes #########################
|
201
|
+
#######################################################################################################################
|
202
|
+
|
203
|
+
app_gateway.add_probe(
|
204
|
+
name: 'Probe1',
|
205
|
+
protocol: 'http',
|
206
|
+
host: 'localhost',
|
207
|
+
path: '/fog-test',
|
208
|
+
interval: 60,
|
209
|
+
timeout: 300,
|
210
|
+
unhealthy_threshold: 5
|
211
|
+
)
|
212
|
+
puts 'Added probe in application gateway'
|
213
|
+
app_gateway.remove_probe(
|
214
|
+
name: 'Probe1',
|
215
|
+
protocol: 'http',
|
216
|
+
host: 'localhost',
|
217
|
+
path: '/fog-test',
|
218
|
+
interval: 60,
|
219
|
+
timeout: 300,
|
220
|
+
unhealthy_threshold: 5
|
221
|
+
)
|
222
|
+
puts 'Removed probe in application gateway'
|
223
|
+
|
224
|
+
########################################################################################################################
|
225
|
+
###################### Destroy Application Gateway ######################
|
226
|
+
########################################################################################################################
|
227
|
+
|
228
|
+
puts "Deleted application gateway: #{app_gateway.destroy}"
|
229
|
+
|
230
|
+
########################################################################################################################
|
231
|
+
###################### CleanUp ######################
|
232
|
+
########################################################################################################################
|
233
|
+
|
234
|
+
pubip = network.public_ips.get(resource_group_name, public_ip_name)
|
235
|
+
pubip.destroy
|
236
|
+
|
237
|
+
vnet = network.virtual_networks.get(resource_group_name, virtual_network_name)
|
238
|
+
vnet.destroy
|
239
|
+
|
240
|
+
resource_group = resource.resource_groups.get(resource_group_name)
|
241
|
+
resource_group.destroy
|
242
|
+
rescue
|
243
|
+
puts 'Integration Test for application gateway is failing'
|
244
|
+
resource_group.destroy unless resource_group.nil?
|
245
|
+
end
|
@@ -23,40 +23,57 @@ compute = Fog::Compute::AzureRM.new(
|
|
23
23
|
)
|
24
24
|
|
25
25
|
########################################################################################################################
|
26
|
-
######################
|
26
|
+
###################### Resource names #####################
|
27
27
|
########################################################################################################################
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
)
|
29
|
+
time = current_time
|
30
|
+
resource_group_name = "AS-RG-#{time}"
|
31
|
+
availability_set_name = "AS#{time}@%%$%$#"
|
33
32
|
|
34
33
|
########################################################################################################################
|
35
|
-
######################
|
34
|
+
###################### Prerequisites ######################
|
36
35
|
########################################################################################################################
|
37
36
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
)
|
43
|
-
########################################################################################################################
|
44
|
-
###################### List Availability Sets ######################
|
45
|
-
########################################################################################################################
|
46
|
-
compute.availability_sets(resource_group: 'TestRG-AS').each do |availability_set|
|
47
|
-
Fog::Logger.debug "Name: #{availability_set.name}, Location: #{availability_set.location}"
|
48
|
-
end
|
37
|
+
begin
|
38
|
+
resource_group = rs.resource_groups.create(
|
39
|
+
name: resource_group_name,
|
40
|
+
location: LOCATION
|
41
|
+
)
|
49
42
|
|
50
|
-
########################################################################################################################
|
51
|
-
######################
|
52
|
-
########################################################################################################################
|
43
|
+
########################################################################################################################
|
44
|
+
###################### Create Availability Set ######################
|
45
|
+
########################################################################################################################
|
53
46
|
|
54
|
-
avail_set = compute.availability_sets.
|
55
|
-
|
47
|
+
avail_set = compute.availability_sets.create(
|
48
|
+
name: availability_set_name,
|
49
|
+
location: LOCATION,
|
50
|
+
resource_group: resource_group_name
|
51
|
+
)
|
52
|
+
puts "Created availability set: #{avail_set.name}"
|
56
53
|
|
57
|
-
########################################################################################################################
|
58
|
-
######################
|
59
|
-
########################################################################################################################
|
54
|
+
########################################################################################################################
|
55
|
+
###################### List Availability Sets ######################
|
56
|
+
########################################################################################################################
|
57
|
+
puts 'List availability sets:'
|
58
|
+
compute.availability_sets(resource_group: resource_group_name).each do |availability_set|
|
59
|
+
puts availability_set.name
|
60
|
+
end
|
61
|
+
|
62
|
+
########################################################################################################################
|
63
|
+
###################### Get and Delete Availability Set ######################
|
64
|
+
########################################################################################################################
|
60
65
|
|
61
|
-
|
62
|
-
|
66
|
+
avail_set = compute.availability_sets.get(resource_group_name, availability_set_name)
|
67
|
+
puts "Get availability set: #{avail_set.name}"
|
68
|
+
puts "Deleted availability set: #{avail_set.destroy}"
|
69
|
+
|
70
|
+
########################################################################################################################
|
71
|
+
###################### CleanUp ######################
|
72
|
+
########################################################################################################################
|
73
|
+
|
74
|
+
rg = rs.resource_groups.get(resource_group_name)
|
75
|
+
rg.destroy
|
76
|
+
rescue
|
77
|
+
puts 'Integration Test for availability set is failing'
|
78
|
+
resource_group.destroy unless resource_group.nil?
|
79
|
+
end
|