Blueprints API¶
- class cloudify_rest_client.blueprints.Blueprint(blueprint)[source]¶
Bases:
dict
- property id¶
- Returns:
The identifier of the blueprint.
- property created_at¶
- Returns:
Timestamp of blueprint creation.
- property created_by¶
- Returns:
The name of the blueprint creator.
- property main_file_name¶
- Returns:
Blueprint main file name.
- property plan¶
Gets the plan the blueprint represents: nodes, relationships etc…
- Returns:
The content of the blueprint.
- property description¶
Gets the description of the blueprint
- Returns:
The description of the blueprint.
- property state¶
Gets the upload state of the blueprint
- Returns:
The upload state of the blueprint.
- property labels¶
- Returns:
The labels of this blueprint.
- property upload_execution¶
- Returns:
The upload_blueprint execution that parsed this blueprint.
- property tenant_name¶
- Returns:
The name of the tenant associated with this blueprint.
- property requirements¶
Requirements for creating deployments based on this blueprint.
If set, this is a dict with key describing various requirements, such as “secrets” or “parent_capabilities”. It is up to the caller to interpret them.
- Returns:
A description of blueprint deploy requirements.
- class cloudify_rest_client.blueprints.BlueprintsClient(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 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.
filter_id – A filter ID to filter the blueprints list by
filter_rules – A list of filter rules to filter the blueprints list by
constraints – A list of DSL constraints for blueprint_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.BlueprintState.fields
- Returns:
Blueprints list.
- publish_archive(archive_location, blueprint_id, blueprint_filename=None, visibility='tenant', progress_callback=None, async_upload=False, labels=None, created_at=None, created_by=None, skip_execution=False, requirements=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.
visibility – The visibility of the blueprint, can be ‘private’, ‘tenant’ or ‘global’.
progress_callback – Progress bar callback method
labels – The blueprint’s labels. A list of 1-entry dictionaries: [{<key1>: <value1>}, {<key2>: <value2>}, …]’
- Requirements:
A dict representing the blueprint deploy requirements
- 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.
- upload(path, entity_id, visibility='tenant', progress_callback=None, skip_size_limit=True, async_upload=False, labels=None, created_at=None, created_by=None, state=None, skip_execution=False, legacy=False, requirements=None)[source]¶
Uploads a blueprint to Cloudify’s manager.
- Parameters:
path – Main blueprint yaml file path.
entity_id – Id of the uploaded blueprint.
visibility – The visibility of the blueprint, can be ‘private’, ‘tenant’ or ‘global’.
progress_callback – Progress bar callback method
skip_size_limit – Indicator whether to check size limit on blueprint folder
labels – The blueprint’s labels. A list of 1-entry dictionaries: [{<key1>: <value1>}, {<key2>: <value2>}, …]’
legacy – Support some parameters for upload to older managers. Internal use only.
- Requirements:
A dict representing the blueprint deploy requirements
- Returns:
Created response.
Blueprint path should point to the main yaml file of the response 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 response’s unique Id.
- validate(path, entity_id, blueprint_filename=None, visibility='tenant', progress_callback=None, skip_size_limit=True)[source]¶
Validates a blueprint with Cloudify’s manager.
- Parameters:
path – Main blueprint yaml file path.
entity_id – Id of the uploaded blueprint.
blueprint_filename – The archive’s main blueprint yaml filename.
visibility – The visibility of the blueprint, can be ‘private’, ‘tenant’ or ‘global’.
progress_callback – Progress bar callback method
skip_size_limit – Indicator whether to check size limit on blueprint folder
Blueprint path should point to the main yaml file of the response to be uploaded. Its containing folder will be packed to an archive and get uploaded to the manager. Validation is basically an upload without the storage part being done.
- 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, force=False)[source]¶
Deletes the blueprint whose id matches the provided blueprint id.
- Parameters:
blueprint_id – The id of the blueprint to be deleted.
force – Delete blueprint even if there is a blueprint currently importing it.
- 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.
- set_global(blueprint_id)[source]¶
Updates the blueprint’s visibility to global
- Parameters:
blueprint_id – Blueprint’s id to update.
- Returns:
The blueprint.
- set_visibility(blueprint_id, visibility)[source]¶
Updates the blueprint’s visibility
- Parameters:
blueprint_id – Blueprint’s id to update.
visibility – The visibility to update, should be ‘tenant’ or ‘global’.
- Returns:
The blueprint.
- update(blueprint_id, update_dict)[source]¶
Update a blueprint.
Used for updating the blueprint’s state (and error) while uploading, and updating the blueprint’s other attributes upon a successful upload. This method is for internal use only.
- Parameters:
blueprint_id – Blueprint’s id to update.
update_dict – Dictionary of attributes and values to be updated.
- Returns:
The updated blueprint.
- upload_archive(blueprint_id, archive_path)[source]¶
Upload an archive for an existing a blueprint.
Used for uploading the blueprint’s archive, downloaded from a URL using a system workflow, to the manager’s file server This method is for internal use only.
- Parameters:
blueprint_id – Blueprint’s id to update.
archive_path – Path of a local blueprint archive data to upload to the manager’s file server. Valid only when the blueprint’s current upload state is Uploading, and is not being updated.
- upload_icon(blueprint_id, icon_path)[source]¶
Upload an icon for an existing a blueprint.
- Parameters:
blueprint_id – Blueprint’s id to update.
icon_path – Path of a local file containing a icon for the blueprint.
- remove_icon(blueprint_id)[source]¶
Request removal of the icon for an existing a blueprint.
- Parameters:
blueprint_id – Blueprint’s id to update.
- dump(blueprint_ids=None)[source]¶
Generate blueprints’ attributes for a snapshot.
- Parameters:
blueprint_ids – A list of blueprints identifiers, if not empty, used to select specific blueprints to be dumped.
- Returns:
A generator of dictionaries, which describe blueprints’ attributes.
- restore(entities, logger, path_func=None)[source]¶
Restore blueprints from a snapshot.
- Parameters:
entities – An iterable (e.g. a list) of dictionaries describing blueprints to be restored.
logger – A logger instance.
path_func – A function used retrieve blueprint’s path.
- Returns:
A generator of dictionaries, which describe additional data used for snapshot restore entities post-processing.