Sha256: 5816933f010adac0407a274fada3b5938650795919e235b66febdec08ec1cc34

Contents?: true

Size: 792 Bytes

Versions: 7

Compression:

Stored size: 792 Bytes

Contents

require 'fog/core/collection'
require 'fog/vsphere/models/compute/snapshot'

module Fog
  module Compute
    class Vsphere
      class Snapshots < Fog::Collection
        attribute :server_id, alias: :instance_uuid
        attribute :parent_snapshot
        model Fog::Compute::Vsphere::Snapshot

        def all(filters = {})
          if parent_snapshot
            load service.list_child_snapshots(parent_snapshot, filters)
          else
            requires :server_id
            load service.list_vm_snapshots(server_id, filters)
          end
        end

        def get(snapshot_ref)
          all.each do |snapshot|
            snapshot = snapshot.get_child(snapshot_ref)
            return snapshot if snapshot
          end
          nil
        end
      end
    end
  end
end

Version data entries

7 entries across 5 versions & 2 rubygems

Version Path
fog-vsphere-2.5.0 lib/fog/vsphere/models/compute/snapshots.rb
fog-vsphere-2.4.0 lib/fog/vsphere/models/compute/snapshots.rb
fog-vsphere-2.3.0 lib/fog/vsphere/models/compute/snapshots.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-vsphere-2.2.0/lib/fog/vsphere/models/compute/snapshots.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-vsphere-2.2.0/lib/fog/vsphere/models/compute/snapshots.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-vsphere-2.2.0/lib/fog/vsphere/models/compute/snapshots.rb
fog-vsphere-2.2.0 lib/fog/vsphere/models/compute/snapshots.rb