Sha256: bdc8ed9942a9ba9e19cfcd29bc4b123532f9e59993781ff3f9a766713fe5bd80
Contents?: true
Size: 1.38 KB
Versions: 7
Compression:
Stored size: 1.38 KB
Contents
require 'fog/model' module Fog module Slicehost class Compute class Server < Fog::Model identity :id attribute :addresses attribute :backup_id, :aliases => 'backup-id' attribute :bandwidth_in, :aliases => 'bw-in' attribute :bandwidth_out, :aliases => 'bw-out' attribute :flavor_id, :aliases => 'flavor-id' attribute :image_id, :aliases => 'image-id' attribute :name attribute :password, :aliases => 'root-password' attribute :progress attribute :status def initialize(attributes={}) @flavor_id ||= 1 super end def destroy requires :id connection.delete_slice(@id) true end def flavor requires :flavor_id connection.flavors.get(@flavor_id) end def image requires :image_id connection.images.get(@image_id) end def ready? @status == 'active' end def reboot(type = 'SOFT') requires :id connection.reboot_slice(@id, type) true end def save requires :flavor_id, :image_id, :name data = connection.create_slice(@flavor_id, @image_id, @name) merge_attributes(data.body) true end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems