Blueprints API

class cloudify_rest_client.blueprints.Blueprint(blueprint)[source]

Bases: dict

id
Returns:The identifier of the blueprint.
created_at
Returns:Timestamp of blueprint creation.
created_by
Returns:The name of the blueprint creator.
main_file_name
Returns:Blueprint main file name.
plan

Gets the plan the blueprint represents: nodes, relationships etc...

Returns:The content of the blueprint.
description

Gets the description of the blueprint

Returns:The description of the blueprint.
class cloudify_rest_client.blueprints.BlueprintsClient(api)[source]

Bases: object

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

Returns a list of currently stored blueprints.

Parameters:
  • _include – List of fields to include in response.
  • sort – Key for sorting the list.
  • is_descending – True for descending order, False for ascending.
  • kwargs – Optional filter fields. For a list of available fields see the REST service’s models.BlueprintState.fields
Returns:

Blueprints list.

publish_archive(archive_location, blueprint_id, blueprint_filename=None, private_resource=False, progress_callback=None)[source]

Publishes a blueprint archive to the Cloudify manager.

Parameters:
  • archive_location – Path or Url to the archive file.
  • blueprint_id – Id of the uploaded blueprint.
  • blueprint_filename – The archive’s main blueprint yaml filename.
  • private_resource – Whether the blueprint should be private
  • progress_callback – Progress bar callback method
Returns:

Created blueprint.

Archive file should contain a single directory in which there is a blueprint file named blueprint_filename (if blueprint_filename is None, this value will be passed to the REST service where a default value should be used). Blueprint ID parameter is available for specifying the blueprint’s unique Id.

static calc_size(blueprint_path)[source]
upload(blueprint_path, blueprint_id, private_resource=False, progress_callback=None)[source]

Uploads a blueprint to Cloudify’s manager.

Parameters:
  • blueprint_path – Main blueprint yaml file path.
  • blueprint_id – Id of the uploaded blueprint.
  • private_resource – Whether the blueprint should be private
  • progress_callback – Progress bar callback method
Returns:

Created blueprint.

Blueprint path should point to the main yaml file of the blueprint to be uploaded. Its containing folder will be packed to an archive and get uploaded to the manager. Blueprint ID parameter is available for specifying the blueprint’s unique Id.

get(blueprint_id, _include=None)[source]

Gets a blueprint by its id.

Parameters:
  • blueprint_id – Blueprint’s id to get.
  • _include – List of fields to include in response.
Returns:

The blueprint.

delete(blueprint_id)[source]

Deletes the blueprint whose id matches the provided blueprint id.

Parameters:blueprint_id – The id of the blueprint to be deleted.
Returns:Deleted blueprint.
download(blueprint_id, output_file=None, progress_callback=None)[source]

Downloads a previously uploaded blueprint from Cloudify’s manager.

Parameters:
  • blueprint_id – The Id of the blueprint to be downloaded.
  • progress_callback – Callback function for printing a progress bar
  • output_file – The file path of the downloaded blueprint file (optional)
Returns:

The file path of the downloaded blueprint.

add_permission(blueprint_id, users, permission)[source]
remove_permission(blueprint_id, users, permission)[source]