Note: Please go to docs.rightscale.com to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Guides > RightScale API 1.5 > Examples > Deployments > Delete Deployment

Delete Deployment

Delete a deployment.  Also known as "destroy" a deployment.

icon_curl_v1.png   icon_powershell_v1.png

Table of Contents

Curl

Prerequisite:  Example assumes you have previously authenticated, and your valid session cookie is in 'mycookie'.

Example Call

#!/bin/sh -e
DEPLOYMENT="314866001"
curl -i -H X_API_VERSION:1.5 -b mycookie -X DELETE https://my.rightscale.com/api/deployments/$DEPLOYMENT

Sample Output

There is no XML/JSON content, just headers output.  (HTTP 204 No Content)

Notes

  • You cannot delete a locked deployment.  (HTTP 422 Unprocessible Entity and "ActionNotAllowed: The deployment is locked" returned.)
  • You cannot delete a deployment with operational servers.  (HTTP 422 and "ActionNotAllowed: This deployment cannot be deleted because it contains running servers and/or active arrays.")
  • Warning!  You can delete a deployment that has non-operational servers in it (as long as its not locked).  The servers will be deleted too.

PowerShell

Prerequisite:  Example assumes you have previously authenticated and your session cookie for subsequent requests is in 'cookieContainer'.

Example Call

#get cookie container from authentication $cookieContainer
$deploymentID = "365623001"
$deleteDeploymentsRequest = [System.Net.WebRequest]::Create("https://my.rightscale.com/api/deployments/$deploymentID")
$deleteDeploymentsRequest.Method = "DELETE"
$deleteDeploymentsRequest.CookieContainer = $cookieContainer
$deleteDeploymentsRequest.Headers.Add("X_API_VERSION", "1.5");
[System.Net.WebResponse] $deleteDeploymentsResponse = $deleteDeploymentsRequest.GetResponse()
$deleteDeploymentsResponseStream = $deleteDeploymentsResponse.GetResponseStream()
$deleteDeploymentsResponseStreamReader = New-Object System.IO.StreamReader -argumentList $deleteDeploymentsResponseStream
[string]$deleteDeploymentsResponseString = $deleteDeploymentsResponseStreamReader.ReadToEnd()
$deleteDeploymentsResponse

Sample Output

IsMutuallyAuthenticated : False
Cookies : {}
Headers : {Connection, Status, X-Runtime, X-Request-Uuid...}
SupportsHeaders : True
ContentLength : -1
ContentEncoding :
ContentType :
CharacterSet :
Server : nginx/1.0.15
LastModified : 2/21/2013 1:00:04 PM
StatusCode : NoContent
StatusDescription : No Content
ProtocolVersion : 1.1
ResponseUri : https://my.rightscale.com/api/deployments/365623001
Method : DELETE
IsFromCache : False
You must to post a comment.
Last modified
23:17, 16 May 2013

Tags

Classifications

This page has no classifications.

Announcements

None


© 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.