Sha256: 79af109738e839dc37ef08d7a372e4f4e6c6b3244783f4e85c25cc2c49b256dc

Contents?: true

Size: 953 Bytes

Versions: 10

Compression:

Stored size: 953 Bytes

Contents

module Fog
  module Vsphere
    class Compute
      class Interfacetypes < Fog::Collection
        autoload :Interfacetype, File.expand_path('../interfacetype', __FILE__)

        model Fog::Vsphere::Compute::Interfacetype
        attr_accessor :datacenter
        attr_accessor :servertype

        def all(filters = {})
          requires :servertype
          case servertype
          when Fog::Vsphere::Compute::Servertype
            load service.list_interface_types(filters.merge(datacenter: datacenter,
                                                            servertype: servertype.id))
          else
            raise 'interfacetypes should have a servertype'
          end
        end

        def get(id)
          requires :servertype
          requires :datacenter
          new service.get_interface_type id, servertype, datacenter
        rescue Fog::Vsphere::Compute::NotFound
          nil
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
fog-vsphere-3.4.0 lib/fog/vsphere/models/compute/interfacetypes.rb
fog-vsphere-3.3.1 lib/fog/vsphere/models/compute/interfacetypes.rb
fog-vsphere-3.3.0 lib/fog/vsphere/models/compute/interfacetypes.rb
fog-vsphere-3.2.5 lib/fog/vsphere/models/compute/interfacetypes.rb
fog-vsphere-3.2.2 lib/fog/vsphere/models/compute/interfacetypes.rb
fog-vsphere-3.2.1 lib/fog/vsphere/models/compute/interfacetypes.rb
fog-vsphere-3.2.0 lib/fog/vsphere/models/compute/interfacetypes.rb
fog-vsphere-3.1.1 lib/fog/vsphere/models/compute/interfacetypes.rb
fog-vsphere-3.1.0 lib/fog/vsphere/models/compute/interfacetypes.rb
fog-vsphere-3.0.0 lib/fog/vsphere/models/compute/interfacetypes.rb