Abiquo 2.6


Skip to end of metadata
Go to start of metadata

Template Definition Resource

Exposed Resources Hierarchy
Template Definition Resource

Contents:

Main URI of the Resource

This class operates mainly over the Resource URI: /admin/enterprises/{enterprise}/appslib/templateDefinitions

Exposed Methods

Retrieve all the template definitions

This method retrieves all the Template Definitions for a given enterprise, including those the being used in any Template Definition List.

Synopsis: GET http://example.com/api/admin/enterprises/{enterprise}/appslib/templateDefinitions
Roles Required: ROLE_APPLIB_ALLOW_MODIFY
Request Headers: Accept: application/vnd.abiquo.templatedefinitions+xml; version=2.4; Content-type: ;
Request Parameters:

Parameter

Required

Default Value

Description

 

 

 

 

Request Message Body Entity:
Response Message Body Entity: TemplateDefinitions Media Type
Request Example:

 Click here to show or hide the request example
Retrieve all the template definitions example
curl --verbose -u admin:xabiquo -X GET 'http://localhost/api/admin/enterprises/1/appslib/templateDefinitions'

> GET /api/admin/enterprises/1/appslib/templateDefinitions HTTP/1.1
> Authorization: Basic YWRtaW46eGFiaXF1bw==
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: localhost
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: Apache-Coyote/1.1
< Set-Cookie: auth=YWRtaW46MTM1OTc0NTY0NTAxODozYTc1YWNkZmQ4ZTEzODZlNTYxODk2YmVlZTAzMmUyYTpBQklRVU8; Expires=Fri, 01-Feb-2013 19:07:25 GMT; Path=/api
< Set-Cookie: JSESSIONID=8AD80A529AAAECBCFEB5B0537702C9B0.nodeAlbert; Path=/api
< Content-Type: application/vnd.abiquo.templatedefinitions+xml;version=2.4
< Content-Length: 5544
< Date: Fri, 01 Feb 2013 18:37:25 GMT
< 
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<templateDefinitions>
  <templateDefinition>
    <link title="OS" rel="category"
    type="application/vnd.abiquo.category+xml"
    href="http://localhost:80/api/config/categories/9" />
    <link rel="edit"
    type="application/vnd.abiquo.templatedefinition+xml"
    href="http://localhost:80/api/admin/enterprises/1/appslib/templateDefinitions/110" />
    <link rel="enterprise"
    type="application/vnd.abiquo.enterprise+xml"
    href="http://localhost:80/api/admin/enterprises/1" />
    <id>110</id>
    <url>
    http://abiquo-repository.abiquo.com/centos5/centos5.ovf</url>
    <name>Centos 5.6 x86_64</name>
    <description>Centos 5. Log in as 'root' with password
    'abiquo'.</description>
    <productName>Centos 5.6 x86_64</productName>
    <iconUrl>
    http://abiquo-repository.s3.amazonaws.com/centos5/centos.png</iconUrl>
    <diskFormatType>QCOW2_SPARSE</diskFormatType>
    <diskFileSize>614</diskFileSize>
    <osType>UNRECOGNIZED</osType>
  </templateDefinition>
  <templateDefinition>
    <link title="OS" rel="category"
    type="application/vnd.abiquo.category+xml"
    href="http://localhost:80/api/config/categories/9" />
    <link rel="edit"
    type="application/vnd.abiquo.templatedefinition+xml"
    href="http://localhost:80/api/admin/enterprises/1/appslib/templateDefinitions/111" />
    <link rel="enterprise"
    type="application/vnd.abiquo.enterprise+xml"
    href="http://localhost:80/api/admin/enterprises/1" />
    <id>111</id>
    <url>
    http://abiquo-repository.abiquo.com/ubuntu-9.04/ubuntu-9.04-i386-sparse.1.5.ovf</url>
    <name>Ubuntu Linux 9.04 32 bits</name>
    <description>Ubuntu is a computer operating system based on the
    Debian Linux distribution. Ubuntu provides an up-to-date,
    stable operating system for the average user, with a strong
    focus on usability and ease-of-installation. Log in as 'root'
    with password 'abiquo'</description>
    <productName>Ubuntu Linux 9.04 32 bits</productName>
    <iconUrl>
    http://abiquo-repository.abiquo.com/s3direct/ubuntu-9.04/ubuntu_logo.png</iconUrl>
    <diskFormatType>VMDK_SPARSE</diskFormatType>
    <diskFileSize>764</diskFileSize>
    <osType>UBUNTU</osType>
    <ethernetDriverType>E1000</ethernetDriverType>
    <diskControllerType>IDE</diskControllerType>
  </templateDefinition>
