Templates
A template represents a file with variables that will be replaced by a value upon rendering.
Templates may be associated to a platform, a distribution or an application.
Representation
The following elements are defined as part of a template representation:
- name: The name of the template.
- delimiter: The delimiter used to recognize template variables.
Example
{
"name" : "/etc/hosts",
"delimiter": {
"start": "${"
"end": "}",
}
}
Above delimiters imply that a variable x is denoted by ${x} in template’s content.
Methods
Templates are part of a sub-collection, below URLs are therefore relative.
Collection
files
- GET: returns the list of templates.
- POST: adds a new template.
Entity
files/{file_name}
- GET: returns the template
- PUT: updates the template
- DELETE: removes the template
Other
Template’s content
files/{file_name}/content
- GET: returns the content of the template
- POST: uploads the content of the template; single- or multi-part content may be used.
Application’s file resources
Application file resources use the exact same URLs and methods. The only difference is that a resource is not defined/represented in the same way as a simple template (see application).