Previous Topic: cat ObjectNext Topic: group Object


class Object

Use this object to manage class objects on a VDC.

Method

Description

list

Retrieve list of classes in a package

move

Move an appliance class from one catalog to another

copy

Copy a class from one package to another

destroy

Destroy a class

lock

Lock a class

unlock

Unlock a class

migrate

Migrate an appliance class from a remote grid

export

Export a class

import

Import a class

get_desc

Retrieve class descriptor

put_desc

Replace class descriptor

list Method (class Object)
Description

Retrieve list of classes in a package

Syntax
/api/v2/class/list?class=class&vdc=controller-name 
Arguments
class

Name of the package

vdc

Name of the target virtual data center

Transaction Type

synchronous

Request Type

GET

Examples

Retrieve list of classes in /test.

GET http://192.168.123.200/api/v2/class/list?class=/filer&vdc=mygrid 
Sample Output
XML:

<catalog>
  <classes>
    <class>
      <category>Filer</category>
      <description>Linux Filer based on CentOS 6.3 x86_64 (v5.2.3-1)
</description>
      <locked>1</locked>
      <name>Filer_Linux</name>
    </class>
  </classes>
  <name>filer</name>
</catalog>
JSON:

{
   "name" : "filer",
   "class" : [
      {
         "locked" : 1,
         "name" : "Filer_Linux",
         "category" : "Filer",
         "description" : "Linux Filer based on CentOS 6.3 x86_64 (v5.2.3-1)"
      }
   ]
}
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 (class). - Argument class=entity missing in the request.

404.1

Application test does not exist. - Invalid application specified in the request.

404.1

Global catalog 'test' not found. - Invalid global catalog specified in the request.

move Method (class Object)
Description

Rename a class, or move a class from one package to another

Syntax
/api/v2/class/move?class=class&new_name=new-class&vdc=controller-name 
Arguments
class

Name of the class to be moved

new_name

Name of the new class

vdc

Name of the target virtual data center

Transaction Type

synchronous

Request Type

GET

Examples

Move /test:LUX5 to /test2:LUX5.

GET http://192.168.123.200/api/v2/class/move?class=/test:LUX5&new_name=/test2:LUX5&vdc=mygrid 
Sample Output
XML:
None
JSON:
None 

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 (class). - Argument class=entity missing in the request.

400.4

Missing required arguments (new_name). - Argument new_name=new-name missing in the request.

404.1

Could not find class LUX5 in source package. - Invalid class specified in the request.

404.1

Unable to move class '/system:LUX5' from read-only catalog 'system'. - Read-only source catalog specified in the request.

404.1

Unable to move class '/test:LUX5' into read-only catalog 'system'. - Read-only destination catalog specified in the request.

404.1

Global catalog 'test' not found. - Invalid source/destination catalog name specified in the request.

404.1

Failed to move volume boot. - Class volume is in-use or same source and destination catalog specified.

copy Method (class Object)
Description

Copy a class from one package to another

Syntax
/api/v2/class/copy?class=class&new_name=new-class&vdc=controller-name 
Arguments
class

Name of the class to be copied

new_name

Name of the new class

vdc

Name of the target virtual data center

Transaction Type

asynchronous

Request Type

GET

Examples

Copy /system:LUX5 to /test:LUX5.

GET http://192.168.123.200/api/v2/class/copy?class=/system:LUX5&new_name=/test: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 (class). - Argument class=entity missing in the request.

400.4

Missing required arguments (new_name). - Argument new_name=new-name 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.

destroy Method (class Object)
Description

Destroy a class

Syntax
/api/v2/class/destroy?class=class&vdc=controller-name 
Arguments
class

Name of the class to be destroyed

vdc

Name of the target virtual data center

Transaction Type

asynchronous

Request Type

GET

Examples

Destroy /test:LUX5.

GET http://192.168.123.200/api/v2/class/destroy?class=/test: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 (class). - Argument class=entity 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.

lock Method (class Object)
Description

Lock a class

