Previous Topic: app ObjectNext Topic: iface Object


comp Object

Use this object to manage components on a VDC.

Method

Description

list

Retrieve list of application components

info

Retrieve component information

exec

Run a shell command on a specified application component

start

Start a component

stop

Stop a component

continue

Continue starting of component

restart

Restart a component

list Method (comp Object)
Description

Retrieve list of application components

Syntax
/api/v2/comp/list?app=application&vdc=controller-name 
Arguments
app

Name of the application

vdc

Name of the target virtual data center

Transaction Type

synchronous

Request Type

GET

Examples

Retrieve list of components in application test.

GET http://192.168.123.200/api/v2/comp/list?app=test&vdc=mygrid 
Sample Output
XML:
<application>
   <name>Lamp</name>
   <components>
       <component>
         <name>main.admin</name>
         <bw>50000000</bw>
         <cpu>0.05</cpu>
         <mem>67108864</mem>
         <server>srv2</server>
         <state>running</state>
      </component>
      <component>
          <name>main.config</name>
         <bw>150000000</bw>
          <cpu>0.20</cpu>
         <mem>268435456</mem>
          <server>srv3</server>
         <state>running</state>
      </component>
      <component>
         <name>main.dbase</name>
         <bw>100000000</bw>
         <cpu>0.40</cpu>
         <mem>536870912</mem>
         <server>srv1</server>
         <state>running</state>
      </component>
         .
         .
         .
   </components>
</application>
JSON:
{
   "component" : [
       {
         "bw" : "50000000",
   nbsp;     "cpu" : "0.05",
         "name" : "main.admin",
         "mem" : "67108864",
         "server" : "srv2",
         "state" : "running"
       },
      {
   
      "bw" : "150000000",
         "cpu" : "0.20",
         "name" : "main.config",
         "mem" : "268435456",
         "server" : "srv3",
         "state" : "running"
       },
      {
         "bw" : "100000000",
         "cpu" : "0.40",
         "name" : "main.dbase",
         "mem" : "536870912",
         "server" : "srv1",
         "state" : "running"
       },
      .
      .
      .
   ],
   "name" : "Lamp"
} 

HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (app). - Argument app=app is missing from the request.

404.1

Failed to list components for application 'test' - it is not installed. - An invalid application name was specified in the request.

404.1

Failed to list components for application 'ws_api' - get info failed - may be due to it not running. Component list is requested for an application in stopped state.

info Method (comp Object)
Description

Retrieve component information

Syntax
/api/v2/comp/info?app=application&comp=component&vdc=controller-name 
Arguments
app

Name of the application

comp

Name of the component

vdc

Name of the target virtual data center

Transaction Type

synchronous

Request Type

GET

Examples

Retrieve information for main.LUX5 in application test.

GET http://192.168.123.200/api/v2/comp/info?app=test&comp=main.LUX5&vdc=mygrid 
Sample Output
XML:
<component> 
   <name>main.vds64_centos50</name> 
   <bw>250000000</bw> 
   <class>.LUX5</class> 
   <console_options>ssh:22,text</console_options> 
   <cpu>0.25</cpu> 
   <dflt_ip>10.144.12.1</dflt_ip> 
   <mem>268435456</mem> 
   <mem_service>0</mem_service> 
   <os_guess>Linux</os_guess> 
   <os_kernel>Linux 2.6.18.8-xenU #1 SMP Mon Aug 18 14:00:41 PDT 2008</os_kernel> 
   <os_name>!CentOS</os_name> 
   <os_type>Linux</os_type> 
   <os_version>5</os_version> 
   <pv_driver>unknown</pv_driver> 
   <server>srv1</server> 
   <state>running</state> 
   <t_start>1271891904</t_start> 
   <t_state_chg>1271891904</t_state_chg> 
</component> 
JSON:
{ 
   "os_guess" : "Linux", 
   "state" : "running", 
   "pv_driver" : "unknown", 
   "os_version" : "5", 
   "server" : "srv1", 
   "os_type" : "Linux", 
   "t_state_chg" : "1272066766", 
   "console_options" : "ssh:22,text", 
   "dflt_ip" : "10.144.12.1", 
   "cpu" : "0.25", 
   "os_name" : "CentOS", 
   "name" : "main.vds64_centos50", 
   "mem_service" : "0", 
   "bw" : "250000000", 
   "os_kernel" : "Linux 2.6.18.8-xenU #1 SMP Mon Aug 18 14:00:41 PDT 2008", 
   "t_start" : "1272066766", 
   "mem" : "268435456", 
   "class" : ".VDS64_CENTOS50" 
} 

HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (app). - Argument app=app missing in the request.

400.4

Missing required arguments (comp). - Argument comp=comp missing in the request.

404.1

