The heat.rpc.client Module

The heat.rpc.client Module

Client side of the heat engine RPC API.

class heat.rpc.client.EngineClient[source]

Bases: object

Client side of the heat engine rpc API.

API version history:

1.0 - Initial version.
1.1 - Add support_status argument to list_resource_types()
1.4 - Add support for service list
1.9 - Add template_type option to generate_template()
1.10 - Add support for software config list
1.11 - Add support for template versions list
1.12 - Add with_detail option for stack resources list
1.13 - Add support for template functions list
1.14 - Add cancel_with_rollback option to stack_cancel_update
1.15 - Add preview_update_stack() call
1.16 - Adds version, type_name to list_resource_types()
1.17 - Add files to validate_template
1.18 - Add show_nested to validate_template
1.19 - Add show_output and list_outputs for returning stack outputs
1.20 - Add resolve_outputs to stack show
1.21 - Add deployment_id to create_software_deployment
1.22 - Add support for stack export
1.23 - Add environment_files to create/update/preview/validate
1.24 - Adds ignorable_errors to validate_template
1.25 - list_stack_resource filter update
1.26 - Add mark_unhealthy
1.27 - Add check_software_deployment
1.28 - Add get_environment call
1.29 - Add template_id to create_stack/update_stack
1.30 - Add possibility to resource_type_* return descriptions
1.31 - Add nested_depth to list_events, when nested_depth is specified
       add root_stack_id to response
1.32 - Add get_files call
1.33 - Remove tenant_safe from list_stacks, count_stacks
       and list_software_configs
1.34 - Add migrate_convergence_1 call
1.35 - Add with_condition to list_template_functions
BASE_RPC_API_VERSION = '1.0'
abandon_stack(ctxt, stack_identity)[source]

Deletes a given stack but resources would not be deleted.

Parameters:
  • ctxt – RPC context.
  • stack_identity – Name of the stack you want to abandon.
authenticated_to_backend(ctxt)[source]

Validate the credentials in the RPC context.

Verify that the credentials in the RPC context are valid for the current cloud backend.

Parameters:ctxt – RPC context.
call(ctxt, msg, version=None, timeout=None)[source]
cast(ctxt, msg, version=None)[source]
check_software_deployment(cnxt, deployment_id, timeout)[source]
count_stacks(ctxt, filters=None, show_deleted=False, show_nested=False, show_hidden=False, tags=None, tags_any=None, not_tags=None, not_tags_any=None)[source]

Returns the number of stacks that match the given filters.

Parameters:
  • ctxt – RPC context.
  • filters – a dict of ATTR:VALUE to match against stacks
  • show_deleted – if true, count will include the deleted stacks
  • show_nested – if true, count will include nested stacks
  • show_hidden – if true, count will include hidden stacks
  • tags – count stacks containing these tags. If multiple tags are passed, they will be combined using the boolean AND expression
  • tags_any – count stacks containing these tags. If multiple tags are passed, they will be combined using the boolean OR expression
  • not_tags – count stacks not containing these tags. If multiple tags are passed, they will be combined using the boolean AND expression
  • not_tags_any – count stacks not containing these tags. If multiple tags are passed, they will be combined using the boolean OR expression
Returns:

an integer representing the number of matched stacks

create_software_config(cnxt, group, name, config, inputs=None, outputs=None, options=None)[source]
create_software_deployment(cnxt, server_id, config_id=None, input_values=None, action='INIT', status='COMPLETE', status_reason='', stack_user_project_id=None, deployment_id=None)[source]
create_stack(ctxt, stack_name, template, params, files, args, environment_files=None)[source]

Creates a new stack using the template provided.

Note that at this stage the template has already been fetched from the heat-api process if using a template-url.

Parameters:
  • ctxt – RPC context.
  • stack_name – Name of the stack you want to create.
  • template – Template of stack you want to create.
  • params – Stack Input Params/Environment
  • files – files referenced from the environment.
  • args – Request parameters/args passed from API
  • environment_files (list or None) – optional ordered list of environment file names included in the files dict
