Cloud Computing Made Easy®
Kaavo Web Services
From Cloud Computing Wiki - Kaavo
Introduction
Kaavo Web Services allows users to programmatically interact with IMOD to automate the deployment and runtime management of custom applications, SaaS, or PaaS solutions on top of the IaaS layer. The web services interface is provided to enable third parties to develop their cloud solutions leveraging Kaavo's technology without exposing their users to the IMOD web interface. Kaavo Web Services also provide APIs to allow integration of third party monitoring and alerts systems. E.g. an external monitoring system can trigger an event to start automatic remediation response in Kaavo IMOD. SOAP(Simple Object Access Protocol) is used for accessing the Web service. The web service uses document/literal wrapped style. If you are looking to automate the deployment and management of your solutions on the Cloud, instead of writing one-off management solution yourself, consider using Kaavo Web Services. Kaavo Web Services exposes all the power of Kaavo IMOD to handle complex multi-server, multi-tier distributed cloud deployments. Watch recording of 1 hour webinar on using Kaavo Web Services.
Web Services API
We have exposed the following API as Web service. The endpoint is secured through https. User credentials have to be specified in every request. The WSDL file is available at https://imod.kaavo.com/api/KaavoWebServices?wsdl
1. Ability to deploy and undeploy systems
Specify the system name and the system definition xml to deploy system. Specify the system name for undeployment.
Parameters
deploySystem(systemName, systemDefnXML, userId, password) undeploySystem(systemName, userId, password)
2. Ability to start and stop systems
Specify the name of the system to start or stop.
Parameters
startSystem(systemName, userId, password) stopSystem(systemName, userId, password)
3. Ability to set/delete thresholds for triggering custom events
Specify system name and event details(name, metric, threshold, etc.).
Parameters
createEvent(systemName, eventName, type, serverTypeCSV, metricName, relation, threshold,
period, priority, severity, sendAlert, comments, userId, password)
deleteEvent(systemName, eventName, userId, password)
type must be one of 'aggregate' or 'nonaggregate' (refer http://wiki.kaavo.com/index.php/N-Tier_Guide_System_Definition#Configure_Events)
serverTypesCSV is a comma separated list of server roles. server roles are specified as <tier-name>:<role-name>. For example, db_tier:mysql-manager-node for the Linux php-colab 3tier template.
metricName is the name of the metric to measure. Possible values are
cpu_utilization_user, cpu_utilization_system, bandwidth_in, bandwidth_out, free_diskspace, free_memory, and swap_memory.
relation must be one of '=', '<', '>'.
threshold is the threshold value for event triggering.
period period over which the metric value is averaged.
sendAlert must be 'true' or 'false'
4. Ability to execute events at scheduled times
Specify system name, event name, start time, frequency, etc.
Parameters
scheduleEvent(systemName, eventName, startDate, frequency, contextParamString, userId, password)
frquency represents frequency of event execution. Possible values are 'once', 'daily', 'weekly', 'monthly', [num] minutes(e.g. 720 minutes)
contextParamString This is for future use. Pass empty string for this. We support only parameter-less events so far.
5. Ability to execute custom events right away
Specify system name, event name.
Parameters
fireEvent(systemName, eventName, contextParamString, userId, password)
contextParamString This is for future use. Pass empty string here.
6. Ability to get a list of names for deployed systems
Parameters
getSystems(userId, password)
7. Ability to get system details given system name
Returns system state and list of tier names.
Parameters
getNTierDetail(systemName, userId, password)
8. Ability to get tier details given system name and tier name
Returns tier state, displayIndex, startupOrder and list of sever type(server role) names.
Parameters
getTierDetail(systemName, tierName, userId, password)
9. Ability to get server type details given system name, tier name, and role name
Returns min, max for the server type and list of server objects with properties such as name, state, public/private DNS/IP, etc.
Parameters
getServerTypeDetail(systemName, tierName, serverRole, userId, password)
10. Ability to get list of names for all the persistent events created on a system, given system name
Parameters
getEvents(systemName, userId, password)
Examples
JAVA Examples
For java examples generate the stub classes such as KaavoWebServices by using the wsimport tool that comes with JDK by executing the following command
wsimport -keep -d <directory> https://imod.kaavo.com/api/KaavoWebServices?wsdl
1. Starting a system
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.kaavo.webservices.KaavoWebServices;
public class KaavoWebServicesClient {
public static void main(String[] args) throws Exception{
URL url = new URL("https://imod.kaavo.com/api/KaavoWebServices?wsdl");
QName qName = new QName("http://webservices.kaavo.com/","KaavoWebServices");
Service service = Service.create(url, qName);
KaavoWebServices eif = service.getPort(KaavoWebServices.class);
eif.startSystem("jira", "userid", "password");
}
}
2. Stopping a system
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.kaavo.webservices.KaavoWebServices;
public class KaavoWebServicesClient {
public static void main(String[] args) throws Exception{
URL url = new URL("https://imod.kaavo.com/api/KaavoWebServices?wsdl");
QName qName = new QName("http://webservices.kaavo.com/","KaavoWebServices");
Service service = Service.create(url, qName);
KaavoWebServices eif = service.getPort(KaavoWebServices.class);
eif.stopSystem("jira", "userid", "password");
}
}
3. Creating an event
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.kaavo.webservices.KaavoWebServices;
public class KaavoWebServicesClient {
public static void main(String[] args) throws Exception{
URL url = new URL("https://imod.kaavo.com/api/KaavoWebServices?wsdl");
QName qName = new QName("http://webservices.kaavo.com/","KaavoWebServices");
Service service = Service.create(url, qName);
KaavoWebServices eif = service.getPort(KaavoWebServices.class);
eif.createEvent("php-aws", "app-tier-server-overloaded", "aggregate", "app_tier:default", "cpu_utilization_user",
">", "30", "60", "", "", "true", "test", "userId", "password");
}
}
4. Getting list of names for deployed systems
import java.net.URL;
import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.kaavo.webservices.KaavoWebServices;
public class KaavoWebServicesClient {
public static void main(String[] args) throws Exception{
URL url = new URL("https://imod.kaavo.com/api/KaavoWebServices?wsdl");
QName qName = new QName("http://webservices.kaavo.com/","KaavoWebServices");
Service service = Service.create(url, qName);
KaavoWebServices eif = service.getPort(KaavoWebServices.class);
List<String> systems = eif.getSystems("userId", "password");
for(String sys : systems)
{
System.out.printf("system name = %s\n", sys);
}
}
}
5. Getting details of servers in a role
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import com.kaavo.webservices.KaavoWebServices;
import com.kaavo.webservices.Server;
import com.kaavo.webservices.ServerType;
public class KaavoWebServicesClient {
public static void main(String[] args) throws Exception{
URL url = new URL("https://imod.kaavo.com/api/KaavoWebServices?wsdl");
QName qName = new QName("http://webservices.kaavo.com/","KaavoWebServices");
Service service = Service.create(url, qName);
KaavoWebServices eif = service.getPort(KaavoWebServices.class);
ServerType st = eif.getServerTypeDetail("phpcollab", "db_tier", "ndbd", "userId", "password");
for(Server srv : st.getServers())
{
System.out.printf("server name = %s, state = %s, publicDNS = %s, privateDNS = %s\n",
srv.getName(), srv.getState(),srv.getPublicDNS(), srv.getPrivateDNS());
}
}
}
C# Examples
1. Undeploying a system
class Program
{
static void Main(string[] args)
{
//KaavoWebService - service reference
KaavoWebService.KaavoWebServicesClient client = new KaavoWebService.KaavoWebServicesClient();
KaavoWebService.undeploySystem undeployMessage = new KaavoWebService.undeploySystem();
undeployMessage.systemName = "systemName";
undeployMessage.userId = "userId";
undeployMessage.password = "password";
client.undeploySystem(undeployMessage);
}
}
2. Firing an event
class Program
{
static void Main(string[] args)
{
KaavoWebService.KaavoWebServicesClient client = new KaavoWebService.KaavoWebServicesClient();
KaavoWebService.fireEvent fireEventMessage = new KaavoWebService.fireEvent();
fireEventMessage.systemName = "systemName";
fireEventMessage.eventName = "eventName";
fireEventMessage.userId = "userId";
fireEventMessage.password = "password";
fireEventMessage.contextParamString = "";
KaavoWebService.fireEventResponse response = client.fireEvent(fireEventMessage);
String message = response.@return;
}
}
Ruby Examples
1. Deploying a system
require 'soap/wsdlDriver' URL = 'https://imod.kaavo.com/api/KaavoWebServices?wsdl' service = SOAP::WSDLDriverFactory.new(URL).create_rpc_driver systemDef = file = File.new("sysdef.xml", "r") while (line = file.gets) systemDef = systemDef + line end file.close puts systemDef service.deploySystem(:systemName=>'systemName', :configXML=>systemDef, :userId=>'userId', :password=>'password');
2. Starting a system
require 'soap/wsdlDriver' URL = 'https://imod.kaavo.com/api/KaavoWebServices?wsdl' service = SOAP::WSDLDriverFactory.new(URL).create_rpc_driver service.startSystem(:systemName=>'systemName', :userId=>'userId', :password=>'password');
3. Scheduling an event
require 'soap/wsdlDriver' URL = 'https://imod.kaavo.com/api/KaavoWebServices?wsdl' service = SOAP::WSDLDriverFactory.new(URL).create_rpc_driver res = service.scheduleEvent( :systemName=>'systemName', :eventName=>'eventName', :startDate=>Time.local(2010,6,30,0,3,12), :frequency=>'once', :contextParamString=>, :userId=>'userId', :password=>'password' );
Perl Examples
1. Firing an event
use SOAP::Lite +trace=>'all';
my $soap = SOAP::Lite->proxy('https://imod.kaavo.com/api/KaavoWebServices?wsdl');
$soap->ns('http://webservices.kaavo.com/');
$soap->call("startSystem"
SOAP::Data->name('systemName'=>'systemName'),
SOAP::Data->name('userId'=>'userId'),
SOAP::Data->name('password'=>'password')
);
![[Wiki Home]](/skins/common/images/wiki.png)