Sha256: 13676cc19a78ee177c35714ac86f07ea8fe5efa1e7382b41154c8b3d45a291d9

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 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|
            subnets << Fog::Network::AzureRM::Subnet.parse(subnet)
          end
          load(subnets)
        end

        def get(resource_group, virtual_network_name, subnet_name)
          subnet = service.get_subnet(resource_group, virtual_network_name, subnet_name)
          subnet_object = Fog::Network::AzureRM::Subnet.new(service: service)
          subnet_object.merge_attributes(Fog::Network::AzureRM::Subnet.parse(subnet))
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.9 lib/fog/azurerm/models/network/subnets.rb
fog-azure-rm-0.0.8 lib/fog/azurerm/models/network/subnets.rb
fog-azure-rm-0.0.6 lib/fog/azurerm/models/network/subnets.rb
fog-azure-rm-0.0.5 lib/fog/azurerm/models/network/subnets.rb
fog-azure-rm-0.0.4 lib/fog/azurerm/models/network/subnets.rb