Class: Fog::Brightbox::Compute::Server

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/compute/models/brightbox/server.rb

Instance Attribute Summary

Attributes inherited from Model

#collection, #connection

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #reload, #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, #identity, #identity=, #merge_attributes, #new_record?, #requires

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#destroyObject



58
59
60
61
62
# File 'lib/fog/compute/models/brightbox/server.rb', line 58

def destroy
  requires :identity
  connection.destroy_server(identity)
  true
end

#flavorObject



64
65
66
67
# File 'lib/fog/compute/models/brightbox/server.rb', line 64

def flavor
  requires :flavor_id
  connection.flavors.get(flavor_id)
end

#imageObject



69
70
71
72
# File 'lib/fog/compute/models/brightbox/server.rb', line 69

def image
  requires :image_id
  connection.images.get(image_id)
end

#ready?Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/fog/compute/models/brightbox/server.rb', line 74

def ready?
  status == 'active'
end

#rebootObject



36
37
38
# File 'lib/fog/compute/models/brightbox/server.rb', line 36

def reboot
  false
end

#saveObject



78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/fog/compute/models/brightbox/server.rb', line 78

def save
  requires :image_id
  options = {
    :image => image_id,
    :server_type => flavor_id,
    :name => name,
    :zone => zone_id,
    :user_data => user_data
  }.delete_if {|k,v| v.nil? || v == "" }
  data = connection.create_server(options)
  merge_attributes(data)
  true
end

#shutdownObject



52
53
54
55
56
# File 'lib/fog/compute/models/brightbox/server.rb', line 52

def shutdown
  requires :identity
  connection.shutdown_server(identity)
  true
end

#snapshotObject



31
32
33
34
# File 'lib/fog/compute/models/brightbox/server.rb', line 31

def snapshot
  requires :identity
  connection.snapshot_server(identity)
end

#startObject



40
41
42
43
44
# File 'lib/fog/compute/models/brightbox/server.rb', line 40

def start
  requires :identity
  connection.start_server(identity)
  true
end

#stopObject



46
47
48
49
50
# File 'lib/fog/compute/models/brightbox/server.rb', line 46

def stop
  requires :identity
  connection.stop_server(identity)
  true
end