Failed to display info for component test:main.srv - does not exist. - Application/component specified in the request is invalid or not running.

exec Method (comp Object)
Description

Run a shell command on a specified application component.

Syntax

/api/v2/comp/exec?app=test&comp=component&cmd=command&vdc=controller-name

Arguments
app

Name of the application

comp

Name of the component

cmd

Shell command to run.

vdc

Name of the target virtual data center

Transaction Type

synchronous

Request Type

GET

Examples

Run the ‘vmstat’ command on component test::mon.

GET http://192.168.123.200/api/v2/comp/exec?app=test&comp=main.mon&cmd=’vmstat’&vdc=mygrid

HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (app). - Argument app=app missing in the request.

400.4

Missing required arguments (comp). - Argument comp=comp missing in the request.

404.1

Application test does not exist. - An invalid application name was specified in the request.

404.1

Component main.mon does not exist. - An invalid component name was specified in the request.

Note: The command will not run unless an ACL is set on the application that contains the target component to authorize the user representing the Web Services API to control the application.

start Method (comp Object)
Description

Start a component

Syntax
/api/v2/comp/start?app=application&comp=component&vdc=controller-name 
Arguments
app

Name of the application

comp

Name of the component

vdc

Name of the target virtual data center

Transaction Type

asynchronous

Request Type

GET

Examples

Start main.LUX5 in application test.

GET http://192.168.123.200/api/v2/comp/start?app=test&comp=main.LUX5&vdc=mygrid 
Sample Output
XML:
<job>be805915-76b2-48c8-b8a0-b881cca66da6</job>
JSON:
{
   "job" : "be805915-76b2-48c8-b8a0-b881cca66da6"
} 

HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (app). - Argument app=app missing in the request.

400.4

Missing required arguments (comp). - Argument comp=comp missing in the request.

Note: To get the status of job, issue a /api/v2/job/info? request with the job_id returned above as the argument. For more information about how to obtain the job status, refer to the job object.

stop Method (comp Object)
Description

Stop a component

Syntax
/api/v2/comp/stop?app=application&comp=component&vdc=controller-name 
Arguments
app

Name of the application

comp

Name of the component

vdc

Name of the target virtual data center

Transaction Type

asynchronous

Request Type

GET

Examples

Stop main.LUX5 in application test.

GET http://192.168.123.200/api/v2/comp/stop?app=test&comp=main.LUX5&vdc=mygrid 
Sample Output
XML:
<job>be805915-76b2-48c8-b8a0-b881cca66da6</job>
JSON:
{
   "job" : "be805915-76b2-48c8-b8a0-b881cca66da6"
} 

HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (app). - Argument app=app missing in the request.

400.4

Missing required arguments (comp). - Argument comp=comp missing in the request.

Note: To get the status of job, issue a /api/v2/job/info? request with the job_id returned above as the argument. For more information about how to obtain the job status, refer to the job object.

continue Method (comp Object)
Description

Continue starting of a component

Syntax
/api/v2/comp/continue?app=application&comp=component&vdc=controller-name 
Arguments
app

Name of the application

comp

Name of the component

vdc

Name of the target virtual data center

Transaction Type

asynchronous

Request Type

GET

Examples

Continue starting of main.LUX5 in application test.

GET http://192.168.123.200/api/v2/comp/continue?app=test&comp=main.LUX5&vdc=mygrid 
Sample Output
XML:
<job>be805915-76b2-48c8-b8a0-b881cca66da6</job>
JSON:
{
   "job" : "be805915-76b2-48c8-b8a0-b881cca66da6"
} 

HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (app). - Argument app=app missing in the request.

400.4

Missing required arguments (comp). - Argument comp=comp missing in the request.

Note: To get the status of job, issue a /api/v2/job/info? request with the job_id returned above as the argument. For more information about how to obtain the job status, refer to the job object.

restart Method (comp Object)
Description

Restart a component

Syntax
/api/v2/comp/restart?app=application&comp=component&vdc=controller-name 
Arguments
app

Name of the application

comp

Name of the component

vdc

Name of the target virtual data center

Transaction Type

asynchronous

Request Type

GET

Examples

Restart main.LUX5 in application test.

GET http://192.168.123.200/api/v2/comp/restart?app=test&comp=main.LUX5&vdc=mygrid 
Sample Output
XML:
<job>be805915-76b2-48c8-b8a0-b881cca66da6</job>
JSON:
{
   "job" : "be805915-76b2-48c8-b8a0-b881cca66da6"
} 

HTTP Error Codes
404

Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.

400.4

Missing required arguments (app). - Argument app=app missing in the request.

400.4

Missing required arguments (comp). - Argument comp=comp missing in the request.

Note: To get the status of job, issue a /api/v2/job/info? request with the job_id returned above as the argument. For more information about how to obtain the job status, refer to the job object.