The heat.engine.resource ModuleΒΆ

class heat.engine.resource.Metadata[source]

Bases: object

A descriptor for accessing the metadata of a resource while ensuring the most up-to-date data is always obtained from the database.

class heat.engine.resource.Resource(name, json_snippet, stack)[source]

Bases: object

ACTIONS = ('INIT', 'CREATE', 'DELETE', 'UPDATE', 'ROLLBACK', 'SUSPEND', 'RESUME', 'ADOPT')
ADOPT = 'ADOPT'
COMPLETE = 'COMPLETE'
CREATE = 'CREATE'
DELETE = 'DELETE'
FAILED = 'FAILED'
FnBase64(data)[source]

For the instrinsic function Fn::Base64.

Parameters:data – the input data.
Returns:the Base64 representation of the input data.
FnGetAtt(key)[source]

For the intrinsic function Fn::GetAtt.

Parameters:key – the attribute key.
Returns:the attribute value.
FnGetRefId()[source]

For the intrinsic function Ref.

Results:the id or name of the resource.
INIT = 'INIT'
IN_PROGRESS = 'IN_PROGRESS'
RESUME = 'RESUME'
ROLLBACK = 'ROLLBACK'
STATUSES = ('IN_PROGRESS', 'FAILED', 'COMPLETE')
SUSPEND = 'SUSPEND'
UPDATE = 'UPDATE'
add_dependencies(deps)[source]
adopt(resource_data)[source]

Adopt the existing resource. Resource subclasses can provide a handle_adopt() method to customise adopt.

attributes_schema = {}
ceilometer()[source]
cinder()[source]
create()[source]

Create the resource. Subclasses should provide a handle_create() method to customise creation.

delete()[source]

Delete the resource. Subclasses should provide a handle_delete() method to customise deletion.

destroy(*args, **kwargs)[source]

Delete the resource and remove it from the database.

get_abandon_data()[source]
handle_adopt(resource_data=None)[source]
handle_update(json_snippet=None, tmpl_diff=None, prop_diff=None)[source]
has_interface(resource_type)[source]

Check to see if this resource is either mapped to resource_type or is a “resource_type”.

heat()[source]
identifier()[source]

Return an identifier for this resource.

implementation_signature()[source]

Return a tuple defining the implementation.

This should be broken down into a definition and an implementation version.

keystone()[source]
metadata[source]
metadata_update(new_metadata=None)[source]

No-op for resources which don’t explicitly override this method

neutron()[source]
nova(service_type='compute')[source]
parsed_template(section=None, default={})[source]

Return the parsed template data for the resource. May be limited to only one section of the data, in which case a default value may also be supplied.

physical_resource_name()[source]
physical_resource_name_limit = 255
preview()[source]

Default implementation of Resource.preview.

This method should be overriden by child classes for specific behavior.

static reduce_physical_resource_name(name, limit)[source]

Reduce length of physical resource name to a limit.

The reduced name will consist of the following:

  • the first 2 characters of the name
  • a hyphen
  • the end of the name, truncated on the left to bring the name length within the limit
Parameters:
  • name – The name to reduce the length of
  • limit – The max length limit
Returns:

A name whose length is less than or equal to the limit

reparse()[source]
required_by()[source]

Returns a list of names of resources which directly require this resource as a dependency.

requires_deferred_auth = False
resource_id_set(inst)[source]
classmethod resource_to_template(resource_type)[source]
Parameters:resource_type – The resource type to be displayed in the template
Returns:A template where the resource’s properties_schema is mapped as parameters, and the resource’s attributes_schema is mapped as outputs
resume()[source]

Resume the resource. Subclasses should provide a handle_resume() method to implement resume

set_deletion_policy(policy)[source]
signal(details=None)[source]

signal the resource. Subclasses should provide a handle_signal() method to implement the signal, the base-class raise an exception if no handler is implemented.

state[source]

Returns state, tuple of action, status.

state_reset()[source]

Reset state to (INIT, COMPLETE)

state_set(action, status, reason='state changed')[source]
strict_dependency = True
support_status = <heat.engine.support.SupportStatus object at 0x7f7c011147d0>
suspend()[source]

Suspend the resource. Subclasses should provide a handle_suspend() method to implement suspend

swift()[source]
trove()[source]
type()[source]
update(after, before=None, prev_resource=None)[source]

update the resource. Subclasses should provide a handle_update() method to customise update, the base-class handle_update will fail by default.

update_allowed_keys = ()
update_allowed_properties = ()
update_template_diff(after, before)[source]

Returns the difference between the before and after json snippets. If something has been removed in after which exists in before we set it to None. If any keys have changed which are not in update_allowed_keys, raises UpdateReplace if the differing keys are not in update_allowed_keys

update_template_diff_properties(after, before)[source]

Returns the changed Properties between the before and after json snippets. If a property has been removed in after which exists in before we set it to None. If any properties have changed which are not in update_allowed_properties, raises UpdateReplace if the modified properties are not in the update_allowed_properties

validate()[source]
classmethod validate_deletion_policy(template)[source]
exception heat.engine.resource.UpdateReplace(resource_name='Unknown', message=u'The Resource %s requires replacement.')[source]

Bases: exceptions.Exception

Raised when resource update requires replacement

heat.engine.resource.get_class(resource_type, resource_name=None)[source]

Return the Resource class for a given resource type.

heat.engine.resource.get_types(support_status)[source]

Return a list of valid resource types.

Previous topic

The heat.engine.parser Module

Next topic

The heat.engine.support Module

This Page