class Fog::TrafficManager::AzureRM::TrafficManagerProfile
Traffic Manager Profile model for TrafficManager
Service
Public Class Methods
parse(profile)
click to toggle source
# File lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb, line 21 def self.parse(profile) traffic_manager_profile = get_hash_from_object(profile) if profile.dns_config traffic_manager_profile['relative_name'] = profile.dns_config.relative_name traffic_manager_profile['fqdn'] = profile.dns_config.fqdn traffic_manager_profile['ttl'] = profile.dns_config.ttl end if profile.monitor_config traffic_manager_profile['profile_monitor_status'] = profile.monitor_config.profile_monitor_status traffic_manager_profile['protocol'] = profile.monitor_config.protocol traffic_manager_profile['port'] = profile.monitor_config.port traffic_manager_profile['path'] = profile.monitor_config.path end traffic_manager_profile['resource_group'] = get_resource_group_from_id(profile.id) traffic_manager_profile['endpoints'] = [] profile.endpoints.each do |endpoint| end_point = Fog::TrafficManager::AzureRM::TrafficManagerEndPoint.new traffic_manager_profile['endpoints'] << end_point.merge_attributes(Fog::TrafficManager::AzureRM::TrafficManagerEndPoint.parse(endpoint)) end traffic_manager_profile end
Public Instance Methods
destroy()
click to toggle source
# File lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb, line 52 def destroy service.delete_traffic_manager_profile(resource_group, name) end
save()
click to toggle source
# File lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb, line 45 def save requires :name, :resource_group, :traffic_routing_method, :relative_name, :ttl, :protocol, :port, :path traffic_manager_profile = service.create_or_update_traffic_manager_profile(traffic_manager_profile_hash) merge_attributes(Fog::TrafficManager::AzureRM::TrafficManagerProfile.parse(traffic_manager_profile)) end
update(profile_params)
click to toggle source
# File lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb, line 56 def update(profile_params) validate_input(profile_params) profile_params[:endpoints] = endpoints.map { |endpoint| get_hash_from_object(endpoint)['attributes'] } merge_attributes(profile_params) profile = service.create_or_update_traffic_manager_profile(traffic_manager_profile_hash) merge_attributes(Fog::TrafficManager::AzureRM::TrafficManagerProfile.parse(profile)) end
Private Instance Methods
traffic_manager_profile_hash()
click to toggle source
# File lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb, line 72 def traffic_manager_profile_hash { resource_group: resource_group, name: name, traffic_routing_method: traffic_routing_method, relative_name: relative_name, ttl: ttl, protocol: protocol, port: port, path: path, endpoints: endpoints } end
validate_input(attr_hash)
click to toggle source
# File lib/fog/azurerm/models/traffic_manager/traffic_manager_profile.rb, line 66 def validate_input(attr_hash) invalid_attr = [:resource_group, :name, :relative_name, :id] result = invalid_attr & attr_hash.keys raise 'Cannot modify the given attribute' unless result.empty? end