Sha256: 75966516c87dcce31b89a8c3d109b6aaaacde589f3c1cb33b5b46721a18f21db

Contents?: true

Size: 702 Bytes

Versions: 1

Compression:

Stored size: 702 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.find { |snapshot| snapshot.get_child(snapshot_ref) }
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-1.36.0 lib/fog/vsphere/models/compute/snapshots.rb