Templates
Contents
Templates
A template bundles the operative system to be run by a cloud server and the services and scripts to be applied to it, thus defining a blueprint for cloud server configuration management.
List Templates
GET /v2/blueprint/templates
It lists all available templates.
Inputs
None
Returns
An array of templates with the following format:
Field | Type | Description |
---|---|---|
id | String | Identifier of the template. |
name | String | Name of the template. |
generic_image_id | String | Identifier of the OS image that the template builds on. |
label_ids | Array of strings | List of ids corresponding to the labels the template has assigned. |
resource_type | String | An identifier for the type of resource, specifically "template". |
Show Template
GET /v2/blueprint/templates/:id
It shows information about a specific template.
Inputs
None
Returns
Field | Type | Description |
---|---|---|
id | String | Identifier of the template. |
name | String | Name of the template. |
generic_image_id | String | Identifier of the OS image that the template builds on. |
run_list | Array of strings | A list of cookbook recipes that is applied on the servers. |
configuration_attributes | Object | The attributes used to configure the cookbooks in the cookbook_versions list |
cookbook_versions | Hash of string | A set of cookbooks that this template includes. They can be cookbook versions inside the platform or Chef supermarket's cookbooks |
error_message | Sting | Optional, this field indicates the error that happened when the template failed to compile if an error occurred. |
state | String | The state of the template. Values can be ‘created', ‘compiling', ‘ready', ‘compiling_error' |
variables | Array of string | A set of variables referencing other resources that the servers may use. |
label_ids | Array of strings | List of ids corresponding to the labels the template has assigned. |
resource_type | String | An identifier for the type of resource, specifically "template". |
Create Template
POST /v2/blueprint/templates
It creates a new template.
Inputs
Field | Type | Description | Required |
---|---|---|---|
name | String | Name of the template. | Yes |
generic_image_id | String | Identifier of the OS image that the template builds on. | Yes |
run_list | Array of strings | A list of cookbook recipes that is applied on the servers. | No |
configuration_attributes | Object | The attributes used to configure the cookbooks in the cookbook_versions list | No |
cookbook_versions | String | A set of cookbooks that this template includes. They can be cookbook versions inside the platform or Chef supermarket's cookbooks | No |
label_ids | Array of strings | List of ids corresponding to the labels to assign to the template. | No |
Returns
Field | Type | Description |
---|---|---|
id | String | Identifier of the template. |
name | String | Name of the template. |
generic_image_id | String | Identifier of the OS image that the template builds on. |
run_list | Array of strings | A list of cookbook recipes that is applied on the servers. |
configuration_attributes | Object | The attributes used to configure the cookbooks in the cookbook_versions list |
cookbook_versions | Hash of string | A set of cookbooks that this template includes. They can be cookbook versions inside the platform or Chef supermarket's cookbooks |
error_message | Sting | Optional, this field indicates the error that happened when the template failed to compile if an error occurred. |
state | String | The state of the template. Values can be ‘created', ‘compiling', ‘ready', ‘compiling_error' |
variables | Array of string | A set of variables referencing other resources that the servers may use. |
label_ids | Array of strings | List of ids corresponding to the labels the template has assigned. |
resource_type | String | An identifier for the type of resource, specifically "template". |
Update Template
PUT /v2/blueprint/templates/:id
It updates an existing template.
Inputs
Field | Type | Description | Required |
---|---|---|---|
name | String | Name of the template. | No |
run_list | Array of strings | A list of cookbook recipes that is applied on the servers. | No |
cookbook_versions | Hash of string | A set of cookbooks that this template includes. They can be cookbook versions inside the platform or Chef supermarket's cookbooks | No |
configuration_attributes | Object | The attributes used to configure the services in the service_list. | No |
Returns
Field | Type | Description |
---|---|---|
id | String | Identifier of the template. |
name | String | Name of the template. |
generic_image_id | String | Identifier of the OS image that the template builds on. |
run_list | Array of strings | A list of cookbook recipes that is applied on the servers. |
configuration_attributes | Object | The attributes used to configure the cookbooks in the cookbook_versions list |
cookbook_versions | Hash of string | A set of cookbooks that this template includes. They can be cookbook versions inside the platform or Chef supermarket's cookbooks |
error_message | Sting | Optional, this field indicates the error that happened when the template failed to compile if an error occurred. |
state | String | The state of the template. Values can be ‘created', ‘compiling', ‘ready', ‘compiling_error' |
variables | Array of string | A set of variables referencing other resources that the servers may use. |
label_ids | Array of strings | List of ids corresponding to the labels the template has assigned. |
resource_type | String | An identifier for the type of resource, specifically "template". |
Compile Template
PUT /v2/blueprint/templates/:id/compile
It compiles an existing template.
Inputs
None
Returns
Field | Type | Description |
---|---|---|
id | String | Identifier of the template. |
name | String | Name of the template. |
generic_image_id | String | Identifier of the OS image that the template builds on. |
run_list | Array of strings | A list of cookbook recipes that is applied on the servers. |
configuration_attributes | Object | The attributes used to configure the cookbooks in the cookbook_versions list |
cookbook_versions | Hash of string | A set of cookbooks that this template includes. They can be cookbook versions inside the platform or Chef supermarket's cookbooks |
error_message | Sting | Optional, this field indicates the error that happened when the template failed to compile if an error occurred. |
state | String | The state of the template. Values can be ‘created', ‘compiling', ‘ready', ‘compiling_error' |
variables | Array of string | A set of variables referencing other resources that the servers may use. |
label_ids | Array of strings | List of ids corresponding to the labels the template has assigned. |
resource_type | String | An identifier for the type of resource, specifically "template". |
Destroy Template
DELETE /v2/blueprint/templates/:id
It deletes a template.
Inputs
None
Returns
None
Template Scripts
List Template Scripts
GET /v2/blueprint/templates/:template_id/scripts
Shows the parametrized scripts of a template that either is run automatically during either boot, migration, or shutdown or can be run in an operational state.
Inputs
Field | Type | Description | Required |
---|---|---|---|
type | String | Type of script, when it will run on a server. Must be "operational", "boot" or "shutdown". | No |
Returns
An array of parametrized scripts:
Field | Type | Description |
---|---|---|
id | String | Identifier of the parameterized script. |
type | String | Type of the script, when it will run on a server. Must be "operational", "boot" or "shutdown". |
template_id | String | Identifier of the template that contains the parameterized script. |
script_id | String | Identifier of the script this parametrized script parametrizes. |
parameter_values | Object | An object with values for each of the parameters of the parameterized script. |
execution_order | Integer | For parametrized scripts other than "operational", the order in which they automatically run. |
resource_type | String | An identifier for the type of resource, specifically "template_script". |
Show Template Script
GET /v2/blueprint/templates/:template_id/scripts/:id
It shows information about a specific parameterized script.
Inputs
None
Returns
Field | Type | Description |
---|---|---|
id | String | Identifier of the parameterized script. |
type | String | Type of the script, when it will run on a server. It must be "operational", "boot" or "shutdown". |
template_id | String | Identifier of the template that contains the parameterized script. |
script_id | String | Identifier of the script this parametrized script parametrizes. |
parameter_values | Object | An object with values for each of the parameters of the parameterized script. |
execution_order | Integer | For parametrized scripts other than "operational", the order in which they automatically run. |
resource_type | String | An identifier for the type of resource, specifically "template_script". |
Create Template Script
POST /v2/blueprint/templates/:template_id/scripts
It creates a new parametrized script for a template and appends it to the list of parametrized scripts of the
same type.
Inputs
Field | Type | Description | Required |
---|---|---|---|
type | String | Type of the script, when it will run on a server. It must be "operational", "boot" or "shutdown". | Yes |
script_id | String | Identifier of the script this parametrized script parametrizes. | Yes |
parameter_values | Object | An object with values for each of the parameters of the parameterized script. | Yes |
Returns
Field | Type | Description |
---|---|---|
id | String | Identifier of the parameterized script. |
type | String | Type of the script, when it will run on a server. It must be "operational", "boot" or "shutdown". |
template_id | String | Identifier of the template that contains the parameterized script. |
script_id | String | Identifier of the script parametrized by the parameterized script. |
parameter_values | Object | An object with values for each of the parameters of the parameterized script. |
execution_order | Integer | For parametrized scripts other than "operational", the order in which they automatically run. |
resource_type | String | An identifier for the type of resource, specifically "template_script". |
Update Template Script
PUT /v2/blueprint/templates/:template_id/scripts/:id
It updates an existing parametrized script for a template.
Inputs
Field | Type | Description | Required |
---|---|---|---|
parameter_values | Object | An object with values for each of the parameters of the parameterized script. | Yes |
Returns
Field | Type | Description |
---|---|---|
id | String | Identifier of the parameterized script. |
type | String | Type of the script, when it will run on a server. It must be "operational", "boot" or "shutdown". |
template_id | String | Identifier of the template that contains the parameterized script. |
script_id | String | Identifier of the script this parametrized script parametrizes. |
parameter_values | Object | An object with values for each of the parameters of the parameterized script. |
execution_order | Integer | For parametrized scripts other than "operational", the order in which they automatically run. |
resource_type | String | An identifier for the type of resource, specifically "template_script". |
Reorder Template Scripts
PUT /v2/blueprint/templates/:template_id/scripts/reorder
It changes the execution order of the scripts of a certain type in a template.
Inputs
Field | Type | Description | Required |
---|---|---|---|
type | String | Type of the script, when it will run on a server. It must be "boot", "operational" or "shutdown". | Yes |
script_ids | Array of String | Ids of the scripts you want to reorder | Yes |
Returns
An array of parametrized scripts of the specified type belonging to the template that has been reordered.
Field | Type | Description |
---|---|---|
id | String | Identifier of the parameterized script. |
type | String | Type of the script, when it will run on a server. It must be "operational", "boot" or "shutdown". |
template_id | String | Identifier of the template that contains the parameterized script. |
script_id | String | Identifier of the script this parametrized script parametrizes. |
parameter_values | Object | An object with values for each of the parameters of the parameterized script. |
execution_order | Integer | For parametrized scripts other than "operational", the order in which they automatically run. |
resource_type | String | An identifier for the type of resource, specifically "template_script". |
Destroy Template Script
DELETE /v2/blueprint/templates/:template_id/scripts/:id
It removes a parametrized script from a template.
Inputs
None
Returns
None
Template Servers
List Template Servers
GET /v2/blueprint/templates/:template_id/servers
It returns information about the servers that use a specific template.
Inputs
None
Returns
An array of servers with the following fields:
Field | Type | Description | Deprecation notices | Notes |
---|---|---|---|---|
id | String | Identifier of the server. | ||
name | String | Logical name of the server. | ||
fqdn | String | Fully qualified domain name (FQDN) of the server. | ||
state | String | State of the server. It can be any of the following: commissioning,inactive, booting, bootstrapping, operational, stalled, shutting_down,decommissioning, commission_stalled. | ||
public_ip | String | Public IP of the server or null if it does not have one yet. | ||
private_ip | String | Private IP of the server or null if it does not have one yet. | ||
workspace_id | String | Identifier of the workspace to which the server belongs. | No longer available from 7.3 onwards | |
template_id | String | Identifier of the template defining the software configuration the server uses. | ||
server_plan_id | String | Identifier of the server plan with which the server is deployed. | ||
cloud_account_id | String | Identifier of the cloud account in which the server is deployed. | ||
ssh_profile_id | String | Identifier of the ssh profile the server uses. | Deprecated from version 9 onwards. | |
ssh_profile_ids | Array of string | Identifiers of the ssh profiles the server uses. | Available from version 9 onwards. | |
firewall_profile_id | String | Identifier of the firewall profile applied on the server. | ||
server_array_id | String | Identifier of the server array to which the server belongs if any or null. | ||
brownfield_state | String | A string describing the level of integration with the platform achieved. It must be one of "M1", "M1-M2", "M2", "M2-M3", "Overriden", "Certified" or "Pure". | ||
subnet_id | String | Identifier of the subnet on which the server is deployed if any or null. | ||
vpc_id | String | Identifier of the VPC on which the server is deployed if any or null. | ||
privateness | Boolean | For servers deployed on a VPC, flag indicating whether the server will get only a private IP | ||
variable_value_ids | Object | An object defining variable values for the configuration in the template. It has a key for each variable defined and arrays of two elements as values:The first element of the array is the id of the variable valueThe second element of the array is the resource_type of the variable value | ||
template_addons_ids | Array of String | A list of Ids of template addons that may be applied to this server. | ||
label_ids | String | List of ids corresponding to the labels the server has assigned. | ||
resource_type | String | An identifier for the type of resource, specifically "server". |