Node Instances API¶
- class cloudify_rest_client.node_instances.NodeInstance[source]¶
Bases:
dict
Cloudify node instance.
- property id¶
- Returns:
The identifier of the node instance.
- property node_id¶
- Returns:
The identifier of the node whom this is in instance of.
- property relationships¶
- Returns:
The node instance relationships.
- property host_id¶
- Returns:
The node instance host_id.
- property deployment_id¶
- Returns:
The deployment id the node instance belongs to.
- property created_by¶
- Returns:
The name of the node instance creator.
- property runtime_properties¶
- Returns:
The runtime properties of the node instance.
- property system_properties¶
- Returns:
The system properties of the node instance.
- property state¶
- Returns:
The current state of the node instance.
- property version¶
- Returns:
The current version of the node instance (used for optimistic locking on update)
- property scaling_groups¶
- Returns:
Scaling group instances this node instance belongs to.
- property index¶
- Returns:
The index of this node instance in relation to other node instances of the same node.
- property is_status_check_ok¶
Has the last status check for this NI succeeded?
This examines the result of the most recent check_status call on this node instance, and returns whether the call succeeded.
If the result is missing, the result is succeeded.
- property has_configuration_drift¶
Has this NI’s configuration drifted?
This examines the result of the most recent check_drift call on this node instance, and returns whether there was any configuration drift reported.
The instance is drifted if either the instance itself, or any of its relationships have drifted.
- class cloudify_rest_client.node_instances.NodeInstancesClient(api)[source]¶
Bases:
object
- create_many(deployment_id, node_instances)[source]¶
Create multiple node-instances.
- Parameters:
deployment_id – the new instances belong to this deployment
node_instances – list of dicts representing the instances to be created. Each node dict must contain at least the keys: id, node_id.
- Returns:
None
- get(node_instance_id, _include=None, evaluate_functions=False)[source]¶
Returns the node instance for the provided node instance id.
- Parameters:
node_instance_id – The identifier of the node instance to get.
_include – List of fields to include in response.
evaluate_functions – Evaluate intrinsic functions
- Returns:
The retrieved node instance.
- update(node_instance_id, state=None, runtime_properties=None, version=1, force=False, relationships=None, system_properties=None)[source]¶
Update node instance with the provided state & runtime_properties.
- Parameters:
node_instance_id – The identifier of the node instance to update.
state – The updated state.
runtime_properties – The updated runtime properties.
system_properties – Like runtime_properties, but only managed by Cloudify itself internally.
version – Current version value of this node instance in Cloudify’s storage (used for optimistic locking).
force – ignore the version check - use with caution
relationships – New relationships to set for the node-instance. This is only useful when called from deployment-update: otherwise, just setting relationships will not do anything else by itself (eg. it won’t run the relationships establish operations)
- Returns:
The updated node instance.
- list(_include=None, constraints=None, **kwargs)[source]¶
Returns a list of node instances which belong to the deployment identified by the provided deployment id.
- Parameters:
deployment_id – Optional deployment id to list node instances for.
node_name – Optional node name to only fetch node instances with this name. The node_name positional argument will be deprecated as of the next rest-client version. Use node_id instead.
node_id – Equivalent to node_name.
_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_instance data type to filter the node_instances by.
kwargs – Optional filter fields. for a list of available fields see the REST service’s models.DeploymentNodeInstance.fields
- Returns:
Node instances.
- Return type:
list
- search(ids, all_tenants=False)[source]¶
Search node instances by their IDs.
- Parameters:
ids – list of ids to search by
all_tenants – search node-instances of all tenants
- Returns:
Node instances.
- Return type:
list
- delete(instance_id)[source]¶
Delete a node-instance
This is only useful from within deployment-update. You don’t want to delete node-instances otherwise: the state of the deployment could be made inconsistent.
- Parameters:
instance_id – ID of the instance to be deleted
- dump(deployment_ids=None, get_broker_conf=None, node_instance_ids=None)[source]¶
Generate node instances’ attributes for a snapshot.
- Parameters:
deployment_ids – A list of deployments’ identifiers used to select node instances to be dumped, should not be empty.
get_broker_conf – A function used to retrieve broker configuration.
node_instance_ids – A list of node instances’ identifiers, if not empty, used to select specific node instances to be dumped.
- Returns:
A generator of dictionaries, which describe node instances’ attributes.
- restore(entities, logger, deployment_id, inject_broker_conf=None)[source]¶
Restore node instances from a snapshot.
- Parameters:
entities – An iterable (e.g. a list) of dictionaries describing node instances to be restored.
logger – A logger instance.
deployment_id – A deployment identifier for the entities.
inject_broker_conf – A function used to inject broker configuration for given node_instance’s runtime_properties.