Class: Fog::Network::AzureRM::LocalNetworkGateway

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

Overview

LocalNetworkGateway model class for Network Service

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(local_network_gateway) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fog/azurerm/models/network/local_network_gateway.rb', line 20

def self.parse(local_network_gateway)
  local_network_gateway_hash = get_hash_from_object(local_network_gateway)
  bgp_settings = local_network_gateway.bgp_settings
  unless bgp_settings.nil?
    local_network_gateway_hash['asn'] = bgp_settings.asn
    local_network_gateway_hash['bgp_peering_address'] = bgp_settings.bgp_peering_address
    local_network_gateway_hash['peer_weight'] = bgp_settings.peer_weight
  end
  local_network_address_space = local_network_gateway.local_network_address_space
  local_network_gateway_hash['local_network_address_space_prefixes'] = local_network_address_space.address_prefixes unless local_network_address_space.nil?
  local_network_gateway_hash['resource_group'] = get_resource_group_from_id(local_network_gateway.id)
  local_network_gateway_hash
end

Instance Method Details

#destroyObject



40
41
42
# File 'lib/fog/azurerm/models/network/local_network_gateway.rb', line 40

def destroy
  service.delete_local_network_gateway(resource_group, name)
end

#saveObject



34
35
36
37
38
# File 'lib/fog/azurerm/models/network/local_network_gateway.rb', line 34

def save
  requires :name, :location, :resource_group, :local_network_address_space_prefixes, :gateway_ip_address, :asn, :bgp_peering_address, :peer_weight
  local_network_gateway = service.create_or_update_local_network_gateway(local_network_gateway_parameters)
  merge_attributes(Fog::Network::AzureRM::LocalNetworkGateway.parse(local_network_gateway))
end