Class: RightScaleAPI::Server
Instance Attribute Summary
#account
Attributes inherited from Base
#href, #id
Class Method Summary
collapse
Instance Method Summary
collapse
#collection_uri
Methods inherited from Base
api_name, attributes, create, #delete, #destroy, get, #get, #head, #initialize, #post, #put, #reload!, #send_request, #update, #uri
Class Method Details
.opts_to_query_opts(opts) ⇒ Object
68
69
70
71
72
73
74
|
# File 'lib/right-scale-api/server.rb', line 68
def self.opts_to_query_opts opts
assoc_ip = opts.delete :associate_eip_at_launch
if !assoc_ip.nil?
opts[:associate_eip_at_launch] = assoc_ip ? 1 : 0
end
super opts
end
|
Instance Method Details
#attach_blank_volume(opts) ⇒ Object
Account#create_ec2_ebs_volume’s opts + :device – device mount point, eg /dev/sdk
61
62
63
64
65
66
|
# File 'lib/right-scale-api/server.rb', line 61
def attach_blank_volume opts
device = opts.delete :device
opts = {:ec2_availability_zone => 'us-east-1a'}.merge opts volume = account.create_ec2_ebs_volume opts
attach_volume volume, device
end
|
#attach_volume(volume, device) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/right-scale-api/server.rb', line 46
def attach_volume volume, device
if running?
post '/attach_volume', :query => {
:server => {
:ec2_ebs_volume_href => volume.uri,
:device => device
}
}
else
volume.attach_to_server self, device, 'boot'
end
end
|
#reboot ⇒ Object
34
35
36
|
# File 'lib/right-scale-api/server.rb', line 34
def reboot
post '/reboot'
end
|
#running? ⇒ Boolean
42
43
44
|
# File 'lib/right-scale-api/server.rb', line 42
def running?
state == 'operational'
end
|
#settings ⇒ Object
38
39
40
|
# File 'lib/right-scale-api/server.rb', line 38
def settings
get('/settings')['settings']
end
|
#start ⇒ Object
26
27
28
|
# File 'lib/right-scale-api/server.rb', line 26
def start
post '/start'
end
|
#stop ⇒ Object
30
31
32
|
# File 'lib/right-scale-api/server.rb', line 30
def stop
post '/stop'
end
|