create_watch_data(ctxt, watch_name, stats_data)[source]

Creates data for CloudWatch and WaitConditions.

This could be used by CloudWatch and WaitConditions and treat HA service events like any other CloudWatch.

Parameters:
  • ctxt – RPC context.
  • watch_name – Name of the watch/alarm
  • stats_data – The data to post.
delete_snapshot(cnxt, stack_identity, snapshot_id)[source]
delete_software_config(cnxt, config_id)[source]
delete_software_deployment(cnxt, deployment_id)[source]
delete_stack(ctxt, stack_identity, cast=False)[source]

Deletes a given stack.

Parameters:
  • ctxt – RPC context.
  • stack_identity – Name of the stack you want to delete.
  • cast – cast the message instead of using call (default: False)

You probably never want to use cast(). If you do, you’ll never hear about any exceptions the call might raise.

describe_stack_resource(ctxt, stack_identity, resource_name, with_attr=False)[source]

Get detailed resource information about a particular resource.

Parameters:
  • ctxt – RPC context.
  • stack_identity – Name of the stack.
  • resource_name – the Resource.
describe_stack_resources(ctxt, stack_identity, resource_name)[source]

Get detailed resource information about one or more resources.

Parameters:
  • ctxt – RPC context.
  • stack_identity – Name of the stack.
  • resource_name – the Resource.
export_stack(ctxt, stack_identity)[source]

Exports the stack data in JSON format.

Parameters:
  • ctxt – RPC context.
  • stack_identity – Name of the stack you want to export.
find_physical_resource(ctxt, physical_resource_id)[source]

Return an identifier for the resource.

Parameters:
  • ctxt – RPC context.
  • physcial_resource_id – The physical resource ID to look up.
generate_template(ctxt, type_name, template_type='cfn')[source]

Generate a template based on the specified type.

Parameters:
  • ctxt – RPC context.
  • type_name – The resource type name to generate a template for.
  • template_type – the template type to generate, cfn or hot.
get_environment(context, stack_identity)[source]

Returns the environment for an existing stack.

Parameters:
  • context – RPC context
  • stack_identity – identifies the stack
Return type:

dict

get_files(context, stack_identity)[source]

Returns the files for an existing stack.

Parameters:
  • context – RPC context
  • stack_identity – identifies the stack
Return type:

dict

get_revision(ctxt)[source]
get_template(ctxt, stack_identity)[source]

Get the template.

Parameters:
  • ctxt – RPC context.
  • stack_name – Name of the stack you want to see.
identify_stack(ctxt, stack_name)[source]

Returns the full stack identifier for a single, live stack.

Parameters:
  • ctxt – RPC context.
  • stack_name – Name of the stack you want to see, or None to see all
ignore_error_by_name(name)[source]

Returns a context manager that filters exceptions with a given name.

Parameters:name – Name to compare the local exception name to.
ignore_error_named(error, name)[source]

Raises the error unless its local name matches the supplied name.

Parameters:
  • error – Remote raised error to derive the local name from.
  • name – Name to compare local name to.
list_events(ctxt, stack_identity, filters=None, limit=None, marker=None, sort_keys=None, sort_dir=None, nested_depth=None)[source]

Lists all events associated with a given stack.

It supports pagination (limit and marker), sorting (sort_keys and sort_dir) and filtering(filters) of the results.

Parameters:
  • ctxt – RPC context.
  • stack_identity – Name of the stack you want to get events for
  • filters – a dict with attribute:value to filter the list
  • limit – the number of events to list (integer or string)
  • marker – the ID of the last event in the previous page
  • sort_keys – an array of fields used to sort the list
  • sort_dir – the direction of the sort (‘asc’ or ‘desc’).
  • nested_depth – Levels of nested stacks to list events for.
list_outputs(cntx, stack_identity)[source]
list_resource_types(ctxt, support_status=None, type_name=None, heat_version=None, with_description=False)[source]

