Class: RightScaleCLI::Deployments
- Inherits:
-
Thor
- Object
- Thor
- RightScaleCLI::Deployments
- Defined in:
- lib/rightscale_cli/deployments.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create(name, description) ⇒ Object
- #destroy(deployment_id) ⇒ Object
-
#initialize(*args) ⇒ Deployments
constructor
A new instance of Deployments.
- #list ⇒ Object
- #servers(deployment) ⇒ Object
- #terminate(deployment_id) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Deployments
26 27 28 29 30 |
# File 'lib/rightscale_cli/deployments.rb', line 26 def initialize(*args) super @client = RightScaleCLI::Client.new() @logger = RightScaleCLI::Logger.new() end |
Class Method Details
.banner(task, namespace = true, subcommand = false) ⇒ Object
66 67 68 |
# File 'lib/rightscale_cli/deployments.rb', line 66 def self.(task, namespace = true, subcommand = false) "#{basename} #{task.formatted_usage(self, true, subcommand)}" end |
Instance Method Details
#create(name, description) ⇒ Object
41 42 43 |
# File 'lib/rightscale_cli/deployments.rb', line 41 def create(name, description) @client.create('deployment', { :name => name, :description => description }) end |
#destroy(deployment_id) ⇒ Object
46 47 48 |
# File 'lib/rightscale_cli/deployments.rb', line 46 def destroy(deployment_id) @client.destroy('deployment', deployment_id) end |
#list ⇒ Object
36 37 38 |
# File 'lib/rightscale_cli/deployments.rb', line 36 def list() @client.render(@client.get('deployments'), 'deployments') end |
#servers(deployment) ⇒ Object
51 52 53 54 |
# File 'lib/rightscale_cli/deployments.rb', line 51 def servers(deployment) @logger.info("Retrieving all servers in deployment, #{deployment}...") @client.render(@client.show('deployments', deployment, 'servers'), 'servers') end |
#terminate(deployment_id) ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'lib/rightscale_cli/deployments.rb', line 57 def terminate(deployment_id) @client.client.deployments.index(:id=> deployment_id).show.servers.index.each do |server| unless server.state == 'inactive' @logger.info "Terminating #{server.href} (state: #{server.state}.)" server.terminate end end end |