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,169 @@
|
|
1
|
+
module Fog
|
2
|
+
module Network
|
3
|
+
class AzureRM
|
4
|
+
# Real class for Load-Balancer Request
|
5
|
+
class Real
|
6
|
+
def get_load_balancer(resource_group_name, load_balancer_name)
|
7
|
+
msg = "Getting Load-Balancer: #{load_balancer_name} in Resource Group: #{resource_group_name}"
|
8
|
+
Fog::Logger.debug msg
|
9
|
+
begin
|
10
|
+
load_balancer = @network_client.load_balancers.get(resource_group_name, load_balancer_name)
|
11
|
+
rescue MsRestAzure::AzureOperationError => e
|
12
|
+
raise_azure_exception(e, msg)
|
13
|
+
end
|
14
|
+
Fog::Logger.debug "Getting Load Balancer #{load_balancer_name} Successfully."
|
15
|
+
load_balancer
|
16
|
+
end
|
17
|
+
# Mock class for Load-Balancer Request
|
18
|
+
class Mock
|
19
|
+
def get_load_balancer(*)
|
20
|
+
response = '{
|
21
|
+
"name":"mylb1",
|
22
|
+
"id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/mylb1",
|
23
|
+
"location":"North US",
|
24
|
+
"tags":{
|
25
|
+
"key":"value"
|
26
|
+
},
|
27
|
+
"etag":"W/\"00000000-0000-0000-0000-000000000000\"",
|
28
|
+
"properties":{
|
29
|
+
"resourceGuid":"6ECBD4C1-0DC1-4D86-9F6E-4A58F83C9023",
|
30
|
+
"provisioningState":"Succeeded",
|
31
|
+
"frontendIPConfigurations":[
|
32
|
+
{
|
33
|
+
"name":"myip1",
|
34
|
+
"id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/mylb1/frontendIPConfigurations/myip1",
|
35
|
+
"etag":"W/\"00000000-0000-0000-0000-000000000000\"",
|
36
|
+
"properties":{
|
37
|
+
"provisioningState":"Succeeded",
|
38
|
+
"subnet":{
|
39
|
+
"id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/myvnet1/subnets/mysubnet1"
|
40
|
+
},
|
41
|
+
"privateIPAddress":"10.0.0.10",
|
42
|
+
"privateIPAllocationMethod":"Static",
|
43
|
+
"publicIPAddress":{
|
44
|
+
"id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/myip1"
|
45
|
+
},
|
46
|
+
"loadBalancingRules":[
|
47
|
+
{
|
48
|
+
"id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/loadBalancingRules/rule1"
|
49
|
+
}
|
50
|
+
],
|
51
|
+
"inboundNatRules":[
|
52
|
+
{
|
53
|
+
"id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/inboundNatRules/rule1"
|
54
|
+
}
|
55
|
+
]
|
56
|
+
}
|
57
|
+
}
|
58
|
+
],
|
59
|
+
"backendAddressPools":[
|
60
|
+
{
|
61
|
+
"name":"pool1",
|
62
|
+
"id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/mylb1/backendAddressPools/pool1",
|
63
|
+
"etag":"W/\"00000000-0000-0000-0000-000000000000\"",
|
64
|
+
"properties":{
|
65
|
+
"provisioningState":"Succeeded",
|
66
|
+
"backendIPConfigurations":[
|
67
|
+
{
|
68
|
+
"id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/vm1nic1/ipConfigurations/ip1"
|
69
|
+
}
|
70
|
+
],
|
71
|
+
"loadBalancingRules":[
|
72
|
+
{
|
73
|
+
"id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/loadBalancingRules/rule1"
|
74
|
+
}
|
75
|
+
]
|
76
|
+
}
|
77
|
+
}
|
78
|
+
],
|
79
|
+
"loadBalancingRules":[
|
80
|
+
{
|
81
|
+
"name":"HTTP Traffic",
|
82
|
+
"id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/mylb1/loadBalancingRules/rule1",
|
83
|
+
"etag":"W/\"00000000-0000-0000-0000-000000000000\"",
|
84
|
+
"properties":{
|
85
|
+
"provisioningState":"Succeeded",
|
86
|
+
"frontendIPConfiguration":{
|
87
|
+
"id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/frontendIPConfigurations/ip1"
|
88
|
+
},
|
89
|
+
"backendAddressPool":{
|
90
|
+
"id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/backendAddressPool/pool1"
|
91
|
+
},
|
92
|
+
"protocol":"Tcp",
|
93
|
+
"frontendPort":80,
|
94
|
+
"backendPort":8080,
|
95
|
+
"probe":{
|
96
|
+
"id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/probes/probe1"
|
97
|
+
},
|
98
|
+
"enableFloatingIP":true,
|
99
|
+
"idleTimeoutInMinutes":4,
|
100
|
+
"loadDistribution":"Default"
|
101
|
+
}
|
102
|
+
}
|
103
|
+
],
|
104
|
+
"probes":[
|
105
|
+
{
|
106
|
+
"name":"my probe 1",
|
107
|
+
"id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/probes/my probe 1",
|
108
|
+
"etag":"W/\"00000000-0000-0000-0000-000000000000\"",
|
109
|
+
"properties":{
|
110
|
+
"provisioningState":"Succeeded",
|
111
|
+
"protocol":"Tcp",
|
112
|
+
"port":8080,
|
113
|
+
"requestPath":"myprobeapp1/myprobe1.svc",
|
114
|
+
"intervalInSeconds":5,
|
115
|
+
"numberOfProbes":16,
|
116
|
+
"loadBalancingRules":[
|
117
|
+
{
|
118
|
+
"id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/loadBalancingRules/rule1"
|
119
|
+
}
|
120
|
+
]
|
121
|
+
}
|
122
|
+
}
|
123
|
+
],
|
124
|
+
"inboundNatRules":[
|
125
|
+
{
|
126
|
+
"name":"RDP Traffic",
|
127
|
+
"id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/inboundNatRules/RDP Traffic",
|
128
|
+
"etag":"W/\"00000000-0000-0000-0000-000000000000\"",
|
129
|
+
"properties":{
|
130
|
+
"provisioningState":"Succeeded",
|
131
|
+
"frontendIPConfiguration":{
|
132
|
+
"id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/frontendIPConfigurations/ip1"
|
133
|
+
},
|
134
|
+
"backendIPConfiguration":{
|
135
|
+
"id":"/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/vm1nic1/ipConfigurations/ip1"
|
136
|
+
},
|
137
|
+
"protocol":"Tcp",
|
138
|
+
"frontendPort":3389,
|
139
|
+
"backendPort":3389
|
140
|
+
}
|
141
|
+
}
|
142
|
+
],
|
143
|
+
"inboundNatPools":[
|
144
|
+
{
|
145
|
+
"name": "RDPForVMSS1",
|
146
|
+
"id": "/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers /Microsoft.Network/loadBalancers/myLB1/inboundNatRules/RDPForVMSS1",
|
147
|
+
"etag": "W/\"00000000-0000-0000-0000-000000000000\"",
|
148
|
+
"properties": {
|
149
|
+
"provisioningState": "Updating|Deleting|Failed|Succeeded",
|
150
|
+
"frontendIPConfiguration": {
|
151
|
+
"id": "/subscriptions/{guid}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/myLB1/frontendIPConfigurations/ip1"
|
152
|
+
},
|
153
|
+
"protocol": "Tcp",
|
154
|
+
"frontendPortRangeStart": 50000,
|
155
|
+
"frontendPortRangeEnd": 50500,
|
156
|
+
"backendPort": 3389
|
157
|
+
}
|
158
|
+
}
|
159
|
+
]
|
160
|
+
}
|
161
|
+
}'
|
162
|
+
load_balancer_mapper = Azure::ARM::Network::Models::LoadBalancer.mapper
|
163
|
+
@network_client.deserialize(load_balancer_mapper, JSON.load(response), 'result.body')
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Fog
|
2
|
+
module Network
|
3
|
+
class AzureRM
|
4
|
+
# Real class for Local Network Gateway Request
|
5
|
+
class Real
|
6
|
+
def get_local_network_gateway(resource_group_name, local_network_gateway_name)
|
7
|
+
msg = "Getting Local Network Gateway #{local_network_gateway_name} from Resource Group #{resource_group_name}."
|
8
|
+
Fog::Logger.debug msg
|
9
|
+
begin
|
10
|
+
local_network_gateway = @network_client.local_network_gateways.get(resource_group_name, local_network_gateway_name)
|
11
|
+
rescue MsRestAzure::AzureOperationError => e
|
12
|
+
raise_azure_exception(e, msg)
|
13
|
+
end
|
14
|
+
Fog::Logger.debug "Local Network Gateway #{local_network_gateway_name} retrieved successfully."
|
15
|
+
local_network_gateway
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# Mock class for Local Network Gateway Request
|
20
|
+
class Mock
|
21
|
+
def get_local_network_gateway(*)
|
22
|
+
local_network_gateway = {
|
23
|
+
'id' => '/subscriptions/<Subscription_id>/resourceGroups/learn_fog/providers/Microsoft.Network/localNetworkGateways/testLocalNetworkGateway',
|
24
|
+
'name' => 'testLocalNetworkGateway',
|
25
|
+
'type' => 'Microsoft.Network/localNetworkGateways',
|
26
|
+
'location' => 'eastus',
|
27
|
+
'properties' =>
|
28
|
+
{
|
29
|
+
'local_network_address_space' => {
|
30
|
+
'address_prefixes' => []
|
31
|
+
},
|
32
|
+
'gateway_ip_address' => '192.168.1.1',
|
33
|
+
'bgp_settings' => {
|
34
|
+
'asn' => 100,
|
35
|
+
'bgp_peering_address' => '192.168.1.2',
|
36
|
+
'peer_weight' => 3
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
local_network_gateway_mapper = Azure::ARM::Network::Models::LocalNetworkGateway.mapper
|
41
|
+
@network_client.deserialize(local_network_gateway_mapper, local_network_gateway, 'result.body')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Fog
|
2
|
+
module Network
|
3
|
+
class AzureRM
|
4
|
+
# Real class for Virtual Network Gateway Connection Request
|
5
|
+
class Real
|
6
|
+
def get_virtual_network_gateway_connection(resource_group_name, gateway_connection_name)
|
7
|
+
msg = "Getting Virtual Network Gateway Connection #{gateway_connection_name} from Resource Group #{resource_group_name}."
|
8
|
+
Fog::Logger.debug msg
|
9
|
+
begin
|
10
|
+
gateway_connection = @network_client.virtual_network_gateway_connections.get(resource_group_name, gateway_connection_name)
|
11
|
+
rescue MsRestAzure::AzureOperationError => e
|
12
|
+
raise_azure_exception(e, msg)
|
13
|
+
end
|
14
|
+
Fog::Logger.debug "Virtual Network Gateway Connection #{gateway_connection_name} retrieved successfully."
|
15
|
+
gateway_connection
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# Mock class for Network Gateway Connection Request
|
20
|
+
class Mock
|
21
|
+
def get_virtual_network_gateway_connection(*)
|
22
|
+
connection = {
|
23
|
+
'name' => 'cn1',
|
24
|
+
'id' => '/subscriptions/{subscription-id}/resourceGroups/{resource_group_name}/providers/microsoft.network/connections/connection1',
|
25
|
+
'location' => 'West US',
|
26
|
+
'tags' => { 'key1' => 'value1' },
|
27
|
+
'properties' => {
|
28
|
+
'virtualNetworkGateway1' => {
|
29
|
+
'name' => 'firstgateway',
|
30
|
+
'id' => '/subscriptions/{subscription-id}/resourceGroups/{resource_group_name}/providers/microsoft.network/SiteToSite/firstgateway'
|
31
|
+
},
|
32
|
+
'virtualNetworkGateway2' => {
|
33
|
+
'name' => 'secondgateway',
|
34
|
+
'id' => '/subscriptions/{subscription-id}/resourceGroups/{resource_group_name}/providers/microsoft.network/SiteToSite/secondgateway'
|
35
|
+
},
|
36
|
+
'connectionType' => 'SiteToSite',
|
37
|
+
'connectivityState' => 'Connected'
|
38
|
+
}
|
39
|
+
}
|
40
|
+
connection_mapper = Azure::ARM::Network::Models::VirtualNetworkGatewayConnection.mapper
|
41
|
+
@network_client.deserialize(connection_mapper, connection, 'result.body')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Fog
|
2
|
+
module Network
|
3
|
+
class AzureRM
|
4
|
+
# Real class for Express Route Circuit Authorization Request
|
5
|
+
class Real
|
6
|
+
def list_express_route_circuit_authorizations(resource_group_name, circuit_name)
|
7
|
+
msg = "Getting list of Express Route Circuit Authorizations from Resource Group #{resource_group_name}."
|
8
|
+
Fog::Logger.debug msg
|
9
|
+
begin
|
10
|
+
circuit_authorizations = @network_client.express_route_circuit_authorizations.list(resource_group_name, circuit_name)
|
11
|
+
rescue MsRestAzure::AzureOperationError => e
|
12
|
+
raise_azure_exception(e, msg)
|
13
|
+
end
|
14
|
+
circuit_authorizations
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# Mock class for Express Route Circuit Authorization Request
|
19
|
+
class Mock
|
20
|
+
def list_express_route_circuit_authorizations(*)
|
21
|
+
authorizations = [
|
22
|
+
{
|
23
|
+
'name' => 'authorization-name',
|
24
|
+
'properties' => {
|
25
|
+
'authorizationKey' => 'authorization-key',
|
26
|
+
'authorizationUseStatus' => 'Available'
|
27
|
+
}
|
28
|
+
}
|
29
|
+
]
|
30
|
+
authorization_mapper = Azure::ARM::Network::Models::ExpressRouteCircuitAuthorization.mapper
|
31
|
+
@network_client.deserialize(authorization_mapper, authorizations, 'result.body')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Fog
|
2
|
+
module Network
|
3
|
+
class AzureRM
|
4
|
+
# Real class for Local Network Gateway Request
|
5
|
+
class Real
|
6
|
+
def list_local_network_gateways(resource_group_name)
|
7
|
+
msg = "Getting list of Local Network Gateway from Resource Group #{resource_group_name}."
|
8
|
+
Fog::Logger.debug msg
|
9
|
+
begin
|
10
|
+
local_network_gateways = @network_client.local_network_gateways.list_as_lazy(resource_group_name)
|
11
|
+
rescue MsRestAzure::AzureOperationError => e
|
12
|
+
raise_azure_exception(e, msg)
|
13
|
+
end
|
14
|
+
local_network_gateways.value
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# Mock class for Local Network Gateway Request
|
19
|
+
class Mock
|
20
|
+
def list_virtual_network_gateways(*)
|
21
|
+
local_network_gateway = {
|
22
|
+
'value' => [
|
23
|
+
{
|
24
|
+
'id' => '/subscriptions/<Subscription_id>/resourceGroups/learn_fog/providers/Microsoft.Network/localNetworkGateways/testLocalNetworkGateway',
|
25
|
+
'name' => 'testLocalNetworkGateway',
|
26
|
+
'type' => 'Microsoft.Network/localNetworkGateways',
|
27
|
+
'location' => 'eastus',
|
28
|
+
'properties' =>
|
29
|
+
{
|
30
|
+
'local_network_address_space' => {
|
31
|
+
'address_prefixes' => []
|
32
|
+
},
|
33
|
+
'gateway_ip_address' => '192.168.1.1',
|
34
|
+
'bgp_settings' => {
|
35
|
+
'asn' => 100,
|
36
|
+
'bgp_peering_address' => '192.168.1.2',
|
37
|
+
'peer_weight' => 3
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
]
|
42
|
+
}
|
43
|
+
local_network_gateway_mapper = Azure::ARM::Network::Models::LocalNetworkGatewayListResult.mapper
|
44
|
+
@network_client.deserialize(local_network_gateway_mapper, local_network_gateway, 'result.body')
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Fog
|
2
|
+
module Network
|
3
|
+
class AzureRM
|
4
|
+
# Real class for Network Request
|
5
|
+
class Real
|
6
|
+
def list_virtual_network_gateway_connections(resource_group_name)
|
7
|
+
msg = "Getting list of Virtual Network Gateway Connection from Resource Group #{resource_group_name}."
|
8
|
+
Fog::Logger.debug msg
|
9
|
+
begin
|
10
|
+
gateway_connections = @network_client.virtual_network_gateway_connections.list_as_lazy(resource_group_name)
|
11
|
+
rescue MsRestAzure::AzureOperationError => e
|
12
|
+
raise_azure_exception(e, msg)
|
13
|
+
end
|
14
|
+
gateway_connections.value
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# Mock class for Network Request
|
19
|
+
class Mock
|
20
|
+
def list_virtual_network_gateway_connections(*)
|
21
|
+
connection = {
|
22
|
+
'value' => [
|
23
|
+
{
|
24
|
+
'name' => 'cn1',
|
25
|
+
'id' => '/subscriptions/{subscription-id}/resourceGroups/{resource_group_name}/providers/microsoft.network/connections/connection1',
|
26
|
+
'location' => 'West US',
|
27
|
+
'tags' => { 'key1' => 'value1' },
|
28
|
+
'properties' => {
|
29
|
+
'virtualNetworkGateway1' => {
|
30
|
+
'name' => 'firstgateway',
|
31
|
+
'id' => '/subscriptions/{subscription-id}/resourceGroups/{resource_group_name}/providers/microsoft.network/SiteToSite/firstgateway'
|
32
|
+
},
|
33
|
+
'virtualNetworkGateway2' => {
|
34
|
+
'name' => 'secondgateway',
|
35
|
+
'id' => '/subscriptions/{subscription-id}/resourceGroups/{resource_group_name}/providers/microsoft.network/SiteToSite/secondgateway'
|
36
|
+
},
|
37
|
+
'connectionType' => 'SiteToSite',
|
38
|
+
'connectivityState' => 'Connected'
|
39
|
+
}
|
40
|
+
}
|
41
|
+
]
|
42
|
+
}
|
43
|
+
connection_mapper = Azure::ARM::Network::Models::VirtualNetworkGatewayConnectionListResult.mapper
|
44
|
+
@network_client.deserialize(connection_mapper, connection, 'result.body').value
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Fog
|
2
|
+
module Network
|
3
|
+
class AzureRM
|
4
|
+
# Real class for Network Request
|
5
|
+
class Real
|
6
|
+
def reset_connection_shared_key(resource_group_name, virtual_network_gateway_connection_name, shared_key_length)
|
7
|
+
msg = "Resetting the shared key of Connection #{virtual_network_gateway_connection_name} from Resource Group #{resource_group_name}."
|
8
|
+
Fog::Logger.debug msg
|
9
|
+
shared_key = get_reset_shared_key_object(shared_key_length)
|
10
|
+
begin
|
11
|
+
@network_client.virtual_network_gateway_connections.reset_shared_key(resource_group_name, virtual_network_gateway_connection_name, shared_key)
|
12
|
+
rescue MsRestAzure::AzureOperationError => e
|
13
|
+
raise_azure_exception(e, msg)
|
14
|
+
end
|
15
|
+
true
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def get_reset_shared_key_object(shared_key_length)
|
21
|
+
shared_key = Azure::ARM::Network::Models::ConnectionResetSharedKey.new
|
22
|
+
shared_key.key_length = shared_key_length
|
23
|
+
shared_key
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Mock class for Network Request
|
28
|
+
class Mock
|
29
|
+
def reset_connection_shared_key(*)
|
30
|
+
Fog::Logger.debug 'Reset the shared key of Connection successfully.'
|
31
|
+
true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Fog
|
2
|
+
module Network
|
3
|
+
class AzureRM
|
4
|
+
# Real class for Network Request
|
5
|
+
class Real
|
6
|
+
def set_connection_shared_key(resource_group_name, virtual_network_gateway_connection_name, shared_key_value)
|
7
|
+
msg = "Setting the shared key of Connection #{virtual_network_gateway_connection_name} from Resource Group #{resource_group_name}."
|
8
|
+
Fog::Logger.debug msg
|
9
|
+
shared_key = get_shared_key_object(shared_key_value)
|
10
|
+
begin
|
11
|
+
@network_client.virtual_network_gateway_connections.set_shared_key(resource_group_name, virtual_network_gateway_connection_name, shared_key)
|
12
|
+
rescue MsRestAzure::AzureOperationError => e
|
13
|
+
raise_azure_exception(e, msg)
|
14
|
+
end
|
15
|
+
true
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def get_shared_key_object(shared_key_value)
|
21
|
+
shared_key = Azure::ARM::Network::Models::ConnectionSharedKey.new
|
22
|
+
shared_key.value = shared_key_value
|
23
|
+
shared_key
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Mock class for Network Request
|
28
|
+
class Mock
|
29
|
+
def set_connection_shared_key(*)
|
30
|
+
Fog::Logger.debug 'Set the shared key of Connection successfully.'
|
31
|
+
true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -4,16 +4,17 @@ module Fog
|
|
4
4
|
# This class provides the actual implemention for service calls.
|
5
5
|
class Real
|
6
6
|
def create_deployment(resource_group, deployment_name, template_link, parameters_link)
|
7
|
-
|
7
|
+
msg = "Creating Deployment: #{deployment_name} in Resource Group: #{resource_group}"
|
8
|
+
Fog::Logger.debug msg
|
8
9
|
deployment = create_deployment_object(template_link, parameters_link)
|
9
10
|
begin
|
10
11
|
@rmc.deployments.validate(resource_group, deployment_name, deployment)
|
11
12
|
deployment = @rmc.deployments.create_or_update(resource_group, deployment_name, deployment)
|
12
|
-
Fog::Logger.debug "Deployment: #{deployment_name} in Resource Group: #{resource_group} created successfully."
|
13
|
-
deployment
|
14
13
|
rescue MsRestAzure::AzureOperationError => e
|
15
|
-
|
14
|
+
raise_azure_exception(e, msg)
|
16
15
|
end
|
16
|
+
Fog::Logger.debug "Deployment: #{deployment_name} in Resource Group: #{resource_group} created successfully."
|
17
|
+
deployment
|
17
18
|
end
|
18
19
|
|
19
20
|
private
|
@@ -4,16 +4,17 @@ module Fog
|
|
4
4
|
# This class provides the actual implemention for service calls.
|
5
5
|
class Real
|
6
6
|
def create_resource_group(name, location)
|
7
|
-
|
7
|
+
msg = "Creating Resource Group: #{name}."
|
8
|
+
Fog::Logger.debug msg
|
8
9
|
resource_group = Azure::ARM::Resources::Models::ResourceGroup.new
|
9
10
|
resource_group.location = location
|
10
11
|
begin
|
11
12
|
resource_group = @rmc.resource_groups.create_or_update(name, resource_group)
|
12
|
-
Fog::Logger.debug "Resource Group #{name} created successfully."
|
13
|
-
resource_group
|
14
13
|
rescue MsRestAzure::AzureOperationError => e
|
15
|
-
|
14
|
+
raise_azure_exception(e, msg)
|
16
15
|
end
|
16
|
+
Fog::Logger.debug "Resource Group #{name} created successfully."
|
17
|
+
resource_group
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
@@ -4,14 +4,15 @@ module Fog
|
|
4
4
|
# This class provides the actual implemention for service calls.
|
5
5
|
class Real
|
6
6
|
def delete_deployment(resource_group, deployment_name)
|
7
|
-
|
7
|
+
msg = "Deleting Deployment: #{deployment_name} in Resource Group: #{resource_group}"
|
8
|
+
Fog::Logger.debug msg
|
8
9
|
begin
|
9
10
|
@rmc.deployments.delete(resource_group, deployment_name)
|
10
|
-
Fog::Logger.debug "Deployment: #{deployment_name} in Resource Group: #{resource_group} deleted successfully."
|
11
|
-
true
|
12
11
|
rescue MsRestAzure::AzureOperationError => e
|
13
|
-
|
12
|
+
raise_azure_exception(e, msg)
|
14
13
|
end
|
14
|
+
Fog::Logger.debug "Deployment: #{deployment_name} in Resource Group: #{resource_group} deleted successfully."
|
15
|
+
true
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
@@ -4,14 +4,15 @@ module Fog
|
|
4
4
|
# This class provides the actual implemention for service calls.
|
5
5
|
class Real
|
6
6
|
def delete_resource_group(name)
|
7
|
-
|
7
|
+
msg = "Deleting Resource Group: #{name}."
|
8
|
+
Fog::Logger.debug msg
|
8
9
|
begin
|
9
10
|
@rmc.resource_groups.delete(name)
|
10
|
-
Fog::Logger.debug "Resource Group #{name} deleted successfully."
|
11
|
-
true
|
12
11
|
rescue MsRestAzure::AzureOperationError => e
|
13
|
-
|
12
|
+
raise_azure_exception(e, msg)
|
14
13
|
end
|
14
|
+
Fog::Logger.debug "Resource Group #{name} deleted successfully."
|
15
|
+
true
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
@@ -14,7 +14,9 @@ module Fog
|
|
14
14
|
resource_type = get_resource_from_resource_id(resource_id, RESOURCE_TYPE)
|
15
15
|
resource_name = get_resource_from_resource_id(resource_id, RESOURCE_NAME)
|
16
16
|
|
17
|
-
|
17
|
+
msg = "Deleting Tag #{tag_name} from Resource #{resource_name}"
|
18
|
+
Fog::Logger.debug msg
|
19
|
+
|
18
20
|
begin
|
19
21
|
resource = @rmc.resources.get(resource_group_name, resource_provider_namespace, '', resource_type, resource_name, API_VERSION)
|
20
22
|
|
@@ -22,11 +24,11 @@ module Fog
|
|
22
24
|
resource.tags.delete_if { |key, value| key == tag_name && value == tag_value }
|
23
25
|
end
|
24
26
|
@rmc.resources.create_or_update(resource_group_name, resource_provider_namespace, '', resource_type, resource_name, API_VERSION, resource)
|
25
|
-
Fog::Logger.debug "Tag #{tag_name} deleted successfully from Resource #{resource_name}"
|
26
|
-
true
|
27
27
|
rescue MsRestAzure::AzureOperationError => e
|
28
|
-
|
28
|
+
raise_azure_exception(e, msg)
|
29
29
|
end
|
30
|
+
Fog::Logger.debug "Tag #{tag_name} deleted successfully from Resource #{resource_name}"
|
31
|
+
true
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|