Class: Fog::Compute::Glesys::Server

Inherits:
Server show all
Extended by:
Deprecation
Defined in:
lib/fog/glesys/models/compute/server.rb

Instance Attribute Summary

Attributes inherited from Server

#private_key, #private_key_path, #public_key, #public_key_path, #username

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

Methods included from Deprecation

deprecate, self_deprecate

Methods inherited from Server

#scp, #scp_download, #ssh, #ssh_port, #sshable?

Methods inherited from Model

#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#destroyObject



48
49
50
51
# File 'lib/fog/glesys/models/compute/server.rb', line 48

def destroy
  requires :identity
  connection.destroy(:serverid => identity, :keepip => keepip)
end

#ready?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/fog/glesys/models/compute/server.rb', line 29

def ready?
  state == 'running'
end

#rebootObject



43
44
45
46
# File 'lib/fog/glesys/models/compute/server.rb', line 43

def reboot
  requires :identity
  connection.reboot(:serverid => identity)
end

#saveObject



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/fog/glesys/models/compute/server.rb', line 53

def save
  raise "Operation not supported" if self.identity
  requires :hostname, :rootpassword

  options = {
    :datacenter     => datacenter   || "Falkenberg",
    :platform       => platform     || "Xen",
    :hostname       => hostname,
    :templatename   => templatename || "Debian-6 x64",
    :disksize       => disksize     || "10",
    :memorysize     => memorysize   || "512",
    :cpucores       => cpucores     || "1",
    :rootpassword   => rootpassword,
    :transfer       => transfer     || "500",
  } 
  data = connection.create(options)
  merge_attributes(data.body['response']['server'])
  data.status == 200 ? true : false
end

#startObject



33
34
35
36
# File 'lib/fog/glesys/models/compute/server.rb', line 33

def start
  requires :identity
  connection.start(:serverid => identity)
end

#stopObject



38
39
40
41
# File 'lib/fog/glesys/models/compute/server.rb', line 38

def stop
  requires :identity
  connection.stop(:serverid => identity)
end