fog-azure-rm 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/.travis.yml +13 -8
- data/CHANGELOG.md +23 -10
- data/CONTRIBUTORS.md +2 -0
- data/lib/fog/azurerm/application_gateway.rb +4 -3
- data/lib/fog/azurerm/compute.rb +0 -1
- data/lib/fog/azurerm/dns.rb +0 -3
- data/lib/fog/azurerm/docs/application_gateway.md +72 -2
- data/lib/fog/azurerm/docs/compute.md +8 -5
- data/lib/fog/azurerm/docs/network.md +185 -6
- data/lib/fog/azurerm/docs/resources.md +2 -2
- data/lib/fog/azurerm/docs/storage.md +2 -2
- data/lib/fog/azurerm/docs/traffic_manager.md +23 -0
- data/lib/fog/azurerm/models/application_gateway/gateway.rb +180 -22
- data/lib/fog/azurerm/models/application_gateway/gateways.rb +4 -2
- data/lib/fog/azurerm/models/application_gateway/ip_configuration.rb +7 -2
- data/lib/fog/azurerm/models/compute/server.rb +5 -2
- data/lib/fog/azurerm/models/compute/servers.rb +4 -8
- data/lib/fog/azurerm/models/network/express_route_circuit_authorization.rb +58 -0
- data/lib/fog/azurerm/models/network/express_route_circuit_authorizations.rb +31 -0
- data/lib/fog/azurerm/models/network/load_balancers.rb +4 -2
- data/lib/fog/azurerm/models/network/local_network_gateway.rb +68 -0
- data/lib/fog/azurerm/models/network/local_network_gateways.rb +29 -0
- data/lib/fog/azurerm/models/network/public_ip.rb +16 -1
- data/lib/fog/azurerm/models/network/virtual_network_gateway_connection.rb +93 -0
- data/lib/fog/azurerm/models/network/virtual_network_gateway_connections.rb +29 -0
- data/lib/fog/azurerm/models/network/virtual_network_gateways.rb +1 -1
- data/lib/fog/azurerm/models/resources/deployments.rb +4 -2
- data/lib/fog/azurerm/models/resources/resource_groups.rb +4 -2
- data/lib/fog/azurerm/models/storage/storage_accounts.rb +4 -2
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_end_point.rb +23 -6
- data/lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb +29 -3
- data/lib/fog/azurerm/network.rb +23 -3
- data/lib/fog/azurerm/requests/application_gateway/{create_application_gateway.rb → create_or_update_application_gateway.rb} +23 -63
- data/lib/fog/azurerm/requests/application_gateway/get_application_gateway.rb +159 -0
- data/lib/fog/azurerm/requests/application_gateway/update_sku_attributes.rb +28 -0
- data/lib/fog/azurerm/requests/application_gateway/update_subnet_id_in_gateway_ip_configuration.rb +29 -0
- data/lib/fog/azurerm/requests/compute/create_virtual_machine.rb +31 -20
- data/lib/fog/azurerm/requests/compute/get_virtual_machine.rb +1 -1
- data/lib/fog/azurerm/requests/network/create_or_update_express_route_circuit.rb +1 -1
- data/lib/fog/azurerm/requests/network/create_or_update_express_route_circuit_authorization.rb +49 -0
- data/lib/fog/azurerm/requests/network/create_or_update_local_network_gateway.rb +78 -0
- data/lib/fog/azurerm/requests/network/{create_public_ip.rb → create_or_update_public_ip.rb} +22 -8
- data/lib/fog/azurerm/requests/network/create_or_update_virtual_network_gateway_connection.rb +81 -0
- data/lib/fog/azurerm/requests/network/delete_express_route_circuit_authorization.rb +28 -0
- data/lib/fog/azurerm/requests/network/delete_local_network_gateway.rb +28 -0
- data/lib/fog/azurerm/requests/network/delete_virtual_network_gateway_connection.rb +28 -0
- data/lib/fog/azurerm/requests/network/get_connection_shared_key.rb +25 -0
- data/lib/fog/azurerm/requests/network/get_express_route_circuit_authorization.rb +34 -0
- data/lib/fog/azurerm/requests/network/get_load_balancer.rb +169 -0
- data/lib/fog/azurerm/requests/network/get_local_network_gateway.rb +46 -0
- data/lib/fog/azurerm/requests/network/get_virtual_network_gateway_connection.rb +46 -0
- data/lib/fog/azurerm/requests/network/list_express_route_circuit_authorizations.rb +36 -0
- data/lib/fog/azurerm/requests/network/list_local_network_gateways.rb +49 -0
- data/lib/fog/azurerm/requests/network/list_virtual_network_gateway_connections.rb +49 -0
- data/lib/fog/azurerm/requests/network/reset_connection_shared_key.rb +36 -0
- data/lib/fog/azurerm/requests/network/set_connection_shared_key.rb +36 -0
- data/lib/fog/azurerm/requests/resources/create_deployment.rb +5 -4
- data/lib/fog/azurerm/requests/resources/create_resource_group.rb +5 -4
- data/lib/fog/azurerm/requests/resources/delete_deployment.rb +5 -4
- data/lib/fog/azurerm/requests/resources/delete_resource_group.rb +5 -4
- data/lib/fog/azurerm/requests/resources/delete_resource_tag.rb +6 -4
- data/lib/fog/azurerm/requests/resources/get_deployment.rb +81 -0
- data/lib/fog/azurerm/requests/resources/get_resource_group.rb +47 -0
- data/lib/fog/azurerm/requests/resources/list_deployments.rb +5 -4
- data/lib/fog/azurerm/requests/resources/list_resource_groups.rb +6 -5
- data/lib/fog/azurerm/requests/resources/list_tagged_resources.rb +5 -4
- data/lib/fog/azurerm/requests/resources/tag_resource.rb +6 -4
- data/lib/fog/azurerm/requests/storage/get_storage_account.rb +36 -0
- data/lib/fog/azurerm/requests/traffic_manager/{create_traffic_manager_endpoint.rb → create_or_update_traffic_manager_endpoint.rb} +2 -2
- data/lib/fog/azurerm/requests/traffic_manager/{create_traffic_manager_profile.rb → create_or_update_traffic_manager_profile.rb} +6 -6
- data/lib/fog/azurerm/requests/traffic_manager/list_traffic_manager_profiles.rb +1 -1
- data/lib/fog/azurerm/resources.rb +2 -3
- data/lib/fog/azurerm/storage.rb +1 -1
- data/lib/fog/azurerm/traffic_manager.rb +2 -3
- data/lib/fog/azurerm/utilities/general.rb +5 -0
- data/lib/fog/azurerm/version.rb +1 -1
- data/lib/fog/azurerm.rb +34 -32
- data/test/api_stub/models/application_gateway/gateway.rb +29 -0
- data/test/api_stub/models/network/express_route_circuit_authorization.rb +22 -0
- data/test/api_stub/models/network/local_network_gateway.rb +31 -0
- data/test/api_stub/models/network/virtual_network_gateway_connection.rb +31 -0
- data/test/api_stub/requests/application_gateway/gateway.rb +30 -0
- data/test/api_stub/requests/compute/virtual_machine.rb +129 -2
- data/test/api_stub/requests/network/express_route_circuit_authorization.rb +31 -0
- data/test/api_stub/requests/network/local_network_gateway.rb +62 -0
- data/test/api_stub/requests/network/virtual_network_gateway_connection.rb +68 -0
- data/test/api_stub/requests/traffic_manager/traffic_manager_profile.rb +13 -0
- data/test/api_stub.rb +97 -48
- data/test/integration/Virtual_network_gateway_connection.rb +212 -0
- data/test/integration/application_gateway.rb +125 -54
- data/test/integration/deployment.rb +1 -1
- data/test/integration/express_route_circuit.rb +43 -4
- data/test/integration/external_load_balancer.rb +4 -4
- data/test/integration/internal_load_balancer.rb +4 -4
- data/test/integration/local_network_gateway.rb +76 -0
- data/test/integration/public_ip.rb +7 -0
- data/test/integration/server.rb +5 -4
- data/test/integration/storage_account.rb +5 -5
- data/test/integration/traffic_manager.rb +21 -0
- data/test/integration/virtual_network_gateway.rb +51 -22
- data/test/models/application_gateway/test_gateway.rb +56 -1
- data/test/models/application_gateway/test_gateways.rb +5 -5
- data/test/models/compute/test_servers.rb +6 -14
- data/test/models/network/test_express_route_circuit_authorization.rb +50 -0
- data/test/models/network/test_express_route_circuit_authorizations.rb +43 -0
- data/test/models/network/test_load_balancers.rb +6 -6
- data/test/models/network/test_local_network_gateway.rb +53 -0
- data/test/models/network/test_local_network_gateways.rb +42 -0
- data/test/models/network/test_public_ip.rb +16 -12
- data/test/models/network/test_virtual_network_gateway_connection.rb +59 -0
- data/test/models/network/test_virtual_network_gateway_connections.rb +42 -0
- data/test/models/resources/test_deployments.rb +5 -5
- data/test/models/resources/test_resource_groups.rb +5 -5
- data/test/models/storage/test_storage_accounts.rb +3 -3
- data/test/models/traffic_manager/test_traffic_manager_end_point.rb +1 -1
- data/test/models/traffic_manager/test_traffic_manager_profile.rb +11 -4
- data/test/requests/application_gateway/test_create_or_update_application_gateway.rb +35 -0
- data/test/requests/application_gateway/test_get_application_gateway.rb +24 -0
- data/test/requests/compute/test_create_virtual_machine.rb +17 -2
- data/test/requests/network/test_create_express_route_circuit_authorization.rb +35 -0
- data/test/requests/network/test_create_or_update_local_network_gateway.rb +36 -0
- data/test/requests/network/test_create_public_ip.rb +3 -3
- data/test/requests/network/test_create_virtual_network_gateway_connection.rb +36 -0
- data/test/requests/network/test_delete_express_route_circuit_authorization.rb +23 -0
- data/test/requests/network/test_delete_local_network_gateway.rb +23 -0
- data/test/requests/network/test_delete_virtual_network_gateway.rb +2 -2
- data/test/requests/network/test_delete_virtual_network_gateway_connection.rb +23 -0
- data/test/requests/network/test_get_connection_shared_key.rb +24 -0
- data/test/requests/network/test_get_express_route_circuit_authorization.rb +24 -0
- data/test/requests/network/test_get_load_balancer.rb +24 -0
- data/test/requests/network/test_get_local_network_gateway.rb +24 -0
- data/test/requests/network/test_get_virtual_network_gateway_connection.rb +24 -0
- data/test/requests/network/test_list_express_route_circuit_authorizations.rb +24 -0
- data/test/requests/network/test_list_local_network_gateways.rb +24 -0
- data/test/requests/network/test_list_virtual_network_gateway_connections.rb +24 -0
- data/test/requests/network/test_reset_connection_shared_key.rb +23 -0
- data/test/requests/network/test_set_connection_shared_key.rb +23 -0
- data/test/requests/network/test_update_public_ip.rb +34 -0
- data/test/requests/resources/test_create_deployment.rb +1 -1
- data/test/requests/resources/test_create_resource_group.rb +1 -1
- data/test/requests/resources/test_delete_deployment.rb +1 -1
- data/test/requests/resources/test_delete_resource_group.rb +1 -1
- data/test/requests/resources/test_delete_resource_tag.rb +1 -1
- data/test/requests/resources/test_get_deployment.rb +24 -0
- data/test/requests/resources/test_get_resource_group.rb +24 -0
- data/test/requests/resources/test_list_deployments.rb +1 -1
- data/test/requests/resources/test_list_resource_groups.rb +1 -1
- data/test/requests/resources/test_list_tagged_resources.rb +1 -1
- data/test/requests/resources/test_tag_resource.rb +1 -1
- data/test/requests/storage/test_get_storage_account.rb +25 -0
- data/test/requests/traffic_manager/test_create_traffic_manager_endpoint.rb +2 -2
- data/test/requests/traffic_manager/test_create_traffic_manager_profile.rb +3 -3
- data/test/requests/traffic_manager/test_update_traffic_manager_endpoint.rb +27 -0
- data/test/requests/traffic_manager/test_update_traffic_manager_profile.rb +27 -0
- data/test/test_helper.rb +52 -0
- metadata +73 -9
- data/lib/fog/azurerm/core.rb +0 -14
- data/test/requests/application_gateway/test_create_application_gateway.rb +0 -51
@@ -0,0 +1,212 @@
|
|
1
|
+
require 'fog/azurerm'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
########################################################################################################################
|
5
|
+
###################### Services object required by all actions ######################
|
6
|
+
###################### Keep it Uncommented! ######################
|
7
|
+
########################################################################################################################
|
8
|
+
|
9
|
+
azure_credentials = YAML.load_file('credentials/azure.yml')
|
10
|
+
|
11
|
+
resource = Fog::Resources::AzureRM.new(
|
12
|
+
tenant_id: azure_credentials['tenant_id'],
|
13
|
+
client_id: azure_credentials['client_id'],
|
14
|
+
client_secret: azure_credentials['client_secret'],
|
15
|
+
subscription_id: azure_credentials['subscription_id']
|
16
|
+
)
|
17
|
+
|
18
|
+
network = Fog::Network::AzureRM.new(
|
19
|
+
tenant_id: azure_credentials['tenant_id'],
|
20
|
+
client_id: azure_credentials['client_id'],
|
21
|
+
client_secret: azure_credentials['client_secret'],
|
22
|
+
subscription_id: azure_credentials['subscription_id']
|
23
|
+
)
|
24
|
+
|
25
|
+
########################################################################################################################
|
26
|
+
###################### Prerequisites ######################
|
27
|
+
########################################################################################################################
|
28
|
+
|
29
|
+
resource.resource_groups.create(
|
30
|
+
name: 'TestRG-GC',
|
31
|
+
location: 'eastus'
|
32
|
+
)
|
33
|
+
|
34
|
+
network.virtual_networks.create(
|
35
|
+
name: 'testVnet',
|
36
|
+
location: 'eastus',
|
37
|
+
resource_group: 'TestRG-GC',
|
38
|
+
network_address_list: '10.1.0.0/16,10.2.0.0/16'
|
39
|
+
)
|
40
|
+
|
41
|
+
network.virtual_networks.create(
|
42
|
+
name: 'testVnet2',
|
43
|
+
location: 'eastus',
|
44
|
+
resource_group: 'TestRG-GC',
|
45
|
+
network_address_list: '10.3.0.0/16,10.4.0.0/16'
|
46
|
+
)
|
47
|
+
|
48
|
+
network.subnets.create(
|
49
|
+
name: 'GatewaySubnet',
|
50
|
+
resource_group: 'TestRG-GC',
|
51
|
+
virtual_network_name: 'testVnet',
|
52
|
+
address_prefix: '10.2.0.0/24'
|
53
|
+
)
|
54
|
+
|
55
|
+
network.subnets.create(
|
56
|
+
name: 'GatewaySubnet',
|
57
|
+
resource_group: 'TestRG-GC',
|
58
|
+
virtual_network_name: 'testVnet2',
|
59
|
+
address_prefix: '10.2.0.0/24'
|
60
|
+
)
|
61
|
+
|
62
|
+
network.public_ips.create(
|
63
|
+
name: 'mypubip',
|
64
|
+
resource_group: 'TestRG-GC',
|
65
|
+
location: 'eastus',
|
66
|
+
public_ip_allocation_method: 'Dynamic'
|
67
|
+
)
|
68
|
+
|
69
|
+
network.public_ips.create(
|
70
|
+
name: 'mypubip2',
|
71
|
+
resource_group: 'TestRG-GC',
|
72
|
+
location: 'eastus',
|
73
|
+
public_ip_allocation_method: 'Dynamic'
|
74
|
+
)
|
75
|
+
|
76
|
+
network.local_network_gateways.create(
|
77
|
+
name: 'testlocalnetworkgateway',
|
78
|
+
location: 'eastus',
|
79
|
+
tags: {
|
80
|
+
key1: 'value1',
|
81
|
+
key2: 'value2'
|
82
|
+
},
|
83
|
+
resource_group: 'TestRG-GC',
|
84
|
+
gateway_ip_address: '192.168.1.1',
|
85
|
+
local_network_address_space_prefixes: [],
|
86
|
+
asn: 100,
|
87
|
+
bgp_peering_address: '192.168.1.2',
|
88
|
+
peer_weight: 3
|
89
|
+
)
|
90
|
+
|
91
|
+
network.virtual_network_gateways.create(
|
92
|
+
name: 'testnetworkgateway',
|
93
|
+
location: 'eastus',
|
94
|
+
tags: {
|
95
|
+
key1: 'value1',
|
96
|
+
key2: 'value2'
|
97
|
+
},
|
98
|
+
ip_configurations: [
|
99
|
+
{
|
100
|
+
name: 'default',
|
101
|
+
private_ipallocation_method: 'Dynamic',
|
102
|
+
public_ipaddress_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-GC/providers/Microsoft.Network/publicIPAddresses/mypubip",
|
103
|
+
subnet_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-GC/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/GatewaySubnet",
|
104
|
+
private_ipaddress: nil
|
105
|
+
}
|
106
|
+
],
|
107
|
+
resource_group: 'TestRG-GC',
|
108
|
+
sku_name: 'Standard',
|
109
|
+
sku_tier: 'Standard',
|
110
|
+
sku_capacity: 2,
|
111
|
+
gateway_type: 'vpn',
|
112
|
+
enable_bgp: true,
|
113
|
+
gateway_size: nil,
|
114
|
+
asn: 100,
|
115
|
+
bgp_peering_address: nil,
|
116
|
+
peer_weight: 3,
|
117
|
+
vpn_type: 'RouteBased',
|
118
|
+
vpn_client_address_pool: [],
|
119
|
+
gateway_default_site: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-GC/providers/Microsoft.Network/localNetworkGateways/testlocalnetworkgateway"
|
120
|
+
)
|
121
|
+
|
122
|
+
network.virtual_network_gateways.create(
|
123
|
+
name: 'testnetworkgateway2',
|
124
|
+
location: 'eastus',
|
125
|
+
tags: {
|
126
|
+
key1: 'value1',
|
127
|
+
key2: 'value2'
|
128
|
+
},
|
129
|
+
ip_configurations: [
|
130
|
+
{
|
131
|
+
name: 'default',
|
132
|
+
private_ipallocation_method: 'Dynamic',
|
133
|
+
public_ipaddress_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-GC/providers/Microsoft.Network/publicIPAddresses/mypubip2",
|
134
|
+
subnet_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-GC/providers/Microsoft.Network/virtualNetworks/testVnet2/subnets/GatewaySubnet",
|
135
|
+
private_ipaddress: nil
|
136
|
+
}
|
137
|
+
],
|
138
|
+
resource_group: 'TestRG-GC',
|
139
|
+
sku_name: 'Standard',
|
140
|
+
sku_tier: 'Standard',
|
141
|
+
sku_capacity: 2,
|
142
|
+
gateway_type: 'vpn',
|
143
|
+
enable_bgp: true,
|
144
|
+
gateway_size: nil,
|
145
|
+
asn: 100,
|
146
|
+
bgp_peering_address: nil,
|
147
|
+
peer_weight: 3,
|
148
|
+
vpn_type: 'RouteBased',
|
149
|
+
vpn_client_address_pool: [],
|
150
|
+
gateway_default_site: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-GC/providers/Microsoft.Network/localNetworkGateways/testlocalnetworkgateway"
|
151
|
+
)
|
152
|
+
|
153
|
+
########################################################################################################################
|
154
|
+
###################### Create Virtual Network Gateway Connection ###########
|
155
|
+
########################################################################################################################
|
156
|
+
|
157
|
+
network.virtual_network_gateway_connections.create(
|
158
|
+
name: 'testnetworkgateway2-to-testnetworkgateway',
|
159
|
+
location: 'eastus',
|
160
|
+
resource_group: 'TestRG-GC',
|
161
|
+
virtual_network_gateway1: {
|
162
|
+
name: 'testnetworkgateway2',
|
163
|
+
resource_group: 'TestRG-GC'
|
164
|
+
},
|
165
|
+
virtual_network_gateway2: {
|
166
|
+
name: 'testnetworkgateway',
|
167
|
+
resource_group: 'TestRG-GC'
|
168
|
+
},
|
169
|
+
connection_type: 'Vnet2Vnet'
|
170
|
+
)
|
171
|
+
|
172
|
+
########################################################################################################################
|
173
|
+
###################### List Virtual Network Gateway Connections ###########
|
174
|
+
########################################################################################################################
|
175
|
+
|
176
|
+
gateway_connections = network.virtual_network_gateway_connections(resource_group: 'TestRG-GC')
|
177
|
+
gateway_connections.each do |connection|
|
178
|
+
puts connection.name
|
179
|
+
end
|
180
|
+
|
181
|
+
########################################################################################################################
|
182
|
+
###################### Get Virtual Network Gateway Connection and CleanUp ###########
|
183
|
+
########################################################################################################################
|
184
|
+
|
185
|
+
gateway_connection = network.virtual_network_gateway_connections.get('TestRG-GC', 'testnetworkgateway2-to-testnetworkgateway')
|
186
|
+
puts gateway_connection.name
|
187
|
+
|
188
|
+
gateway_connection.destroy
|
189
|
+
|
190
|
+
network_gateway = network.virtual_network_gateways.get('TestRG-GC', 'testnetworkgateway')
|
191
|
+
network_gateway.destroy
|
192
|
+
|
193
|
+
network_gateway = network.virtual_network_gateways.get('TestRG-GC', 'testnetworkgateway2')
|
194
|
+
network_gateway.destroy
|
195
|
+
|
196
|
+
local_network_gateway = network.local_network_gateways.get('TestRG-GC', 'testlocalnetworkgateway')
|
197
|
+
local_network_gateway.destroy
|
198
|
+
|
199
|
+
pubip = network.public_ips.get('TestRG-GC', 'mypubip')
|
200
|
+
pubip.destroy
|
201
|
+
|
202
|
+
pubip = network.public_ips.get('TestRG-GC', 'mypubip2')
|
203
|
+
pubip.destroy
|
204
|
+
|
205
|
+
vnet = network.virtual_networks.get('TestRG-GC', 'testVnet')
|
206
|
+
vnet.destroy
|
207
|
+
|
208
|
+
vnet = network.virtual_networks.get('TestRG-GC', 'testVnet2')
|
209
|
+
vnet.destroy
|
210
|
+
|
211
|
+
resource_group = resource.resource_groups.get('TestRG-GC')
|
212
|
+
resource_group.destroy
|
@@ -8,7 +8,7 @@ require 'yaml'
|
|
8
8
|
|
9
9
|
azure_credentials = YAML.load_file('credentials/azure.yml')
|
10
10
|
|
11
|
-
|
11
|
+
resource = Fog::Resources::AzureRM.new(
|
12
12
|
tenant_id: azure_credentials['tenant_id'],
|
13
13
|
client_id: azure_credentials['client_id'],
|
14
14
|
client_secret: azure_credentials['client_secret'],
|
@@ -33,7 +33,7 @@ network = Fog::Network::AzureRM.new(
|
|
33
33
|
###################### Prerequisites ######################
|
34
34
|
########################################################################################################################
|
35
35
|
|
36
|
-
|
36
|
+
resource.resource_groups.create(
|
37
37
|
name: 'TestRG-AG',
|
38
38
|
location: 'eastus'
|
39
39
|
)
|
@@ -50,7 +50,7 @@ network.subnets.create(
|
|
50
50
|
name: 'mysubnet',
|
51
51
|
resource_group: 'TestRG-AG',
|
52
52
|
virtual_network_name: 'testVnet',
|
53
|
-
address_prefix: '10.
|
53
|
+
address_prefix: '10.2.0.0/24'
|
54
54
|
)
|
55
55
|
|
56
56
|
network.public_ips.create(
|
@@ -60,9 +60,9 @@ network.public_ips.create(
|
|
60
60
|
public_ip_allocation_method: 'Dynamic'
|
61
61
|
)
|
62
62
|
|
63
|
-
|
64
|
-
|
65
|
-
|
63
|
+
#######################################################################################################################
|
64
|
+
##################### Create Application Gateway ######################
|
65
|
+
#######################################################################################################################
|
66
66
|
|
67
67
|
application_gateway.gateways.create(
|
68
68
|
name: 'gateway',
|
@@ -71,57 +71,128 @@ application_gateway.gateways.create(
|
|
71
71
|
sku_name: 'Standard_Medium',
|
72
72
|
sku_tier: 'Standard',
|
73
73
|
sku_capacity: '2',
|
74
|
-
gateway_ip_configurations: [
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
}
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
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
|
+
########################################################################################################################
|
142
|
+
###################### Update sku attributes (Name and Capacity) #########################
|
143
|
+
########################################################################################################################
|
144
|
+
|
145
|
+
app_gateway.update_sku('Standard_Small', '1')
|
146
|
+
|
147
|
+
########################################################################################################################
|
148
|
+
###################### Update gateway ip configuration (Subnet id) #########################
|
149
|
+
########################################################################################################################
|
150
|
+
|
151
|
+
network.subnets.create(
|
152
|
+
name: 'mysubnet1',
|
153
|
+
resource_group: 'TestRG-AG',
|
154
|
+
virtual_network_name: 'testVnet',
|
155
|
+
address_prefix: '10.2.0.0/24'
|
156
|
+
)
|
157
|
+
|
158
|
+
app_gateway.update_gateway_ip_configuration("/subscriptions/#{azure_credentials['subscription_id']}/resourcegroups/TestRG-AG/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/mysubnet1")
|
159
|
+
|
160
|
+
########################################################################################################################
|
161
|
+
###################### Add/Remove Frontend ports #########################
|
162
|
+
########################################################################################################################
|
163
|
+
|
164
|
+
app_gateway.add_frontend_port(name: 'frontendPort1', port: 80)
|
165
|
+
|
166
|
+
app_gateway.remove_frontend_port(name: 'frontendPort1', port: 80)
|
167
|
+
|
168
|
+
#######################################################################################################################
|
169
|
+
##################### Add/Remove Probes #########################
|
170
|
+
#######################################################################################################################
|
171
|
+
|
172
|
+
app_gateway.add_probe(
|
173
|
+
name: 'Probe1',
|
174
|
+
protocol: 'http',
|
175
|
+
host: 'localhost',
|
176
|
+
path: '/fog-test',
|
177
|
+
interval: 60,
|
178
|
+
timeout: 300,
|
179
|
+
unhealthy_threshold: 5
|
180
|
+
)
|
181
|
+
app_gateway.remove_probe(
|
182
|
+
name: 'Probe1',
|
183
|
+
protocol: 'http',
|
184
|
+
host: 'localhost',
|
185
|
+
path: '/fog-test',
|
186
|
+
interval: 60,
|
187
|
+
timeout: 300,
|
188
|
+
unhealthy_threshold: 5
|
117
189
|
)
|
118
190
|
|
119
191
|
########################################################################################################################
|
120
|
-
######################
|
192
|
+
###################### Destroy Application Gateway ######################
|
121
193
|
########################################################################################################################
|
122
194
|
|
123
|
-
|
124
|
-
ag.destroy
|
195
|
+
app_gateway.destroy
|
125
196
|
|
126
197
|
########################################################################################################################
|
127
198
|
###################### CleanUp ######################
|
@@ -133,5 +204,5 @@ pubip.destroy
|
|
133
204
|
vnet = network.virtual_networks.get('TestRG-AG', 'testVnet')
|
134
205
|
vnet.destroy
|
135
206
|
|
136
|
-
|
137
|
-
|
207
|
+
resource_group = resource.resource_groups.get('TestRG-AG')
|
208
|
+
resource_group.destroy
|
@@ -39,7 +39,7 @@ resources.deployments.create(
|
|
39
39
|
###################### List and Get Deployment #########################
|
40
40
|
########################################################################################################################
|
41
41
|
|
42
|
-
deployment = resources.deployments(resource_group
|
42
|
+
deployment = resources.deployments.get(resource_group.name, 'testdeployment')
|
43
43
|
|
44
44
|
########################################################################################################################
|
45
45
|
###################### Destroy Deployment ###############################
|
@@ -30,7 +30,7 @@ resources.resource_groups.create(
|
|
30
30
|
name: 'TestRG-ER',
|
31
31
|
location: 'eastus'
|
32
32
|
)
|
33
|
-
|
33
|
+
puts 'Resource Group created!'
|
34
34
|
########################################################################################################################
|
35
35
|
################ Create Express Route Circuit #################
|
36
36
|
########################################################################################################################
|
@@ -60,6 +60,7 @@ network.express_route_circuits.create(
|
|
60
60
|
}
|
61
61
|
]
|
62
62
|
)
|
63
|
+
puts 'Express Route Circuit created!'
|
63
64
|
|
64
65
|
########################################################################################################################
|
65
66
|
###################### List Express Route Circuit ####################
|
@@ -71,10 +72,48 @@ circuits.each do |circuit|
|
|
71
72
|
end
|
72
73
|
|
73
74
|
########################################################################################################################
|
74
|
-
######################
|
75
|
+
###################### Create Express Route Circuit Authorizations ####################
|
75
76
|
########################################################################################################################
|
77
|
+
network.express_route_circuit_authorizations.create(
|
78
|
+
resource_group: 'TestRG-ER',
|
79
|
+
circuit_name: 'testERCircuit',
|
80
|
+
authorization_status: 'Available',
|
81
|
+
authorization_name: 'Test-Auth',
|
82
|
+
name: 'Unique-Auth-Name'
|
83
|
+
)
|
84
|
+
puts 'Express Route Circuit Authorization created!'
|
76
85
|
|
77
|
-
|
78
|
-
|
86
|
+
########################################################################################################################
|
87
|
+
###################### Get a Express Route Circuit Authorization ####################
|
88
|
+
########################################################################################################################
|
89
|
+
authorization = network.express_route_circuit_authorizations.get('TestRG-ER', 'testERCircuit', 'Test-Auth')
|
90
|
+
puts authorization.name.to_s
|
91
|
+
|
92
|
+
########################################################################################################################
|
93
|
+
###################### List Express Route Circuit Authorizations ####################
|
94
|
+
########################################################################################################################
|
95
|
+
authorizations = network.express_route_circuit_authorizations(resource_group: 'TestRG-ER', circuit_name: 'testERCircuit')
|
96
|
+
authorizations.each do |auth|
|
97
|
+
puts auth.name.to_s
|
98
|
+
end
|
79
99
|
|
100
|
+
########################################################################################################################
|
101
|
+
###################### Destroy Express Route Circuit Authorization ####################
|
102
|
+
########################################################################################################################
|
103
|
+
authorization = network.express_route_circuit_authorizations.get('TestRG-ER', 'testERCircuit', 'Test-Auth')
|
104
|
+
authorization.destroy
|
105
|
+
puts 'Express Route Circuit Authorization deleted!'
|
106
|
+
|
107
|
+
########################################################################################################################
|
108
|
+
###################### Destroy Express Route Circuit ######################
|
109
|
+
########################################################################################################################
|
110
|
+
circuit = network.express_route_circuits.get('TestRG-ER', 'testERCircuit')
|
80
111
|
circuit.destroy
|
112
|
+
puts 'Express Route Circuit deleted!'
|
113
|
+
|
114
|
+
########################################################################################################################
|
115
|
+
###################### CleanUp ######################
|
116
|
+
########################################################################################################################
|
117
|
+
resource_group = resources.resource_groups.get('TestRG-ER')
|
118
|
+
resource_group.destroy
|
119
|
+
puts 'Resource Group deleted!'
|
@@ -103,8 +103,8 @@ network.load_balancers.create(
|
|
103
103
|
###################### Get and Destroy Load Balancer ######################
|
104
104
|
########################################################################################################################
|
105
105
|
|
106
|
-
|
107
|
-
|
106
|
+
load_balancer = network.load_balancers.get('TestRG-LB', 'lb')
|
107
|
+
load_balancer.destroy
|
108
108
|
|
109
109
|
########################################################################################################################
|
110
110
|
###################### CleanUp ######################
|
@@ -116,5 +116,5 @@ pubip.destroy
|
|
116
116
|
vnet = network.virtual_networks.get('TestRG-LB', 'testVnet')
|
117
117
|
vnet.destroy
|
118
118
|
|
119
|
-
|
120
|
-
|
119
|
+
resource_group = rs.resource_groups.get('TestRG-LB')
|
120
|
+
resource_group.destroy
|
@@ -113,8 +113,8 @@ network.load_balancers.create(
|
|
113
113
|
###################### Get and Destroy Internal Load Balancer ######################
|
114
114
|
########################################################################################################################
|
115
115
|
|
116
|
-
|
117
|
-
|
116
|
+
load_balancer = network.load_balancers.get('NRP-RG-Fog', 'lb')
|
117
|
+
load_balancer.destroy
|
118
118
|
|
119
119
|
########################################################################################################################
|
120
120
|
###################### CleanUp ######################
|
@@ -123,5 +123,5 @@ lb.destroy
|
|
123
123
|
vnet = network.virtual_networks.get('NRP-RG-Fog', 'NRPVNet')
|
124
124
|
vnet.destroy
|
125
125
|
|
126
|
-
|
127
|
-
|
126
|
+
resource_group = rs.resource_groups.get('NRP-RG-Fog')
|
127
|
+
resource_group.destroy
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'fog/azurerm'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
########################################################################################################################
|
5
|
+
###################### Services object required by all actions ######################
|
6
|
+
###################### Keep it Uncommented! ######################
|
7
|
+
########################################################################################################################
|
8
|
+
|
9
|
+
azure_credentials = YAML.load_file('credentials/azure.yml')
|
10
|
+
|
11
|
+
resource = Fog::Resources::AzureRM.new(
|
12
|
+
tenant_id: azure_credentials['tenant_id'],
|
13
|
+
client_id: azure_credentials['client_id'],
|
14
|
+
client_secret: azure_credentials['client_secret'],
|
15
|
+
subscription_id: azure_credentials['subscription_id']
|
16
|
+
)
|
17
|
+
|
18
|
+
network = Fog::Network::AzureRM.new(
|
19
|
+
tenant_id: azure_credentials['tenant_id'],
|
20
|
+
client_id: azure_credentials['client_id'],
|
21
|
+
client_secret: azure_credentials['client_secret'],
|
22
|
+
subscription_id: azure_credentials['subscription_id']
|
23
|
+
)
|
24
|
+
|
25
|
+
########################################################################################################################
|
26
|
+
###################### Prerequisites ######################
|
27
|
+
########################################################################################################################
|
28
|
+
|
29
|
+
resource.resource_groups.create(
|
30
|
+
name: 'TestRG-LNG',
|
31
|
+
location: 'eastus'
|
32
|
+
)
|
33
|
+
|
34
|
+
########################################################################################################################
|
35
|
+
###################### Create Local Network Gateway ######################
|
36
|
+
########################################################################################################################
|
37
|
+
|
38
|
+
network.local_network_gateways.create(
|
39
|
+
name: 'testlocalnetworkgateway',
|
40
|
+
location: 'eastus',
|
41
|
+
tags: {
|
42
|
+
key1: 'value1',
|
43
|
+
key2: 'value2'
|
44
|
+
},
|
45
|
+
resource_group: 'TestRG-LNG',
|
46
|
+
gateway_ip_address: '192.168.1.1',
|
47
|
+
local_network_address_space_prefixes: [],
|
48
|
+
asn: 100,
|
49
|
+
bgp_peering_address: '192.168.1.2',
|
50
|
+
peer_weight: 3
|
51
|
+
)
|
52
|
+
|
53
|
+
########################################################################################################################
|
54
|
+
###################### List Local Network Gateways ######################
|
55
|
+
########################################################################################################################
|
56
|
+
|
57
|
+
local_network_gateways = network.local_network_gateways(resource_group: 'TestRG-LNG')
|
58
|
+
local_network_gateways.each do |gateway|
|
59
|
+
puts gateway.name.to_s
|
60
|
+
end
|
61
|
+
|
62
|
+
########################################################################################################################
|
63
|
+
###################### Get Local Network Gateway ######################
|
64
|
+
########################################################################################################################
|
65
|
+
|
66
|
+
local_network_gateway = network.local_network_gateways.get('TestRG-LNG', 'testlocalnetworkgateway')
|
67
|
+
puts local_network_gateway.name.to_s
|
68
|
+
|
69
|
+
########################################################################################################################
|
70
|
+
###################### CleanUp ######################
|
71
|
+
########################################################################################################################
|
72
|
+
|
73
|
+
local_network_gateway.destroy
|
74
|
+
|
75
|
+
resource_group = resource.resource_groups.get('TestRG-LNG')
|
76
|
+
resource_group.destroy
|
@@ -48,6 +48,13 @@ network.public_ips.create(
|
|
48
48
|
public_ip_allocation_method: 'Static'
|
49
49
|
)
|
50
50
|
|
51
|
+
########################################################################################################################
|
52
|
+
###################### Get and Update Public IP ######################
|
53
|
+
########################################################################################################################
|
54
|
+
|
55
|
+
pubip = network.public_ips.get('TestRG-PB', 'mypubip')
|
56
|
+
pubip.update(public_ip_allocation_method: 'Dynamic', idle_timeout_in_minutes: '10', domain_name_label: 'newdomainlabel')
|
57
|
+
|
51
58
|
########################################################################################################################
|
52
59
|
###################### Get and Delete Public IP ######################
|
53
60
|
########################################################################################################################
|