Interface TemplateApi


public interface TemplateApi
Provides synchronous access to cloudstack via their REST API.

See Also:
  • 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 template
      options - optional arguments
      Returns:
      an asynchronous job response
      See Also:
      • invalid reference
        ://download.cloud.com/releases/2.2.0/api_2.2.8/user/createTemplate
              .html
    • 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 template
      format - 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 on
      options - optional arguments
      Returns:
      data about the newly-registered template
      See Also:
      • invalid reference
        ://download.cloud.com/releases/2.2.0/api_2.2.8/user/registerTemplate
              .html
    • 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 file
      options - optional arguments
      Returns:
      updated data about the template
      See Also:
      • invalid reference
        ://download.cloud.com/releases/2.2.0/api_2.2.8/user/updateTemplate
              .html
    • 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:
      • invalid reference
        ://download.cloud.com/releases/2.2.0/api_2.2.8/user/copyTemplate.html
    • 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 template
      options - optional arguments
      See Also:
      • invalid reference
        ://download.cloud.com/releases/2.2.0/api_2.2.8/user/deleteTemplate
              .html
    • listTemplates

      @Named("listTemplates") @GET @Consumes("application/json") Set<Template> listTemplates()
      List all executable templates.
      Returns:
      all executable templates, or empty set, if no templates are found
      See Also:
      • invalid reference
        ://download.cloud.com/releases/2.2.0/api_2.2.8/user/listTemplates.
              html
    • 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:
      • invalid reference
        ://download.cloud.com/releases/2.2.0/api_2.2.8/user/listTemplates.
              html
      • invalid reference
        TemplateFilter
    • 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 ID
      options - 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 ID
      options - 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 template
      mode - FIXME the mode of extraction - HTTP_DOWNLOAD or FTP_UPLOAD
      zoneId - the ID of the zone where the ISO is originally located
      options - optional arguments
      Returns:
      an asynchronous job response
      See Also:
      • invalid reference
        ://download.cloud.com/releases/2.2.0/api_2.2.8/user/extractTemplate
              .html