Deployments API

class cloudify_rest_client.deployments.Deployment(deployment)[source]

Bases: dict

Cloudify deployment.

property id
Returns:

The identifier of the deployment.

property blueprint_id
Returns:

The identifier of the blueprint this deployment belongs to.

property created_by
Returns:

The name of the deployment creator.

property workflows
Returns:

The workflows of this deployment.

property inputs
Returns:

The inputs provided on deployment creation.

property outputs
Returns:

The outputs definition of this deployment.

property capabilities
Returns:

The capabilities definition of this deployment.

property description
Returns:

The description of this deployment.

property site_name
Returns:

The site of this deployment.

property visibility
Returns:

The visibility of this deployment.

property runtime_only_evaluation
property labels
Returns:

The labels of this deployment.

property deployment_groups
Returns:

IDs of deployment groups that this deployment belongs to

property installation_status
Returns:

The deployment installation status

property deployment_status
Returns:

The overall deployment status

property sub_services_status
Returns:

The aggregated sub services status

property sub_environments_status
Returns:

The aggregated sub environments status

property sub_services_count
Returns:

The aggregated sub services count

property sub_environments_count
Returns:

The aggregated sub environments count

property environment_type
Returns:

The environment type

property latest_execution_id
Returns:

The deployment latest execution ID

property latest_execution_workflow_id
Returns:

The deployment latest execution workflow name

property latest_execution_status
Returns:

The deployment latest execution status

property latest_execution_total_operations
Returns:

The total operations for latest execution of deployment

property latest_execution_finished_operations
Returns:

The finished operations for latest execution of deployment

property tenant_name
is_environment()[source]
Returns:

True if deployment is an environment

property display_name
Returns:

The deployment’s display name

property policy_types
property policy_triggers
property groups
property scaling_groups
property unavailable_instances

Amount of instances that failed their status check.

property drifted_instances

Amount of instances that have configuration drift.

class cloudify_rest_client.deployments.Workflow(workflow)[source]

Bases: dict

property id
Returns:

The workflow’s id

property name
Returns:

The workflow’s name

property parameters
Returns:

The workflow’s parameters

property is_available

Is this workflow available for running?

property availability_rules

Rules defining if this workflow is available

class cloudify_rest_client.deployments.DeploymentOutputs(outputs)[source]

Bases: dict

property deployment_id

Deployment Id the outputs belong to.

property outputs

Deployment outputs as dict.

class cloudify_rest_client.deployments.DeploymentCapabilities(capabilities)[source]

Bases: dict

property deployment_id

Id of the deployment the capabilities belong to.

property capabilities

Deployment capabilities as dict.

class cloudify_rest_client.deployments.DeploymentScalingGroup(scaling_groups)[source]

Bases: dict

property name

Name of the scaling group.

property members

A list of members of the scaling group (nodes).

property properties

A dict of scaling group’s configuration for instances quantities.

class cloudify_rest_client.deployments.DeploymentGroup(group)[source]

Bases: dict

property deployment_ids

IDs of deployments belonging to this group

property default_inputs

Default inputs for new deployments created in this group

property default_blueprint_id

Default blueprint for new deployments created in this group

property labels

Labels of this deployment group

property description

Description of this deployment group

class cloudify_rest_client.deployments.DeploymentGroupsClient(api)[source]

Bases: object

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

List all deployment groups.

get(group_id)[source]

Get the specified deployment group.

put(group_id, visibility='tenant', description=None, blueprint_id=None, default_inputs=None, labels=None, filter_id=None, deployment_ids=None, new_deployments=None, deployments_from_group=None, created_by=None, created_at=None, creation_counter=None)[source]

Create or update the specified deployment group.

Setting group deployments using this method (via either filter_id or deployment_ids) will set, NOT ADD, ie. it will remove all other deployments from the group.

Parameters:
  • visibility – visibility of the group

  • description – description of the group

  • blueprint_id – the default blueprint to use when extending

  • default_inputs – the default inputs to use when extending

  • deployment_ids – make the group contain these existing deployments

  • labels – labels for this group; those will be automatically added to all deployments created by this group

  • filter_id – set the group to contain the deployments matching this filter

  • new_deployments (a list of dicts, each can contain the keys "id", "inputs", "labels") – create new deployments using this specification, merged with the group’s default_blueprint and default_inputs

  • deployments_from_group – add all deployments belonging to the group given by this id

  • created_by – Override the creator. Internal use only.

  • created_at – Override the creation timestamp. Internal use only.

  • creation_counter – Override the creation counter. Internal use only.

Returns:

the created deployment group

