Class: RightScaleCLI::Deployments
- Inherits:
-
Thor
- Object
- Thor
- RightScaleCLI::Deployments
- Defined in:
- lib/rightscale_cli/deployments.rb
Overview
Represents RightScale Deployments
Class Method Summary collapse
Instance Method Summary collapse
- #create(name, description) ⇒ Object
- #destroy(deployment_id) ⇒ Object
- #export(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
Returns a new instance of Deployments.
30 31 32 33 34 35 |
# File 'lib/rightscale_cli/deployments.rb', line 30 def initialize(*args) super @client = RightScaleCLI::Client.new() @logger = RightScaleCLI::Logger.new @config = RightScaleCLI::Config.new.directives end |
Class Method Details
.banner(task, _namespace = true, subcommand = false) ⇒ Object
90 91 92 |
# File 'lib/rightscale_cli/deployments.rb', line 90 def self.(task, _namespace = true, subcommand = false) "#{basename} #{task.formatted_usage(self, true, subcommand)}" end |
Instance Method Details
#create(name, description) ⇒ Object
56 57 58 |
# File 'lib/rightscale_cli/deployments.rb', line 56 def create(name, description) @client.create('deployment', name: name, description: description) end |
#destroy(deployment_id) ⇒ Object
61 62 63 |
# File 'lib/rightscale_cli/deployments.rb', line 61 def destroy(deployment_id) @client.destroy('deployment', deployment_id) end |
#export(deployment_id) ⇒ Object
84 85 86 87 88 |
# File 'lib/rightscale_cli/deployments.rb', line 84 def export(deployment_id) @config[:timeout] = nil @client = RightApi::Client.new(@config) deployment_to_cat_file @client, deployment_id, nil, nil end |
#list ⇒ Object
51 52 53 |
# File 'lib/rightscale_cli/deployments.rb', line 51 def list @client.render(@client.get('deployments'), 'deployments') end |
#servers(deployment) ⇒ Object
66 67 68 69 70 |
# File 'lib/rightscale_cli/deployments.rb', line 66 def servers(deployment) @logger.info("Retrieving all servers in deployment, #{deployment}...") @client.render(@client.show('deployments', deployment, 'servers'), 'servers') end |
#terminate(deployment_id) ⇒ Object
73 74 75 76 77 78 79 80 81 |
# File 'lib/rightscale_cli/deployments.rb', line 73 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 |