Get a list of valid resource types.

Parameters:
  • ctxt – RPC context.
  • support_status – Support status of resource type
  • type_name – Resource type’s name (regular expression allowed)
  • heat_version – Heat version
  • with_description – Either return resource type description or not
list_services(cnxt)[source]
list_software_configs(cnxt, limit=None, marker=None)[source]
list_software_deployments(cnxt, server_id=None)[source]
list_stack_resources(ctxt, stack_identity, nested_depth=0, with_detail=False, filters=None)[source]

List the resources belonging to a stack.

Parameters:
  • ctxt – RPC context.
  • stack_identity – Name of the stack.
  • nested_depth – Levels of nested stacks of which list resources.
  • with_detail – show detail for resources in list.
  • filters – a dict with attribute:value to search the resources
list_stacks(ctxt, limit=None, marker=None, sort_keys=None, sort_dir=None, filters=None, show_deleted=False, show_nested=False, show_hidden=False, tags=None, tags_any=None, not_tags=None, not_tags_any=None)[source]

Returns attributes of all stacks.

It supports pagination (limit and marker), sorting (sort_keys and sort_dir) and filtering (filters) of the results.

Parameters:
  • ctxt – RPC context.
  • limit – the number of stacks to list (integer or string)
  • marker – the ID of the last item in the previous page
  • sort_keys – an array of fields used to sort the list
  • sort_dir – the direction of the sort (‘asc’ or ‘desc’)
  • filters – a dict with attribute:value to filter the list
  • show_deleted – if true, show soft-deleted stacks
  • show_nested – if true, show nested stacks
  • show_hidden – if true, show hidden stacks
  • tags – show stacks containing these tags. If multiple tags are passed, they will be combined using the boolean AND expression
  • tags_any – show stacks containing these tags. If multiple tags are passed, they will be combined using the boolean OR expression
  • not_tags – show stacks not containing these tags. If multiple tags are passed, they will be combined using the boolean AND expression
  • not_tags_any – show stacks not containing these tags. If multiple tags are passed, they will be combined using the boolean OR expression
Returns:

a list of stacks

list_template_functions(ctxt, template_version, with_condition=False)[source]

Get a list of available functions in a given template.

Parameters:ctxt – RPC context
:param template_name : name of the template which function list you
want to get
Parameters:with_condition – return includes condition functions.
list_template_versions(ctxt)[source]

Get a list of available template versions.

Parameters:ctxt – RPC context.
local_error_name(error)[source]

Returns the name of the error with any _Remote postfix removed.

Parameters:error – Remote raised error to derive the name from.
static make_msg(method, **kwargs)[source]
metadata_software_deployments(cnxt, server_id)[source]
migrate_convergence_1(ctxt, stack_id)[source]

Migrate the stack to convergence engine

Parameters:
  • ctxt – RPC context
  • stack_name – Name of the stack you want to migrate
preview_stack(ctxt, stack_name, template, params, files, args, environment_files=None)[source]

Simulates a new stack using the provided template.

Note that at this stage the template has already been fetched from the heat-api process if using a template-url.

Parameters:
  • ctxt – RPC context.
  • stack_name – Name of the stack you want to create.
  • template – Template of stack you want to create.
  • params – Stack Input Params/Environment
  • files – files referenced from the environment.
  • args – Request parameters/args passed from API
  • environment_files (list or None) – optional ordered list of environment file names included in the files dict
preview_update_stack(ctxt, stack_identity, template, params, files, args, environment_files=None)[source]

Returns the resources that would be changed in an update.

Based on the provided template and parameters.

Requires RPC version 1.15 or above.

Parameters:
  • ctxt – RPC context.
  • stack_identity – Name of the stack you wish to update.
  • template – New template for the stack.
  • params – Stack Input Params/Environment
  • files – files referenced from the environment.
  • args – Request parameters/args passed from API
  • environment_files (list or None) – optional ordered list of environment file names included in the files dict
