The heat.engine.resource ModuleΒΆ

heat.engine.resource.Metadata[source]

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

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

For the instrinsic function Fn::Base64.

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

For the intrinsic function Fn::GetAtt.

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

For the intrinsic function Ref.

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

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

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

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

Resource.delete()[source]

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

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

Delete the resource and remove it from the database.

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

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

Resource.heat()[source]
Resource.identifier()[source]

Return an identifier for this resource.

Resource.implementation_signature()[source]

Return a tuple defining the implementation.

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

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

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

Resource.neutron()[source]
Resource.nova(service_type='compute')[source]
Resource.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.

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

Default implementation of Resource.preview.

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

static Resource.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

Resource.reparse()[source]
Resource.required_by()[source]

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

Resource.requires_deferred_auth = False
Resource.resource_id_set(inst)[source]
classmethod Resource.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
Resource.resume()[source]

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

Resource.set_deletion_policy(policy)[source]
Resource.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.

Resource.state[source]

Returns state, tuple of action, status.

Resource.state_reset()[source]

Reset state to (INIT, COMPLETE)

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

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

Resource.swift()[source]
Resource.trove()[source]
Resource.type()[source]
Resource.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.

Resource.update_allowed_keys = ()
Resource.update_allowed_properties = ()
Resource.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

Resource.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

Resource.validate()[source]
classmethod Resource.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.environment Module

Next topic

The heat.engine.function Module

This Page