tacker.api.extensions module

class tacker.api.extensions.ActionExtension(collection, action_name, handler)

Bases: object

Add custom actions to core Tacker OpenStack API controllers.

class tacker.api.extensions.ActionExtensionController(application)

Bases: Controller

action(request, id)
add_action(action_name, handler)
class tacker.api.extensions.ExtensionController(extension_manager)

Bases: Controller

delete(request, id)
show(request, id)
class tacker.api.extensions.ExtensionDescriptor

Bases: object

Base class that defines the contract for extensions.

Note that you don’t have to derive from this class to have a valid extension; it is purely a convenience.


List of extensions.ActionExtension extension objects.

Actions are verbs callable from the API.


The alias for the extension.

e.g. ‘FOXNSOX’


Returns mappings between extension aliases and XML namespaces.

The mappings are XML namespaces that should, for backward compatibility reasons, be added to the XML serialization of extended attributes. This allows an established extended attribute to be provided by another extension than the original one while keeping its old alias in the name. :return: A dictionary of extension_aliases and namespace strings.


Friendly description for the extension.

e.g. ‘The Fox In Socks Extension’


Retrieve extended resources or attributes for core resources.

Extended attributes are implemented by a core plugin similarly to the attributes defined in the core, and can appear in request and response messages. Their names are scoped with the extension’s prefix. The core API version is passed to this function, which must return a map[<resource_name>][<attribute_name>][<attribute_property>] specifying the extended resource attribute properties required by that API version.

Extension can add resources and their attr definitions too. The returned map can be integrated into RESOURCE_ATTRIBUTE_MAP.


The name of the extension.

e.g. ‘Fox In Socks’


The XML namespace for the extension.

e.g. ‘http://www.fox.in.socks/api/ext/pie/v1.0


Returns an abstract class which defines contract for the plugin.

The abstract class should inherit from extesnions.PluginInterface, Methods in this abstract class should be decorated as abstractmethod


List of extensions.RequestException extension objects.

Request extensions are used to handle custom request data.


List of extensions.ResourceExtension extension objects.

Resources define new nouns, and are accessible through URLs.


The timestamp when the extension was last updated.

e.g. ‘2011-01-22T13:25:27-06:00’

update_attributes_map(extended_attributes, extension_attrs_map=None)

Update attributes map for this extension.

This is default method for extending an extension’s attributes map. An extension can use this method and supplying its own resource attribute map in extension_attrs_map argument to extend all its attributes that needs to be extended.

If an extension does not implement update_attributes_map, the method does nothing and just return.

class tacker.api.extensions.ExtensionManager(path)

Bases: object

Load extensions from the configured extension path.

See tests/unit/extensions/foxinsocks.py for an example extension implementation.

extend_resources(version, attr_map)

Extend resources with additional resources or attributes.


attr_map – the existing mapping from resource name to attrs definition.

After this function, we will extend the attr_map if an extension wants to extend this map.


Returns a list of ActionExtension objects.

classmethod get_instance()

Returns a list of RequestExtension objects.


Returns a list of ResourceExtension objects.

class tacker.api.extensions.ExtensionMiddleware(application, ext_mgr=None)

Bases: Middleware

Extensions middleware for WSGI.

classmethod factory(global_config, **local_config)

Paste factory.

class tacker.api.extensions.PluginInterface

Bases: object

class tacker.api.extensions.RequestExtension(method, url_route, handler)

Bases: object

Extend requests and responses of core Tacker OpenStack API controllers.

Provide a way to add data to responses and handle custom request data that is sent to core Tacker OpenStack API controllers.

class tacker.api.extensions.RequestExtensionController(application)

Bases: Controller

process(request, *args, **kwargs)
class tacker.api.extensions.ResourceExtension(collection, controller, parent=None, path_prefix='', collection_actions={}, member_actions={}, attr_map={})

Bases: object

Add top level resources to the OpenStack API in Tacker.

tacker.api.extensions.extension_middleware_factory(global_config, **local_config)

Paste factory.