class Fog::Network::AzureRM::ExpressRouteCircuit

Express Route Circuit model class for Network Service

Public Class Methods

parse(circuit) click to toggle source
# 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

Public Instance Methods

destroy() click to toggle source
# File lib/fog/azurerm/models/network/express_route_circuit.rb, line 62
def destroy
  service.delete_express_route_circuit(resource_group, name)
end
save() click to toggle source
# 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

Private Instance Methods

express_route_circuit_params() click to toggle source
# File lib/fog/azurerm/models/network/express_route_circuit.rb, line 68
def express_route_circuit_params
  {
    resource_group_name: resource_group,
    circuit_name: name,
    location: location,
    tags: tags,
    sku_name: sku_name,
    sku_tier: sku_tier,
    sku_family: sku_family,
    service_provider_name: service_provider_name,
    peering_location: peering_location,
    bandwidth_in_mbps: bandwidth_in_mbps,
    peerings: peerings
  }
end