Class: Fog::Network::AzureRM::VirtualNetworks

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

Overview

This class is giving implementation of all/list, get and check name availability for virtual network.

Instance Method Summary collapse

Instance Method Details

#allObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fog/azurerm/models/network/virtual_networks.rb', line 10

def all
  virtual_networks = []
  if !resource_group.nil?
    requires :resource_group
    vnets = service.list_virtual_networks(resource_group)
  else
    vnets = service.list_virtual_networks_in_subscription
  end
  vnets.each do |vnet|
    virtual_networks << Fog::Network::AzureRM::VirtualNetwork.parse(vnet)
  end
  load(virtual_networks)
end

#check_virtual_network_exists(resource_group, name) ⇒ Object



30
31
32
# File 'lib/fog/azurerm/models/network/virtual_networks.rb', line 30

def check_virtual_network_exists(resource_group, name)
  service.check_virtual_network_exists(resource_group, name)
end

#get(resource_group_name, virtual_network_name) ⇒ Object



24
25
26
27
28
# File 'lib/fog/azurerm/models/network/virtual_networks.rb', line 24

def get(resource_group_name, virtual_network_name)
  virtual_network = service.get_virtual_network(resource_group_name, virtual_network_name)
  virtual_network_fog = Fog::Network::AzureRM::VirtualNetwork.new(service: service)
  virtual_network_fog.merge_attributes(Fog::Network::AzureRM::VirtualNetwork.parse(virtual_network))
end