Class: Fog::Compute::Brightbox::Server
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Brightbox::Server
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
#inspect, #reload, #to_json, #wait_for
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires
Constructor Details
#initialize(attributes = {}) ⇒ Server
Returns a new instance of Server.
31
32
33
34
35
|
# File 'lib/fog/compute/models/brightbox/server.rb', line 31
def initialize(attributes={})
self.flavor_id ||= 'typ-4nssg' self.image_id ||= 'img-2ab98' super
end
|
Instance Method Details
#activate_console ⇒ Object
92
93
94
95
96
|
# File 'lib/fog/compute/models/brightbox/server.rb', line 92
def activate_console
requires :identity
response = connection.activate_console_server(identity)
[response["console_url"], response["console_token"], response["console_token_expires"]]
end
|
#destroy ⇒ Object
64
65
66
67
68
|
# File 'lib/fog/compute/models/brightbox/server.rb', line 64
def destroy
requires :identity
connection.destroy_server(identity)
true
end
|
#flavor ⇒ Object
70
71
72
73
|
# File 'lib/fog/compute/models/brightbox/server.rb', line 70
def flavor
requires :flavor_id
connection.flavors.get(flavor_id)
end
|
#image ⇒ Object
75
76
77
78
|
# File 'lib/fog/compute/models/brightbox/server.rb', line 75
def image
requires :image_id
connection.images.get(image_id)
end
|
#private_ip_address ⇒ Object
80
81
82
|
# File 'lib/fog/compute/models/brightbox/server.rb', line 80
def private_ip_address
interfaces.first
end
|
#public_ip_address ⇒ Object
84
85
86
|
# File 'lib/fog/compute/models/brightbox/server.rb', line 84
def public_ip_address
cloud_ips.first
end
|
#ready? ⇒ Boolean
88
89
90
|
# File 'lib/fog/compute/models/brightbox/server.rb', line 88
def ready?
self.state == 'active'
end
|
#reboot ⇒ Object
42
43
44
|
# File 'lib/fog/compute/models/brightbox/server.rb', line 42
def reboot
false
end
|
#save ⇒ Object
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/fog/compute/models/brightbox/server.rb', line 98
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
|
#shutdown ⇒ Object
58
59
60
61
62
|
# File 'lib/fog/compute/models/brightbox/server.rb', line 58
def shutdown
requires :identity
connection.shutdown_server(identity)
true
end
|
#snapshot ⇒ Object
37
38
39
40
|
# File 'lib/fog/compute/models/brightbox/server.rb', line 37
def snapshot
requires :identity
connection.snapshot_server(identity)
end
|
#start ⇒ Object
46
47
48
49
50
|
# File 'lib/fog/compute/models/brightbox/server.rb', line 46
def start
requires :identity
connection.start_server(identity)
true
end
|
#stop ⇒ Object
52
53
54
55
56
|
# File 'lib/fog/compute/models/brightbox/server.rb', line 52
def stop
requires :identity
connection.stop_server(identity)
true
end
|