Sha256: f259586ab76151c044868334b921b3e9261e84ee130250345144b31ba2089322

Contents?: true

Size: 1006 Bytes

Versions: 1

Compression:

Stored size: 1006 Bytes

Contents

require 'fog/core/collection'
require 'fog/azurerm/models/network/network_interface'

module Fog
  module Network
    class AzureRM
      # NetworkInterfaces collection class for Network Service
      class NetworkInterfaces < Fog::Collection
        model Fog::Network::AzureRM::NetworkInterface
        attribute :resource_group

        def all
          requires :resource_group
          network_interfaces = []
          network_interface_list = service.list_network_interfaces(resource_group)
          network_interface_list.each do |nic|
            hash = {}
            nic.instance_variables.each do |var|
              hash[var.to_s.delete('@')] = nic.instance_variable_get(var)
            end
            hash['resource_group'] = resource_group
            network_interfaces << hash
          end
          load(network_interfaces)
        end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.1 lib/fog/azurerm/models/network/network_interfaces.rb