Sha256: 6ed3450ac6e37ae008484e26d7ad10f6a6999ac23459be2475e1865dbb669a14
Contents?: true
Size: 1.65 KB
Versions: 1
Compression:
Stored size: 1.65 KB
Contents
require 'smartdc/api/machine/tags' require 'smartdc/api/machine/metadata' require 'smartdc/api/machine/snapshots' module Smartdc module Api class Machines attr_reader :request, :id def initialize(request, id=nil) @request = request @id = id end def create(params={}) request.post('my/machines/', params) end def read raise ArgumentError unless id request.get('my/machines/' + id.to_s) end def find(params={}) request.get('my/machines', params) end def delete raise ArgumentError unless id request.delete('my/machines/' + id.to_s) end def stop raise ArgumentError unless id request.post('my/machines/' + id.to_s, {'action'=>'stop'}) end def start raise ArgumentError unless id request.post('my/machines/' + id.to_s, {'action'=>'start'}) end def reboot raise ArgumentError unless id request.post('my/machines/' + id.to_s, {'action'=>'reboot'}) end def resize(params={}) raise ArgumentError unless id params[:action] = 'resize' request.post('my/machines/' + id.to_s, params) end def tags(_id=nil) raise ArgumentError unless id Smartdc::Api::Machine::Tags.new(request, id, _id) end def metadata(_id=nil) raise ArgumentError unless id Smartdc::Api::Machine::Metadata.new(request, id, _id) end def snapshots(_id=nil) raise ArgumentError unless id Smartdc::Api::Machine::Snapshots.new(request, id, _id) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
smartdc-0.4.0 | lib/smartdc/api/machines.rb |