cowbird.handlers.impl.magpie

Module Contents

Classes

Magpie

Complete the Magpie’s webhook call by calling Magpie temporary urls. Also keep service-shared resources in sync when

Attributes

LOGGER

COOKIES_TIMEOUT

cowbird.handlers.impl.magpie.LOGGER[source]
cowbird.handlers.impl.magpie.COOKIES_TIMEOUT = 60[source]
class cowbird.handlers.impl.magpie.Magpie(settings: cowbird.typedefs.SettingsType, name: str, admin_user: str, admin_password: str, **kwargs: Any)[source]

Bases: cowbird.handlers.handler.Handler

Complete the Magpie’s webhook call by calling Magpie temporary urls. Also keep service-shared resources in sync when permissions are updated for one of them.

** Cowbird components diagram 1.2.0 needs to be updated since Magpie can handle permissions synchronisation directly on permission update events. No need to handle them explicitly in nginx, thredds and geoserver classes.

Create the magpie instance and instantiate the permission synchronizer that will handle the permission events.

Parameters
  • settings – Cowbird settings for convenience

  • name – Handler name

  • admin_user – Magpie admin username used for login.

  • admin_password – Magpie admin password used for login.

required_params[source]
_send_request(method: str, url: str, params: Optional[Any] = None, json: Optional[Any] = None)requests.Response[source]

Wrapping function to send requests to Magpie, which also handles login and cookies.

get_service_types()List[source]

Returns the list of service types available on Magpie.

abstract get_resource_id(resource_full_name)[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.

get_resources_tree(resource_id: int)List[source]

Returns the associated Magpie Resource object and all its parents in a list ordered from parent to child.

get_user_permissions(user: str)Dict[source]

Gets all user resource permissions.

get_group_permissions(grp: str)Dict[source]

Gets all group resource permissions.

abstract user_created(user_name)[source]
abstract user_deleted(user_name)[source]
permission_created(permission)[source]
permission_deleted(permission)[source]
create_permission(permissions_data: List[Dict[str, str]])None[source]

Make sure that the specified permission exists on Magpie.

delete_permission(permissions_data: List[Dict[str, str]])None[source]

Remove the specified permission from Magpie if it exists.

login()requests.cookies.RequestsCookieJar[source]

Login to Magpie app using admin credentials.