class Fog::Compute::RackspaceV2::Server

Constants

ACTIVE

States

BUILD
DELETED
ERROR
HARD_REBOOT
MIGRATING
PASSWORD
REBOOT
REBUILD
RESCUE
RESIZE
REVERT_RESIZE
SUSPENDED
UNKNOWN
VERIFY_RESIZE

Attributes

password[R]

Public Instance Methods

attachments() click to toggle source
# File lib/fog/rackspace/models/compute_v2/server.rb, line 87
def attachments
  @attachments ||= begin
    Fog::Compute::RackspaceV2::Attachments.new({
      :connection => connection,
      :server => self
    })
  end
end
change_admin_password(password) click to toggle source
# File lib/fog/rackspace/models/compute_v2/server.rb, line 133
def change_admin_password(password)
  requires :identity
  connection.change_server_password(identity, password)
  self.state = PASSWORD
  @password = password
  true
end
confirm_resize() click to toggle source
# File lib/fog/rackspace/models/compute_v2/server.rb, line 121
def confirm_resize
  requires :identity
  connection.confirm_resize_server(identity)
  true
end
create() click to toggle source
# File lib/fog/rackspace/models/compute_v2/server.rb, line 55
def create
  requires :name, :image_id, :flavor_id
  options = {}
  options[:disk_config] = disk_config unless disk_config.nil?
  data = connection.create_server(name, image_id, flavor_id, 1, 1, options)
  merge_attributes(data.body['server'])
  true
end
destroy() click to toggle source
# File lib/fog/rackspace/models/compute_v2/server.rb, line 71
def destroy
  requires :identity
  connection.delete_server(identity)
  true
end
flavor() click to toggle source
# File lib/fog/rackspace/models/compute_v2/server.rb, line 77
def flavor
  requires :flavor_id
  @flavor ||= connection.flavors.get(flavor_id)
end
image() click to toggle source
# File lib/fog/rackspace/models/compute_v2/server.rb, line 82
def image
  requires :image_id
  @image ||= connection.images.get(image_id)
end
ready?() click to toggle source
# File lib/fog/rackspace/models/compute_v2/server.rb, line 96
def ready?
  state == ACTIVE
end
reboot(type = 'SOFT') click to toggle source
# File lib/fog/rackspace/models/compute_v2/server.rb, line 100
def reboot(type = 'SOFT')
  requires :identity
  connection.reboot_server(identity, type)
  self.state = type == 'SOFT' ? REBOOT : HARD_REBOOT
  true
end
rebuild(image_id) click to toggle source
# File lib/fog/rackspace/models/compute_v2/server.rb, line 114
def rebuild(image_id)
  requires :identity
  connection.rebuild_server(identity, image_id)
  self.state = REBUILD
  true
end
resize(flavor_id) click to toggle source
# File lib/fog/rackspace/models/compute_v2/server.rb, line 107
def resize(flavor_id)
  requires :identity
  connection.resize_server(identity, flavor_id)
  self.state = RESIZE
  true
end
revert_resize() click to toggle source
# File lib/fog/rackspace/models/compute_v2/server.rb, line 127
def revert_resize
  requires :identity
  connection.revert_resize_server(identity)
  true
end
save() click to toggle source
# File lib/fog/rackspace/models/compute_v2/server.rb, line 46
def save
  if identity
    update
  else
    create
  end
  true
end
update() click to toggle source
# File lib/fog/rackspace/models/compute_v2/server.rb, line 64
def update
  requires :identity, :name
  data = connection.update_server(identity, name)
  merge_attributes(data.body['server'])
  true
end

Private Instance Methods

adminPass=(new_admin_pass) click to toggle source
# File lib/fog/rackspace/models/compute_v2/server.rb, line 143
def adminPass=(new_admin_pass)
  @password = new_admin_pass
end