Class: RightScale::Servers

Inherits:
API
  • Object
show all
Defined in:
lib/rightscale-api/servers.rb

Overview

Instance Attribute Summary

Attributes inherited from API

#client

Instance Method Summary collapse

Methods inherited from API

#create, #destroy, #formatted_uri, #index, #initialize, #show, #update

Constructor Details

This class inherits a constructor from RightScale::API

Instance Method Details

#attach_volume(ec2_ebs_volume_href, device) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/rightscale-api/servers.rb', line 24

def attach_volume(ec2_ebs_volume_href, device)
  response = client.post("/servers/#{identifier}/attach_volume", :query => {
    :server => {
      :ec2_ebs_volume_href => ec2_ebs_volume_href,
      :device => device
    }
  })
end

#reboot(identifier) ⇒ Object



12
13
14
# File 'lib/rightscale-api/servers.rb', line 12

def reboot(identifier)
  response = client.post("/servers/#{identifier}/reboot")
end

#run_script(identifier, right_script_href, params = {}) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/rightscale-api/servers.rb', line 16

def run_script(identifier, right_script_href, params = {})
  query = {:server => {:right_script_href => right_script_href}}
  query[:server].merge(params) if !params.empty?

  response = client.post("/servers/#{identifier}/run_script", :query => query)
  return response
end

#settings(identifier) ⇒ Object



33
34
35
36
# File 'lib/rightscale-api/servers.rb', line 33

def settings(identifier)
  response = client.get("#{formatted_uri(identifier)}/settings")
  return response['settings']
end

#start(identifier) ⇒ Object



4
5
6
# File 'lib/rightscale-api/servers.rb', line 4

def start(identifier)
  response = client.post("/servers/#{identifier}/start")
end

#stop(identifier) ⇒ Object



8
9
10
# File 'lib/rightscale-api/servers.rb', line 8

def stop(identifier)
  response = client.post("/servers/#{identifier}/stop")
end