class Fog::TrafficManager::AzureRM::TrafficManagerEndPoint
Traffic Manager End Point model for Traffic Manager Service
Public Class Methods
parse(endpoint)
click to toggle source
# File lib/fog/azurerm/models/traffic_manager/traffic_manager_end_point.rb, line 20 def self.parse(endpoint) traffic_manager_endpoint = get_hash_from_object(endpoint) traffic_manager_endpoint['type'] = get_end_point_type(endpoint.type) traffic_manager_endpoint['resource_group'] = get_resource_group_from_id(endpoint.id) traffic_manager_endpoint['traffic_manager_profile_name'] = get_traffic_manager_profile_name_from_endpoint_id(endpoint.id) traffic_manager_endpoint end
Public Instance Methods
destroy()
click to toggle source
# File lib/fog/azurerm/models/traffic_manager/traffic_manager_end_point.rb, line 37 def destroy service.delete_traffic_manager_endpoint(resource_group, name, traffic_manager_profile_name, type) end
save()
click to toggle source
# File lib/fog/azurerm/models/traffic_manager/traffic_manager_end_point.rb, line 28 def save requires :name, :traffic_manager_profile_name, :resource_group, :type requires :target_resource_id if type.eql?(AZURE_ENDPOINTS) requires :target, :endpoint_location if type.eql?(EXTERNAL_ENDPOINTS) requires :target_resource_id, :endpoint_location, :min_child_endpoints if type.eql?(NESTED_ENDPOINTS) create_or_update end
update(endpoint_params)
click to toggle source
# File lib/fog/azurerm/models/traffic_manager/traffic_manager_end_point.rb, line 41 def update(endpoint_params) validate_input(endpoint_params) merge_attributes(endpoint_params) create_or_update end
Private Instance Methods
create_or_update()
click to toggle source
# File lib/fog/azurerm/models/traffic_manager/traffic_manager_end_point.rb, line 50 def create_or_update if %w(azureEndpoints externalEndpoints nestedEndpoints).select { |type| type if type.eql?(type) }.any? traffic_manager_endpoint = service.create_or_update_traffic_manager_endpoint(traffic_manager_endpoint_hash) merge_attributes(Fog::TrafficManager::AzureRM::TrafficManagerEndPoint.parse(traffic_manager_endpoint)) else raise(ArgumentError, ":type should be '#{AZURE_ENDPOINTS}', '#{EXTERNAL_ENDPOINTS}' or '#{NESTED_ENDPOINTS}'") end end
traffic_manager_endpoint_hash()
click to toggle source
# File lib/fog/azurerm/models/traffic_manager/traffic_manager_end_point.rb, line 59 def traffic_manager_endpoint_hash { resource_group: resource_group, name: name, traffic_manager_profile_name: traffic_manager_profile_name, type: type, target_resource_id: target_resource_id, target: target, weight: weight, priority: priority, endpoint_location: endpoint_location, min_child_endpoints: min_child_endpoints } end
validate_input(attr_hash)
click to toggle source
# File lib/fog/azurerm/models/traffic_manager/traffic_manager_end_point.rb, line 74 def validate_input(attr_hash) invalid_attr = [:resource_group, :name, :traffic_manager_profile_name, :id] result = invalid_attr & attr_hash.keys raise 'Cannot modify the given attribute' unless result.empty? end