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
# File 'lib/fog/azurerm/models/network/express_route_circuit.rb', line 24

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

Instance Method Details

#destroyObject



62
63
64
# File 'lib/fog/azurerm/models/network/express_route_circuit.rb', line 62

def destroy
  service.delete_express_route_circuit(resource_group, name)
end

#saveObject



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

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