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 > Inputs > Modify Next Instance Input

Modify Next Instance Input

Change a server level input (for the "next" instance) value.  In our example, the SYS_FIREWALL category input named "sys_firewall/rule/port" gets changed to 8080.

Note:  HTTP PUT method is used.  If a specified input does not exist, it gets created.  If it does exist, its value is set to the one provided.

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
CLOUD="2112"                               # Set the Cloud ID
INSTANCE="B469CS55K5VRQ"                   # Set the NEXT Instance ID
PORT="8080"                                # New port number/value for the text input
curl -i -H X-API-Version:1.5 -b mycookie \
-d inputs[][name]="sys_firewall/rule/port" \      # Input name to modify
-d inputs[][value]="text:$PORT" \                 # text value to set the input to (8080)
-X PUT https://my.rightscale.com/api/clouds/$CLOUD/instances/$INSTANCE/inputs/multi_update

Sample Output

HTTP/1.1 204 No Content
Server: nginx/1.0.15
Date: Wed, 07 Nov 2012 01:34:17 GMT
Connection: keep-alive
Status: 204 No Content
X-Runtime: 822
X-Request-Uuid: d09e5755c5cd4ad1ae7e2ce3f1da7cfb
Set-Cookie: rs_gbl=eNo1kE1vgjAAQP9LzzShFWgh2UGHGRoYgqBzl6W0gDI-EiwNaPzvg8Pu773DewIGHNBMQAPiDpwnGO55DxxCKXlpQHLgoJWJsYl1k2jgJmY4wzYqOLMgplYGEcoxpFTkkNi2wRgmvGBizsn837Xx4s51oFbhNnokm9KvizaX9bUJ3c_zvt03GGW6GpU4NlFi0RjXSfBRu2uXw-rE1l566qdDpFOz3Zx95HVVsirDUg7r6wFug0tpwazUebElVP0ImapR_N6_-8Ro9o-q9N2vPso9y5WFruiVHGJiw53RMjSFXR_FtpvuvLC6VeNjuij-PhjxJnhbjozLEcZ5N7RynoJerz9L-1y7; domain=.rightscale.com; path=/; HttpOnly
Cache-Control: no-cache

PowerShell

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

Example Call

$cloudID = "2112"                      # Set the ID of the deployment to be modified
$instanceID = "B469CS55K5VRQ"          # Set the ID of the next instance whose next inputs are being
$port = "8080"                         # Set the new port value to 8080
$stringToPut = "inputs[][name]=sys_firewall/rule/port&"
$stringToPut += "inputs[][value]=text:$port"
$inputWebRequest = [System.Net.WebRequest]::Create("https://my.rightscale.com/api/clouds/$cloudID/instances/$instanceID/inputs/multi_update")
$inputWebRequest.Method = "PUT"
$inputWebRequest.Headers.Add("X-API-Version","1.5")
$inputWebRequest.CookieContainer = $cookieContainer
$inputWebRequest.ServicePoint.Expect100Continue = $false
$inputRequestStream = $inputWebRequest.GetRequestStream()
$inputRequestStream.Close()
[System.Net.WebResponse]$inputResponse = $inputWebRequest.GetResponse()
$inputResponseStream = $inputResponse.GetResponseStream()
$inputResponseStreamReader = New-Object System.IO.StreamReader -ArgumentList $inputResponseStream
$inputResponse
#this is the cookie container for subsequent requests: $cookieContainer

 

Sample Output

See http/curl output.

See also

You must to post a comment.
Last modified
23:18, 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.