Class: Fog::Network::AzureRM::ExpressRouteCircuit

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

Overview

Express Route Circuit model class for Network Service

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(circuit) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/fog/azurerm/models/network/express_route_circuit.rb', line 24

def self.parse(circuit)
  hash = {}
  hash['id'] = circuit.id
  hash['name'] = circuit.name
  hash['location'] = circuit.location
  hash['service_key'] = circuit.service_key
  hash['service_provider_notes'] = circuit.service_provider_notes
  hash['resource_group'] = get_resource_group_from_id(circuit.id)
  hash['resource_group'] = circuit.id.split('/')[4]
  hash['tags'] = circuit.tags
  sku = circuit.sku
  unless sku.nil?
    hash['sku_name'] = sku.name
    hash['sku_tier'] = sku.tier
    hash['sku_family'] = sku.family
  end
  hash['provisioning_state'] = circuit.provisioning_state
  hash['circuit_provisioning_state'] = circuit.circuit_provisioning_state
  hash['service_provider_provisioning_state'] = circuit.service_provider_provisioning_state
  service_provider_properties = circuit.service_provider_properties
  unless service_provider_properties.nil?
    hash['service_provider_name'] = service_provider_properties.service_provider_name
    hash['peering_location'] = service_provider_properties.peering_location
    hash['bandwidth_in_mbps'] = service_provider_properties.bandwidth_in_mbps
  end
  hash['peerings'] = []
  circuit.peerings.each do |peering|
    circuit_peering = Fog::Network::AzureRM::ExpressRouteCircuitPeering.new
    hash['peerings'] << circuit_peering.merge_attributes(Fog::Network::AzureRM::ExpressRouteCircuitPeering.parse(peering))
  end unless circuit.peerings.nil?
  hash
end

Instance Method Details

#destroyObject



64
65
66
# File 'lib/fog/azurerm/models/network/express_route_circuit.rb', line 64

def destroy
  service.delete_express_route_circuit(resource_group, name)
end

#saveObject



57
58
59
60
61
62
# File 'lib/fog/azurerm/models/network/express_route_circuit.rb', line 57

def save
  requires :location, :tags, :resource_group, :service_provider_name, :peering_location, :bandwidth_in_mbps
  express_route_parameters = express_route_circuit_params
  circuit = service.create_or_update_express_route_circuit(express_route_parameters)
  merge_attributes(Fog::Network::AzureRM::ExpressRouteCircuit.parse(circuit))
end