Sha256: ef15c9941f66523598caa01b32b444088d636d4e060b56b54e5d19fad3522c93

Contents?: true

Size: 1.14 KB

Versions: 11

Compression:

Stored size: 1.14 KB

Contents

module Fog
  module Vsphere
    class Compute
      class Real
        def vm_take_snapshot(options = {})
          raise ArgumentError, 'instance_uuid is a required parameter' unless options.key? 'instance_uuid'
          raise ArgumentError, 'name is a required parameter' unless options.key? 'name'
          vm = get_vm_ref(options['instance_uuid'])
          task = vm.CreateSnapshot_Task(
            name: options['name'],
            description: options['description'] || '',
            memory: options['memory'] || true,
            quiesce: options['quiesce'] || false
          )

          task.wait_for_completion

          {
            'task_state' => task.info.state,
            'was_cancelled' => task.info.cancelled
          }
        end
      end

      class Mock
        def vm_take_snapshot(options = {})
          raise ArgumentError, 'instance_uuid is a required parameter' unless options.key? 'instance_uuid'
          raise ArgumentError, 'name is a required parameter' unless options.key? 'name'
          {
            'task_state' => 'success',
            'was_cancelled' => false
          }
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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