fog-azure-rm 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +17 -0
- data/.gitignore +6 -0
- data/.hound.yml +2 -0
- data/.rubocop.yml +36 -0
- data/.travis.yml +14 -0
- data/CHANGELOG.md +28 -0
- data/CONTRIBUTING.md +2 -0
- data/CONTRIBUTORS.md +2 -0
- data/Gemfile +3 -0
- data/fog-azure-rm.gemspec +34 -0
- data/lib/fog/azurerm.rb +1 -0
- data/lib/fog/azurerm/compute.rb +0 -1
- data/lib/fog/azurerm/config.rb +4 -0
- data/lib/fog/azurerm/credentials.rb +10 -3
- data/lib/fog/azurerm/docs/compute.md +172 -0
- data/lib/fog/azurerm/docs/dns.md +112 -0
- data/lib/fog/azurerm/docs/network.md +794 -0
- data/lib/fog/azurerm/docs/resources.md +155 -0
- data/lib/fog/azurerm/docs/storage.md +222 -0
- data/lib/fog/azurerm/docs/structure.md +53 -0
- data/lib/fog/azurerm/models/compute/server.rb +3 -2
- data/lib/fog/azurerm/models/network/frontend_ip_configuration.rb +5 -1
- data/lib/fog/azurerm/models/network/network_interface.rb +49 -4
- data/lib/fog/azurerm/models/network/network_interfaces.rb +4 -2
- data/lib/fog/azurerm/models/network/network_security_group.rb +27 -4
- data/lib/fog/azurerm/models/network/network_security_groups.rb +4 -2
- data/lib/fog/azurerm/models/network/network_security_rule.rb +1 -1
- data/lib/fog/azurerm/models/network/subnet.rb +26 -6
- data/lib/fog/azurerm/models/network/subnets.rb +4 -2
- data/lib/fog/azurerm/models/network/virtual_network.rb +72 -10
- data/lib/fog/azurerm/models/network/virtual_networks.rb +4 -2
- data/lib/fog/azurerm/models/resources/azure_resource.rb +25 -0
- data/lib/fog/azurerm/models/resources/azure_resources.rb +31 -0
- data/lib/fog/azurerm/models/resources/dependency.rb +27 -0
- data/lib/fog/azurerm/models/resources/deployment.rb +65 -0
- data/lib/fog/azurerm/models/resources/deployments.rb +27 -0
- data/lib/fog/azurerm/models/resources/provider.rb +27 -0
- data/lib/fog/azurerm/models/resources/provider_resource_type.rb +22 -0
- data/lib/fog/azurerm/models/storage/blob.rb +13 -0
- data/lib/fog/azurerm/models/storage/blobs.rb +22 -0
- data/lib/fog/azurerm/models/storage/container.rb +65 -0
- data/lib/fog/azurerm/models/storage/containers.rb +44 -0
- data/lib/fog/azurerm/models/storage/data_disk.rb +26 -0
- data/lib/fog/azurerm/models/storage/storage_account.rb +4 -0
- data/lib/fog/azurerm/network.rb +21 -3
- data/lib/fog/azurerm/requests/network/add_address_prefixes_in_virtual_network.rb +68 -0
- data/lib/fog/azurerm/requests/network/add_dns_servers_in_virtual_network.rb +74 -0
- data/lib/fog/azurerm/requests/network/add_security_rules.rb +152 -0
- data/lib/fog/azurerm/requests/network/add_subnets_in_virtual_network.rb +69 -0
- data/lib/fog/azurerm/requests/network/attach_network_security_group_to_subnet.rb +59 -0
- data/lib/fog/azurerm/requests/network/attach_resource_to_nic.rb +88 -0
- data/lib/fog/azurerm/requests/network/attach_route_table_to_subnet.rb +59 -0
- data/lib/fog/azurerm/requests/network/create_load_balancer.rb +4 -4
- data/lib/fog/azurerm/requests/network/{create_network_interface.rb → create_or_update_network_interface.rb} +14 -13
- data/lib/fog/azurerm/requests/network/{create_network_security_group.rb → create_or_update_network_security_group.rb} +17 -35
- data/lib/fog/azurerm/requests/network/create_or_update_virtual_network.rb +116 -0
- data/lib/fog/azurerm/requests/network/create_subnet.rb +28 -14
- data/lib/fog/azurerm/requests/network/detach_network_security_group_from_subnet.rb +53 -0
- data/lib/fog/azurerm/requests/network/detach_resource_from_nic.rb +80 -0
- data/lib/fog/azurerm/requests/network/detach_route_table_from_subnet.rb +53 -0
- data/lib/fog/azurerm/requests/network/get_network_interface.rb +60 -0
- data/lib/fog/azurerm/requests/network/get_network_security_group.rb +161 -0
- data/lib/fog/azurerm/requests/network/get_subnet.rb +36 -0
- data/lib/fog/azurerm/requests/network/get_virtual_network.rb +64 -0
- data/lib/fog/azurerm/requests/network/remove_address_prefixes_from_virtual_network.rb +67 -0
- data/lib/fog/azurerm/requests/network/remove_dns_servers_from_virtual_network.rb +67 -0
- data/lib/fog/azurerm/requests/network/remove_security_rule.rb +155 -0
- data/lib/fog/azurerm/requests/network/remove_subnets_from_virtual_network.rb +57 -0
- data/lib/fog/azurerm/requests/resources/create_deployment.rb +90 -0
- data/lib/fog/azurerm/requests/resources/delete_deployment.rb +28 -0
- data/lib/fog/azurerm/requests/resources/delete_resource_tag.rb +48 -0
- data/lib/fog/azurerm/requests/resources/list_deployments.rb +75 -0
- data/lib/fog/azurerm/requests/resources/list_tagged_resources.rb +46 -0
- data/lib/fog/azurerm/requests/resources/tag_resource.rb +46 -0
- data/lib/fog/azurerm/requests/storage/create_container.rb +37 -0
- data/lib/fog/azurerm/requests/storage/delete_container.rb +26 -0
- data/lib/fog/azurerm/requests/storage/delete_disk.rb +36 -0
- data/lib/fog/azurerm/requests/storage/get_blob_metadata.rb +30 -0
- data/lib/fog/azurerm/requests/storage/get_container_access_control_list.rb +29 -0
- data/lib/fog/azurerm/requests/storage/get_container_metadata.rb +31 -0
- data/lib/fog/azurerm/requests/storage/get_container_properties.rb +36 -0
- data/lib/fog/azurerm/requests/storage/get_storage_access_keys.rb +31 -0
- data/lib/fog/azurerm/requests/storage/list_containers.rb +49 -0
- data/lib/fog/azurerm/requests/storage/list_storage_account_for_rg.rb +0 -1
- data/lib/fog/azurerm/requests/storage/set_blob_metadata.rb +26 -0
- data/lib/fog/azurerm/requests/storage/set_container_metadata.rb +26 -0
- data/lib/fog/azurerm/resources.rb +13 -0
- data/lib/fog/azurerm/storage.rb +46 -6
- data/lib/fog/azurerm/utilities/general.rb +18 -0
- data/lib/fog/azurerm/version.rb +1 -1
- data/rakefile +21 -0
- data/test/api_stub.rb +44 -0
- data/test/api_stub/models/compute/availability_set.rb +21 -0
- data/test/api_stub/models/compute/server.rb +191 -0
- data/test/api_stub/models/dns/record_set.rb +59 -0
- data/test/api_stub/models/dns/zone.rb +47 -0
- data/test/api_stub/models/network/application_gateway.rb +135 -0
- data/test/api_stub/models/network/load_balancer.rb +132 -0
- data/test/api_stub/models/network/network_interface.rb +71 -0
- data/test/api_stub/models/network/network_security_group.rb +94 -0
- data/test/api_stub/models/network/public_ip.rb +35 -0
- data/test/api_stub/models/network/subnet.rb +35 -0
- data/test/api_stub/models/network/traffic_manager_end_point.rb +26 -0
- data/test/api_stub/models/network/traffic_manager_profile.rb +74 -0
- data/test/api_stub/models/network/virtual_network.rb +61 -0
- data/test/api_stub/models/resources/deployment.rb +110 -0
- data/test/api_stub/models/resources/resource.rb +40 -0
- data/test/api_stub/models/resources/resource_group.rb +38 -0
- data/test/api_stub/models/storage/blob.rb +17 -0
- data/test/api_stub/models/storage/container.rb +92 -0
- data/test/api_stub/models/storage/data_disk.rb +30 -0
- data/test/api_stub/models/storage/storageaccount.rb +29 -0
- data/test/api_stub/requests/compute/availability_set.rb +46 -0
- data/test/api_stub/requests/compute/virtual_machine.rb +654 -0
- data/test/api_stub/requests/dns/record_set.rb +105 -0
- data/test/api_stub/requests/dns/zone.rb +67 -0
- data/test/api_stub/requests/network/application_gateway.rb +433 -0
- data/test/api_stub/requests/network/load_balancer.rb +366 -0
- data/test/api_stub/requests/network/network_interface.rb +268 -0
- data/test/api_stub/requests/network/network_security_group.rb +240 -0
- data/test/api_stub/requests/network/public_ip.rb +73 -0
- data/test/api_stub/requests/network/subnet.rb +73 -0
- data/test/api_stub/requests/network/traffic_manager_endpoint.rb +25 -0
- data/test/api_stub/requests/network/traffic_manager_profile.rb +140 -0
- data/test/api_stub/requests/network/virtual_network.rb +127 -0
- data/test/api_stub/requests/resources/deployment.rb +23 -0
- data/test/api_stub/requests/resources/resource.rb +47 -0
- data/test/api_stub/requests/resources/resource_group.rb +53 -0
- data/test/api_stub/requests/storage/blob.rb +24 -0
- data/test/api_stub/requests/storage/container.rb +95 -0
- data/test/api_stub/requests/storage/storageaccount.rb +112 -0
- data/test/integration/README.md +14 -0
- data/test/integration/application_gateway.rb +129 -0
- data/test/integration/availability_set.rb +56 -0
- data/test/integration/container.rb +81 -0
- data/test/integration/credentials/azure.yml +4 -0
- data/test/integration/external_load_balancer.rb +119 -0
- data/test/integration/internal_load_balancer.rb +126 -0
- data/test/integration/network_interface.rb +135 -0
- data/test/integration/network_security_group.rb +104 -0
- data/test/integration/public_ip.rb +63 -0
- data/test/integration/record_set.rb +88 -0
- data/test/integration/server.rb +139 -0
- data/test/integration/storage_account.rb +62 -0
- data/test/integration/subnet.rb +91 -0
- data/test/integration/traffic_manager.rb +81 -0
- data/test/integration/virtual_network.rb +124 -0
- data/test/integration/zone.rb +64 -0
- data/test/models/compute/test_availability_set.rb +53 -0
- data/test/models/compute/test_availability_sets.rb +41 -0
- data/test/models/compute/test_server.rb +143 -0
- data/test/models/compute/test_servers.rb +49 -0
- data/test/models/dns/test_record_set.rb +59 -0
- data/test/models/dns/test_record_sets.rb +51 -0
- data/test/models/dns/test_zone.rb +49 -0
- data/test/models/dns/test_zones.rb +49 -0
- data/test/models/network/test_application_gateway.rb +62 -0
- data/test/models/network/test_application_gateways.rb +42 -0
- data/test/models/network/test_load_balancer.rb +56 -0
- data/test/models/network/test_load_balancers.rb +42 -0
- data/test/models/network/test_network_interface.rb +106 -0
- data/test/models/network/test_network_interfaces.rb +41 -0
- data/test/models/network/test_network_security_group.rb +88 -0
- data/test/models/network/test_network_security_groups.rb +40 -0
- data/test/models/network/test_network_security_rule.rb +30 -0
- data/test/models/network/test_public_ip.rb +58 -0
- data/test/models/network/test_public_ips.rb +55 -0
- data/test/models/network/test_subnet.rb +84 -0
- data/test/models/network/test_subnets.rb +42 -0
- data/test/models/network/test_traffic_manager_end_point.rb +53 -0
- data/test/models/network/test_traffic_manager_end_points.rb +42 -0
- data/test/models/network/test_traffic_manager_profile.rb +54 -0
- data/test/models/network/test_traffic_manager_profiles.rb +41 -0
- data/test/models/network/test_virtual_network.rb +112 -0
- data/test/models/network/test_virtual_networks.rb +54 -0
- data/test/models/resources/test_deployment.rb +54 -0
- data/test/models/resources/test_deployments.rb +37 -0
- data/test/models/resources/test_resource.rb +22 -0
- data/test/models/resources/test_resource_group.rb +43 -0
- data/test/models/resources/test_resource_groups.rb +37 -0
- data/test/models/resources/test_resources.rb +38 -0
- data/test/models/storage/test_blobs.rb +32 -0
- data/test/models/storage/test_container.rb +67 -0
- data/test/models/storage/test_containers.rb +56 -0
- data/test/models/storage/test_data_disk.rb +29 -0
- data/test/models/storage/test_storage_account.rb +62 -0
- data/test/models/storage/test_storage_accounts.rb +65 -0
- data/test/requests/compute/test_attach_data_disk_to_vm.rb +175 -0
- data/test/requests/compute/test_create_availability_set.rb +30 -0
- data/test/requests/compute/test_create_virtual_machine.rb +50 -0
- data/test/requests/compute/test_deallocate_virtual_machine.rb +29 -0
- data/test/requests/compute/test_delete_availability_set.rb +29 -0
- data/test/requests/compute/test_delete_virtual_machine.rb +29 -0
- data/test/requests/compute/test_detach_data_disk_from_vm.rb +53 -0
- data/test/requests/compute/test_generalize_virtual_machine.rb +29 -0
- data/test/requests/compute/test_get_virtual_machine.rb +31 -0
- data/test/requests/compute/test_get_vm_status.rb +31 -0
- data/test/requests/compute/test_list_availability_sets.rb +30 -0
- data/test/requests/compute/test_list_available_sizes_for_virtual_machine.rb +31 -0
- data/test/requests/compute/test_list_virtual_machines.rb +30 -0
- data/test/requests/compute/test_power_off_virtual_machine.rb +29 -0
- data/test/requests/compute/test_redeploy_virtual_machine.rb +29 -0
- data/test/requests/compute/test_restart_virtual_machine.rb +29 -0
- data/test/requests/compute/test_start_virtual_machine.rb +29 -0
- data/test/requests/dns/test_check_for_zone.rb +52 -0
- data/test/requests/dns/test_create_record_set.rb +45 -0
- data/test/requests/dns/test_create_zone.rb +36 -0
- data/test/requests/dns/test_delete_record_set.rb +35 -0
- data/test/requests/dns/test_delete_zone.rb +35 -0
- data/test/requests/dns/test_get_records_from_record_set.rb +55 -0
- data/test/requests/dns/test_list_record_sets.rb +36 -0
- data/test/requests/dns/test_list_zones.rb +40 -0
- data/test/requests/network/test_add_address_prefixes_in_virtual_network.rb +45 -0
- data/test/requests/network/test_add_dns_servers_in_virtual_network.rb +45 -0
- data/test/requests/network/test_add_security_rules.rb +63 -0
- data/test/requests/network/test_add_subnets_in_virtual_network.rb +45 -0
- data/test/requests/network/test_attach_network_security_group_to_subnet.rb +33 -0
- data/test/requests/network/test_attach_resource_to_nic.rb +65 -0
- data/test/requests/network/test_attach_route_table_to_subnet.rb +33 -0
- data/test/requests/network/test_check_for_public_ip.rb +38 -0
- data/test/requests/network/test_check_for_virtual_network.rb +38 -0
- data/test/requests/network/test_create_application_gateway.rb +61 -0
- data/test/requests/network/test_create_load_balancer.rb +56 -0
- data/test/requests/network/test_create_network_interface.rb +54 -0
- data/test/requests/network/test_create_network_security_group.rb +45 -0
- data/test/requests/network/test_create_or_update_virtual_network.rb +63 -0
- data/test/requests/network/test_create_public_ip.rb +44 -0
- data/test/requests/network/test_create_subnet.rb +44 -0
- data/test/requests/network/test_create_traffic_manager_endpoint.rb +32 -0
- data/test/requests/network/test_create_traffic_manager_profile.rb +32 -0
- data/test/requests/network/test_delete_application_gateway.rb +30 -0
- data/test/requests/network/test_delete_load_balancer.rb +30 -0
- data/test/requests/network/test_delete_network_interface.rb +30 -0
- data/test/requests/network/test_delete_network_security_group.rb +32 -0
- data/test/requests/network/test_delete_public_ip.rb +30 -0
- data/test/requests/network/test_delete_subnet.rb +30 -0
- data/test/requests/network/test_delete_traffic_manager_endpoint.rb +28 -0
- data/test/requests/network/test_delete_traffic_manager_profile.rb +28 -0
- data/test/requests/network/test_delete_virtual_network.rb +30 -0
- data/test/requests/network/test_detach_network_security_group_from_subnet.rb +33 -0
- data/test/requests/network/test_detach_resource_from_nic.rb +60 -0
- data/test/requests/network/test_detach_route_table_from_subnet.rb +33 -0
- data/test/requests/network/test_get_network_interface.rb +31 -0
- data/test/requests/network/test_get_network_security_group.rb +33 -0
- data/test/requests/network/test_get_subnet.rb +33 -0
- data/test/requests/network/test_get_traffic_manager_profile.rb +29 -0
- data/test/requests/network/test_list_application_gateways.rb +31 -0
- data/test/requests/network/test_list_load_balancers.rb +31 -0
- data/test/requests/network/test_list_network_interfaces.rb +31 -0
- data/test/requests/network/test_list_network_security_groups.rb +33 -0
- data/test/requests/network/test_list_public_ips.rb +31 -0
- data/test/requests/network/test_list_subnets.rb +31 -0
- data/test/requests/network/test_list_traffic_manager_profiles.rb +29 -0
- data/test/requests/network/test_list_virtual_networks.rb +31 -0
- data/test/requests/network/test_remove_address_prefixes_from_virtual_network.rb +45 -0
- data/test/requests/network/test_remove_dns_servers_from_virtual_network.rb +45 -0
- data/test/requests/network/test_remove_security_rule.rb +49 -0
- data/test/requests/network/test_remove_subnets_from_virtual_network.rb +45 -0
- data/test/requests/resources/test_create_deployment.rb +49 -0
- data/test/requests/resources/test_create_resource_group.rb +31 -0
- data/test/requests/resources/test_delete_deployment.rb +31 -0
- data/test/requests/resources/test_delete_resource_group.rb +30 -0
- data/test/requests/resources/test_delete_resource_tag.rb +51 -0
- data/test/requests/resources/test_list_deployments.rb +32 -0
- data/test/requests/resources/test_list_resource_groups.rb +31 -0
- data/test/requests/resources/test_list_tagged_resources.rb +31 -0
- data/test/requests/resources/test_tag_resource.rb +51 -0
- data/test/requests/storage/test_check_storage_account_name_availability.rb +59 -0
- data/test/requests/storage/test_create_container.rb +31 -0
- data/test/requests/storage/test_create_storage_account.rb +56 -0
- data/test/requests/storage/test_delete_container.rb +30 -0
- data/test/requests/storage/test_delete_storage_account.rb +34 -0
- data/test/requests/storage/test_get_blob_metadata.rb +18 -0
- data/test/requests/storage/test_get_container_access_control_list.rb +31 -0
- data/test/requests/storage/test_get_container_metadata.rb +18 -0
- data/test/requests/storage/test_get_container_properties.rb +31 -0
- data/test/requests/storage/test_get_storage_access_keys.rb +31 -0
- data/test/requests/storage/test_list_containers.rb +23 -0
- data/test/requests/storage/test_list_storage_accounts.rb +47 -0
- data/test/requests/storage/test_list_storage_accounts_for_rg.rb +51 -0
- data/test/requests/storage/test_set_blob_metadata.rb +17 -0
- data/test/requests/storage/test_set_container_metadata.rb +17 -0
- data/test/test_credentials.rb +39 -0
- data/test/test_helper.rb +428 -0
- metadata +273 -14
- data/lib/fog/azurerm/models/compute/data_disk.rb +0 -26
- data/lib/fog/azurerm/requests/network/create_virtual_network.rb +0 -115
@@ -0,0 +1,794 @@
|
|
1
|
+
# Network
|
2
|
+
|
3
|
+
This document explains how to get started using Azure Network Service with Fog. With this gem you can create/update/list/delete virtual networks, subnets, public IPs and network interfaces.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
First of all, you need to require the Fog library by executing:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
require 'fog/azurerm'
|
11
|
+
```
|
12
|
+
## Create Connection
|
13
|
+
|
14
|
+
Next, create a connection to the Network Service:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
azure_network_service = Fog::Network::AzureRM.new(
|
18
|
+
tenant_id: '<Tenantid>', # Tenant id of Azure Active Directory Application
|
19
|
+
client_id: '<Clientid>', # Client id of Azure Active Directory Application
|
20
|
+
client_secret: '<ClientSecret>', # Client Secret of Azure Active Directory Application
|
21
|
+
subscription_id: '<Subscriptionid>' # Subscription id of an Azure Account
|
22
|
+
)
|
23
|
+
```
|
24
|
+
## Create Virtual Network
|
25
|
+
|
26
|
+
Create a new virtual network
|
27
|
+
|
28
|
+
Optional parameters for Virtual Network: subnets, dns_servers & address_prefixes
|
29
|
+
Optional parameters for Subnet: network_security_group_id, route_table_id & address_prefix
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
vnet = azure_network_service.virtual_networks.create(
|
33
|
+
name: '<Virtual Network Name>',
|
34
|
+
location: 'westus',
|
35
|
+
resource_group: '<Resource Group Name>',
|
36
|
+
subnets: [{
|
37
|
+
name: '<Subnet Name>',
|
38
|
+
address_prefix: '10.1.0.0/24',
|
39
|
+
network_security_group_id: '/subscriptions/<Subscription Id>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/networkSecurityGroups/<Network Security Group Name>',
|
40
|
+
route_table_id: '/subscriptions/<Subscription Id>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/routeTables/<Route Table Name>'
|
41
|
+
}],
|
42
|
+
dns_servers: ['10.1.0.0','10.2.0.0'],
|
43
|
+
address_prefixes: ['10.1.0.0/16','10.2.0.0/16']
|
44
|
+
)
|
45
|
+
```
|
46
|
+
|
47
|
+
## Check for Virtual Network
|
48
|
+
|
49
|
+
Checks if the Virtual Network already exists or not.
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
azure_network_service.virtual_networks.check_if_exists('<Virtual Network name>', '<Resource Group name>')
|
53
|
+
```
|
54
|
+
|
55
|
+
## List Virtual Networks
|
56
|
+
|
57
|
+
List all virtual networks in a subscription
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
vnets = azure_network_service.virtual_networks(resource_group: '<Resource Group Name>')
|
61
|
+
vnets.each do |vnet|
|
62
|
+
puts "#{vnet.name}"
|
63
|
+
puts "#{vnet.location}"
|
64
|
+
end
|
65
|
+
```
|
66
|
+
|
67
|
+
## Retrieve a single Virtual Network
|
68
|
+
|
69
|
+
Get a single record of virtual network
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
vnet = azure_network_service.virtual_networks.get('<Resource Group Name>', '<Virtual Network name>')
|
73
|
+
puts "#{vnet.name}"
|
74
|
+
```
|
75
|
+
|
76
|
+
## Add/Remove DNS Servers to/from Virtual Network
|
77
|
+
|
78
|
+
Add/Remove DNS Servers to/from Virtual Network
|
79
|
+
|
80
|
+
```ruby
|
81
|
+
vnet.add_dns_servers(['10.3.0.0','10.4.0.0'])
|
82
|
+
vnet.remove_dns_servers(['10.3.0.0','10.4.0.0'])
|
83
|
+
```
|
84
|
+
|
85
|
+
## Add/Remove Address Prefixes to/from Virtual Network
|
86
|
+
|
87
|
+
Add/Remove Address Prefixes to/from Virtual Network
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
vnet.add_address_prefixes(['10.2.0.0/16', '10.3.0.0/16'])
|
91
|
+
vnet.remove_address_prefixes(['10.2.0.0/16'])
|
92
|
+
```
|
93
|
+
|
94
|
+
## Add/Remove Subnets to/from Virtual Network
|
95
|
+
|
96
|
+
Add/Remove Subnets to/from Virtual Network
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
vnet.add_subnets([{
|
100
|
+
name: 'test-subnet',
|
101
|
+
address_prefix: '10.3.0.0/24'
|
102
|
+
}])
|
103
|
+
|
104
|
+
vnet.remove_subnets(['test-subnet'])
|
105
|
+
```
|
106
|
+
|
107
|
+
## Update Virtual Network
|
108
|
+
|
109
|
+
Update Virtual Network
|
110
|
+
|
111
|
+
```ruby
|
112
|
+
vnet.update({
|
113
|
+
subnets:[{
|
114
|
+
name: 'fog-subnet',
|
115
|
+
address_prefix: '10.3.0.0/16'
|
116
|
+
}],
|
117
|
+
dns_servers: ['10.3.0.0','10.4.0.0']
|
118
|
+
})
|
119
|
+
```
|
120
|
+
|
121
|
+
## Destroy a single virtual network
|
122
|
+
|
123
|
+
Get virtual network object from the get method and then destroy that virtual network.
|
124
|
+
|
125
|
+
```ruby
|
126
|
+
vnet.destroy
|
127
|
+
```
|
128
|
+
|
129
|
+
## Create Subnet
|
130
|
+
|
131
|
+
Create a new Subnet
|
132
|
+
|
133
|
+
Optional parameters: network_security_group_id, route_table_id & address_prefix
|
134
|
+
|
135
|
+
```ruby
|
136
|
+
subnet = azure_network_service.subnets.create(
|
137
|
+
name: '<Subnet Name>',
|
138
|
+
resource_group: '<Resource Group Name>',
|
139
|
+
virtual_network_name: '<Virtual Network Name>',
|
140
|
+
address_prefix: '10.0.0.0/24',
|
141
|
+
network_security_group_id: '/subscriptions/<Subscription Id>/resourceGroups/<Resource Group Name>/providers/Microsoft.Network/networkSecurityGroups/<Network Security Group Name>',
|
142
|
+
route_table_id: '/subscriptions/<Subscription Id>/resourceGroups/<Resource Group Name>/providers/Microsoft.Network/routeTables/<Route Table Name>'
|
143
|
+
)
|
144
|
+
```
|
145
|
+
|
146
|
+
## List Subnets
|
147
|
+
|
148
|
+
List subnets in a resource group and a virtual network
|
149
|
+
|
150
|
+
```ruby
|
151
|
+
subnets = azure_network_service.subnets(resource_group: '<Resource Group name>', virtual_network_name: '<Virtual Network name>')
|
152
|
+
subnets.each do |subnet|
|
153
|
+
puts "#{subnet.name}"
|
154
|
+
end
|
155
|
+
```
|
156
|
+
|
157
|
+
## Retrieve a single Subnet
|
158
|
+
|
159
|
+
Get a single record of Subnet
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
subnet = azure_network_service
|
163
|
+
.subnets(resource_group: '<Resource Group name>', virtual_network_name: '<Virtual Network name>')
|
164
|
+
.get('<Subnet name>')
|
165
|
+
puts "#{subnet.name}"
|
166
|
+
```
|
167
|
+
|
168
|
+
## Attach Network Security Group to Subnet
|
169
|
+
|
170
|
+
Attach Network Security Group to Subnet
|
171
|
+
|
172
|
+
```ruby
|
173
|
+
subnet = azure_network_service.attach_network_security_group('/subscriptions/<Subscription Id>/resourceGroups/<Resource Group Name>/providers/Microsoft.Network/networkSecurityGroups/<Network Security Group Name>')
|
174
|
+
puts "#{subnet.network_security_group_id}"
|
175
|
+
```
|
176
|
+
|
177
|
+
## Detach Network Security Group from Subnet
|
178
|
+
|
179
|
+
Detach Network Security Group from Subnet
|
180
|
+
|
181
|
+
```ruby
|
182
|
+
subnet = azure_network_service.detach_network_security_group
|
183
|
+
puts "#{subnet.network_security_group_id}"
|
184
|
+
```
|
185
|
+
|
186
|
+
## Attach Route Table to Subnet
|
187
|
+
|
188
|
+
Attach Route Table to Subnet
|
189
|
+
|
190
|
+
```ruby
|
191
|
+
subnet = azure_network_service.attach_route_table('/subscriptions/<Subscription Id>/resourceGroups/<Resource Group Name>/providers/Microsoft.Network/routeTables/<Route Table Name>')
|
192
|
+
puts "#{subnet.route_table_id}"
|
193
|
+
```
|
194
|
+
|
195
|
+
## Detach Route Table from Subnet
|
196
|
+
|
197
|
+
Detach Route Table from Subnet
|
198
|
+
|
199
|
+
```ruby
|
200
|
+
subnet = azure_network_service.detach_route_table
|
201
|
+
puts "#{subnet.route_table_id}"
|
202
|
+
```
|
203
|
+
|
204
|
+
## Destroy a single Subnet
|
205
|
+
|
206
|
+
Get a subnet object from the get method and then destroy that subnet.
|
207
|
+
|
208
|
+
```ruby
|
209
|
+
subnet.destroy
|
210
|
+
```
|
211
|
+
|
212
|
+
## Create Network Interface Card
|
213
|
+
|
214
|
+
Create a new network interface. Skip public_ip_address_id parameter to create network interface without PublicIP. The parameter, private_ip_allocation_method can be Dynamic or Static.
|
215
|
+
|
216
|
+
```ruby
|
217
|
+
nic = azure_network_service.network_interfaces.create(
|
218
|
+
name: '<Network Interface name>',
|
219
|
+
resource_group: '<Resource Group name>',
|
220
|
+
location: 'eastus',
|
221
|
+
subnet_id: '/subscriptions/<Subscriptionid>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/virtualNetworks/<Virtual Network name>/subnets/<Subnet name>',
|
222
|
+
public_ip_address_id: '/subscriptions/<Subscriptionid>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/publicIPAddresses/<Public IP name>',
|
223
|
+
ip_configuration_name: '<Ip Configuration Name>',
|
224
|
+
private_ip_allocation_method: 'Dynamic'
|
225
|
+
)
|
226
|
+
```
|
227
|
+
|
228
|
+
## List Network Interface Cards
|
229
|
+
|
230
|
+
List network interfaces in a resource group
|
231
|
+
|
232
|
+
```ruby
|
233
|
+
nics = azure_network_service.network_interfaces(resource_group: '<Resource Group name>')
|
234
|
+
nics.each do |nic|
|
235
|
+
puts "#{nic.name}"
|
236
|
+
end
|
237
|
+
```
|
238
|
+
|
239
|
+
## Retrieve a single Network Interface Card
|
240
|
+
|
241
|
+
Get a single record of Network Interface
|
242
|
+
|
243
|
+
```ruby
|
244
|
+
nic = azure_network_service
|
245
|
+
.network_interfaces
|
246
|
+
.get('<Resource Group name>', '<Network Interface name>')
|
247
|
+
puts "#{nic.name}"
|
248
|
+
```
|
249
|
+
|
250
|
+
## Update Network Interface Card
|
251
|
+
|
252
|
+
You can update network interface by passing only updated attributes, in the form of hash.
|
253
|
+
For example,
|
254
|
+
```ruby
|
255
|
+
nic.update(private_ip_allocation_method: 'Static', private_ip_address: '10.0.0.0')
|
256
|
+
```
|
257
|
+
## Attach/Detach resources to Network Interface Card
|
258
|
+
|
259
|
+
Attach Subnet, Public-IP or Network-Security-Group as following
|
260
|
+
```ruby
|
261
|
+
subnet_id = "<NEW-SUBNET-ID>"
|
262
|
+
nic.attach_subnet(subnet_id)
|
263
|
+
|
264
|
+
public_ip_id = "<NEW-PUBLIC_IP-ID>"
|
265
|
+
nic.attach_public_ip(public_ip_id)
|
266
|
+
|
267
|
+
nsg_id = "<NEW-NSG-ID>"
|
268
|
+
nic.attach_network_security_group(nsg_id)
|
269
|
+
|
270
|
+
```
|
271
|
+
Detach Public-IP or Network-Security-Group as following
|
272
|
+
|
273
|
+
```ruby
|
274
|
+
nic.detach_public_ip
|
275
|
+
|
276
|
+
nic.detach_network_security_group
|
277
|
+
|
278
|
+
```
|
279
|
+
`Note: You can't detach subnet from Network Interface.`
|
280
|
+
|
281
|
+
## Destroy a single Network Interface Card
|
282
|
+
|
283
|
+
Get a network interface object from the get method and then destroy that network interface.
|
284
|
+
|
285
|
+
```ruby
|
286
|
+
nic.destroy
|
287
|
+
```
|
288
|
+
|
289
|
+
## Create Public IP
|
290
|
+
|
291
|
+
Create a new public IP. The parameter, type can be Dynamic or Static.
|
292
|
+
|
293
|
+
```ruby
|
294
|
+
pubip = azure_network_service.public_ips.create(
|
295
|
+
name: '<Public IP name>',
|
296
|
+
resource_group: '<Resource Group name>',
|
297
|
+
location: 'westus',
|
298
|
+
public_ip_allocation_method: 'Static'
|
299
|
+
)
|
300
|
+
```
|
301
|
+
|
302
|
+
## Check for Public IP
|
303
|
+
|
304
|
+
Checks if the Public IP already exists or not.
|
305
|
+
|
306
|
+
```ruby
|
307
|
+
azure_network_service.public_ips.check_if_exists('<Public IP name>', '<Resource Group name>')
|
308
|
+
```
|
309
|
+
|
310
|
+
## List Public IPs
|
311
|
+
|
312
|
+
List network interfaces in a resource group
|
313
|
+
|
314
|
+
```ruby
|
315
|
+
pubips = azure_network_service.public_ips(resource_group: '<Resource Group name>')
|
316
|
+
pubips.each do |pubip|
|
317
|
+
puts "#{pubip.name}"
|
318
|
+
end
|
319
|
+
```
|
320
|
+
|
321
|
+
## Retrieve a single Public Ip
|
322
|
+
|
323
|
+
Get a single record of Public Ip
|
324
|
+
|
325
|
+
```ruby
|
326
|
+
pubip = azure_network_service
|
327
|
+
.public_ips(resource_group: '<Resource Group name>')
|
328
|
+
.get('<Public IP name>')
|
329
|
+
puts "#{pubip.name}"
|
330
|
+
```
|
331
|
+
|
332
|
+
## Destroy a single Public Ip
|
333
|
+
|
334
|
+
Get a Public IP object from the get method and then destroy that public IP.
|
335
|
+
|
336
|
+
```ruby
|
337
|
+
pubip.destroy
|
338
|
+
```
|
339
|
+
|
340
|
+
## Create Network Security Group
|
341
|
+
|
342
|
+
Network security group requires a resource group to create.
|
343
|
+
|
344
|
+
```ruby
|
345
|
+
azure_network_service.network_security_groups.create(
|
346
|
+
name: '<Network Security Group name>',
|
347
|
+
resource_group: '<Resource Group name>',
|
348
|
+
location: 'eastus',
|
349
|
+
security_rules: [{
|
350
|
+
name: '<Security Rule name>',
|
351
|
+
protocol: 'tcp',
|
352
|
+
source_port_range: '22',
|
353
|
+
destination_port_range: '22',
|
354
|
+
source_address_prefix: '0.0.0.0/0',
|
355
|
+
destination_address_prefix: '0.0.0.0/0',
|
356
|
+
access: 'Allow',
|
357
|
+
priority: '100',
|
358
|
+
direction: 'Inbound'
|
359
|
+
}]
|
360
|
+
)
|
361
|
+
```
|
362
|
+
|
363
|
+
## List Network Security Groups
|
364
|
+
|
365
|
+
List all the network security groups in a resource group
|
366
|
+
|
367
|
+
```ruby
|
368
|
+
network_security_groups = azure_network_service.network_security_groups(resource_group: '<Resource Group name>')
|
369
|
+
network_security_groups.each do |nsg|
|
370
|
+
puts "#{nsg.name}"
|
371
|
+
end
|
372
|
+
```
|
373
|
+
|
374
|
+
## Retrieve a single Network Security Group
|
375
|
+
|
376
|
+
Get a single record of Network Security Group
|
377
|
+
|
378
|
+
```ruby
|
379
|
+
nsg = azure_network_service
|
380
|
+
.network_security_groups
|
381
|
+
.get('<Resource Group Name>','<Network Security Group name>')
|
382
|
+
puts "#{nsg.name}"
|
383
|
+
```
|
384
|
+
|
385
|
+
## Update Security Rules
|
386
|
+
|
387
|
+
You can update security rules by passing the modified attributes in the form of hash.
|
388
|
+
|
389
|
+
```ruby
|
390
|
+
nsg.update_security_rules(
|
391
|
+
security_rules:
|
392
|
+
[
|
393
|
+
{
|
394
|
+
name: '<Security Rule name>',
|
395
|
+
protocol: 'tcp',
|
396
|
+
source_port_range: '*',
|
397
|
+
destination_port_range: '*',
|
398
|
+
source_address_prefix: '0.0.0.0/0',
|
399
|
+
destination_address_prefix: '0.0.0.0/0',
|
400
|
+
access: 'Allow',
|
401
|
+
priority: '100',
|
402
|
+
direction: 'Inbound'
|
403
|
+
}
|
404
|
+
]
|
405
|
+
)
|
406
|
+
```
|
407
|
+
`Note: You can't modify Name of a security rule.`
|
408
|
+
|
409
|
+
## Add and Remove Security Rules in a Network Security Group
|
410
|
+
|
411
|
+
Add array of security rules in the form of hash.
|
412
|
+
|
413
|
+
```ruby
|
414
|
+
nsg.add_security_rules(
|
415
|
+
[
|
416
|
+
{
|
417
|
+
name: '<Security Rule name>',
|
418
|
+
protocol: 'tcp',
|
419
|
+
source_port_range: '3389',
|
420
|
+
destination_port_range: '3389',
|
421
|
+
source_address_prefix: '0.0.0.0/0',
|
422
|
+
destination_address_prefix: '0.0.0.0/0',
|
423
|
+
access: 'Allow',
|
424
|
+
priority: '102',
|
425
|
+
direction: 'Inbound'
|
426
|
+
}
|
427
|
+
]
|
428
|
+
)
|
429
|
+
```
|
430
|
+
|
431
|
+
Delete security rule by providing its name.
|
432
|
+
|
433
|
+
```ruby
|
434
|
+
nsg.remove_security_rule('<Security Rule name>')
|
435
|
+
```
|
436
|
+
|
437
|
+
## Destroy a Network Security Group
|
438
|
+
|
439
|
+
Get a network security group object from the get method and then destroy that network security group.
|
440
|
+
|
441
|
+
```ruby
|
442
|
+
nsg.destroy
|
443
|
+
```
|
444
|
+
|
445
|
+
## Create External Load Balancer
|
446
|
+
|
447
|
+
Create a new load balancer.
|
448
|
+
|
449
|
+
```ruby
|
450
|
+
lb = azure_network_service.load_balancers.create(
|
451
|
+
name: '<Load Balancer name>',
|
452
|
+
resource_group: '<Resource Group name>',
|
453
|
+
location: 'westus',
|
454
|
+
|
455
|
+
frontend_ip_configurations:
|
456
|
+
[
|
457
|
+
{
|
458
|
+
name: 'fic',
|
459
|
+
private_ipallocation_method: 'Dynamic',
|
460
|
+
public_ipaddress_id: '/subscriptions/<Subscriptionid>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/publicIPAddresses/<Public-IP-Name>'
|
461
|
+
}
|
462
|
+
],
|
463
|
+
backend_address_pool_names:
|
464
|
+
[
|
465
|
+
'pool1'
|
466
|
+
],
|
467
|
+
load_balancing_rules:
|
468
|
+
[
|
469
|
+
{
|
470
|
+
name: 'lb_rule_1',
|
471
|
+
frontend_ip_configuration_id: '/subscriptions/<Subscriptionid>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/loadBalancers/<Load Balancer name>/frontendIPConfigurations/fic',
|
472
|
+
backend_address_pool_id: '/subscriptions/<Subscriptionid>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/loadBalancers/<Load Balancer name>/backendAddressPools/pool1',
|
473
|
+
protocol: 'Tcp',
|
474
|
+
frontend_port: '80',
|
475
|
+
backend_port: '8080',
|
476
|
+
enable_floating_ip: false,
|
477
|
+
idle_timeout_in_minutes: 4,
|
478
|
+
load_distribution: "Default"
|
479
|
+
}
|
480
|
+
],
|
481
|
+
inbound_nat_rules:
|
482
|
+
[
|
483
|
+
{
|
484
|
+
name: 'RDP-Traffic',
|
485
|
+
frontend_ip_configuration_id: '/subscriptions/<Subscriptionid>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/loadBalancers/<Load Balancer name>/frontendIPConfigurations/fic',
|
486
|
+
protocol: 'Tcp',
|
487
|
+
frontend_port: 3389,
|
488
|
+
backend_port: 3389
|
489
|
+
}
|
490
|
+
]
|
491
|
+
)
|
492
|
+
```
|
493
|
+
|
494
|
+
## Create Internal Load Balancer
|
495
|
+
|
496
|
+
```ruby
|
497
|
+
|
498
|
+
lb = azure_network_service.load_balancers.create(
|
499
|
+
name: '<Load Balancer name>',
|
500
|
+
resource_group: '<Resource Group name>',
|
501
|
+
location: 'westus',
|
502
|
+
frontend_ip_configurations:
|
503
|
+
[
|
504
|
+
{
|
505
|
+
name: 'LB-Frontend',
|
506
|
+
private_ipallocation_method: 'Static',
|
507
|
+
private_ipaddress: '10.1.2.5',
|
508
|
+
subnet_id: subnet.id
|
509
|
+
}
|
510
|
+
],
|
511
|
+
backend_address_pool_names:
|
512
|
+
[
|
513
|
+
'LB-backend'
|
514
|
+
],
|
515
|
+
load_balancing_rules:
|
516
|
+
[
|
517
|
+
{
|
518
|
+
name: 'HTTP',
|
519
|
+
frontend_ip_configuration_id: "/subscriptions/<Subscriptionid>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/loadBalancers/<Load-Balancer-Name>/frontendIPConfigurations/LB-Frontend",
|
520
|
+
backend_address_pool_id: "/subscriptions/<Subscriptionid>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/loadBalancers/<Load-Balancer-Name>/backendAddressPools/LB-backend",
|
521
|
+
probe_id: "/subscriptions/<Subscriptionid>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/loadBalancers<Load-Balancer-Name>lb/probes/HealthProbe",
|
522
|
+
protocol: 'Tcp',
|
523
|
+
frontend_port: '80',
|
524
|
+
backend_port: '80'
|
525
|
+
}
|
526
|
+
],
|
527
|
+
inbound_nat_rules:
|
528
|
+
[
|
529
|
+
{
|
530
|
+
name: 'RDP1',
|
531
|
+
frontend_ip_configuration_id: "/subscriptions/<Subscriptionid>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/loadBalancers/<Load-Balancer-Name>/frontendIPConfigurations/LB-Frontend",
|
532
|
+
protocol: 'Tcp',
|
533
|
+
frontend_port: 3441,
|
534
|
+
backend_port: 3389
|
535
|
+
},
|
536
|
+
{
|
537
|
+
name: 'RDP2',
|
538
|
+
frontend_ip_configuration_id: "/subscriptions/<Subscriptionid>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/loadBalancers/<Load-Balancer-Name>/frontendIPConfigurations/LB-Frontend",
|
539
|
+
protocol: 'Tcp',
|
540
|
+
frontend_port: 3442,
|
541
|
+
backend_port: 3389
|
542
|
+
}
|
543
|
+
],
|
544
|
+
probes:
|
545
|
+
[
|
546
|
+
{
|
547
|
+
name: 'HealthProbe',
|
548
|
+
protocol: 'http',
|
549
|
+
request_path: 'HealthProbe.aspx',
|
550
|
+
port: '80',
|
551
|
+
interval_in_seconds: 15,
|
552
|
+
number_of_probes: 2
|
553
|
+
}
|
554
|
+
]
|
555
|
+
)
|
556
|
+
```
|
557
|
+
|
558
|
+
## List Load Balancers
|
559
|
+
|
560
|
+
List all load balancers in a resource group
|
561
|
+
|
562
|
+
```ruby
|
563
|
+
lbs = azure_network_service.load_balancers(resource_group: '<Resource Group name>')
|
564
|
+
lbs.each do |lb|
|
565
|
+
puts "#{lb.name}"
|
566
|
+
end
|
567
|
+
```
|
568
|
+
|
569
|
+
## Retrieve a single Load Balancer
|
570
|
+
|
571
|
+
Get a single record of Load Balancer
|
572
|
+
|
573
|
+
```ruby
|
574
|
+
lb = azure_network_service
|
575
|
+
.load_balancers(resource_group: '<Resource Group name>')
|
576
|
+
.get('<Load Balancer name>')
|
577
|
+
puts "#{lb.name}"
|
578
|
+
```
|
579
|
+
|
580
|
+
## Destroy a Load Balancer
|
581
|
+
|
582
|
+
Get a load balancer object from the get method and then destroy that load balancer.
|
583
|
+
|
584
|
+
```ruby
|
585
|
+
lb.destroy
|
586
|
+
```
|
587
|
+
|
588
|
+
## Create Traffic Manager Profile
|
589
|
+
|
590
|
+
Create a new Traffic Manager Profile. The parameter, traffic_routing_method can be Performance, Weighted or Priority.
|
591
|
+
|
592
|
+
```ruby
|
593
|
+
profile = azure_network_service.traffic_manager_profiles.create(
|
594
|
+
name: '<Profile Name>',
|
595
|
+
resource_group: '<Resource Group Name>',
|
596
|
+
traffic_routing_method: 'Performance',
|
597
|
+
relative_name: '<Profile Relative Name>',
|
598
|
+
ttl: '30',
|
599
|
+
protocol: 'http',
|
600
|
+
port: '80',
|
601
|
+
path: '/monitorpage.aspx'
|
602
|
+
)
|
603
|
+
```
|
604
|
+
|
605
|
+
## List Traffic Manager Profiles
|
606
|
+
|
607
|
+
List Traffic Manager Profiles in a resource group
|
608
|
+
|
609
|
+
```ruby
|
610
|
+
profiles = azure_network_service.traffic_manager_profiles(resource_group: '<Resource Group name>')
|
611
|
+
profiles.each do |profile|
|
612
|
+
puts "#{profile.name}"
|
613
|
+
end
|
614
|
+
```
|
615
|
+
|
616
|
+
## Retrieve a single Traffic Manager Profile
|
617
|
+
|
618
|
+
Get a single record of Traffic Manager Profile
|
619
|
+
|
620
|
+
```ruby
|
621
|
+
profile = azure_network_service
|
622
|
+
.traffic_manager_profiles(resource_group: '<Resource Group name>')
|
623
|
+
.get('<Profile name>')
|
624
|
+
puts "#{profile.name}"
|
625
|
+
```
|
626
|
+
|
627
|
+
## Destroy a single Traffic Manager Profile
|
628
|
+
|
629
|
+
Get a Traffic Manager Profile object from the get method and then destroy that Traffic Manager Profile.
|
630
|
+
|
631
|
+
```ruby
|
632
|
+
profile.destroy
|
633
|
+
```
|
634
|
+
|
635
|
+
## Create Traffic Manager Endpoint
|
636
|
+
|
637
|
+
Create a new Traffic Manager Endpoint. The parameter, type can be external, azure or nested.
|
638
|
+
|
639
|
+
```ruby
|
640
|
+
profile = azure_network_service.traffic_manager_end_points.create(
|
641
|
+
name: '<Endpoint Name>',
|
642
|
+
traffic_manager_profile_name: '<Profile Name>',
|
643
|
+
resource_group: '<Resource Group Name>',
|
644
|
+
type: 'external',
|
645
|
+
target: 'test.com',
|
646
|
+
endpoint_location: 'West US'
|
647
|
+
)
|
648
|
+
```
|
649
|
+
|
650
|
+
## List Traffic Manager Endpoints
|
651
|
+
|
652
|
+
List Traffic Manager Endpoints in a resource group
|
653
|
+
|
654
|
+
```ruby
|
655
|
+
endpoints = azure_network_service.traffic_manager_end_points(resource_group: '<Resource Group name>', traffic_manager_profile_name: '<Profile Name>')
|
656
|
+
endpoints.each do |endpoint|
|
657
|
+
puts "#{endpoint.name}"
|
658
|
+
end
|
659
|
+
```
|
660
|
+
|
661
|
+
## Retrieve a single Traffic Manager Endpoint
|
662
|
+
|
663
|
+
Get a single record of Traffic Manager Endpoint
|
664
|
+
|
665
|
+
```ruby
|
666
|
+
endpoint = azure_network_service
|
667
|
+
.traffic_manager_end_points(resource_group: '<Resource Group name>', traffic_manager_profile_name: '<Profile Name>')
|
668
|
+
.get('<Endpoint name>')
|
669
|
+
puts "#{endpoint.name}"
|
670
|
+
```
|
671
|
+
|
672
|
+
## Destroy a single Traffic Manager Endpoint
|
673
|
+
|
674
|
+
Get a Traffic Manager Endpoint object from the get method and then destroy that Traffic Manager Endpoint.
|
675
|
+
|
676
|
+
```ruby
|
677
|
+
endpoint.destroy
|
678
|
+
```
|
679
|
+
|
680
|
+
## Create Application Gateway
|
681
|
+
|
682
|
+
Create a new Application Gateway.
|
683
|
+
|
684
|
+
```ruby
|
685
|
+
gateway = azure_network_service.application_gateways.create(
|
686
|
+
name: '<Gateway Name>',
|
687
|
+
location: 'eastus',
|
688
|
+
resource_group: '<Resource Group name>',
|
689
|
+
sku_name: 'Standard_Medium',
|
690
|
+
sku_tier: 'Standard',
|
691
|
+
sku_capacity: '2',
|
692
|
+
gateway_ip_configurations:
|
693
|
+
[
|
694
|
+
{
|
695
|
+
name: 'gatewayIpConfigName',
|
696
|
+
subnet_id: '/subscriptions/<Subscription_id>/resourcegroups/<Resource Group name>/providers/Microsoft.Network/virtualNetworks/<Virtual Network Name>/subnets/<Subnet Name>'
|
697
|
+
}
|
698
|
+
],
|
699
|
+
frontend_ip_configurations:
|
700
|
+
[
|
701
|
+
{
|
702
|
+
name: 'frontendIpConfig',
|
703
|
+
private_ip_allocation_method: 'Dynamic',
|
704
|
+
public_ip_address_id: '/subscriptions/<Subscription_id>/resourcegroups/<Resource Group name>/providers/Microsoft.Network/publicIPAddresses/<Public IP Address Name>',
|
705
|
+
private_ip_address: '10.0.1.5'
|
706
|
+
}
|
707
|
+
],
|
708
|
+
frontend_ports:
|
709
|
+
[
|
710
|
+
{
|
711
|
+
name: 'frontendPort',
|
712
|
+
port: 443
|
713
|
+
}
|
714
|
+
],
|
715
|
+
backend_address_pools:
|
716
|
+
[
|
717
|
+
{
|
718
|
+
name: 'backendAddressPool',
|
719
|
+
ip_addresses: [
|
720
|
+
{
|
721
|
+
ipAddress: '10.0.1.6'
|
722
|
+
}
|
723
|
+
]
|
724
|
+
}
|
725
|
+
],
|
726
|
+
backend_http_settings_list:
|
727
|
+
[
|
728
|
+
{
|
729
|
+
name: 'gateway_settings',
|
730
|
+
port: 80,
|
731
|
+
protocol: 'Http',
|
732
|
+
cookie_based_affinity: 'Enabled',
|
733
|
+
request_timeout: '30'
|
734
|
+
}
|
735
|
+
],
|
736
|
+
http_listeners:
|
737
|
+
[
|
738
|
+
{
|
739
|
+
name: 'gateway_listener',
|
740
|
+
frontend_ip_config_id: '/subscriptions/<Subscription_id>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/applicationGateways/<Gateway Name>/frontendIPConfigurations/frontendIpConfig',
|
741
|
+
frontend_port_id: '/subscriptions/<Subscription_id>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/applicationGateways/<Gateway Name>/frontendPorts/frontendPort',
|
742
|
+
protocol: 'Http',
|
743
|
+
host_name: '',
|
744
|
+
require_server_name_indication: 'false'
|
745
|
+
}
|
746
|
+
],
|
747
|
+
request_routing_rules:
|
748
|
+
[
|
749
|
+
{
|
750
|
+
name: 'gateway_request_route_rule',
|
751
|
+
type: 'Basic',
|
752
|
+
http_listener_id: '/subscriptions/<Subscription_id>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/applicationGateways/<Gateway Name>/httpListeners/gateway_listener',
|
753
|
+
backend_address_pool_id: '/subscriptions/<Subscription_id>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/applicationGateways/<Gateway Name>/backendAddressPools/backendAddressPool',
|
754
|
+
backend_http_settings_id: '/subscriptions/<Subscription_id>/resourceGroups/<Resource Group name>/providers/Microsoft.Network/applicationGateways/<Gateway Name>/backendHttpSettingsCollection/gateway_settings',
|
755
|
+
url_path_map: ''
|
756
|
+
}
|
757
|
+
]
|
758
|
+
|
759
|
+
|
760
|
+
)
|
761
|
+
```
|
762
|
+
|
763
|
+
## List Application Gateways
|
764
|
+
|
765
|
+
List all application gateways in a resource group
|
766
|
+
|
767
|
+
```ruby
|
768
|
+
gateways = azure_network_service.application_gateways(resource_group: '<Resource Group Name>')
|
769
|
+
gateways.each do |gateway|
|
770
|
+
puts "#{gateway.name}"
|
771
|
+
end
|
772
|
+
```
|
773
|
+
|
774
|
+
## Retrieve a single Application Gateway
|
775
|
+
|
776
|
+
Get a single record of Application Gateway
|
777
|
+
|
778
|
+
```ruby
|
779
|
+
gateway = azure_network_service
|
780
|
+
.application_gateways(resource_group: '<Resource Group name>')
|
781
|
+
.get('<Application Gateway Name>')
|
782
|
+
puts "#{gateway.name}"
|
783
|
+
```
|
784
|
+
|
785
|
+
## Destroy a single Application Gateway
|
786
|
+
|
787
|
+
Get a application gateway object from the get method and then destroy that application gateway.
|
788
|
+
|
789
|
+
```ruby
|
790
|
+
gateway.destroy
|
791
|
+
```
|
792
|
+
|
793
|
+
## Support and Feedback
|
794
|
+
Your feedback is highly appreciated! If you have specific issues with the fog ARM, you should file an issue via Github.
|