resource_mark_unhealthy(ctxt, stack_identity, resource_name, mark_unhealthy, resource_status_reason=None)[source]

Mark the resource as unhealthy or healthy.

Parameters:
  • ctxt – RPC context.
  • stack_identity – Name of the stack.
  • resource_name – the Resource.
  • mark_unhealthy – indicates whether the resource is unhealthy.
  • resource_status_reason – reason for health change.
resource_schema(ctxt, type_name, with_description=False)[source]

Get the schema for a resource type.

Parameters:
  • ctxt – RPC context.
  • with_description – Return resource with description or not.
resource_signal(ctxt, stack_identity, resource_name, details, sync_call=False)[source]

Generate an alarm on the resource.

Parameters:
  • ctxt – RPC context.
  • stack_identity – Name of the stack.
  • resource_name – the Resource.
  • details – the details of the signal.
set_watch_state(ctxt, watch_name, state)[source]

Temporarily set the state of a given watch.

Parameters:
  • ctxt – RPC context.
  • watch_name – Name of the watch
  • state – State (must be one defined in WatchRule class)
show_output(cntx, stack_identity, output_key)[source]
show_snapshot(cnxt, stack_identity, snapshot_id)[source]
show_software_config(cnxt, config_id)[source]
show_software_deployment(cnxt, deployment_id)[source]
show_stack(ctxt, stack_identity, resolve_outputs=True)[source]

Returns detailed information about one or all stacks.

Parameters:
  • ctxt – RPC context.
  • stack_identity – Name of the stack you want to show, or None to

show all :param resolve_outputs: If True, stack outputs will be resolved

show_watch(ctxt, watch_name)[source]

Returns the attributes of one watch/alarm.

The show_watch method returns the attributes of one watch or all watches if no watch_name is passed.

Parameters:
  • ctxt – RPC context.
  • watch_name – Name of the watch/alarm you want to see, or None to see all
show_watch_metric(ctxt, metric_namespace=None, metric_name=None)[source]

Returns the datapoints for a metric.

The show_watch_metric method returns the datapoints associated with a specified metric, or all metrics if no metric_name is passed.

Parameters:
  • ctxt – RPC context.
  • metric_namespace – Name of the namespace you want to see, or None to see all
  • metric_name – Name of the metric you want to see, or None to see all
signal_software_deployment(cnxt, deployment_id, details, updated_at=None)[source]
stack_cancel_update(ctxt, stack_identity, cancel_with_rollback=True)[source]
stack_check(ctxt, stack_identity)[source]
stack_list_snapshots(cnxt, stack_identity)[source]
stack_restore(cnxt, stack_identity, snapshot_id)[source]
stack_resume(ctxt, stack_identity)[source]
stack_snapshot(ctxt, stack_identity, name)[source]
stack_suspend(ctxt, stack_identity)[source]
update_software_deployment(cnxt, deployment_id, config_id=None, input_values=None, output_values=None, action=None, status=None, status_reason=None, updated_at=None)[source]
update_stack(ctxt, stack_identity, template, params, files, args, environment_files=None)[source]

Updates an existing stack based on the provided template and params.

Note that at this stage the template has already been fetched from the heat-api process if using a template-url.

Parameters:
  • ctxt – RPC context.
  • stack_name – Name of the stack you want to create.
  • template – Template of stack you want to create.
  • params – Stack Input Params/Environment
  • files – files referenced from the environment.
  • args – Request parameters/args passed from API
  • environment_files (list or None) – optional ordered list of environment file names included in the files dict
validate_template(ctxt, template, params=None, files=None, environment_files=None, show_nested=False, ignorable_errors=None)[source]

Uses the stack parser to check the validity of a template.

Parameters:
  • ctxt – RPC context.
  • template – Template of stack you want to create.
  • params – Stack Input Params/Environment
  • files – files referenced from the environment/template.
  • environment_files – ordered list of environment file names included in the files dict
  • show_nested – if True nested templates will be validated
  • ignorable_errors – List of error_code to be ignored as part of

validation

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.