Sha256: 7616c4f7bc156a7f056ae6e09cc65c487716e90bf673c3797791ac65e60af75f

Contents?: true

Size: 713 Bytes

Versions: 5

Compression:

Stored size: 713 Bytes

Contents

require 'fog/core/collection'
require 'fog/openstack/models/network/subnet'

module Fog
  module Network
    class OpenStack
      class Subnets < Fog::Collection
        attribute :filters

        model Fog::Network::OpenStack::Subnet

        def initialize(attributes)
          self.filters ||= {}
          super
        end

        def all(filters_arg = filters)
          filters = filters_arg
          load(service.list_subnets(filters).body['subnets'])
        end

        def get(subnet_id)
          if subnet = service.get_subnet(subnet_id).body['subnet']
            new(subnet)
          end
        rescue Fog::Network::OpenStack::NotFound
          nil
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fog-1.31.0 lib/fog/openstack/models/network/subnets.rb
fog-1.30.0 lib/fog/openstack/models/network/subnets.rb
fog-1.29.0 lib/fog/openstack/models/network/subnets.rb
fog-1.28.0 lib/fog/openstack/models/network/subnets.rb
fog-1.27.0 lib/fog/openstack/models/network/subnets.rb