Class: Fog::Network::AzureRM::Subnets

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

Overview

Subnet collection for network service

Instance Method Summary collapse

Instance Method Details

#allObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fog/azurerm/models/network/subnets.rb', line 13

def all
  requires :resource_group
  requires :virtual_network_name
  subnets = []
  service.list_subnets(resource_group, virtual_network_name).each do |subnet|
    hash = {}
    subnet.instance_variables.each do |var|
      hash[var.to_s.delete('@')] = subnet.instance_variable_get(var)
    end
    hash['resource_group'] = subnet.instance_variable_get('@id').split('/')[4]
    hash['virtual_network_name'] = subnet.instance_variable_get('@id').split('/')[8]
    subnets << hash
  end
  load(subnets)
end

#get(identity) ⇒ Object



29
30
31
# File 'lib/fog/azurerm/models/network/subnets.rb', line 29

def get(identity)
  all.find { |f| f.name == identity }
end