Syntax
/api/v2/class/lock?class=class&pwd=password&vdc=controller-name 
Arguments
class

Name of the class to be locked

pwd

Password

vdc

Name of the target virtual data center

Transaction Type

synchronous

Request Type

GET

Examples

Lock class /test:IN.

GET http://192.168.123.200/api/v2/class/lock?class=/test:IN&pwd=password&vdc=mygrid 
Sample Output
XML:
<message></message>
JSON:
{
   "message" :""
}

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 (class). - Argument class=entity missing in the request.

400.4

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

404.1

Global catalog 'test' not found. - Invalid catalog specified in the request.

404.1

Class 'LUX' not found. - Invalid class specified in the request.

Note: The password specified to lock a class is required to unlock the class. When a class is locked, the following operations cannot be executed by non-administrators:

unlock Method (class Object)
Description

Unlock a class

Syntax
/api/v2/class/unlock?class=class&pwd=password&vdc=controller-name 
Arguments
class

Name of the class to be unlocked

pwd

Password

vdc

Name of the target virtual data center

Transaction Type

synchronous

Request Type

GET

Examples

Unlock class /test:IN.

GET http://192.168.123.200/api/v2/class/unlock?class=/test:IN&pwd=password&vdc=mygrid 
Sample Output
XML:
<message></message>
JSON:
{
   "message" :""
}

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 (class). - Argument class=entity missing in the request.

400.4

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

404.1

Global catalog 'test' not found. - Invalid catalog specified in the request.

404.1

Class 'LUX' not found. - Invalid class specified in the request.

Note: If the class was locked with a password, the passwords must match. If the class was locked without a password, then only an administrator may unlock the class.

migrate Method (class Object)
Description

Migrate a class from a remote grid

Syntax
/api/v2/class/migrate?grid=remote-grid&class=class&vdc=controller-name 
Arguments
grid

Controller IP or FQDN of the remote grid

class

Name of the class to be migrated

vdc

Name of the target virtual data center

Transaction Type

asynchronous

Request Type

GET

Examples

Migrate /test:LUX5 from remote-grid.mygrid.net

GET http://192.168.123.200/api/v2/class/migrate?grid=remote-grid.mygrid.net&class=/test: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 (class). - Argument class=entity missing in the request.

400.4

Missing required arguments (grid). - Argument grid=remote-grid 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.

export Method (class Object)
Description

Export a class

Syntax
/api/v2/class/export?class=class&dir=directory&vdc=controller-name 
Arguments
class

Name of the class

dir

Name of exchange directory relative to /vol/_impex where class is to be exported to

vdc

Name of the target virtual data center

Transaction Type

asynchronous

Request Type

GET

Examples

Export /test:LUX5

GET http://192.168.123.200/api/v2/class/export?class=/test:LUX5&dir=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 (class,dir) - Argument class=class and dir=dir missing

400.4

Missing required arguments (class) - Argument class=class missing

400.4

Missing required argument (dir) - Argument dir=dir missing

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.

import Method (class Object)
Description

Import a class

Syntax
/api/v2/class/import?class=class&dir=directory&vdc=controller-name 
Arguments
class

Name of the class

dir

Name of exchange directory relative to /vol/_impex where class is to be exported to

vdc

Name of the target virtual data center

Transaction Type

asynchronous

Request Type

GET

Examples

Import /test:LUX5

GET http://192.168.123.200/api/v2/class/import?class=/test:LUX5&dir=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 (class,dir) - Argument class=class and dir=dir missing

400.4

Missing required arguments (class) - Argument class=class missing

400.4

Missing required argument (dir) - Argument dir=dir missing

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.

get_desc Method (class Object)
Description

Display class descriptor

Syntax
/api/v2/class/get_desc?class=class&vdc=controller-name 
Arguments
class

Name of the class

vdc

Name of the target virtual data center

Transaction Type

synchronous

Request Type

GET

Examples

Display descriptor for /test:LUX5

