Sha256: fcd086fee40a51e1ea43c2a882047a74153c17222384d0fef726666adc19ab57

Contents?: true

Size: 662 Bytes

Versions: 23

Compression:

Stored size: 662 Bytes

Contents

module Fog
  module Vsphere
    class Compute
      class Folder < Fog::Model
        identity :id

        attribute :name
        attribute :parent
        attribute :datacenter
        attribute :path
        attribute :type

        # Pass :recursive => true to get a Servers object that searches for VM names recursively
        def vms(options = {})
          return [] if type.to_s != 'vm'
          service.servers(folder: path, datacenter: datacenter, recursive: options[:recursive])
        end

        def to_s
          name
        end

        def destroy
          service.folder_destroy(path, datacenter)
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
fog-vsphere-3.1.1 lib/fog/vsphere/models/compute/folder.rb
fog-vsphere-3.1.0 lib/fog/vsphere/models/compute/folder.rb
fog-vsphere-3.0.0 lib/fog/vsphere/models/compute/folder.rb