</templateDefinitions>




Create a template definition

If you have an OVF Envelope document available in an HTTP URL (e.g http://rs.bcn.abiquo.com:9000/ovf/10/) you can use it to add as a template definition into Abiquo. Category and Icon links: you can add new icons and categories while creating a Template Definition by adding the icon path in the title field of the link and/or the category name in the title field. Template definitions created using this method do not belong to any template definition list.

Synopsis: POST http://example.com/api/admin/enterprises/{enterprise}/appslib/templateDefinitions
Roles Required: ROLE_APPLIB_ALLOW_MODIFY
Request Headers: Accept: application/vnd.abiquo.templatedefinition+xml; version=2.4; Content-type: application/vnd.abiquo.templatedefinition+xml; version=2.4;
Request Parameters:

Parameter

Required

Default Value

Description

 

 

 

 

Request Message Body Entity: TemplateDefinition Media Type
Response Message Body Entity: TemplateDefinition Media Type
Request Example:

 Click here to show or hide the request example
Create a template definition example
curl --verbose -u admin:xabiquo -X POST http://localhost/api/admin/enterprises/1/appslib/templateDefinitions \
   -H 'Content-type: application/vnd.abiquo.templatedefinition+xml;version=2.4' \
   -d '<templateDefinition>
         <link href="http://localhost:80/api/config/categories/7" rel="category" title="Operative Systems,base"/>
         <url>http://rs.bcn.abiquo.com:9000/ovf/10/desc.ovf</url>
         <productName>MyCustomTemplate</productName>
         <description>Just a test</description>
         <iconUrl>http://icons.abiquo.com/namenode.jpg</iconUrl>
         <diskFileSize>2048</diskFileSize>
         <diskFormatType>VMDK_FLAT</diskFormatType>
      </templateDefinition>'

> POST /api/admin/enterprises/1/appslib/templateDefinitions HTTP/1.1
> Authorization: Basic YWRtaW46eGFiaXF1bw==
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: localhost
> Accept: */*
> Content-type: application/vnd.abiquo.templatedefinition+xml;version=2.4
> Content-Length: 481
> 
< HTTP/1.1 201 Creado
< Server: Apache-Coyote/1.1
< Set-Cookie: auth=YWRtaW46MTM1OTc0NTc1MTM0Njo3MTBlM2JlMWUxYmUyY2JjYWJjYWUyNWQ5NWU5YmJjODpBQklRVU8; Expires=Fri, 01-Feb-2013 19:09:11 GMT; Path=/api
< Location: http://localhost:80/api/admin/enterprises/1/appslib/templateDefinitions/115
< Set-Cookie: JSESSIONID=28839E79BAFE1DBA60104B1E9ADFA34B.nodeAlbert; Path=/api
< Content-Type: application/vnd.abiquo.templatedefinition+xml;version=2.4
< Content-Length: 821
< Date: Fri, 01 Feb 2013 18:39:11 GMT
< 
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<templateDefinition>
  <link rel="enterprise"
  type="application/vnd.abiquo.enterprise+xml"
  href="http://localhost:80/api/admin/enterprises/1" />
  <link title="Operative Systems,base" rel="category"
  type="application/vnd.abiquo.category+xml"
  href="http://localhost:80/api/config/categories/8" />
  <link rel="edit"
  type="application/vnd.abiquo.templatedefinition+xml"
  href="http://localhost:80/api/admin/enterprises/1/appslib/templateDefinitions/115" />
  <id>115</id>
  <url>http://rs.bcn.abiquo.com:9000/ovf/10/desc.ovf</url>
  <description>Just a test</description>
  <productName>MyCustomTemplate</productName>
  <iconUrl>http://icons.abiquo.com/namenode.jpg</iconUrl>
  <diskFormatType>VMDK_FLAT</diskFormatType>
  <diskFileSize>2048</diskFileSize>
  <osType>OTHER_64</osType>
</templateDefinition>

Download a template

You can download the template of the entity here (click right mouse button and 'Save Link As..')

Retrieve a template definition

Get the content of a Template Definition.

Synopsis: GET http://example.com/api/admin/enterprises/{enterprise}/appslib/templateDefinitions/{templateDefinition}
Roles Required: ROLE_APPLIB_ALLOW_MODIFY
Request Headers: Accept: application/vnd.abiquo.templatedefinition+xml; version=2.4; Content-type: ;
Request Parameters:

Parameter

Required

Default Value

Description

 

 

 

 

Request Message Body Entity:
Response Message Body Entity: TemplateDefinition Media Type
Request Example:

 Click here to show or hide the request example
Retrieve a template definition example
curl --verbose -u admin:xabiquo -X GET http://localhost:80/api/admin/enterprises/1/appslib/templateDefinitions/115 

> GET /api/admin/enterprises/1/appslib/templateDefinitions/115 HTTP/1.1
> Authorization: Basic YWRtaW46eGFiaXF1bw==
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: localhost
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: Apache-Coyote/1.1
< Set-Cookie: auth=YWRtaW46MTM1OTc0NTk4ODY5MDplZWFlYzI5MTU2NjM0ZDYxNWU0MjZiMTIxOGUxZGM3NTpBQklRVU8; Expires=Fri, 01-Feb-2013 19:13:08 GMT; Path=/api
< Set-Cookie: JSESSIONID=0D66747D8DCB2970CD998AD44FDE2B9B.nodeAlbert; Path=/api
< Content-Type: application/vnd.abiquo.templatedefinition+xml;version=2.4
< Content-Length: 821
< Date: Fri, 01 Feb 2013 18:43:08 GMT
< 
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<templateDefinition>
  <link title="Operative Systems,base" rel="category"
  type="application/vnd.abiquo.category+xml"
  href="http://localhost:80/api/config/categories/8" />
  <link rel="edit"
  type="application/vnd.abiquo.templatedefinition+xml"
  href="http://localhost:80/api/admin/enterprises/1/appslib/templateDefinitions/115" />
  <link rel="enterprise"
  type="application/vnd.abiquo.enterprise+xml"
  href="http://localhost:80/api/admin/enterprises/1" />
  <id>115</id>
  <url>http://rs.bcn.abiquo.com:9000/ovf/10/desc.ovf</url>
  <description>Just a test</description>
  <productName>MyCustomTemplate</productName>
  <iconUrl>http://icons.abiquo.com/namenode.jpg</iconUrl>
  <diskFormatType>VMDK_FLAT</diskFormatType>
  <diskFileSize>2048</diskFileSize>
  <osType>OTHER_64</osType>
</templateDefinition>



Modify a template definition

Updates the content of a Template Definition. The new attribute values do not affect virtual machine templates that were already downloaded.

Synopsis: PUT http://example.com/api/admin/enterprises/{enterprise}/appslib/templateDefinitions/{templateDefinition}
Roles Required: ROLE_APPLIB_ALLOW_MODIFY
Request Headers: Accept: application/vnd.abiquo.templatedefinition+xml; version=2.4; Content-type: application/vnd.abiquo.templatedefinition+xml; version=2.4;
Request Parameters:

Parameter

Required

Default Value

Description

 

 

 

 

Request Message Body Entity: TemplateDefinition Media Type
Response Message Body Entity: TemplateDefinition Media Type
Request Example:

 Click here to show or hide the request example
Modify a template definition example
curl --verbose -u admin:xabiquo -X PUT 'http://localhost:80/api/admin/enterprises/1/appslib/templateDefinitions/115' \
    -H "Content-type:application/vnd.abiquo.templatedefinition+xml" -d \
'<templateDefinition>
  <link title="Operative Systems,base" rel="category"
  type="application/vnd.abiquo.category+xml"
  href="http://localhost:80/api/config/categories/8" />
  <link rel="edit"
  type="application/vnd.abiquo.templatedefinition+xml"
  href="http://localhost:80/api/admin/enterprises/1/appslib/templateDefinitions/115" />
  <link rel="enterprise"
  type="application/vnd.abiquo.enterprise+xml"
  href="http://localhost:80/api/admin/enterprises/1" />
  <id>115</id>
  <url>http://rs.bcn.abiquo.com:9000/ovf/10/desc.ovf</url>
  <description>Just a test</description>
  <productName>MyCustomTemplate</productName>
  <iconUrl>http://icons.abiquo.com/namenode.jpg</iconUrl>
  <diskFormatType>RAW</diskFormatType>
  <diskFileSize>2048</diskFileSize>
  <osType>OTHER_64</osType>
</templateDefinition>'

> PUT /api/admin/enterprises/1/appslib/templateDefinitions/115 HTTP/1.1
> Authorization: Basic YWRtaW46eGFiaXF1bw==
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: localhost
> Accept: */*
> Content-type:application/vnd.abiquo.templatedefinition+xml
> Content-Length: 809
> 
< HTTP/1.1 200 OK
< Server: Apache-Coyote/1.1
< Set-Cookie: auth=YWRtaW46MTM1OTc0NjE3NDYwMzoyZTE2MGNkZTE1NWI2OTVmODZlMjY3ZGE2ZGMxZDA0OTpBQklRVU8; Expires=Fri, 01-Feb-2013 19:16:14 GMT; Path=/api
< Set-Cookie: JSESSIONID=31632F339D478FED728417723A8D25F1.nodeAlbert; Path=/api
< Content-Type: application/vnd.abiquo.templatedefinition+xml;version=2.4
< Content-Length: 815
< Date: Fri, 01 Feb 2013 18:46:14 GMT
< 
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<templateDefinition>
  <link title="Operative Systems,base" rel="category"
  type="application/vnd.abiquo.category+xml"
  href="http://localhost:80/api/config/categories/8" />
  <link rel="edit"
  type="application/vnd.abiquo.templatedefinition+xml"
  href="http://localhost:80/api/admin/enterprises/1/appslib/templateDefinitions/115" />
  <link rel="enterprise"
  type="application/vnd.abiquo.enterprise+xml"
  href="http://localhost:80/api/admin/enterprises/1" />
  <id>115</id>
  <url>http://rs.bcn.abiquo.com:9000/ovf/10/desc.ovf</url>
  <description>Just a test</description>
  <productName>MyCustomTemplate</productName>
  <iconUrl>http://icons.abiquo.com/namenode.jpg</iconUrl>
  <diskFormatType>RAW</diskFormatType>
  <diskFileSize>2048</diskFileSize>
  <osType>OTHER_64</osType>
</templateDefinition>



Download a template

You can download the template of the entity here (click right mouse button and 'Save Link As..')

Delete a template definition

If the current Template Definition being deleted is used in a Template Definition List, then the list is updated to exclude the deleted Template Definition. If the template is downloaded (a virtual machine template exists) then this method does NOT delete from the datacenter repository. It only makes the current template definition unavailable for downloading again.

Synopsis: DELETE http://example.com/api/admin/enterprises/{enterprise}/appslib/templateDefinitions/{templateDefinition}
Roles Required: ROLE_APPLIB_ALLOW_MODIFY
Request Headers: Accept: ; Content-type: ;
Request Parameters:

Parameter

Required

Default Value

Description

 

 

 

 

Request Message Body Entity:
Response Message Body Entity:
Request Example:

 Click here to show or hide the request example
Delete a template definition example
curl --verbose -u admin:xabiquo -X DELETE 'http://localhost:80/api/admin/enterprises/1/appslib/templateDefinitions/115'


> DELETE /api/admin/enterprises/1/appslib/templateDefinitions/115 HTTP/1.1
> Authorization: Basic YWRtaW46eGFiaXF1bw==
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: localhost
> Accept: */*
> 
< HTTP/1.1 204 Sin Contenido
< Server: Apache-Coyote/1.1
< Set-Cookie: auth=YWRtaW46MTM1OTc0NjI1OTg3ODowNThjZTc3YTZjY2EwMWI1NjllY2FlZDMzZmI1ZTVlYTpBQklRVU8; Expires=Fri, 01-Feb-2013 19:17:39 GMT; Path=/api
< Set-Cookie: JSESSIONID=2EFA97C53E9FC2A3258C5F368B8EF745.nodeAlbert; Path=/api
< Date: Fri, 01 Feb 2013 18:47:39 GMT
<