GET http://192.168.123.200/api/v2/class/get_desc?class=/test:LUX5&vdc=mygrid 
Sample Output
XML:
<message>component LUX5 
   { 
   .category         = Generic 
   .description      = &quot;Generic Linux Appliance - based on CentOS 5.4 (v1.3.1-1)&quot; 
   .doc_url          = &quot;http://doc.3tera.com/AppLogic29/CatGenericLux.html&quot; 
   .config_mode      = dhcp 
   .migrateable      = 1 
 
   volume boot       : class               , boot           , dev  = /dev/hda1 , type = instantiable 
   volume usr        : class               , shared         , ro               , dev  = /dev/hda2    , type = common 
 
   resource cpu      : min      = 0.05     , max      = 4   , dflt = 0.05 
   resource mem      : min      = 64M      , max      = 2G  , dflt = 128M 
   resource bw       : min      = 1M       , max      = 2G  , dflt = 100M 
 
   input in          : protocol = any 
   output out        : protocol = any 
   output net        : gateway             , protocol = any 
   output mon        : protocol = cce 
 
   interface default 
 
   virtualization    : mode     = paravirt 
      { 
      console       = &quot;ssh:22,text&quot; 
      device_schema = /dev/hdaX 
      } 
 
   visual 
      { 
      color      = gray 
      style      = small 
      size       = 3 
      east       = ooo 
      west       = i 
      picture    = linux 
 
      output out : orient = east 
      input in   : orient = west 
      output mon : orient = east 
      output net : orient = east 
      } 
   } 
</message>
JSON:
{ 
   "message" : "component LUX5\n   {\n   .category         = Generic\n   .description      = \"Generic Linux Appliance - based on CentOS 5.4 (v1.3.1-1)\"\n   .doc_url          = \"http://doc.3tera.com/AppLogic29/CatGenericLux.html\"\n   .config_mode      = dhcp\n   .migrateable      = 1\n\n   volume boot       : class               , boot           , dev  = /dev/hda1 , type = instantiable\n   volume usr        : class               , shared         , ro               , dev  = /dev/hda2    , type = common\n\n   resource cpu      : min      = 0.05     , max      = 4   , dflt = 0.05\n   resource mem      : min      = 64M      , max      = 2G  , dflt = 128M\n   resource bw       : min      = 1M       , max      = 2G  , dflt = 100M\n\n   input in          : protocol = any\n   output out        : protocol = any\n   output net        : gateway             , protocol = any\n   output mon        : protocol = cce\n\n   interface default\n\n   virtualization    : mode     = paravirt\n      {\n      console       = \"ssh:22,text\"\n      device_schema = /dev/hdaX\n      }\n\n   visual\n      {\n      color      = gray\n      style      = small\n      size       = 3\n      east       = ooo\n      west       = i\n      picture    = linux\n\n      output out : orient = east\n      input in   : orient = west\n      output mon : orient = east\n      output net : orient = east\n      }\n   }\n" 
}

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 (class) - Argument class=class missing

404.1

Global catalog 'test' not found - Invalid catalog specified

404.1

Catalog class 'LUX' not found - Invalid class specified

put_desc Method (class Object)
Description

Replace class descriptor

Syntax
/api/v2/class/put_desc?vdc=controller-name -F class=classname -F desc=@descriptor-file

Arguments
class

Name of the class

desc

Name of the descriptor file

vdc

Name of the target virtual data center

Transaction Type

synchronous

Request Type

POST: multipart/form-data

Examples

Replace descriptor for /test:LUX5

POST http://192.168.123.200/api/v2/class/put_desc?vdc=mygrid -F class=class -F desc=@desc.txt

Sample Output
XML:
<message></message>
JSON:
{ 
   "message" : "" 
}

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 (class) - Argument class=class missing

404.1

Failed to put descriptor for '/test:LUX5' - Failed to retrieve descriptor from standard input. - Argument desc=descriptor-file missing

404.1

Global catalog 'test' not found - Invalid catalog specified

404.1

Catalog class 'LUX' not found - Invalid class specified

Note: Currently only requests of type “multipart/form-data” are supported. The descriptor file is expected to be UDL compliant.