Sha256: d25d5f95da597bc6fdd0e780328c2b4517f80dfd409c77bcce61345e04b2e98e
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
require 'fog/core/collection' require 'fog/azurerm/models/network/subnet' module Fog module Network class AzureRM # Subnet collection for network service class Subnets < Fog::Collection model Fog::Network::AzureRM::Subnet attribute :resource_group attribute :virtual_network_name 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 def get(identity) all.find { |f| f.name == identity } rescue Fog::Errors::NotFound nil end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fog-azure-rm-0.0.0 | lib/fog/azurerm/models/network/subnets.rb |