Package org.jclouds.cloudstack.features
Interface TemplateApi
public interface TemplateApi
Provides synchronous access to cloudstack via their REST API.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptioncopyTemplateToZone
(String id, String sourceZoneId, String destZoneId) Copies a template from one zone to another.createTemplate
(TemplateMetadata templateMetadata, CreateTemplateOptions... options) Creates a template of a virtual machine.deleteTemplate
(String id, DeleteTemplateOptions... options) Deletes a template from the system.extractTemplate
(String id, ExtractMode mode, String zoneId, ExtractTemplateOptions... options) getTemplateInZone
(String templateId, String zoneId) get a specific template by idlistTemplatePermissions
(String id, AccountInDomainOptions... options) List template visibility and all accounts that have permissions to view this template.List all executable templates.listTemplates
(ListTemplatesOptions options) List all public, private, and privileged templates.registerTemplate
(TemplateMetadata templateMetadata, String format, String hypervisor, String url, String zoneId, RegisterTemplateOptions... options) Registers an existing template into the Cloud.com cloud.updateTemplate
(String id, UpdateTemplateOptions... options) Updates attributes of a template.void
updateTemplatePermissions
(String id, UpdateTemplatePermissionsOptions... options) Updates a template visibility permissions.
-
Method Details
-
createTemplate
@Named("createTemplate") @GET @Consumes("application/json") AsyncCreateResponse createTemplate(TemplateMetadata templateMetadata, CreateTemplateOptions... options) Creates a template of a virtual machine. The virtual machine must be in a STOPPED state. A template created from this command is automatically designated as a private template visible to the account that created it.- Parameters:
templateMetadata
- overall description of the templateoptions
- optional arguments- Returns:
- an asynchronous job response
- See Also:
-
registerTemplate
@Named("registerTemplate") @GET @Consumes("application/json") Set<Template> registerTemplate(TemplateMetadata templateMetadata, @QueryParam("format") String format, @QueryParam("hypervisor") String hypervisor, @QueryParam("url") String url, @QueryParam("zoneid") String zoneId, RegisterTemplateOptions... options) Registers an existing template into the Cloud.com cloud.- Parameters:
templateMetadata
- overall description of the templateformat
- the format for the template. Possible values include QCOW2, RAW, and VHD.url
- the URL of where the template is hosted. Possible URL include http:// and https://zoneId
- the ID of the zone the template is to be hosted onoptions
- optional arguments- Returns:
- data about the newly-registered template
- See Also:
-
updateTemplate
@Named("updateTemplate") @GET @Consumes("application/json") Template updateTemplate(@QueryParam("id") String id, UpdateTemplateOptions... options) Updates attributes of a template.- Parameters:
id
- the ID of the image fileoptions
- optional arguments- Returns:
- updated data about the template
- See Also:
-
copyTemplateToZone
@Named("copyTemplate") @GET @Consumes("application/json") AsyncCreateResponse copyTemplateToZone(@QueryParam("id") String id, @QueryParam("sourcezoneid") String sourceZoneId, @QueryParam("destzoneid") String destZoneId) Copies a template from one zone to another.- Parameters:
id
- Template ID.sourceZoneId
- ID of the zone the template is currently hosted on.destZoneId
- ID of the zone the template is being copied to.- Returns:
- an asynchronous job response
- See Also:
-
deleteTemplate
@Named("deleteTemplate") @GET @Consumes("application/json") AsyncCreateResponse deleteTemplate(@QueryParam("id") String id, DeleteTemplateOptions... options) Deletes a template from the system. All virtual machines using the deleted template will not be affected.- Parameters:
id
- the ID of the templateoptions
- optional arguments- See Also:
-
listTemplates
List all executable templates.- Returns:
- all executable templates, or empty set, if no templates are found
- See Also:
-
listTemplates
@Named("listTemplates") @GET @Consumes("application/json") Set<Template> listTemplates(ListTemplatesOptions options) List all public, private, and privileged templates.- Parameters:
options
- if present, how to constrain the list, defaults to all executable templates- Returns:
- templates matching query, or empty set, if no templates are found
- See Also:
-
getTemplateInZone
@Named("listTemplates") @GET @Consumes("application/json") Template getTemplateInZone(@QueryParam("id") String templateId, @QueryParam("zoneid") String zoneId) get a specific template by id- Parameters:
templateId
-zoneId
- zone template is defined in- Returns:
- template or null if not found
-
updateTemplatePermissions
@Named("updateTemplatePermissions") @GET void updateTemplatePermissions(@QueryParam("id") String id, UpdateTemplatePermissionsOptions... options) Updates a template visibility permissions. A public template is visible to all accounts within the same domain. A private template is visible only to the owner of the template. A privileged template is a private template with account permissions added. Only accounts specified under the template permissions are visible to them.- Parameters:
id
- the template IDoptions
- optional arguments
-
listTemplatePermissions
@Named("listTemplatePermissions") @GET @Consumes("application/json") Set<TemplatePermission> listTemplatePermissions(@QueryParam("id") String id, AccountInDomainOptions... options) List template visibility and all accounts that have permissions to view this template.- Parameters:
id
- the template IDoptions
- optional arguments- Returns:
- the list of permissions that apply to the template
-
extractTemplate
@Named("extractTemplate") @GET @Consumes("application/json") AsyncCreateResponse extractTemplate(@QueryParam("id") String id, @QueryParam("mode") ExtractMode mode, @QueryParam("zoneid") String zoneId, ExtractTemplateOptions... options) - Parameters:
id
- the ID of the templatemode
- FIXME the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOADzoneId
- the ID of the zone where the ISO is originally locatedoptions
- optional arguments- Returns:
- an asynchronous job response
- See Also:
-