tacker.api.extensions module

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: tacker.wsgi.Controller

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

Bases: tacker.wsgi.Controller

create(request)
delete(request, id)
index(request)
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.

get_actions()

List of extensions.ActionExtension extension objects.

Actions are verbs callable from the API.

get_alias()

The alias for the extension.

e.g. ‘FOXNSOX’

get_alias_namespace_compatibility_map()

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.

get_description()

Friendly description for the extension.

e.g. ‘The Fox In Socks Extension’

get_extended_resources(version)

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.

get_name()

The name of the extension.

e.g. ‘Fox In Socks’

get_namespace()

The XML namespace for the extension.

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

get_plugin_interface()

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

get_request_extensions()

List of extensions.RequestException extension objects.

Request extensions are used to handle custom request data.

get_resources()

List of extensions.ResourceExtension extension objects.

Resources define new nouns, and are accessible through URLs.

get_updated()

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.

add_extension(ext)
extend_resources(version, attr_map)

Extend resources with additional resources or attributes.

Parameters: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.

get_actions()

Returns a list of ActionExtension objects.

classmethod get_instance()
get_request_extensions()

Returns a list of RequestExtension objects.

get_resources()

Returns a list of ResourceExtension objects.

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

Bases: tacker.wsgi.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: tacker.wsgi.Controller

add_handler(handler)
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.append_api_extensions_path(paths)
tacker.api.extensions.extension_middleware_factory(global_config, **local_config)

Paste factory.

tacker.api.extensions.get_extensions_path()
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.