Nodes API

class cloudify_rest_client.nodes.Node[source]

Bases: dict

Cloudify node.

property id
Returns:

The identifier of the node.

property deployment_id
Returns:

The deployment id the node belongs to.

property created_by
Returns:

The name of the node creator.

property properties
Returns:

The static properties of the node.

property operations
Returns:

The node operations mapped to plugins.

Return type:

dict

property relationships
Returns:

The node relationships with other nodes.

Return type:

list

property blueprint_id
Returns:

The id of the blueprint this node belongs to.

Return type:

str

property plugins
Returns:

The plugins this node has operations mapped to.

Return type:

dict

property number_of_instances
Returns:

The number of instances this node has.

Return type:

int

property planned_number_of_instances
Returns:

The planned number of instances this node has.

Return type:

int

property deploy_number_of_instances
Returns:

The number of instances this set for this node when the deployment was created.

Return type:

int

property unavailable_instances

Amount of instances that failed their status check.

property drifted_instances

Amount of instances that have configuration drift.

property host_id
Returns:

The id of the node instance which hosts this node.

Return type:

str

property type_hierarchy
Returns:

The type hierarchy of this node.

Return type:

list

property type
Returns:

The type of this node.

Return type:

str

class cloudify_rest_client.nodes.NodeTypes(node_type)[source]

Bases: dict

property id

ID of the node.

property deployment_id

ID of the deployment the node belong to.

property type

Node’s type.

class cloudify_rest_client.nodes.NodesClient(api)[source]

Bases: object

list(_include=None, filter_rules=None, constraints=None, **kwargs)[source]

Returns a list of nodes which belong to the deployment identified by the provided deployment id.

Parameters:
  • deployment_id – The deployment’s id to list nodes for.

  • node_id – If provided, returns only the requested node. This parameter is deprecated, use ‘id’ instead.

  • _include – List of fields to include in response.

  • sort – Key for sorting the list.

  • is_descending – True for descending order, False for ascending.

  • constraints – A list of DSL constraints for node_template data type to filter the nodes by.

  • kwargs – Optional filter fields. for a list of available fields see the REST service’s models.DeploymentNode.fields

  • evaluate_functions – Evaluate intrinsic functions

Returns:

Nodes.

Return type:

list

get(deployment_id, node_id, _include=None, evaluate_functions=False, instance_context=None)[source]

Returns the node which belongs to the deployment identified by the provided deployment id .

Parameters:
  • deployment_id – The deployment’s id of the node.

  • node_id – The node id.

  • _include – List of fields to include in response.

  • evaluate_functions – Evaluate intrinsic functions

  • instance_context – When evaluating functions, do it in context of this node instance id, i.e. get_attribute calls in node properties can be treated as if they were on the node instance with the given id.

Returns:

Nodes.

Return type:

Node

create_many(deployment_id, nodes)[source]

Create multiple nodes.

Parameters:
  • deployment_id – the new nodes belong to this deployment

  • nodes – list of dicts representing the nodes to be created. Each node dict must contain at least the keys: id, type.

Returns:

None

update(deployment_id, node_id, **kwargs)[source]

Update a node with new attributes.

This is only useful from the deployment-update workflow: updating node attributes will do nothing else by itself (it won’t re-install the existing instances, or re-establish relationships, etc.)

Parameters:
  • deployment_id – The deployment the node belongs to

  • node_id – The node id within the given deployment

  • kwargs – The new node attributes

delete(deployment_id, node_id)[source]

Delete a node

Parameters:
  • deployment_id – The deployment the node belongs to

  • node_id – The node id within the given deployment

dump(deployment_ids=None, node_ids=None)[source]

Generate nodes’ attributes for a snapshot.

Parameters:
  • deployment_ids – A list of deployments’ identifiers used to select nodes to be dumped, should not be empty.

  • node_ids – A list of nodes’ identifiers, if not empty, used to select specific nodes to be dumped.

Returns:

A generator of dictionaries, which describe nodes’ attributes.

restore(entities, logger, deployment_id)[source]

Restore nodes from a snapshot.

Parameters:
  • entities – An iterable (e.g. a list) of dictionaries describing nodes to be restored.

  • logger – A logger instance.

  • deployment_id – A deployment identifier for the entities.

class cloudify_rest_client.nodes.NodeTypesClient(api)[source]

Bases: object

list(node_type=None, constraints=None, **kwargs)[source]

Returns a list of node’s types matching constraints.

Parameters:
  • deployment_id – An identifier of a deployment which nodes are going to be searched. If omitted, ‘deployment_id’ key should be present in the constraints dict, otherwise the request will fail.

  • node_type – If provided, returns only the requested type.

  • constraints – A list of DSL constraints for node_type data type to filter the types by.

  • kwargs – Optional filter fields. for a list of available fields see the REST service’s models.Node.fields

Returns:

NodeTypes list.