fog-azure-rm 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +19 -8
- data/LICENSE.md +1 -1
- data/README.md +9 -8
- data/lib/fog/azurerm/models/compute/availability_set.rb +17 -3
- data/lib/fog/azurerm/models/compute/availability_sets.rb +2 -6
- data/lib/fog/azurerm/models/compute/server.rb +1 -1
- data/lib/fog/azurerm/models/compute/servers.rb +3 -1
- data/lib/fog/azurerm/models/dns/record_set.rb +31 -3
- data/lib/fog/azurerm/models/dns/record_sets.rb +7 -17
- data/lib/fog/azurerm/models/dns/zone.rb +26 -3
- data/lib/fog/azurerm/models/dns/zones.rb +8 -6
- data/lib/fog/azurerm/models/network/frontend_ip_configuration.rb +32 -0
- data/lib/fog/azurerm/models/network/inbound_nat_pool.rb +27 -0
- data/lib/fog/azurerm/models/network/inbound_nat_rule.rb +29 -0
- data/lib/fog/azurerm/models/network/load_balancer.rb +249 -0
- data/lib/fog/azurerm/models/network/load_balancers.rb +27 -0
- data/lib/fog/azurerm/models/network/load_balancing_rule.rb +42 -0
- data/lib/fog/azurerm/models/network/network_interface.rb +46 -7
- data/lib/fog/azurerm/models/network/network_interfaces.rb +2 -8
- data/lib/fog/azurerm/models/network/network_security_group.rb +89 -0
- data/lib/fog/azurerm/models/network/network_security_groups.rb +27 -0
- data/lib/fog/azurerm/models/network/network_security_rule.rb +40 -0
- data/lib/fog/azurerm/models/network/probe.rb +29 -0
- data/lib/fog/azurerm/models/network/public_ip.rb +32 -4
- data/lib/fog/azurerm/models/network/public_ips.rb +2 -8
- data/lib/fog/azurerm/models/network/subnet.rb +20 -12
- data/lib/fog/azurerm/models/network/subnets.rb +1 -7
- data/lib/fog/azurerm/models/network/traffic_manager_end_point.rb +63 -0
- data/lib/fog/azurerm/models/network/traffic_manager_end_points.rb +29 -0
- data/lib/fog/azurerm/models/network/traffic_manager_profile.rb +59 -0
- data/lib/fog/azurerm/models/network/traffic_manager_profiles.rb +24 -0
- data/lib/fog/azurerm/models/network/virtual_network.rb +19 -6
- data/lib/fog/azurerm/models/network/virtual_networks.rb +4 -9
- data/lib/fog/azurerm/models/resources/resource_group.rb +2 -1
- data/lib/fog/azurerm/models/resources/resource_groups.rb +1 -9
- data/lib/fog/azurerm/models/storage/storage_account.rb +5 -7
- data/lib/fog/azurerm/models/storage/storage_accounts.rb +5 -6
- data/lib/fog/azurerm/network.rb +30 -0
- data/lib/fog/azurerm/requests/compute/create_availability_set.rb +13 -2
- data/lib/fog/azurerm/requests/compute/create_virtual_machine.rb +60 -2
- data/lib/fog/azurerm/requests/compute/deallocate_virtual_machine.rb +4 -2
- data/lib/fog/azurerm/requests/compute/delete_availability_set.rb +4 -2
- data/lib/fog/azurerm/requests/compute/delete_virtual_machine.rb +4 -2
- data/lib/fog/azurerm/requests/compute/generalize_virtual_machine.rb +4 -2
- data/lib/fog/azurerm/requests/compute/get_virtual_machine.rb +57 -1
- data/lib/fog/azurerm/requests/compute/list_availability_sets.rb +16 -1
- data/lib/fog/azurerm/requests/compute/list_available_sizes_for_virtual_machine.rb +27 -1
- data/lib/fog/azurerm/requests/compute/power_off_virtual_machine.rb +4 -2
- data/lib/fog/azurerm/requests/compute/redeploy_virtual_machine.rb +4 -2
- data/lib/fog/azurerm/requests/compute/restart_virtual_machine.rb +4 -2
- data/lib/fog/azurerm/requests/compute/start_virtual_machine.rb +4 -2
- data/lib/fog/azurerm/requests/dns/check_for_zone.rb +16 -17
- data/lib/fog/azurerm/requests/dns/create_record_set.rb +80 -37
- data/lib/fog/azurerm/requests/dns/create_zone.rb +43 -27
- data/lib/fog/azurerm/requests/dns/delete_record_set.rb +17 -19
- data/lib/fog/azurerm/requests/dns/delete_zone.rb +16 -19
- data/lib/fog/azurerm/requests/dns/get_records_from_record_set.rb +29 -28
- data/lib/fog/azurerm/requests/dns/list_record_sets.rb +49 -23
- data/lib/fog/azurerm/requests/dns/list_zones.rb +57 -23
- data/lib/fog/azurerm/requests/network/check_for_public_ip.rb +3 -1
- data/lib/fog/azurerm/requests/network/check_for_virtual_network.rb +4 -2
- data/lib/fog/azurerm/requests/network/create_load_balancer.rb +208 -0
- data/lib/fog/azurerm/requests/network/create_network_interface.rb +42 -4
- data/lib/fog/azurerm/requests/network/create_network_security_group.rb +200 -0
- data/lib/fog/azurerm/requests/network/create_public_ip.rb +19 -5
- data/lib/fog/azurerm/requests/network/create_subnet.rb +19 -6
- data/lib/fog/azurerm/requests/network/create_traffic_manager_endpoint.rb +78 -0
- data/lib/fog/azurerm/requests/network/create_traffic_manager_profile.rb +127 -0
- data/lib/fog/azurerm/requests/network/create_virtual_network.rb +40 -5
- data/lib/fog/azurerm/requests/network/delete_load_balancer.rb +27 -0
- data/lib/fog/azurerm/requests/network/delete_network_interface.rb +5 -3
- data/lib/fog/azurerm/requests/network/delete_network_security_group.rb +29 -0
- data/lib/fog/azurerm/requests/network/delete_public_ip.rb +4 -2
- data/lib/fog/azurerm/requests/network/delete_subnet.rb +10 -8
- data/lib/fog/azurerm/requests/network/delete_traffic_manager_endpoint.rb +37 -0
- data/lib/fog/azurerm/requests/network/delete_traffic_manager_profile.rb +37 -0
- data/lib/fog/azurerm/requests/network/delete_virtual_network.rb +8 -6
- data/lib/fog/azurerm/requests/network/get_traffic_manager_profile.rb +96 -0
- data/lib/fog/azurerm/requests/network/list_load_balancers.rb +31 -0
- data/lib/fog/azurerm/requests/network/list_network_interfaces.rb +41 -9
- data/lib/fog/azurerm/requests/network/list_network_security_groups.rb +171 -0
- data/lib/fog/azurerm/requests/network/list_public_ips.rb +21 -9
- data/lib/fog/azurerm/requests/network/list_subnets.rb +34 -11
- data/lib/fog/azurerm/requests/network/list_traffic_manager_profiles.rb +98 -0
- data/lib/fog/azurerm/requests/network/list_virtual_networks.rb +53 -8
- data/lib/fog/azurerm/requests/resources/create_resource_group.rb +11 -2
- data/lib/fog/azurerm/requests/resources/delete_resource_group.rb +4 -2
- data/lib/fog/azurerm/requests/resources/list_resource_groups.rb +23 -7
- data/lib/fog/azurerm/requests/storage/check_storage_account_name_availability.rb +2 -0
- data/lib/fog/azurerm/requests/storage/create_storage_account.rb +14 -8
- data/lib/fog/azurerm/requests/storage/delete_storage_account.rb +4 -3
- data/lib/fog/azurerm/requests/storage/list_storage_account_for_rg.rb +33 -2
- data/lib/fog/azurerm/requests/storage/list_storage_accounts.rb +32 -5
- data/lib/fog/azurerm/storage.rb +0 -1
- data/lib/fog/azurerm/version.rb +1 -1
- metadata +35 -10
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'fog/core/collection'
|
2
|
+
require 'fog/azurerm/models/network/network_security_group'
|
3
|
+
|
4
|
+
module Fog
|
5
|
+
module Network
|
6
|
+
class AzureRM
|
7
|
+
# collection class for Network Security Group
|
8
|
+
class NetworkSecurityGroups < Fog::Collection
|
9
|
+
model Fog::Network::AzureRM::NetworkSecurityGroup
|
10
|
+
attribute :resource_group
|
11
|
+
|
12
|
+
def all
|
13
|
+
requires :resource_group
|
14
|
+
network_security_groups = []
|
15
|
+
service.list_network_security_groups(resource_group).each do |nsg|
|
16
|
+
network_security_groups << Fog::Network::AzureRM::NetworkSecurityGroup.parse(nsg)
|
17
|
+
end
|
18
|
+
load(network_security_groups)
|
19
|
+
end
|
20
|
+
|
21
|
+
def get(identity)
|
22
|
+
all.find { |f| f.name == identity }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Fog
|
2
|
+
module Network
|
3
|
+
class AzureRM
|
4
|
+
# Subnet model for Network Service
|
5
|
+
class NetworkSecurityRule < Fog::Model
|
6
|
+
identity :name
|
7
|
+
attribute :id
|
8
|
+
attribute :resource_group
|
9
|
+
attribute :network_security_group_name
|
10
|
+
attribute :description
|
11
|
+
attribute :protocol
|
12
|
+
attribute :source_port_range
|
13
|
+
attribute :destination_port_range
|
14
|
+
attribute :source_address_prefix
|
15
|
+
attribute :destination_address_prefix
|
16
|
+
attribute :access
|
17
|
+
attribute :priority
|
18
|
+
attribute :direction
|
19
|
+
|
20
|
+
def self.parse(nsr)
|
21
|
+
hash = {}
|
22
|
+
hash['id'] = nsr['id']
|
23
|
+
hash['name'] = nsr['name']
|
24
|
+
hash['resource_group'] = nsr['id'].split('/')[4]
|
25
|
+
hash['network_security_group_name'] = nsr['id'].split('/')[8]
|
26
|
+
hash['description'] = nsr['properties']['description']
|
27
|
+
hash['protocol'] = nsr['properties']['protocol']
|
28
|
+
hash['source_port_range'] = nsr['properties']['sourcePortRange']
|
29
|
+
hash['destination_port_range'] = nsr['properties']['destinationPortRange']
|
30
|
+
hash['source_address_prefix'] = nsr['properties']['sourceAddressPrefix']
|
31
|
+
hash['destination_address_prefix'] = nsr['properties']['destinationAddressPrefix']
|
32
|
+
hash['access'] = nsr['properties']['access']
|
33
|
+
hash['priority'] = nsr['properties']['priority']
|
34
|
+
hash['direction'] = nsr['properties']['direction']
|
35
|
+
hash
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Fog
|
2
|
+
module Network
|
3
|
+
class AzureRM
|
4
|
+
# Probe model for Network Service
|
5
|
+
class Probe < Fog::Model
|
6
|
+
identity :name
|
7
|
+
attribute :id
|
8
|
+
attribute :protocol
|
9
|
+
attribute :port
|
10
|
+
attribute :request_path
|
11
|
+
attribute :interval_in_seconds
|
12
|
+
attribute :number_of_probes
|
13
|
+
|
14
|
+
def self.parse(probe)
|
15
|
+
probe_prop = probe['properties']
|
16
|
+
hash = {}
|
17
|
+
hash['id'] = probe['id']
|
18
|
+
hash['name'] = probe['name']
|
19
|
+
hash['protocol'] = probe_prop['protocol']
|
20
|
+
hash['port'] = probe_prop['port']
|
21
|
+
hash['request_path'] = probe_prop['requestPath']
|
22
|
+
hash['interval_in_seconds'] = probe_prop['intervalInSeconds']
|
23
|
+
hash['number_of_probes'] = probe_prop['numberOfProbes']
|
24
|
+
hash
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -4,17 +4,45 @@ module Fog
|
|
4
4
|
# PublicIP model class for Network Service
|
5
5
|
class PublicIp < Fog::Model
|
6
6
|
identity :name
|
7
|
-
attribute :
|
7
|
+
attribute :id
|
8
8
|
attribute :location
|
9
9
|
attribute :resource_group
|
10
|
+
attribute :ip_address
|
11
|
+
attribute :public_ip_allocation_method
|
12
|
+
attribute :idle_timeout_in_minutes
|
13
|
+
attribute :ip_configuration_id
|
14
|
+
attribute :domain_name_label
|
15
|
+
attribute :fqdn
|
16
|
+
attribute :reverse_fqdn
|
17
|
+
|
18
|
+
def self.parse(pip)
|
19
|
+
pip_properties = pip['properties']
|
20
|
+
hash = {}
|
21
|
+
hash['id'] = pip['id']
|
22
|
+
hash['name'] = pip['name']
|
23
|
+
hash['location'] = pip['location']
|
24
|
+
hash['resource_group'] = pip['id'].split('/')[4]
|
25
|
+
hash['public_ip_allocation_method'] = pip_properties['publicIPAllocationMethod']
|
26
|
+
hash['ip_address'] = pip_properties['ipAddress']
|
27
|
+
hash['idle_timeout_in_minutes'] = pip_properties['idleTimeoutInMinutes']
|
28
|
+
hash['ip_configuration_id'] = pip_properties['ipConfiguration']['id'] unless pip_properties['ipConfiguration'].nil?
|
29
|
+
|
30
|
+
unless pip_properties['dnsSettings'].nil?
|
31
|
+
hash['domain_name_label'] = pip_properties['dnsSettings']['domainNameLabel']
|
32
|
+
hash['fqdn'] = pip_properties['dnsSettings']['fqdn']
|
33
|
+
hash['reverse_fqdn'] = pip_properties['dnsSettings']['reverseFqdn']
|
34
|
+
end
|
35
|
+
|
36
|
+
hash
|
37
|
+
end
|
10
38
|
|
11
39
|
def save
|
12
40
|
requires :name
|
13
|
-
requires :
|
41
|
+
requires :public_ip_allocation_method
|
14
42
|
requires :location
|
15
43
|
requires :resource_group
|
16
|
-
|
17
|
-
|
44
|
+
pip = service.create_public_ip(resource_group, name, location, public_ip_allocation_method)
|
45
|
+
merge_attributes(Fog::Network::AzureRM::PublicIp.parse(pip))
|
18
46
|
end
|
19
47
|
|
20
48
|
def destroy
|
@@ -12,14 +12,8 @@ module Fog
|
|
12
12
|
def all
|
13
13
|
requires :resource_group
|
14
14
|
public_ips = []
|
15
|
-
|
16
|
-
|
17
|
-
hash = {}
|
18
|
-
pip.instance_variables.each do |var|
|
19
|
-
hash[var.to_s.delete('@')] = pip.instance_variable_get(var)
|
20
|
-
end
|
21
|
-
hash['resource_group'] = resource_group
|
22
|
-
public_ips << hash
|
15
|
+
service.list_public_ips(resource_group).each do |pip|
|
16
|
+
public_ips << Fog::Network::AzureRM::PublicIp.parse(pip)
|
23
17
|
end
|
24
18
|
load(public_ips)
|
25
19
|
end
|
@@ -7,26 +7,34 @@ module Fog
|
|
7
7
|
attribute :id
|
8
8
|
attribute :resource_group
|
9
9
|
attribute :virtual_network_name
|
10
|
-
attribute :
|
11
|
-
attribute :
|
12
|
-
attribute :
|
13
|
-
attribute :
|
14
|
-
|
10
|
+
attribute :address_prefix
|
11
|
+
attribute :network_security_group_id
|
12
|
+
attribute :route_table_id
|
13
|
+
attribute :ip_configurations_ids
|
14
|
+
|
15
|
+
def self.parse(subnet)
|
16
|
+
hash = {}
|
17
|
+
hash['id'] = subnet['id']
|
18
|
+
hash['name'] = subnet['name']
|
19
|
+
hash['resource_group'] = subnet['id'].split('/')[4]
|
20
|
+
hash['virtual_network_name'] = subnet['id'].split('/')[8]
|
21
|
+
hash['address_prefix'] = subnet['properties']['addressPrefix']
|
22
|
+
hash['network_security_group_id'] = subnet['properties']['networkSecurityGroup']['id'] unless subnet['properties']['networkSecurityGroup'].nil?
|
23
|
+
hash['route_table_id'] = subnet['properties']['routeTable']['id'] unless subnet['properties']['routeTable'].nil?
|
24
|
+
hash['ip_configurations_ids'] = subnet['properties']['ipConfigurations'].map{ |item| item['id'] } unless subnet['properties']['ipConfigurations'].nil?
|
25
|
+
hash
|
26
|
+
end
|
15
27
|
|
16
28
|
def save
|
17
29
|
requires :name
|
18
30
|
requires :resource_group
|
19
31
|
requires :virtual_network_name
|
20
|
-
|
21
|
-
|
22
|
-
subnet = service.create_subnet(resource_group, virtual_network_name, name, addressPrefix)
|
23
|
-
Fog::Logger.debug "Subnet #{name} created successfully."
|
24
|
-
#puts "Subnet #{name} created successfully."
|
25
|
-
subnet
|
32
|
+
subnet = service.create_subnet(resource_group, name, virtual_network_name, address_prefix)
|
33
|
+
merge_attributes(Fog::Network::AzureRM::Subnet.parse(subnet))
|
26
34
|
end
|
27
35
|
|
28
36
|
def destroy
|
29
|
-
service.delete_subnet(resource_group,
|
37
|
+
service.delete_subnet(resource_group, name, virtual_network_name)
|
30
38
|
end
|
31
39
|
end
|
32
40
|
end
|
@@ -15,13 +15,7 @@ module Fog
|
|
15
15
|
requires :virtual_network_name
|
16
16
|
subnets = []
|
17
17
|
service.list_subnets(resource_group, virtual_network_name).each do |subnet|
|
18
|
-
|
19
|
-
subnet.instance_variables.each do |var|
|
20
|
-
hash[var.to_s.delete('@')] = subnet.instance_variable_get(var)
|
21
|
-
end
|
22
|
-
hash['resource_group'] = subnet.instance_variable_get('@id').split('/')[4]
|
23
|
-
hash['virtual_network_name'] = subnet.instance_variable_get('@id').split('/')[8]
|
24
|
-
subnets << hash
|
18
|
+
subnets << Fog::Network::AzureRM::Subnet.parse(subnet)
|
25
19
|
end
|
26
20
|
load(subnets)
|
27
21
|
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Fog
|
2
|
+
module Network
|
3
|
+
class AzureRM
|
4
|
+
# Traffic Manager End Point model for Network Service
|
5
|
+
class TrafficManagerEndPoint < Fog::Model
|
6
|
+
identity :name
|
7
|
+
attribute :traffic_manager_profile_name
|
8
|
+
attribute :id
|
9
|
+
attribute :resource_group
|
10
|
+
attribute :type
|
11
|
+
attribute :target_resource_id
|
12
|
+
attribute :target
|
13
|
+
attribute :endpoint_status
|
14
|
+
attribute :endpoint_monitor_status
|
15
|
+
attribute :weight
|
16
|
+
attribute :priority
|
17
|
+
attribute :endpoint_location
|
18
|
+
attribute :min_child_endpoints
|
19
|
+
|
20
|
+
def self.parse(endpoint)
|
21
|
+
hash = {}
|
22
|
+
hash['id'] = endpoint['id']
|
23
|
+
hash['name'] = endpoint['name']
|
24
|
+
hash['resource_group'] = endpoint['id'].split('/')[4]
|
25
|
+
type = endpoint['type'].split('/')[2]
|
26
|
+
type.slice!('Endpoints')
|
27
|
+
hash['type'] = type
|
28
|
+
hash['target_resource_id'] = endpoint['properties']['targetResourceId']
|
29
|
+
hash['target'] = endpoint['properties']['target']
|
30
|
+
hash['endpoint_status'] = endpoint['properties']['endpointStatus']
|
31
|
+
hash['endpoint_monitor_status'] = endpoint['properties']['endpointMonitorStatus']
|
32
|
+
hash['weight'] = endpoint['properties']['weight']
|
33
|
+
hash['priority'] = endpoint['properties']['priority']
|
34
|
+
hash['endpoint_location'] = endpoint['properties']['endpointLocation']
|
35
|
+
hash['min_child_endpoints'] = endpoint['properties']['minChildEndpoints']
|
36
|
+
hash
|
37
|
+
end
|
38
|
+
|
39
|
+
def save
|
40
|
+
requires :name, :traffic_manager_profile_name, :resource_group, :type
|
41
|
+
requires :target_resource_id if type.eql?('azure')
|
42
|
+
requires :target, :endpoint_location if type.eql?('external')
|
43
|
+
requires :target_resource_id, :endpoint_location, :min_child_endpoints if type.eql?('nested')
|
44
|
+
|
45
|
+
if %w(azure external nested).select { |type| type if type.eql?(type) }.any?
|
46
|
+
traffic_manager_endpoint = service.create_traffic_manager_endpoint(resource_group, name,
|
47
|
+
traffic_manager_profile_name, type,
|
48
|
+
target_resource_id, target, weight,
|
49
|
+
priority, endpoint_location,
|
50
|
+
min_child_endpoints)
|
51
|
+
merge_attributes(Fog::Network::AzureRM::TrafficManagerEndPoint.parse(traffic_manager_endpoint))
|
52
|
+
else
|
53
|
+
raise(ArgumentError, ':type should be "azure", "external" or "nested"')
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def destroy
|
58
|
+
service.delete_traffic_manager_endpoint(resource_group, name, traffic_manager_profile_name, type)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Fog
|
2
|
+
module Network
|
3
|
+
class AzureRM
|
4
|
+
# Traffic Manager End Point Collection for Network Service
|
5
|
+
class TrafficManagerEndPoints < Fog::Collection
|
6
|
+
attribute :resource_group
|
7
|
+
attribute :traffic_manager_profile_name
|
8
|
+
model Fog::Network::AzureRM::TrafficManagerEndPoint
|
9
|
+
|
10
|
+
def all
|
11
|
+
requires :resource_group
|
12
|
+
requires :traffic_manager_profile_name
|
13
|
+
|
14
|
+
traffic_manager_endpoints = []
|
15
|
+
profile = service.get_traffic_manager_profile(resource_group, traffic_manager_profile_name)
|
16
|
+
end_points = profile['properties']['endpoints']
|
17
|
+
end_points.each do |endpoint|
|
18
|
+
traffic_manager_endpoints << Fog::Network::AzureRM::TrafficManagerEndPoint.parse(endpoint)
|
19
|
+
end
|
20
|
+
load(traffic_manager_endpoints)
|
21
|
+
end
|
22
|
+
|
23
|
+
def get(identity)
|
24
|
+
all.find { |endpoint| endpoint.name == identity }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Fog
|
2
|
+
module Network
|
3
|
+
class AzureRM
|
4
|
+
# Traffic Manager Profile model for Network Service
|
5
|
+
class TrafficManagerProfile < Fog::Model
|
6
|
+
identity :name
|
7
|
+
attribute :id
|
8
|
+
attribute :resource_group
|
9
|
+
attribute :location
|
10
|
+
attribute :profile_status
|
11
|
+
attribute :traffic_routing_method
|
12
|
+
attribute :relative_name
|
13
|
+
attribute :fqdn
|
14
|
+
attribute :ttl
|
15
|
+
attribute :profile_monitor_status
|
16
|
+
attribute :protocol
|
17
|
+
attribute :port
|
18
|
+
attribute :path
|
19
|
+
attribute :endpoints
|
20
|
+
|
21
|
+
def self.parse(profile)
|
22
|
+
hash = {}
|
23
|
+
hash['id'] = profile['id']
|
24
|
+
hash['name'] = profile['name']
|
25
|
+
hash['resource_group'] = profile['id'].split('/')[4]
|
26
|
+
hash['location'] = profile['location']
|
27
|
+
hash['profile_status'] = profile['properties']['profileStatus']
|
28
|
+
hash['traffic_routing_method'] = profile['properties']['trafficRoutingMethod']
|
29
|
+
hash['relative_name'] = profile['properties']['dnsConfig']['relativeName']
|
30
|
+
hash['fqdn'] = profile['properties']['dnsConfig']['fqdn']
|
31
|
+
hash['ttl'] = profile['properties']['dnsConfig']['ttl']
|
32
|
+
hash['profile_monitor_status'] = profile['properties']['monitorConfig']['profileMonitorStatus']
|
33
|
+
hash['protocol'] = profile['properties']['monitorConfig']['protocol']
|
34
|
+
hash['port'] = profile['properties']['monitorConfig']['port']
|
35
|
+
hash['path'] = profile['properties']['monitorConfig']['path']
|
36
|
+
hash['endpoints'] = []
|
37
|
+
profile['properties']['endpoints'].each do |endpoint|
|
38
|
+
end_point = Fog::Network::AzureRM::TrafficManagerEndPoint.new
|
39
|
+
hash['endpoints'] << end_point.merge_attributes(Fog::Network::AzureRM::TrafficManagerEndPoint.parse(endpoint))
|
40
|
+
end
|
41
|
+
hash
|
42
|
+
end
|
43
|
+
|
44
|
+
def save
|
45
|
+
requires :name, :resource_group, :traffic_routing_method, :relative_name, :ttl,
|
46
|
+
:protocol, :port, :path
|
47
|
+
traffic_manager_profile = service.create_traffic_manager_profile(resource_group, name,
|
48
|
+
traffic_routing_method, relative_name, ttl,
|
49
|
+
protocol, port, path)
|
50
|
+
merge_attributes(Fog::Network::AzureRM::TrafficManagerProfile.parse(traffic_manager_profile))
|
51
|
+
end
|
52
|
+
|
53
|
+
def destroy
|
54
|
+
service.delete_traffic_manager_profile(resource_group, name)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Fog
|
2
|
+
module Network
|
3
|
+
class AzureRM
|
4
|
+
# Traffic Manager Profile Collection for Network Service
|
5
|
+
class TrafficManagerProfiles < Fog::Collection
|
6
|
+
attribute :resource_group
|
7
|
+
model Fog::Network::AzureRM::TrafficManagerProfile
|
8
|
+
|
9
|
+
def all
|
10
|
+
requires :resource_group
|
11
|
+
traffic_manager_profiles = []
|
12
|
+
service.list_traffic_manager_profiles(resource_group).each do |profile|
|
13
|
+
traffic_manager_profiles << Fog::Network::AzureRM::TrafficManagerProfile.parse(profile)
|
14
|
+
end
|
15
|
+
load(traffic_manager_profiles)
|
16
|
+
end
|
17
|
+
|
18
|
+
def get(identity)
|
19
|
+
all.find { |profile| profile.name == identity }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -5,20 +5,33 @@ module Fog
|
|
5
5
|
identity :name
|
6
6
|
attribute :id
|
7
7
|
attribute :location
|
8
|
+
attribute :resource_group
|
8
9
|
attribute :dns_list
|
9
10
|
attribute :subnet_address_list
|
10
11
|
attribute :network_address_list
|
11
|
-
|
12
|
-
|
12
|
+
|
13
|
+
def self.parse(vnet)
|
14
|
+
hash = {}
|
15
|
+
hash['id'] = vnet['id']
|
16
|
+
hash['name'] = vnet['name']
|
17
|
+
hash['resource_group'] = vnet['id'].split('/')[4]
|
18
|
+
hash['location'] = vnet['location']
|
19
|
+
hash['dns_list'] = vnet['properties']['dhcpOptions']['dnsServers'].join(',') unless vnet['properties']['dhcpOptions'].nil?
|
20
|
+
hash['network_address_list'] = vnet['properties']['addressSpace']['addressPrefixes'].join(',') unless vnet['properties']['addressSpace']['addressPrefixes'].nil?
|
21
|
+
subnet_address_list = []
|
22
|
+
vnet['properties']['subnets'].each do |subnet|
|
23
|
+
subnet_address_list << subnet['properties']['addressPrefix']
|
24
|
+
end
|
25
|
+
hash['subnet_address_list'] = subnet_address_list.join(',')
|
26
|
+
hash
|
27
|
+
end
|
13
28
|
|
14
29
|
def save
|
15
30
|
requires :name
|
16
31
|
requires :location
|
17
32
|
requires :resource_group
|
18
|
-
|
19
|
-
|
20
|
-
Fog::Logger.debug "Virtual Network #{name} created successfully."
|
21
|
-
virtual_network
|
33
|
+
vnet = service.create_virtual_network(resource_group, name, location, dns_list, subnet_address_list, network_address_list)
|
34
|
+
merge_attributes(Fog::Network::AzureRM::VirtualNetwork.parse(vnet))
|
22
35
|
end
|
23
36
|
|
24
37
|
def destroy
|