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)
  hash = {}
  hash['id'] = circuit_peering.id
  hash['name'] = circuit_peering.name
  hash['resource_group'] = get_resource_group_from_id(circuit_peering.id)
  hash['circuit_name'] = circuit_peering.id.split('/')[8]
  hash['provisioning_state'] = circuit_peering.provisioning_state
  hash['peering_type'] = circuit_peering.peering_type
  hash['peer_asn'] = circuit_peering.peer_asn
  hash['azure_asn'] = circuit_peering.azure_asn
  hash['primary_azure_port'] = circuit_peering.primary_azure_port
  hash['secondary_azure_port'] = circuit_peering.secondary_azure_port
  hash['state'] = circuit_peering.state
  hash['primary_peer_address_prefix'] = circuit_peering.primary_peer_address_prefix
  hash['secondary_peer_address_prefix'] = circuit_peering.secondary_peer_address_prefix
  hash['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
    hash['advertised_public_prefixes'] = []
    public_prefixes.each do |public_prefix|
      hash['advertised_public_prefixes'] << public_prefix
    end unless public_prefixes.nil?

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

Instance Method Details

#destroyObject



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

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

#saveObject



59
60
61
62
63
64
65
# 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_parameters = express_route_circuit_peering_params
  circuit_peering = service.create_or_update_express_route_circuit_peering(circuit_peering_parameters)
  merge_attributes(Fog::Network::AzureRM::ExpressRouteCircuitPeering.parse(circuit_peering))
end