add_deployments(group_id, deployment_ids=None, count=None, new_deployments=None, filter_id=None, filter_rules=None, deployments_from_group=None, batch_size=5000)[source]

Add the specified deployments to the group

Parameters:
  • group_id – add deployments to this group

  • deployment_ids – add these pre-existing deployments

  • count – create this many deployments using the group’s default_inputs and default_blueprint, and add them to the group. Mutally exclusive with inputs.

  • new_deployments (a list of dicts, each can contain the keys "id", "inputs", "labels") – create new deployments using this specification, merged with the group’s default_blueprint and default_inputs. Mutually exclusive with count.

  • filter_id – add deployments matching this filter

  • filter_rules – add deployments matching these filter rules

  • deployments_from_group – add all deployments belonging to the group given by this id

  • batch_size – when creating new deployments, create this many at a time (do multiple HTTP calls if needed)

Returns:

the updated deployment group

remove_deployments(group_id, deployment_ids=None, filter_id=None, filter_rules=None, deployments_from_group=None)[source]

Remove the specified deployments from the group

Parameters:
  • group_id – remove deployments from this group

  • deployment_ids – remove these deployment from the group

  • filter_id – remove deployments matching this filter

  • filter_rules – remove deployments matching these filter rules

  • deployments_from_group – remove all deployments belonging to the group given by this id

Returns:

the updated deployment group

delete(group_id, delete_deployments=False, force=False, with_logs=False, recursive=False)[source]

Delete a deployment group. By default, keep the deployments.

Parameters:
  • group_id – the group to remove

  • delete_deployments – also delete all deployments belonging to this group

  • force – same meaning as in deployments.delete

  • with_logs – same meaning as in deployments.delete

  • recursive – same meaning as in deployments.delete

dump(deployment_groups_ids=None)[source]

Generate deployment groups’ attributes for a snapshot.

Parameters:

deployment_groups_ids – A list of deployment groups’ identifiers, if not empty, used to select deployment groups to be dumped.

Returns:

A generator of dictionaries, which describe deployment groups’ attributes.

restore(entities, logger)[source]

Restore deployment groups from a snapshot.

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

  • logger – A logger instance.

class cloudify_rest_client.deployments.DeploymentOutputsClient(api)[source]

Bases: object

get(deployment_id)[source]

Gets the outputs for the provided deployment’s Id.

Parameters:

deployment_id – Deployment Id to get outputs for.

Returns:

Outputs as dict.

class cloudify_rest_client.deployments.DeploymentCapabilitiesClient(api)[source]

Bases: object

get(deployment_id)[source]

Gets the capabilities for the provided deployment’s Id.

Parameters:

deployment_id – Deployment Id to get capabilities for.

Returns:

Capabilities as dict.

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

Returns a list of deployment’s capabilities matching constraints.

Parameters:
  • deployment_id – An identifier of a deployment which capabilities are going to be searched.

  • _include – List of fields to include in response.

  • constraints – A list of DSL constraints for capability_value data type to filter the capabilities by.

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

Returns:

Deployments list.

class cloudify_rest_client.deployments.DeploymentScalingGroupsClient(api)[source]

Bases: object

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

Returns a list of deployment’s scaling groups matching constraints.

Parameters:
  • blueprint_id – An identifier of a blueprint which scaling groups are going to be searched.

  • deployment_id – An identifier of a deployment which scaling groups are going to be searched.

  • constraints – A list of DSL constraints for scaling_group data type to filter the scaling groups by.

  • _include – List of fields to include in response.

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

Returns:

DeploymentScalingGroup list.

class cloudify_rest_client.deployments.DeploymentsClient(api)[source]

Bases: object

list(_include=None, sort=None, is_descending=False, filter_id=None, filter_rules=None, constraints=None, **kwargs)[source]

Returns a list of all deployments.

Parameters:
  • _include – List of fields to include in response.

  • sort – Key for sorting the list.

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

  • filter_id – A filter ID to filter the deployments list by

  • filter_rules – A list of filter rules to filter the deployments list by

  • constraints – A list of DSL constraints for deployment_id data type. The purpose is similar to the filter_rules, but syntax differs.

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

Returns:

Deployments list.

get(deployment_id, _include=None, all_sub_deployments=True, include_workdir=False)[source]

Returns a deployment by its id.

Parameters:
  • deployment_id – Id of the deployment to get.

  • _include – List of fields to include in response.

  • all_sub_deployments – The values for sub_services_count and

sub_environments_count will represent recursive numbers. Otherwise if its False, then only the direct services and environments will be considered :return: Deployment.

