Cloudify REST API V2
Welcome to Cloudify’s REST API Documentation!
The base URI for the v2 REST API is: /api/v2
.
Response Fields Filtering (Projection)
Request Example (receive only the
id
andcreated_at
fields)
$ curl -XGET http://localhost/api/v2/blueprints?_include=id,created_at
Response Example
{
"items": [
{
"created_at": "2015-11-11 13:11:40.324698",
"id": "hello-world"
}
],
"metadata": {
"pagination": {
"total": 1,
"offset": null,
"size": 10000
}
}
}
You can choose to have only specific fields in the response by using the _include
query parameter.
The parameter value is a comma separated list of fields to include in the response, e.g. _include=field1,field2,field3
Note that specified field names must be part of the resource schema, otherwise an error is raised.
Query Filtering (Selection)
Request Example (requesting only blueprints which
id
is _myblueprint1 or _myblueprint2)
$ curl -XGET http://localhost/api/v2/blueprints?id=my_blueprint1&id=my_blueprint2&_include=id,created_at
Response Example
{
"items": [
{
"created_at": "2015-12-02 11:27:48.527776",
"id": "my_blueprint2"
},
{
"created_at": "2015-12-02 11:23:01.939131",
"id": "my_blueprint1"
}
],
"metadata": {
"pagination": {
"total": 2,
"offset": 0,
"size": 10000
}
}
}
You can make your query more specific by using filters.
Filters are query parameters where the key is a field name and the value is a field value, e.g. id=my-specific-id
Filters also accept multiple values (OR) by using multiple parameters of the same key, e.g. id=my-specific-id&id=another-id
Sorting
Request Example #1 (sort deployments by
id
descending)
$ curl -XGET http://localhost/api/v2/deployments?_sort=-id&_include=blueprint_id,id
Response Example #1
{
"items": [
{
"id": "hello1",
"blueprint_id": "hello-world"
},
{
"id": "dep4",
"blueprint_id": "my_blueprint2"
},
{
"id": "dep3",
"blueprint_id": "my_blueprint1"
},
{
"id": "dep2",
"blueprint_id": "my_blueprint2"
},
{
"id": "dep1",
"blueprint_id": "my_blueprint1"
}
],
"metadata": {
"pagination": {
"total": 5,
"offset": 0,
"size": 10000
}
}
}
Request Example #2 (sort deployments by
blueprint_id
ascending andid
descending)
$ curl -XGET http://localhost/api/v2/deployments?_sort=blueprint_id&_sort=-id&_include=blueprint_id,id
Response Example #2
{
"items": [
{
"id": "hello1",
"blueprint_id": "hello-world"
},
{
"id": "dep3",
"blueprint_id": "my_blueprint1"
},
{
"id": "dep1",
"blueprint_id": "my_blueprint1"
},
{
"id": "dep4",
"blueprint_id": "my_blueprint2"
},
{
"id": "dep2",
"blueprint_id": "my_blueprint2"
}
],
"metadata": {
"pagination": {
"total": 5,
"offset": 0,
"size": 10000
}
}
}
Sort resources by using the _sort
query parameter, e.g. _sort=id
The default sort order is ascending; to make it descending, prefix the field with a minus sign, e.g. _sort=-id
(example #1)
Sorting also works on multiple fields by using multiple _sort
parameters, where the sort sequence corresponds to the
order of _sort
parameters in the request (example #2).
Pagination
Request Example (skip
1
resource, getsize
of4
)
$ curl -XGET http://localhost/api/v2/events?_size=4&_offset=1&_include=@timestamp
Response Example
{
"items": [
{
"@timestamp": "2015-12-01T15:05:36.692Z"
},
{
"@timestamp": "2015-12-01T15:05:37.493Z"
},
{
"@timestamp": "2015-12-01T15:03:57.911Z"
},
{
"@timestamp": "2015-12-01T15:03:58.025Z"
}
],
"metadata": {
"pagination": {
"total": 171,
"offset": 1,
"size": 4
}
}
}
If the response includes too many items for the client to handle at once, use pagination to get only a subset of the results, defined by two parameters:
_size
(default: 10000) the max size of the result subset to receive._offset
(default: 0) the number of resources to skip, i.e._offset=1
means you skip the first resource.
* both parameters are optional.
The response metadata returns the requested parameters, and a total
field which indicates the size of the full set.
Authentication
Authentication headers should be added to every request sent to a secured manager.
Any header can be used, as long as it’s support by one of the manager’s authentication providers.
The default manager configuration supports basic HTTP authentication (examples #1, #2) and tokens (example #3).
Valid credentials do not affect the returned response, but invalid credentials return a “User Unauthorized” error.
Request Example #1 (Get the server’s status, authenticate with username and password)
$ curl -u 'MY_USERNAME':'MY_PASSWORD' <manager-ip-address>:<port>/api/v2/status
Response Example #1
{
"status":"running",
"services":[
{
"display_name":"Celery Management",
"instances":[
{
"Id": "cloudify-mgmtworker.service",
"Description":"Cloudify Management Worker Service",
"LoadState":"loaded",
"state":"running"
},
]
},
...
]
}
Request Example #2 (Get a token, authenticate with username and password)
$ curl -u 'MY_USERNAME':'MY_PASSWORD' <manager-ip-address>:<port>/api/v2/tokens
Response Example #2
{
"value":"eyJhbGciOiJIUzI1NiIsImV4cCI6MTQ1MDAzMjI0MiwiaWF0IjoxNDUwMDMxNjQyfQ.eyJ1c2VybmFtZSI6ImF"
}
Request Example #3 (Get all the blueprints, authenticate with a token)
$ curl -H 'Authentication-Token:MY_TOKEN' <manager-ip-address>:<port>/api/v2/blueprints
Response Example #3
{
"items":[
{
"main_file_name":"openstack-blueprint.yaml",
"description":"This Blueprint installs a nodecellar application on an openstack environment",
"created_at":"2015-12-13 19:00:03.160167",
"updated_at":"2015-12-13 19:00:03.160167",
"plan":{
"relationships":{
"cloudify.openstack.server_connected_to_port":{
"name":"cloudify.openstack.server_connected_to_port",
...
}
}
}
}
]
}
Blueprints
The Blueprint Resource
Attributes:
Attribute | Type | Description |
---|---|---|
id |
string | A unique identifier for the blueprint. |
description |
string | The blueprint’s description. |
main_file_name |
string | The blueprint’s main file name. |
plan |
dict | The parsed result of the blueprint. |
created_at |
datetime | The time the blueprint was uploaded to the manager. |
updated_at |
datetime | The last time the blueprint was updated. |
Get Blueprint
Request Example
$ curl -XGET http://localhost/api/v2/blueprints/hello-world
Response Example
{
"updated_at": "2015-11-08 11:11:36.039194",
"created_at": "2015-11-08 11:11:36.039194",
"main_file_name": "singlehost-blueprint.yaml",
"description": "Deploys a simple Python HTTP server on an existing machine.",
"id": "hello-world",
"plan": {
"relationships": {},
"inputs": {},
"deployment_plugins_to_install": [],
"policy_types": {},
"outputs": {},
"version": {},
"workflow_plugins_to_install": {},
"groups": {},
"workflows": {},
"nodes": [],
"policy_triggers": {}
}
}
GET /api/v2/blueprints/{blueprint-id}
Gets a specific blueprint.
URI Parameters
- blueprint-id: The id of the blueprint to retrieve.
Response
A Blueprint
resource.
Upload Blueprint
PUT /api/v2/blueprints/{blueprint-id}
Uploads a blueprint to Cloudify’s manager.
The call expects an “application/octet-stream” content type where the content is a zip/tar.gz/bz2 archive.
It is possible to upload a blueprint from a URL by specifying the URL in the blueprint_archive_url
request body property.
URI Parameters
blueprint-id
: The id of the uploaded blueprint.
Request Body
Property | Type | Description |
---|---|---|
application_file_name |
string | The main blueprint file name in the blueprint’s archive. |
blueprint_archive_url |
string | A URL the blueprint to be uploaded should be downloaded from by the manager. |
Response
A Blueprint
resource.
List Blueprints
GET /api/v2/blueprints
Lists all blueprints.
Response
Field | Type | Description |
---|---|---|
items |
list | A list of Blueprint resources. |
Delete Blueprint
DELETE /api/v2/blueprints/{blueprint-id}
Deletes a specific blueprint.
URI Parameters
- blueprint-id: The id of the blueprint to delete.
Response
A Blueprint
resource.
Download Blueprint
Downloads a specific blueprint as an archive.
GET /api/v2/blueprints/{blueprint-id}/archive
URI Parameters
- blueprint-id: The id of the blueprint to download.
Response
The blueprint as an archive using an application/octet-stream
content type.
Deployments
The Deployment Resource
Attributes:
Attribute | Type | Description |
---|---|---|
id |
string | A unique identifier for the deployment. |
blueprint_id |
string | The id of the blueprint the deployment is based on. |
created_at |
datetime | The time when the deployment was created. |
updated_at |
datetime | The time the deployment was last updated at. |
workflows |
list | A list of workflows that can be executed on a deployment. |
inputs |
object | A dictionary containing key value pairs which represents a deployment input and its provided value. |
policy_types |
object | A dictionary containing policies of a deployment. |
policy_triggers |
object | A dictionary containing policy triggers of a deployment. |
groups |
object | A dictionary containing the groups definition of deployment. |
outputs |
object | A dictionary containing an outputs definition of a deployment. |
Get Deployment
Request Example
$ curl -XGET http://localhost/api/v2/deployments/hello1
Response Example
{
"inputs": {
"webserver_port": 8080,
"agent_user": "centos",
"server_ip": "localhost",
"agent_private_key_path": "/root/.ssh/key.pem"
},
"policy_triggers": {
"cloudify.policies.triggers.execute_workflow": {
"source": "https://raw.githubusercontent.com/cloudify-cosmo/cloudify-manager/master/resources/rest-service/cloudify/triggers/execute_workflow.clj",
"parameters": {
"workflow_parameters": {
"default": {},
"description": "Workflow paramters"
},
"force": {
"default": false,
"description": "Should the workflow be executed even when another execution\nfor the same workflow is currently in progress\n"
},
"workflow": {
"description": "Workflow name to execute"
},
"socket_timeout": {
"default": 1000,
"description": "Socket timeout when making request to manager REST in ms"
},
"allow_custom_parameters": {
"default": false,
"description": "Should parameters not defined in the workflow parameters\nschema be accepted\n"
},
"conn_timeout": {
"default": 1000,
"description": "Connection timeout when making request to manager REST in ms"
}
}
}
},
"groups": {},
"blueprint_id": "hello-world",
"policy_types": {
"cloudify.policies.types.threshold": {
"source": "https://raw.githubusercontent.com/cloudify-cosmo/cloudify-manager/master/resources/rest-service/cloudify/policies/threshold.clj",
"properties": {
"is_node_started_before_workflow": {
"default": true,
"description": "Before triggering workflow, check if the node state is started"
},
"upper_bound": {
"default": true,
"description": "boolean value for describing the semantics of the threshold.\nif 'true': metrics whose value is bigger than the threshold will cause the triggers to be processed.\nif 'false': metrics with values lower than the threshold will do so.\n"
},
"service": {
"default": [
"service"
],
"description": "Service names whose events should be taken into consideration"
},
"stability_time": {
"default": 0,
"description": "How long a threshold must be breached before the triggers will be processed"
},
"policy_operates_on_group": {
"default": false,
"description": "If the policy should maintain its state for the whole group\nor each node instance individually.\n"
},
"threshold": {
"description": "The metric threshold value"
},
"interval_between_workflows": {
"default": 300,
"description": "Trigger workflow only if the last workflow was triggered earlier than interval-between-workflows seconds ago.\nif < 0 workflows can run concurrently.\n"
}
}
}
},
"outputs": {
"http_endpoint": {
"description": "Web server external endpoint",
"value": "http://localhost:8080"
}
},
"created_at": "2015-11-08 06:53:45.845046",
"workflows": [
{
"created_at": null,
"name": "execute_operation",
"parameters": {
"operation_kwargs": {
"default": {}
},
"node_ids": {
"default": []
},
"node_instance_ids": {
"default": []
},
"run_by_dependency_order": {
"default": false
},
"operation": {},
"allow_kwargs_override": {
"default": null
},
"type_names": {
"default": []
}
}
},
{
"created_at": null,
"name": "install",
"parameters": {}
}
],
"id": "hello1",
"updated_at": "2015-11-08 06:53:45.845046"
}
GET /api/v2/deployments/{deployment-id}
Gets a deployment.
URI Parameters
- deployment-id: The id of the deployment.
Response
A Deployment
resource.
List Deployments
GET /api/v2/deployments
Lists all deployments.
Response
Field | Type | Description |
---|---|---|
items |
list | A list of Deployment resources. |
Create Deployment
PUT /api/v2/deployments/{deployment-id}
Creates a new deployment.
URI Parameters
- deployment-id: The id of the new deployment.
Request Body
Property | Type | Description |
---|---|---|
blueprint_id |
string | The id of the blueprint the new deployment will be based on (required). |
Response
A Deployment
resource.
Delete Deployment
DELETE /api/v2/deployments/{deployment-id}
Deletes a deployment.
An error is raised if the deployment has any live node instances. In order to ignore this validation, the ignore_live_nodes
argument in request body can be used.
URI Parameters
- deployment-id: The id of the deployment.
Request Body
Property | Type | Description |
---|---|---|
ignore_live_nodes |
boolean | Specifies whether to ignore the live nodes validation. |
Response
A Deployment
resource.
Events
The Event Resource
Attributes:
Attribute | Type | Description |
---|---|---|
event_type |
string | Event type name |
type |
string | Indicates whether the resource is an event or a log (cloudify_event or cloudify_log ) |
tags |
list | List of tags |
timestamp |
ISO 8601 | The time at which the event occurred on the executing machine |
@timestamp |
ISO 8601 | The time at which the event was logged on the management machine |
message_code |
string | Reserved, currently unused |
context |
Context | contains various identifiers related to the event |
message |
Message | contains the event message |
level |
string | Log level (only available in log events) |
logger |
string | Logger name |
@version |
string | Internal log entry version (logstash) |
The Context object:
Attribute | Type | Description |
---|---|---|
task_id |
string | Task id (only available in operation events) |
task_name |
string | Task name (only available in operation events) |
task_queue |
string | Task queue (only available in operation events) |
task_target |
string | Task target (only available in operation events) |
operation |
string | Operation path (only available in operation events) |
task_total_retries |
integer | Number of max retries, -1 if infinite (only available in operation events) |
task_current_retries |
integer | Number of attempted retries (only available in operation events) |
plugin |
string | Plugin name |
blueprint_id |
string | Blueprint id |
node_name |
string | Node name |
node_id |
string | Node instance id |
workflow_id |
string | Workflow id |
deployment_id |
string | Deployment id |
execution_id |
string | Execution id |
The Message Object:
Attribute | Type | Description |
---|---|---|
text |
string | Message text |
List Events
Request Example
$ curl -XGET http://localhost/api/v2/events
Response Example
{
"items": [
{
"level": "info",
"timestamp": "2015-12-02 14:53:21.821+0000",
"@timestamp": "2015-12-02T14:53:21.823Z",
"tags": [
"event"
],
"message_code": null,
"@version": "1",
"context": {
"task_id": "45f53924-af08-438c-88ac-34f5d76bb677",
"blueprint_id": "hello-world",
"plugin": "agent",
"task_target": "hello1",
"node_name": "vm",
"workflow_id": "install",
"node_id": "vm_6d480",
"task_name": "cloudify_agent.installer.operations.create",
"task_queue": "hello1",
"operation": "cloudify.interfaces.cloudify_agent.create",
"execution_id": "274d9cfb-42ae-4ba7-853d-bf0e990b5add",
"deployment_id": "hello1"
},
"logger": "45f53924-af08-438c-88ac-34f5d76bb677",
"type": "cloudify_log",
"message": {
"text": "Disabling requiretty directive in sudoers file"
}
},
{
"event_type": "task_started",
"tags": [
"event"
],
"timestamp": "2015-12-02 14:53:23.593+0000",
"@timestamp": "2015-12-02T14:53:23.664Z",
"message_code": null,
"@version": "1",
"context": {
"deployment_id": "hello1",
"task_current_retries": 0,
"task_id": "a0db8898-0fa1-4eae-ad1f-741f3253e6b2",
"blueprint_id": "hello-world",
"plugin": "agent",
"task_target": "hello1",
"node_name": "vm",
"workflow_id": "install",
"node_id": "vm_6d480",
"task_name": "cloudify_agent.installer.operations.configure",
"task_queue": "hello1",
"operation": "cloudify.interfaces.cloudify_agent.configure",
"task_total_retries": -1,
"execution_id": "274d9cfb-42ae-4ba7-853d-bf0e990b5add"
},
"message": {
"text": "Task started 'cloudify_agent.installer.operations.configure'",
"arguments": null
},
"type": "cloudify_event"
}
],
"metadata": {
"pagination": {
"total": 2,
"size": 10000,
"offset": 0
}
}
}
GET /api/v2/events
Lists all events.
GET /api/v2/events?_range=@timestamp,[time_start],[time_end]
Lists all events within a time range:
Parameter | Type | Description |
---|---|---|
time_start |
ISO 8601 | optional value to begin range with. |
time_end |
ISO 8601 | optional value to end range with. |
time range: /api/v2/events?_range=@timestamp,2015-12-01,2015-12-31T14:30:00Z
all events since: /api/v2/events?_range=@timestamp,2015-12-01,
all events until: /api/v2/events?_range=@timestamp,,2015-12-31
Response
Field | Type | Description |
---|---|---|
items |
list | A list of Event resources. |
Executions
The Execution Resource
Attributes:
Attribute | Type | Description |
---|---|---|
id |
string | A unique identifier for the execution. |
workflow_id |
string | The id/name of the workflow the execution is of. |
blueprint_id |
string | The id of the blueprint the execution is in the context of. |
deployment_id |
string | The id of the deployment the execution is in the context of. |
status |
string | The executions status. |
error |
string | The execution’s error message on execution failure. |
created_at |
datetime | The time the execution was queued at. |
parameters |
object | A dict of the workflow parameters passed when starting the execution. |
is_system_workflow |
boolean | true if the execution is of a system workflow. |
Get Execution
Request Example
$ curl -XGET http://localhost/api/v2/executions/2b422fb2-38b4-4b02-95ac-e9b91390599d
Response Example
{
"status": "terminated",
"created_at": "2015-11-18 06:54:14.238731",
"workflow_id": "install",
"is_system_workflow": false,
"parameters": {},
"blueprint_id": "hello-world",
"deployment_id": "hello1",
"error": "",
"id": "2b422fb2-38b4-4b02-95ac-e9b91390599d"
}
GET /api/v2/executions/{execution-id}
Gets an execution.
URI Parameters
- execution-id: The id of the execution.
Response
An Execution
resource.
List Executions
GET /api/v2/executions
Lists all executions.
Response
Field | Type | Description |
---|---|---|
items |
list | A list of Execution resources. |
Start Execution
POST /api/v2/executions
Starts an execution.
Request Body
Property | Type | Description |
---|---|---|
workflow_id |
string | The workflow id/name to execute. |
deployment_id |
string | The id of the deployment the workflow should be executed on. |
Response
An Execution
resource.
Cancel Execution
POST /api/v2/executions/{execution-id}
Cancels an execution.
If passing cancel
as the action fails to cancel the execution, force-cancel
can be passed which will then kill the process running the execution.
URI Parameters
- execution-id: The id of the execution.
Request Body
Property | Type | Description |
---|---|---|
action |
string | The cancellation method to perform: cancel or force-cancel |
Response
An Execution
resource.
Update Execution
PATCH /api/v2/executions/{execution-id}
Updates an execution.
URI Parameters
- execution-id: The id of the execution.
Request Body
Property | Type | Description |
---|---|---|
status |
string | The new status of the execution. |
Response
An Execution
resource.
Manager
The following REST API calls provide information about Cloudify’s manager.
Status
GET /api/v2/events
Gets Cloudify manager status.
Request Example
$ curl -XGET http://localhost/api/v2/status
Response Example
{
"status": "running",
"services": [
{
"instances": [
{
"LoadState": "loaded",
"Description": "InfluxDB Service",
"state": "running",
"MainPID": 3609,
"Id": "cloudify-influxdb.service",
"ActiveState": "active",
"SubState": "running"
}
],
"display_name": "InfluxDB"
},
{
"instances": [
{
"LoadState": "loaded",
"Description": "Cloudify Management Worker Service",
"state": "running",
"MainPID": 6565,
"Id": "cloudify-mgmtworker.service",
"ActiveState": "active",
"SubState": "running"
}
],
"display_name": "Celery Management"
},
{
"instances": [
{
"LoadState": "loaded",
"Description": "LSB: Starts Logstash as a daemon.",
"state": "running",
"MainPID": 0,
"Id": "logstash.service",
"ActiveState": "active",
"SubState": "running"
}
],
"display_name": "Logstash"
},
{
"instances": [
{
"LoadState": "loaded",
"Description": "RabbitMQ Service",
"state": "running",
"MainPID": 2697,
"Id": "cloudify-rabbitmq.service",
"ActiveState": "active",
"SubState": "running"
}
],
"display_name": "RabbitMQ"
},
{
"instances": [
{
"LoadState": "loaded",
"Description": "Cloudify AMQP InfluxDB Broker Service",
"state": "running",
"MainPID": 4293,
"Id": "cloudify-amqpinflux.service",
"ActiveState": "active",
"SubState": "running"
}
],
"display_name": "AMQP InfluxDB"
},
{
"instances": [
{
"LoadState": "loaded",
"Description": "Cloudify REST Service",
"state": "running",
"MainPID": 5021,
"Id": "cloudify-restservice.service",
"ActiveState": "active",
"SubState": "running"
}
],
"display_name": "Manager Rest-Service"
},
{
"instances": [
{
"LoadState": "loaded",
"Description": "Cloudify WebUI Service",
"state": "running",
"MainPID": 5831,
"Id": "cloudify-webui.service",
"ActiveState": "active",
"SubState": "running"
}
],
"display_name": "Cloudify UI"
},
{
"instances": [
{
"LoadState": "loaded",
"Description": "nginx - high performance web server",
"state": "running",
"MainPID": 5893,
"Id": "nginx.service",
"ActiveState": "active",
"SubState": "running"
}
],
"display_name": "Webserver"
},
{
"instances": [
{
"LoadState": "loaded",
"Description": "Riemann Service",
"state": "running",
"MainPID": 6500,
"Id": "cloudify-riemann.service",
"ActiveState": "active",
"SubState": "running"
}
],
"display_name": "Riemann"
},
{
"instances": [
{
"LoadState": "loaded",
"Description": "Elasticsearch",
"state": "running",
"MainPID": 4219,
"Id": "elasticsearch.service",
"ActiveState": "active",
"SubState": "running"
}
],
"display_name": "Elasticsearch"
}
]
}
Attributes:
Attribute | Type | Description |
---|---|---|
status |
string | The status of the manager. Will always have a “running” value. |
services |
list | List of Service resources each, representing a service running in the manager. |
The Service Object:
Attribute | Type | Description |
---|---|---|
instances |
list | List of Instance resources representing the instances of a service running in a manager in a DBus structure. |
display_name |
string | The service name. |
The Instance Object:
Attribute | Type | Description |
---|---|---|
LoadState |
string | Contains a state value that reflects whether the configuration file of this unit has been loaded. |
Description |
string | The description of the service instance. |
state |
string | The state of the service instance (unknown, down, up, finish). |
MainPID |
integer | The process id of the main service instance process. |
Id |
string | The id of the service instance. |
ActiveState |
string | Contains a state value that reflects whether the unit is currently active or not. The following states are currently defined: active, reloading, inactive, failed, activating, deactivating. |
SubState |
string | Encodes states of the same state machine that ActiveState covers, but knows more fine-grained states that are unit-type-specific. |
Information about the instance fields can be found in the DBus reference.
Version
GET /api/v2/version
Gets Cloudify manager version information.
Request Example
$ curl -XGET http://localhost/api/v2/version
Response Example
{
"date": "",
"commit": "",
"version": "3.3.0",
"build": "85"
}
Attributes:
Attribute | Type | Description |
---|---|---|
date |
ISO 8601 | The date and time of the build the manager was built of. |
commit |
string | Git commit hash of the REST service code base used by the manager. |
version |
string | The version of Cloudify manager. |
build |
string | Build number. |
Node Instances
The NodeInstance Resource
Attributes:
Attribute | Type | Description |
---|---|---|
id |
string | The id of the node instance. |
deployment_id |
string | The id of the deployment the node instance belongs to. |
host_id |
string | The Compute node instance id the node is contained within. |
runtime_properties |
object | The runtime properties of the node instance. |
relationships |
list | The relationships the node has with other nodes. |
state |
string | The node instance state. |
version |
integer | A version attribute used for optimistic locking when updating the node instance. |
Get Node Instance
Request Example
$ curl -XGET http://localhost/api/v2/node_instances/vm_150f1
Response Example
{
"relationships": [
{
"target_name": "vm",
"type": "cloudify.relationships.contained_in",
"target_id": "vm_150f1"
}
],
"runtime_properties": {},
"node_id": "http_web_server",
"version": 1,
"state": "uninitialized",
"host_id": "vm_150f1",
"deployment_id": "hello1",
"id": "http_web_server_7e234"
}
GET /api/v2/node_instances/{node-instance-id}
Gets a node instance.
URI Parameters
- node-instance-id: The id of the node instance.
Response
A NodeInstance
resource.
List Node Instances
GET /api/v2/node_instances
Lists all node instances.
Response
Field | Type | Description |
---|---|---|
items |
list | A list of NodeInstance resources. |
Update Node Instance
PATCH /api/v2/node_instances/{node-instance-id}
Updates a node instance.
URI Parameters
- node-instance-id: The id of the node instance.
Request Body
Property | Type | Description |
---|---|---|
runtime_properties |
object | A dictionary containing the updated runtime properties of the node instance. |
state |
string | The new state of the node instance. |
version |
integer | The node instance current version (used for optimistic locking). |
- The version property should be set to the current value of the node instance. The version is auto incremented by Cloudify on every update.
Response
A NodeInstance
resource.
Nodes
The Node Resource
Attributes:
Attribute | Type | Description |
---|---|---|
id |
string | The name of the node. |
deployment_id |
string | The id of the deployment the node belongs to. |
blueprint_id |
string | The id of the blueprint the node belongs to. |
type |
string | The type of the node. |
type_hierarchy |
list | The type hierarchy of the node (ancestors). |
number_of_instances |
integer | The number of node instances the node has. |
planned_number_of_instances |
integer | - |
deploy_number_of_instances |
integer | - |
host_id |
string | The Compute node name the node is contained within. |
properties |
object | The properties of the node. |
operations |
object | The operations the node exposes. |
plugins |
list | A list of plugins the node is using for executing its operations. |
plugins_to_install |
list | A list of required plugins to install in order to execute the node’s operations. |
relationships |
list | The relationships the node has with other nodes. |
id
anddeployment_id
are combined together for uniquely identifying a node.
List Nodes
Request Example
$ curl -X http://localhost/api/v2/nodes
Response Example
{
"items": [
{
"operations": {
"cloudify.interfaces.lifecycle.delete": {
"inputs": {},
"has_intrinsic_functions": false,
"plugin": "",
"retry_interval": null,
"max_retries": null,
"executor": null,
"operation": ""
},
"cloudify.interfaces.lifecycle.create": {
"inputs": {},
"has_intrinsic_functions": false,
"plugin": "",
"retry_interval": null,
"max_retries": null,
"executor": null,
"operation": ""
},
"cloudify.interfaces.lifecycle.stop": {
"inputs": {
"script_path": "scripts/stop.sh"
},
"has_intrinsic_functions": false,
"plugin": "script",
"retry_interval": null,
"max_retries": null,
"executor": "host_agent",
"operation": "script_runner.tasks.run"
},
"cloudify.interfaces.lifecycle.start": {
"inputs": {
"script_path": "scripts/start.sh"
},
"has_intrinsic_functions": false,
"plugin": "script",
"retry_interval": null,
"max_retries": null,
"executor": "host_agent",
"operation": "script_runner.tasks.run"
},
"cloudify.interfaces.lifecycle.configure": {
"inputs": {
"script_path": "scripts/configure.sh"
},
"has_intrinsic_functions": false,
"plugin": "script",
"retry_interval": null,
"max_retries": null,
"executor": "host_agent",
"operation": "script_runner.tasks.run"
}
},
"deploy_number_of_instances": "1",
"type_hierarchy": [
"cloudify.nodes.Root",
"cloudify.nodes.SoftwareComponent",
"cloudify.nodes.WebServer"
],
"blueprint_id": "hello-world",
"plugins": [
{
"distribution_release": null,
"install_arguments": null,
"name": "script",
"package_name": "cloudify-script-plugin",
"distribution_version": null,
"package_version": "1.3",
"supported_platform": null,
"source": null,
"install": false,
"executor": "host_agent",
"distribution": null
}
],
"host_id": "vm",
"properties": {
"port": 8080
},
"relationships": [
{
"source_operations": {
"cloudify.interfaces.relationship_lifecycle.unlink": {
"inputs": {},
"has_intrinsic_functions": false,
"plugin": "",
"retry_interval": null,
"max_retries": null,
"executor": null,
"operation": ""
},
"cloudify.interfaces.relationship_lifecycle.preconfigure": {
"inputs": {},
"has_intrinsic_functions": false,
"plugin": "",
"retry_interval": null,
"max_retries": null,
"executor": null,
"operation": ""
},
"cloudify.interfaces.relationship_lifecycle.establish": {
"inputs": {},
"has_intrinsic_functions": false,
"plugin": "",
"retry_interval": null,
"max_retries": null,
"executor": null,
"operation": ""
},
"cloudify.interfaces.relationship_lifecycle.postconfigure": {
"inputs": {},
"has_intrinsic_functions": false,
"plugin": "",
"retry_interval": null,
"max_retries": null,
"executor": null,
"operation": ""
}
},
"target_operations": {
"cloudify.interfaces.relationship_lifecycle.unlink": {
"inputs": {},
"has_intrinsic_functions": false,
"plugin": "",
"retry_interval": null,
"max_retries": null,
"executor": null,
"operation": ""
},
"cloudify.interfaces.relationship_lifecycle.preconfigure": {
"inputs": {},
"has_intrinsic_functions": false,
"plugin": "",
"retry_interval": null,
"max_retries": null,
"executor": null,
"operation": ""
},
"cloudify.interfaces.relationship_lifecycle.establish": {
"inputs": {},
"has_intrinsic_functions": false,
"plugin": "",
"retry_interval": null,
"max_retries": null,
"executor": null,
"operation": ""
},
"cloudify.interfaces.relationship_lifecycle.postconfigure": {
"inputs": {},
"has_intrinsic_functions": false,
"plugin": "",
"retry_interval": null,
"max_retries": null,
"executor": null,
"operation": ""
}
},
"type_hierarchy": [
"cloudify.relationships.depends_on",
"cloudify.relationships.contained_in"
],
"target_id": "vm",
"type": "cloudify.relationships.contained_in",
"properties": {
"connection_type": "all_to_all"
}
}
],
"plugins_to_install": null,
"type": "cloudify.nodes.WebServer",
"id": "http_web_server",
"number_of_instances": "1",
"deployment_id": "hello1",
"planned_number_of_instances": "1"
}
]
}
GET /api/v2/nodes
Lists all nodes.
Response
Field | Type | Description |
---|---|---|
items |
list | A list of Node resources. |
Plugins
The Plugin Resource
Attributes:
Attribute | Type | Description |
---|---|---|
id |
string | The ID assigned to the plugin upon upload. |
package_name |
string | The python package name. |
archive_name |
string | The plugin archive file name. |
package_source |
string | The python package source, i.e git, pip etc. |
package_version |
string | The python package version. |
supported_platform |
string | The supported platform for the plugin package, ‘any’ if the plugin is compatible with all platforms. |
distribution |
string | The OS distribution the plugin was compiled on. ‘None’ in-case the plugin is cross platform. |
distribution_version |
string | The OS distribution version the plugin was compiled on. ‘None’ in-case the plugin is cross platform. |
distribution_release |
string | The OS distribution release name the plugin was compiled on. ‘None’ in-case the plugin is cross platform. |
wheels |
list | A list of wheels contained in the plugin package. |
excluded_wheels |
list | a list of wheels that were excluded from the plugin package. |
supported_py_versions |
list | a list of python platforms supported by the plugin. |
uploaded_at |
ISO 8601 | The time and date the plugin was uploaded on to the Cloudify-Manager. |
Get Plugin
Request Example
$ curl -XGET http://localhost/api/v2/plugins/0e56d421-ddf9-4fc3-ade5-95ba1de96366
Response Example
{
"archive_name":"cloudify_script_plugin-1.2-py27-none-any-none-none.wgn",
"package_name":"cloudify-script-plugin",
"package_version":"1.2",
"supported_platform":"any",
"package_source":"cloudify-script-plugin==1.2",
"distribution":null,
"distribution_version":null,
"distribution_release":null,
"supported_py_versions":["py27"],
"uploaded_at":"2015-12-06 11:32:46.799188",
"id":"0e56d421-ddf9-4fc3-ade5-95ba1de96366",
"wheels":["bottle-0.12.7-py2-none-any.whl",
"requests-2.7.0-py2.py3-none-any.whl",
"proxy_tools-0.1.0-py2-none-any.whl",
"cloudify_plugins_common-3.2.1-py2-none-any.whl"],
"excluded_wheels":[]
}
GET /api/v2/plugins/{plugin-id}
Gets a plugin.
URI Parameters
- plugin-id: The id of the plugin.
Response
A Plugin
resource.
Delete Plugin
DELETE /api/v2/plugins/{plugin-id}
Deletes a plugin from the Cloudify-Manager.
URI Parameters
- plugin-id: The id of the plugin.
Response
The deleted Plugin
resource.
List Plugins
GET /api/v2/plugins
Lists all plugins.
Response
Field | Type | Description |
---|---|---|
items |
list | A list of Plugin resources. |
metadata |
dict | Metadata relevant to the list response. |
Upload Plugin
POST /api/v2/plugins
Upload a plugins
Request Body
Property | Type | Description |
---|---|---|
plugin_path |
string | The plugin archive local path. |
plugin_archive_url |
string | A URL of the plugin archive to be uploaded. The plugin will be downloaded by the manager. |
Response
The new uploaded Plugin
resource.
Download Plugin
GET /api/v2/plugins/{plugin-id}/archive
Downloads a plugin.
URI Parameters
- plugin-id: The id of the plugin.
Response
The requested plugin archive.
Snapshots
The Snapshot Resource
Attributes:
Attribute | Type | Description |
---|---|---|
id |
string | A unique identifier of the snapshot. |
created_at |
ISO 8601 | The time the snapshot was uploaded to or created on the manager. |
status |
string | Status of the snapshot. One of created/failed/uploading/uploaded. |
error |
string | Message of an error if snapshot creation failed. |
List Snapshots
GET /api/v2/snapshots
Lists all snapshots.
Request Example
$ curl -XGET http://localhost/api/v2/snapshots
Response Example
{
"items": [
{
"created_at": "2015-12-04 13:34:45.080009",
"error": "",
"id": "snapshot1",
"status": "created"
},
{
"created_at": "2015-12-04 13:35:04.972249",
"error": "",
"id": "snapshot2",
"status": "created"
}
],
"metadata": {
"pagination": {
"offset": 0,
"size": 10000,
"total": 2
}
}
}
Response
Attribute | Type | Description |
---|---|---|
items |
list | A list of Snapshot resources. |
Create Snapshot
PUT /api/v2/snapshots/{snapshot-id}
Creates a new snapshot.
URI Parameters
- snapshot-id: The id of the new snapshot.
Request Body
Property | Type | Description |
---|---|---|
include_metrics |
string | Specifies whether metrics stored in InfluxDB should be included in the created snapshot. It defaults to false. |
include_credentials |
string | Specifies whether agent SSH keys (including those specified in uploaded blueprints) should be included in the created snapshot. It defaults to false. |
Response
An Execution resource representing the create snapshot workflow execution.
Delete Snapshot
DELETE /api/v2/snapshots/{snapshot-id}
Deletes an existing snapshot.
URI Parameters
- snapshot-id: The id of the snapshot to be deleted.
Response
An empty Snapshot resource, with one non-empty field (its id).
Restore Snapshot
POST /api/v2/snapshots/{snapshot-id}/restore
Restores the specified snapshot on the manager.
URI Parameters
- snapshot-id: The id of the snapshot to be restored.
Request Body
Property | Default | Description |
---|---|---|
force |
false | Specifies whether to force restoring the snapshot on a manager that already contains blueprints/deployments. |
recreate_deployments_envs |
true | Specifies whether deployment environments should be created for restored deployments. |
Response
An Execution resource representing the restore snapshot workflow execution.
Download Snapshot
GET /api/v2/snapshots/{snapshot-id}/archive
Downloads an existing snapshot.
URI Parameters
- snapshot-id: The id of the snapshot to be downloaded.
Response
A streamed response (content type application/octet-stream
), which is a zip archive containing the snapshot data.
Upload Snapshot
PUT /api/v2/snapshots/{snapshot-id}/archive
Uploads a snapshot to the Cloudify Manager.
The call expects a application/octet-stream
content type where the content is a zip archive.
It is possible to upload a snapshot from a URL by specifying the URL in the snapshot_archive_url
request body property.
URI Parameters
- snapshot-id: The id of the snapshot to be uploaded.
Request Body
Property | Type | Description |
---|---|---|
snapshot_archive_url |
string | Optional parameter specifying a url to a snapshot that will be uploaded to the manager. |
Response
A Snapshot resource.
Tokens
The Tokens Resource
Attributes:
Attribute | Type | Description |
---|---|---|
value |
string | The value of the token |
Get Token
Request Example
$ curl -XGET http://localhost/api/v2/tokens
Response Example
{
"value":"reltkwe5lk645jp0jdvsr345gkllsre"
}
GET /api/v2/tokens
Gets a token.
Response
A Token
resource.