Terminate the running instance of a server.
Table of Contents
Prerequisite: Example assumes you have previously authenticated, and your valid session cookie is in 'mycookie'.
#!/bin/sh -e SERVER="532922001" curl -i -H X_API_VERSION:1.5 -b mycookie -X POST https://my.rightscale.com/api/servers/$SERVER/terminate
Note: There is no XML/JSON content from a Terminate Server (or instance).
HTTP/1.1 204 No Content Server: nginx/1.0.15 Date: Fri, 12 Oct 2012 16:18:49 GMT Connection: keep-alive Status: 204 No Content X-Runtime: 463 X-Request-Uuid: cbb45a90192a4e75b8580e8f0ff5674f Set-Cookie: _session_id=92ede080c999a3e5734035f582d11b0e; path=/; Secure; HttpOnly Cache-Control: no-cache
require 'rubygems' require 'pp' # Require pretty print Ruby gem require 'right_api_client' # RightScale API client gem user = 'greg.doe@example.com' # Set user email address for using the Dashboard acct = '1234' # Set the account ID pass = 'SomePassword' # Set the password for the user. Create client object so you can use the API. @client = RightApi::Client.new(:email => user, :password => pass, :account_id => acct) # # Setup and authenticate above. Set and use additional variables below, display output, etc. # server_id = '626129001' @client.servers(:id => server_id).show.terminate
The specified server is terminated, but no output. (Note: Even if the example script above used "puts" or "pp" to display output, none is returned.)
© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.