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 Model

#collection, #connection

Instance Method Summary collapse

Methods included from Deprecation

deprecate, self_deprecate

Methods inherited from Server

#scp, #scp_download, #ssh

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



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

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

#saveObject



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/fog/glesys/models/compute/server.rb', line 48

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