cowbird.handlers.handler

Attributes

JSON

SettingsType

AnyHandlerParameter

HANDLER_PRIORITY_PARAM

HANDLER_URL_PARAM

HANDLER_WORKSPACE_DIR_PARAM

HANDLER_PARAMETERS

LOGGER

Exceptions

HandlerConfigurationException

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

Classes

Permission

Define every property required to set a permission in Magpie.

Handler

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

Functions

get_logger(→ logging.Logger)

Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when

get_ssl_verify(→ bool)

get_timeout(→ int)

Module Contents

class cowbird.handlers.handler.Permission(service_name: str, service_type: str, resource_id: int, resource_full_name: str, name: str, access: str, scope: str, user: str = None, group: str = None, resource_display_name: str = None)[source]

Define every property required to set a permission in Magpie.

__eq__(other: Permission) bool[source]

Return self==value.

get_full_permission_value() str[source]

Returns the full permission value, consisting of the name-access-scope values.

cowbird.handlers.handler.JSON[source]
cowbird.handlers.handler.SettingsType[source]
cowbird.handlers.handler.get_logger(name: str, level: int | None = None, force_stdout: bool = None, message_format: str | None = None, datetime_format: str | None = None) logging.Logger[source]

Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when level is logging.NOTSET.

cowbird.handlers.handler.get_ssl_verify(container: cowbird.typedefs.AnySettingsContainer | None = None) bool[source]
cowbird.handlers.handler.get_timeout(container: cowbird.typedefs.AnySettingsContainer | None = None) int[source]
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.

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

property required_params: List[AnyHandlerParameter][source]
Abstractmethod:

json() cowbird.typedefs.JSON[source]
_user_workspace_dir(user_name: str) str[source]
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]
abstract resync() None[source]