Cloudify provides Rest API to deploy,launch,scale the applications. There are many API's like getting log or information about the deployed application in the site. Our POC explains a very few of those. For Complete list of API please refer http://www.cloudifysource.org/guide/2.2/restapi/restdoclet.html
Cloudify provides Rest API support from different server rather than Management Web Console. Management Console usually run in <machine>:8099 and RestFull service will be available in <machine>:8100
Deployed Applications Details (Using GET method):
No Parameters Required
http://50.17.100.161:8100/service/applications
Deployed services for a Application (Using GET method):
Parameters : application name(example: helloworld )
http://50.17.100.161:8100/service/applications/<appname>/services
Deployed service Instance Information (Using GET method):
Parameters : application name(example: helloworld ),service name(example:tomcat)
http://50.17.100.161:8100/service/applications/<appname>/services/<servicename>/instances
Deploy and Launch Application (Using Post Method):
Here we have zip to application folder with all the required recipes, send that zip folder as one of the request parameter.
parameters :application name(example: helloworld )
post body params :
MultipartEntity multiPartEntity = new MultipartEntity();
FileBody fileBody = new FileBody(new File(path));
multiPartEntity.addPart("file", fileBody);
httpRequest.setEntity(multiPartEntity);
http://50.17.100.161:8100/service/applications/<appname>/timeout/50
Unistall Application (Using Delete Method):
parameters :application name(example: helloworld )
http://50.17.100.161:8100/service/applications/<appname>/timeout/50
Scale-Up and Scale-Down Application (Using Post Method):
Parameters : application name(example: helloworld ),service name(example:tomcat)
post body params example:
nameValuePairs.add(new BasicNameValuePair("count", Integer.toString(2)));
nameValuePairs.add(new BasicNameValuePair("location-aware", Boolean.toString(true)));
httpRequest.setEntity(new UrlEncodedFormEntity(nameValuePairs));
http://50.17.100.161:8100/service/applications/<appname>/services/<servicename>/timeout/50/set-instances
Custom command invocation (Using Post Method):
Parameters : application name(example: helloworld ),service name(example:tomcat),JsonParams(example:"{"GS_USM_Command_Parameters0":"http://50.17.100.161:8181/webdav/patch.zip","GS_USM_CommandName":"runpatch"}")
post body params example:
HttpPost httpRequest = new HttpPost(url);
StringEntity rr = new StringEntity(jsonparams, "application/json", "UTF-8");
httpRequest.setEntity(rr);
StringEntity rr = new StringEntity(jsonparams, "application/json", "UTF-8");
httpRequest.setEntity(rr);
http://50.17.100.161:8100/service/applications/<appname>/services/<servicename>/beans/universalServiceManagerBean/invoke
No comments:
Post a Comment