Class: Fog::TrafficManager::AzureRM::TrafficManagerEndPoint

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

Overview

Traffic Manager End Point model for Traffic Manager Service

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(endpoint) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/fog/azurerm/models/traffic_manager/traffic_manager_end_point.rb', line 20

def self.parse(endpoint)
  hash = {}
  hash['id'] = endpoint.id
  hash['name'] = endpoint.name
  hash['resource_group'] = get_resource_group_from_id(endpoint.id)
  hash['type'] = get_end_point_type(endpoint.type)
  hash['target_resource_id'] = endpoint.target_resource_id
  hash['target'] = endpoint.target
  hash['endpoint_status'] = endpoint.endpoint_status
  hash['endpoint_monitor_status'] = endpoint.endpoint_monitor_status
  hash['weight'] = endpoint.weight
  hash['priority'] = endpoint.priority
  hash['endpoint_location'] = endpoint.endpoint_location
  hash['min_child_endpoints'] = endpoint.min_child_endpoints
  hash['traffic_manager_profile_name'] = get_traffic_manager_profile_name_from_endpoint_id(endpoint.id)
  hash
end

Instance Method Details

#destroyObject



47
48
49
# File 'lib/fog/azurerm/models/traffic_manager/traffic_manager_end_point.rb', line 47

def destroy
  service.delete_traffic_manager_endpoint(resource_group, name, traffic_manager_profile_name, type)
end

#saveObject



38
39
40
41
42
43
44
45
# File 'lib/fog/azurerm/models/traffic_manager/traffic_manager_end_point.rb', line 38

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) ⇒ Object



51
52
53
54
55
56
# File 'lib/fog/azurerm/models/traffic_manager/traffic_manager_end_point.rb', line 51

def update(endpoint_params)
  validate_input(endpoint_params)
  merge_attributes(endpoint_params)

  create_or_update
end