Class: Fog::Network::AzureRM::TrafficManagerProfile

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/azurerm/models/network/traffic_manager_profile.rb

Overview

Traffic Manager Profile model for Network Service

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(profile) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/fog/azurerm/models/network/traffic_manager_profile.rb', line 21

def self.parse(profile)
  hash = {}
  hash['id'] = profile['id']
  hash['name'] = profile['name']
  hash['resource_group'] = profile['id'].split('/')[4]
  hash['location'] = profile['location']
  hash['profile_status'] = profile['properties']['profileStatus']
  hash['traffic_routing_method'] = profile['properties']['trafficRoutingMethod']
  hash['relative_name'] = profile['properties']['dnsConfig']['relativeName']
  hash['fqdn'] = profile['properties']['dnsConfig']['fqdn']
  hash['ttl'] = profile['properties']['dnsConfig']['ttl']
  hash['profile_monitor_status'] = profile['properties']['monitorConfig']['profileMonitorStatus']
  hash['protocol'] = profile['properties']['monitorConfig']['protocol']
  hash['port'] = profile['properties']['monitorConfig']['port']
  hash['path'] = profile['properties']['monitorConfig']['path']
  hash['endpoints'] = []
  profile['properties']['endpoints'].each do |endpoint|
    end_point = Fog::Network::AzureRM::TrafficManagerEndPoint.new
    hash['endpoints'] << end_point.merge_attributes(Fog::Network::AzureRM::TrafficManagerEndPoint.parse(endpoint))
  end
  hash
end

Instance Method Details

#destroyObject



53
54
55
# File 'lib/fog/azurerm/models/network/traffic_manager_profile.rb', line 53

def destroy
  service.delete_traffic_manager_profile(resource_group, name)
end

#saveObject



44
45
46
47
48
49
50
51
# File 'lib/fog/azurerm/models/network/traffic_manager_profile.rb', line 44

def save
  requires :name, :resource_group, :traffic_routing_method, :relative_name, :ttl,
           :protocol, :port, :path
  traffic_manager_profile = service.create_traffic_manager_profile(resource_group, name,
                                                                   traffic_routing_method, relative_name, ttl,
                                                                   protocol, port, path)
  merge_attributes(Fog::Network::AzureRM::TrafficManagerProfile.parse(traffic_manager_profile))
end