create(blueprint_id, deployment_id, inputs=None, visibility='tenant', skip_plugins_validation=False, site_name=None, runtime_only_evaluation=False, labels=None, display_name=None, async_create=None, created_at=None, created_by=None, workflows=None, groups=None, scaling_groups=None, policy_triggers=None, policy_types=None, outputs=None, capabilities=None, resource_tags=None, description=None, deployment_status=None, installation_status=None, sub_services_status=None, sub_environments_status=None, sub_services_count=None, sub_environments_count=None, _workdir_zip=None)[source]

Creates a new deployment for the provided blueprint id and deployment id.

Parameters:
  • blueprint_id – Blueprint id to create a deployment of.

  • deployment_id – Deployment id of the new created deployment.

  • inputs – Inputs dict for the deployment.

  • visibility – The visibility of the deployment, can be ‘private’ or ‘tenant’.

  • skip_plugins_validation – Determines whether to validate if the required deployment plugins exist on the manager. If validation is skipped, plugins containing source URL will be installed from source.

  • site_name – The name of the site for the deployment.

  • runtime_only_evaluation – If set, all intrinsic functions will only be evaluated at runtime, and no functions will be evaluated at parse time.

  • labels – The deployment’s labels. A list of 1-entry dictionaries: [{<key1>: <value1>}, {<key2>: <value2>}, …]’

  • display_name – The deployment’s display name.

  • async_create – if True, do not wait for the deployment environment to finish creating

  • _workdir_zip – Internal only.

  • workflows – Set the deployment workflows. Internal use only.

  • groups – Set groups. Internal use only.

  • scaling_groups – Set scaling_groups. Internal use only.

  • policy_triggers – Set policy_triggers. Internal use only.

  • policy_types – Set policy_types. Internal use only.

  • outputs – Set outputs. Internal use only.

  • capabilities – Set capabilities. Internal use only.

  • resource_tags – Set resource_tags. Internal use only.

  • description – Set description. Internal use only.

  • created_by – Override the creator. Internal use only.

  • created_at – Override the creation timestamp. Internal use only.

  • deployment_status – Set deployment status. Internal use only.

  • installation_status – Set installation status. Internal use only.

  • sub_services_status – Set sub-services status. Internal use only.

  • sub_environments_status – Set sub-environments status. Internal use only.

  • sub_services_count – Set sub-services count. Internal use only.

  • sub_environments_count – Set sub-environments count. Internal use only.

Returns:

The created deployment.

delete(deployment_id, force=False, delete_db_mode=False, with_logs=False, recursive=False)[source]

Deletes the deployment whose id matches the provided deployment id. By default, deletion of a deployment with live nodes or installations which depend on it is not allowed. This behavior can be changed using the force argument.

Parameters:
  • deployment_id – The deployment’s to be deleted id.

  • force – Delete deployment even if there are existing live nodes for it, or existing installations which depend on it.

  • delete_db_mode – deprecated and does nothing

  • with_logs – when set to true, the management workers’ logs for the deployment are deleted as well.

  • recursive – also delete all service deployments contained in this delployment.

Returns:

The deleted deployment.

set_visibility(deployment_id, visibility)[source]

Updates the deployment’s visibility

Parameters:
  • deployment_id – Deployment’s id to update.

  • visibility – The visibility to update, should be ‘tenant’.

Returns:

The deployment.

set_site(deployment_id, site_name=None, detach_site=False)[source]

Updates the deployment’s site

Parameters:
  • deployment_id – Deployment’s id to update.

  • site_name – The site to update

  • detach_site – True for detaching the current site, making the deployment siteless

Returns:

The deployment.

update_labels(deployment_id, labels, creator=None, created_at=None)[source]

Updates the deployment’s labels.

Parameters:
  • deployment_id – Deployment’s id to update.

  • labels – The new deployment’s labels. A list of 1-entry dictionaries: [{<key1>: <value1>}, {<key2>: <value2>}, …]’

Returns:

The deployment

set_attributes(deployment_id, **kwargs)[source]

Set arbitrary properties on the deployment.

If you’re not sure, you probably want to look at deployment update instead.

For internal use only.

dump(deployment_ids=None)[source]

Generate deployments’ attributes for a snapshot.

Parameters:

deployment_ids – A list of deployments’ identifiers, if not empty, used to select specific deployments to be dumped.

Returns:

A generator of dictionaries, which describe deployments’ attributes.

restore(entities, logger, path_func=None)[source]

Restore deployments from a snapshot.

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

  • logger – A logger instance.

  • path_func – A function used retrieve deployment’s path.