cowbird.handlers.handler

Module Contents

Classes

Handler

Helper class that provides a standard way to create an ABC using

Attributes

AnyHandlerParameter

HANDLER_PRIORITY_PARAM

HANDLER_URL_PARAM

HANDLER_WORKSPACE_DIR_PARAM

HANDLER_PARAMETERS

LOGGER

cowbird.handlers.handler.AnyHandlerParameter[source]
cowbird.handlers.handler.HANDLER_PRIORITY_PARAM: AnyHandlerParameter = 'priority'[source]
cowbird.handlers.handler.HANDLER_URL_PARAM: AnyHandlerParameter = 'url'[source]
cowbird.handlers.handler.HANDLER_WORKSPACE_DIR_PARAM: AnyHandlerParameter = 'workspace_dir'[source]
cowbird.handlers.handler.HANDLER_PARAMETERS[source]
cowbird.handlers.handler.LOGGER[source]
exception cowbird.handlers.handler.HandlerConfigurationException[source]

Bases: Exception

Exception thrown when a handler cannot be instantiated because of a bad configuration.

Initialize self. See help(type(self)) for accurate signature.

class cowbird.handlers.handler.Handler(settings: cowbird.typedefs.SettingsType, name: str, **kwargs: Any)[source]

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

Parameters:
  • settings – Cowbird settings for convenience

  • name – Handler name

  • kwargs – The base class handle, but doesn’t require the following variables:

  • url – Location of the web service represented by the cowbird handler

  • workspace_dir – Workspace directory

  • priority – Relative priority between handlers while handling events. Lower value has higher priority, default value is last.

abstract property required_params: List[AnyHandlerParameter][source]
__slots__[source]

Handler interface used to notify implemented handlers of users/permissions changes.

Todo

At some point we will need a consistency function that goes through all Magpie users and make sure that handlers are up-to-date.

json() cowbird.typedefs.JSON[source]
_user_workspace_dir(user_name: str) str[source]
abstract get_resource_id(resource_full_name: str) int[source]

Each handler must provide this implementation required by the permission synchronizer.

The function needs to find the resource id in Magpie from the resource full name using its knowledge of the service. If the resource doesn’t already exist, the function needs to create it, again using its knowledge of resource type and parent resource type if required.

abstract user_created(user_name: str) None[source]
abstract user_deleted(user_name: str) None[source]
abstract permission_created(permission: cowbird.permissions_synchronizer.Permission) None[source]
abstract permission_deleted(permission: cowbird.permissions_synchronizer.Permission) None[source]