Sha256: b1966b349f00b5cf3fe77cecff65ad44acf0982f0f5fd434c8a7742bf1dd28b2

Contents?: true

Size: 1.07 KB

Versions: 23

Compression:

Stored size: 1.07 KB

Contents

require 'fog/compute/models/server'

module Fog
  module Vsphere
    class Compute
      class Snapshot < Fog::Model
        identity  :ref
        attribute :server_id

        attribute :name
        attribute :quiescedi, default: false
        attribute :description, default: ''
        attribute :create_time
        attribute :power_state, default: 'none'
        attribute :ref
        attribute :mo_ref
        attribute :tree_node
        attribute :snapshot_name_chain
        attribute :ref_chain

        def child_snapshots(filters = {})
          service.snapshots(
            { server_id: server_id, parent_snapshot: self }.update(filters)
          )
        end

        def get_child(snapshot_ref)
          return self if ref == snapshot_ref
          child_snapshots.get(snapshot_ref)
        end

        def revert
          service.vm_revert_snapshot server_id, ref
        end

        def destroy(remove_children = false)
          requires :server_id, :ref
          service.vm_remove_snapshot(server_id, ref, remove_children)
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
fog-vsphere-3.7.0 lib/fog/vsphere/models/compute/snapshot.rb
fog-vsphere-3.6.8 lib/fog/vsphere/models/compute/snapshot.rb
fog-vsphere-3.6.7 lib/fog/vsphere/models/compute/snapshot.rb
fog-vsphere-3.6.6 lib/fog/vsphere/models/compute/snapshot.rb
fog-vsphere-3.6.5 lib/fog/vsphere/models/compute/snapshot.rb
fog-vsphere-3.6.4 lib/fog/vsphere/models/compute/snapshot.rb
fog-vsphere-3.6.3 lib/fog/vsphere/models/compute/snapshot.rb
fog-vsphere-3.6.2 lib/fog/vsphere/models/compute/snapshot.rb
fog-vsphere-3.5.3 lib/fog/vsphere/models/compute/snapshot.rb
fog-vsphere-3.6.0 lib/fog/vsphere/models/compute/snapshot.rb
fog-vsphere-3.5.2 lib/fog/vsphere/models/compute/snapshot.rb
fog-vsphere-3.5.1 lib/fog/vsphere/models/compute/snapshot.rb
fog-vsphere-3.5.0 lib/fog/vsphere/models/compute/snapshot.rb
fog-vsphere-3.4.0 lib/fog/vsphere/models/compute/snapshot.rb
fog-vsphere-3.3.1 lib/fog/vsphere/models/compute/snapshot.rb
fog-vsphere-3.3.0 lib/fog/vsphere/models/compute/snapshot.rb
fog-vsphere-3.2.5 lib/fog/vsphere/models/compute/snapshot.rb
fog-vsphere-3.2.2 lib/fog/vsphere/models/compute/snapshot.rb
fog-vsphere-3.2.1 lib/fog/vsphere/models/compute/snapshot.rb
fog-vsphere-3.2.0 lib/fog/vsphere/models/compute/snapshot.rb