Class: Fog::Network::AzureRM::ExpressRouteCircuitPeering

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

Overview

Express Route Circuit model class for Network Service

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(circuit_peering) ⇒ Object



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
56
57
# File 'lib/fog/azurerm/models/network/express_route_circuit_peering.rb', line 27

def self.parse(circuit_peering)
  express_route_circuit_peering = {}
  express_route_circuit_peering['id'] = circuit_peering.id
  express_route_circuit_peering['name'] = circuit_peering.name
  express_route_circuit_peering['resource_group'] = get_resource_group_from_id(circuit_peering.id)
  express_route_circuit_peering['circuit_name'] = get_circuit_name_from_id(circuit_peering.id)
  express_route_circuit_peering['provisioning_state'] = circuit_peering.provisioning_state
  express_route_circuit_peering['peering_type'] = circuit_peering.peering_type
  express_route_circuit_peering['peer_asn'] = circuit_peering.peer_asn
  express_route_circuit_peering['azure_asn'] = circuit_peering.azure_asn
  express_route_circuit_peering['primary_azure_port'] = circuit_peering.primary_azure_port
  express_route_circuit_peering['secondary_azure_port'] = circuit_peering.secondary_azure_port
  express_route_circuit_peering['state'] = circuit_peering.state
  express_route_circuit_peering['primary_peer_address_prefix'] = circuit_peering.primary_peer_address_prefix
  express_route_circuit_peering['secondary_peer_address_prefix'] = circuit_peering.secondary_peer_address_prefix
  express_route_circuit_peering['vlan_id'] = circuit_peering.vlan_id

  microsoft_peering_config = circuit_peering.microsoft_peering_config
  unless microsoft_peering_config.nil?
    public_prefixes = microsoft_peering_config.advertised_public_prefixes
    express_route_circuit_peering['advertised_public_prefixes'] = []
    public_prefixes.each do |public_prefix|
      express_route_circuit_peering['advertised_public_prefixes'] << public_prefix
    end unless public_prefixes.nil?

    express_route_circuit_peering['advertised_public_prefix_state'] = microsoft_peering_config.advertised_public_prefixes_state
    express_route_circuit_peering['customer_asn'] = microsoft_peering_config.customer_asn
    express_route_circuit_peering['routing_registry_name'] = microsoft_peering_config.routing_registry_name
  end
  express_route_circuit_peering
end

Instance Method Details

#destroyObject



66
67
68
# File 'lib/fog/azurerm/models/network/express_route_circuit_peering.rb', line 66

def destroy
  service.delete_express_route_circuit_peering(resource_group, name, circuit_name)
end

#saveObject



59
60
61
62
63
64
# File 'lib/fog/azurerm/models/network/express_route_circuit_peering.rb', line 59

def save
  requires :name, :resource_group, :circuit_name, :peering_type, :peer_asn, :primary_peer_address_prefix, :secondary_peer_address_prefix, :vlan_id
  requires :advertised_public_prefixes if peering_type.casecmp(MICROSOFT_PEERING) == 0
  circuit_peering = service.create_or_update_express_route_circuit_peering(express_route_circuit_peering_params)
  merge_attributes(Fog::Network::AzureRM::ExpressRouteCircuitPeering.parse(circuit_peering))
end