Sha256: ea92fdf2ae2e873491c1f709a7cc984e41ad9219a7eec65ed4e318a9edcab83c

Contents?: true

Size: 849 Bytes

Versions: 4

Compression:

Stored size: 849 Bytes

Contents

module Smartdc::Api
  module Machine
    class Snapshots
      attr_reader :request

      def initialize(id, options)
        @id = id
        @request = Smartdc::Request.new(options)
      end

      def create(raw={})
        request.post('my/machines/' + @id.to_s + '/snapshots/', raw)
      end

      def read(id)
        raise ArgumentError unless id
        request.get('my/machines/' + @id.to_s + '/snapshots/' + id.to_s)
      end

      def all(query={})
        request.get('my/machines/' + @id.to_s + '/snapshots', query)
      end

      def destroy(id)
        raise ArgumentError unless id
        request.del('my/machines/' + @id.to_s + '/snapshots/' + id.to_s)
      end

      def start(id)
        raise ArgumentError unless id
        request.post('my/machines/' + @id.to_s + '/snapshots/' + id.to_s)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
smartdc-1.2.2 lib/smartdc/api/machine/snapshots.rb
smartdc-1.2.1 lib/smartdc/api/machine/snapshots.rb
smartdc-1.1.1 lib/smartdc/api/machine/snapshots.rb
smartdc-1.0.1 lib/smartdc/api/machine/snapshots.rb