Use this object to manage existing templates.
|
Method |
Description |
|
Retrieve list of application templates |
|
|
Retrieve application template information |
|
|
Rename an application template |
|
|
Destroy an application template |
|
|
Import an application template |
|
|
Export an application template |
|
|
Copy an application template |
|
|
Migrate a template from a remote grid |
|
|
Retrieve application template configuration parameters |
|
|
Retrieve application template boundary |
|
|
Lock an application template |
|
|
Unlock an application template |
|
|
Retrieve template ACL. |
|
|
Replace entire template ACL |
|
|
Replace a portion of template ACL |
Retrieve list of application templates
/api/v2/template/list?vdc=controller-name
Name of the target virtual data center
synchronous
GET
Retrieve list of application templates
GET http://192.168.123.200/api/v2/template/list?vdc=mygrid
<templates> template> name>TWiki_r11</name> description>TWiki 4.3.1 collaboration platform (v4.3.1-7)</description> destroy_on_stop>0</destroy_on_stop> doc_url>http://doc.3tera.net/AppLogic29/RefAppsTWiki4.html</doc_url> id>2</id> state>stopped</state> template>0</template> user1></user1> user2></user2> </template> . . . </templates>
{
"template" : [
{
"template" : "0",
"user1" : "",
"name" : "TWiki_r11",
"description" : "TWiki 4.3.1 collaboration platform (v4.3.1-7)",
"state" : "stopped",
"doc_url" : "http://doc.3tera.net/AppLogic29/RefAppsTWiki4.html",
"destroy_on_stop" : "0",
"id" : "2",
"user2" : ""
},
.
.
.
}
Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.
Retrieve application template info
/api/v2/template/info?template=template&vdc=controller-name
Name of the application template
Name of the target virtual data center
synchronous
GET
Retrieve information for an application template named
VDS_CentOS51_r15. GET http://192.168.123.200/api/v2/template/info?template=VDS_CentOS51_r15&vdc=mygrid
<template> <name>VDS_CentOS51_r15</name> <bw>1000000</bw> <cpu>0.25</cpu> <description>Virtual Dedicated Server - Based on CentOS 5.1 (v1.0.14-1)</description> <destroy_on_stop>0</destroy_on_stop> <dflt_appliance></dflt_appliance> <dflt_appliance_opts></dflt_appliance_opts> <doc_url>http://doc.3tera.net/AppLogic27/RefAppsVdsLinux.html</doc_url> <id>12</id> <incomplete>0</incomplete> <locked>0</locked> <mem>268435456</mem> <state>stopped</state> <template>0</template> <user1></user1> <user2></user2> </template>
{
"locked" : "0",
"template" : "0",
"cpu" : "0.25",
"user1" : "",
"name" : "VDS_CentOS51_r15",
"dflt_appliance" : "",
"description" : "Virtual Dedicated Server - Based on CentOS 5.1 (v1.0.14-1)",
"state" : "stopped",
"bw" : "1000000",
"incomplete" : "0",
"doc_url" : "http://doc.3tera.net/AppLogic27/RefAppsVdsLinux.html",
"dflt_appliance_opts" : "",
"destroy_on_stop" : "0",
"id" : "12",
"mem" : "268435456",
"user2" : ""
}
Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.
Missing required arguments (template). - Argument template=template missing in the request.
Application VDS_CentOS_r1 does not exist. - Template specified in the request does not exist on the VDC.
Rename an application template
/api/v2/template/rename?template=template&new_name=new-template&vdc=controller-name
Name of the template to be renamed
New name of the template
Name of the target virtual data center
synchronous
GET
Rename a template named TWiki_r4 to TWiki_r5.
GET http://192.168.123.200/api/v2/template/rename?template=TWiki_r4&new_name=TWiki_r5&vdc=mygrid
<message></message>
{
"message" :""
}
Entity vdc mygrid not found. - A VDC name was specified that is not configured in the WS_API application.
Missing required arguments (template). - Argument template=template missing in the request.
Missing required arguments (new_name). - Argument new_name=new-name missing in the request.
Entity not found – Permission Denied – application VDS_CentOS_r1 does not exist.
Destroy an application template
/api/v2/template/destroy?template=application&vdc=controller-name
Name of the application template to be destroyed
Name of the target virtual data center
asynchronous
GET
Destroy an application template named test.
GET http://192.168.123.200/api/v2/template/destroy?template=test&vdc=mygrid
<job>be805915-76b2-48c8-b8a0-b881cca66da6</job>
{
"job" : "be805915-76b2-48c8-b8a0-b881cca66da6"
}
Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.
Missing required arguments (template). - Argument template=app 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.
Import an application template.
/api/v2/template/import?template=application&target=directory-or-file&vdc=controller-name
Name of the application template
vdc
Name of the target Virtual Data Center
asynchronous
GET
Import application template named test
GET http://192.168.123.200/api/v2/template/import?template=test&vdc=mygrid
<job>be805915-76b2-48c8-b8a0-b881cca66da6</job>
{
"job" : "be805915-76b2-48c8-b8a0-b881cca66da6"
}
All the output in JSON is UTF8 encoded. Use a UTF8 decode to decode the UTF8 encoded output.
The following is an example of a simple PHP script to decode UTF8 encoded JSON output:
<?
$json = '{"a": "\u00e3\u0081\u0082" }';
$j = json_decode($json);
echo utf8_decode($j->{'a'});
?>
Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.
Missing required arguments (template). - Argument template=app missing in the request.
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 job object.
Export an application template.
/api/v2/template/export?template=application&target=directory-or-file&vdc=controller-name
Name of the application template
Name of the target Virtual Data Center
asynchronous
GET
Export application template named test
GET http://192.168.123.200/api/v2/template/export?template=test&vdc=mygrid
XML
<job>be805915-76b2-48c8-b8a0-b881cca66da6</job>
JSON
{
"job" : "be805915-76b2-48c8-b8a0-b881cca66da6"
}
All the output in JSON is UTF8 encoded. Use a UTF8 decode to decode the UTF8 encoded output.
The following is an example of a simple PHP script to decode UTF8 encoded JSON output:
<?
$json = '{"a": "\u00e3\u0081\u0082" }';
$j = json_decode($json);
echo utf8_decode($j->{'a'});
?>
Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.
Missing required arguments (template). - Argument template=app missing in the request.
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 job object.
Copy an application template
/api/v2/template/copy?template=application&new_name=new-application&vdc=controller-name
Name of the application template to be copied
Name of the new application template
Name of the target virtual data center
asynchronous
GET
Copy an application template named test to test2.
GET http://192.168.123.200/api/v2/template/copy?template=test&new_name=test2&vdc=mygrid
<job>be805915-76b2-48c8-b8a0-b881cca66da6</job>
{
"job" : "be805915-76b2-48c8-b8a0-b881cca66da6"
}
Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.
Missing required arguments (template). - Argument template=app missing in the request.
Missing required arguments (new_name). - Argument new=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.
Migrate an application template from a remote grid
/api/v2/template/migrate?grid=remote-grid&template=application&vdc=controller-name
Controller IP or FQDN of a remote grid
Name of the application template to be migrated
Name of the target virtual data center
See Application Control in the Command Line Shell Reference for descriptions of the options available for this command.
Note: The migrate method does not support SSH agent forwarding.
asynchronous
GET
Migrate an application template named test from remote-grid.mygrid.net.
GET http://192.168.123.200/api/v2/template/migrate?grid=remote-grid.mygrid.net&template=test&vdc=mygrid
<job>be805915-76b2-48c8-b8a0-b881cca66da6</job>
{
"job" : "be805915-76b2-48c8-b8a0-b881cca66da6"
}
Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.
Missing required arguments (template). - Argument template=app missing in the request.
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.
Retrieve application template configuration parameters
/api/v2/template/config?template=template&vdc=controller-name
Name of the application template
Name of the target virtual data center
See Application Control in the Command Line Shell Reference for descriptions of the options available for this command.
Note: The template object in the Web Services API relates to the application object of the shell.
synchronous
GET
Retrieve configuration parameters for template VDS_CentOS51_r15.
GET http://192.168.123.200/api/v2/template/config?template=VDS_CentOS51_r15&vdc=mygrid
<config> <name>VDS_CentOS51_r15</name> <__description>Virtual Dedicated Server - Based on CentOS 5.1 (v1.0.14-1)</__description> <__doc_url>http://doc.3tera.net/AppLogic27/RefAppsVdsLinux.html</__doc_url> <__template>0</__template> </config>
{
"__doc_url" : "http://doc.3tera.net/AppLogic27/RefAppsVdsLinux.html",
"__template" : "0",
"__description" : "Virtual Dedicated Server - Based on CentOS 5.1 (v1.0.14-1)",
"name" : "VDS_CentOS51_r15"
}
Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.
Missing required arguments (template). - Argument template=template missing in the request.
Entity not found – Permission Denied – application VDS_CentOS_r1 does not exist.
Note: This method has been deprecated and is included here for compatibility with existing user scripts. New users should use the config command with the option flag &boundary.
Retrieve application template boundary
/api/v2/template/config_boundary?template=template&vdc=controller-name
Name of the application template
Name of the target virtual data center
synchronous
GET
Retrieve boundary for application template VDS_CentOS51_r15.
GET http://192.168.123.200/api/v2/template/config_boundary?template=VDS_CentOS51_r15&vdc=mygrid
Sample Output
<boundary>
<interface>
<name>ext</name>
</interface>
<name>main</name>
<properties>
<property>
<mandatory>1</mandatory>
<name>mode</name>
<type>string</type>
<values>manual|format|fscopy|fsck|fsrepair</values>
</property>
<property>
<dflt></dflt>
<name>fs_type_src</name>
<type>string</type>
<values>ext2|ext3|ext4|fat16|fat32|reiserfs|swap|ext3-snapshot|iso9660|partitioned|ufssol|zfs|raw</values>
</property>
.
.
.
</properties>
<resources>
<resource>
<dflt>512M</dflt>
<max>1024M</max>
<min>160M</min>
<name>mem</name>
</resource>
.
.
.
</resources>
<volume>
<name>dst</name>
</volume>
</boundary>
{
"resource" : [
{
"min" : "160M",
"max" : "1024M",
"name" : "mem",
"dflt" : "512M"
},
{
"min" : "1000K",
"max" : "1000K",
"name" : "bw",
"dflt" : "1000K"
}
],
"volume" : {
"name" : "dst"
},
"interface" : {
"name" : "ext"
},
"name" : "main",
"property" : [
{
"name" : "mode",
"type" : "string",
"values" : "manual|format|fscopy|fsck|fsrepair",
"mandatory" : 1
},
{
"name" : "adv_options",
"type" : "string",
"dflt" : ""
}
]
}
Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.
Missing required arguments (template). - Argument template=template missing in the request.
Entity not found – Permission Denied – application VDS_CentOS_r1 does not exist.
Lock an application template
/api/v2/template/lock?template=template&pwd=password&vdc=controller-name
Name of the application template
Password
Name of the target virtual data center
synchronous
GET
Lock application template VDS_CentOS51_r15.
GET http://192.168.123.200/api/v2/template/lock?template=VDS_CentOS51_r15&pwd=password&vdc=mygrid
<message></message>
{
"message" :""
}
Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.
Missing required arguments (template). - Argument template=template missing in the request.
Missing required arguments (pwd). - Argument password=password missing in the request.
Permission Denied for ‘lock’ access on object ‘application’ with name ‘VDS_CentOS55_r5’.
Entity not found – Permission Denied – application VDS_CentOS_r1 does not exist.
Note: The password that is used to lock a template application is required to unlock the application. When a template application is locked, no volumes belonging to the application may be managed and the application cannot be modified in any way.
Unlock an application template
/api/v2/template/unlock?template=template&pwd=password&vdc=controller-name
Name of the application template
Password
Name of the target virtual data center
synchronous
GET
Unlock application template VDS_CentOS51_r15.
GET http://192.168.123.200/api/v2/template/unlock?template=VDS_CentOS51_r15&pwd=password&vdc=mygrid
<message></message>
{
"message" :""
}
Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.
Missing required arguments (template). - Argument template=template missing in the request.
Missing required arguments (pwd). - Argument password=password missing in the request.
Permission Denied for ‘lock’ access on object ‘application’ with name ‘VDS_CentOS55_r5’.
Entity not found – Permission Denied – application VDS_CentOS_r1 does not exist.
Note: If the application was locked with a password, the passwords must match. If the application was locked without a password, then only an administrator may unlock the application.
Retrieve the template ACL, or portion of the template ACL which relates to a particular principal.
/api/v2/template/get_acl?template=template&principal=<principal>&vdc=controller-name
Name of the template
A URL-encoded principal
Name of the target virtual data center
synchronous
GET
Example: Retrieve application ACL
Retrieve application ACL for template VDS_CentOS.
GET http://192.168.123.200/api/v2/template/get_acl?template=VDS_CentOS&principal=&vdc=mygrid
<acl>
<entries>
<entry>
<configure>1</configure>
<id>778fee4e-9b83-4160-8b79-8bb0e1a87af8</id>
</entry>
</entries>
<owner>
<id></id>
</owner>
</acl>
{
"acl" : {
"owner" : {
"id" : ""
},
"entries" : [
{
"configure" : 1,
"id" : "778fee4e-9b83-4160-8b79-8bb0e1a87af8"
}
]
}
}
Example: Display the ACL data for principal
Display the ACL data for principal local:user:api@3tera.com for template VDS_CentOS
GET http://192.168.123.200/api/v2/template/get_acl?template=VDS_CentOS&principal=local%3Auser%3Aapi%403tera.com&vdc=mygrid
<acl>
<entries>
<entry>
<configure>1</configure>
<id>778fee4e-9b83-4160-8b79-8bb0e1a87af8</id>
</entry>
</entries>
<owner>
<id></id>
</owner>
</acl>
{
"acl" : {
"owner" : {
"id" : ""
},
"entries" : [
{
"configure" : 1,
"id" : "778fee4e-9b83-4160-8b79-8bb0e1a87af8"
}
]
}
}
Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.
Missing required arguments (template)
- Argument app=app missing
Missing required arguments (principal)
- Argument principal=principal missing
Entity not found - Application test does not exist.
- A template was specified that does not exist on mygrid.
Entity not found - Failed to retrieve application ACL - ACL does not contain principal local user 'test@3tera.com'.
- An invalid principal was specified
Note: This API is available with WS_API_r6-1.0.6-1 and above.
Replace the entire template ACL.
/api/v2/template/put_acl?template=template&owner=<owner>&acl=<ACLs>&vdc=controller-name
Name of the template
A URL-encoded owner attribute of the grid ACL to the specified principal
URL-encoded list of principals separated with a slash (/)
Name of the target virtual data center
synchronous
GET
Replace the entire ACL for template application VDS_CentOS with an owner api@3tera.com
GET http://192.168.123.200/api/v2/template/put_acl?template=VDS_CentOS&owner=local%3Auser%3Aapi%403tera.com&acl=&vdc=mygrid
Replace the entire ACL for template application VDS_CentOS with an owner api@3tera.com and principal local:user:api@3tera.com=full
GET http://192.168.123.200/api/v2/template/put_acl?template=VDS_CentOS&owner=local%3Auser%3Aapi%403tera.com&acl=local%3Auser%3Aapi%403tera.com%3Dfull&vdc=mygrid
Replace the entire ACL for template application VDS_CentOS with an owner api@3tera.com and principal local:user:api@3tera.com=full/local:user:test@3tera.com=configure.
GET http://192.168.123.200/api/v2/template/put_acl?template=VDS_CentOS&owner=local%3Auser%3Aapi%403tera.com&acl=local%3Auser%3Aapi%403tera.com%3Dfull%2Flocal%3Auser%3Atest%403tera.com%3Dconfigure&vdc=mygrid
JSON
{
"message" : ""
}
XML
<message></message>
Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.
Missing required arguments (template)
- Argument template=template missing
Missing required arguments (owner)
- Argument owner=owner
Missing required arguments (acl)
- Argument acl=acl missing
Entity not found - Application test does not exist.
- A template was specified that does not exist on mygrid.
Entity not found - Failed to put application ACL - invalid principal data - principal local user 'test@3tera.com' does not exist.
- An invalid owner or acl was specified
Replace that portion of the template ACL which relates to the owner or a principal.
/api/v2/template/modify_acl?template=template&acl=<ACLs>&vdc=controller-name
Name of the template
URL-encoded list of principals separated with a slash (/)
Name of the target virtual data center
synchronous
GET
Modify the ACL for template application VDS_CentOS by replacing the owner with api@3tera.com
GET http://192.168.123.200/api/v2/template/modify_acl?template=VDS_CentOS&acl=local%3Auser%3Aapi%403tera.com%3Downer&vdc=mygrid
Modify the ACL for template application VDS_CentOS by replacing the owner api@3tera.com and principal local:user:api@3tera.com=full
GET http://192.168.123.200/api/v2/template/modify_acl?template=VDS_CentOS&acl=local%3Auser%3Aapi%403tera.com%3Downer%2Flocal%3Auser%3Aapi%403tera.com%3Dfull&vdc=mygrid
Modify the ACL for template application VDS_CentOS by replacing the access levels for test@3tera.com and api@3tera.com and principal local:user:api@3tera.com=configure/local:user:test@3tera.com=read.
GET http://192.168.123.200/api/v2/template/modify_acl?template=VDS_CentOS&acl=local%3Auser%3Aapi%403tera.com%3Dconfigure%2Flocal%3Auser%3Atest%403tera.com%3Dread&vdc=mygrid
Entity vdc mygrid not found - A VDC name was specified that is not configured in the WS_API application.
Missing required arguments (template)
- Argument template=template missing
Missing required arguments (acl)
- Argument acl=acl missing
Entity not found - Template VDS_CentOS does not exist.
- An application template was specified that does not exist on mygrid.
Entity not found - Failed to put template ACL - invalid principal data - principal local user 'test@3tera.com' does not exist.
- An invalid owner or acl was specified
{
"message" : ""
}
<message></message>
Note: This API is available with WS_API_r6-1.0.6-1 and above.
|
Copyright © 2013 CA Technologies.
All rights reserved.
|
|