panko.api.controllers.v2 package

Submodules

panko.api.controllers.v2.base module

class panko.api.controllers.v2.base.AdvEnum(name, *args, **kwargs)

Bases: wsme.types.wsproperty

Handle default and mandatory for wtypes.Enum.

class panko.api.controllers.v2.base.Base(**kw)

Bases: wsme.types.DynamicBase

as_dict(db_model)
as_dict_from_keys(keys)
classmethod from_db_model(m)
exception panko.api.controllers.v2.base.ClientSideError(error, status_code=400)

Bases: wsme.exc.ClientSideError

exception panko.api.controllers.v2.base.EntityNotFound(entity, id)

Bases: panko.api.controllers.v2.base.ClientSideError

class panko.api.controllers.v2.base.JsonType

Bases: wsme.types.UserType

A simple JSON type.

basetype

alias of str

name = 'json'
static validate(value)
exception panko.api.controllers.v2.base.ProjectNotAuthorized(id, aspect='project')

Bases: panko.api.controllers.v2.base.ClientSideError

class panko.api.controllers.v2.base.Query(**kw)

Bases: panko.api.controllers.v2.base.Base

Query filter.

as_dict()
field

The name of the field to test

get_op()
property op

The comparison operator. Defaults to ‘eq’.

classmethod sample()
set_op(value)
type

The data type of value to compare against the stored data

value

The value to compare against the stored data

panko.api.controllers.v2.capabilities module

class panko.api.controllers.v2.capabilities.Capabilities(**kw)

Bases: panko.api.controllers.v2.base.Base

A representation of the API and storage capabilities.

Usually constrained by restrictions imposed by the storage driver.

api

A flattened dictionary of API capabilities

event_storage

A flattened dictionary of event storage capabilities

classmethod sample()
class panko.api.controllers.v2.capabilities.CapabilitiesController(*args, **kwargs)

Bases: pecan.rest.RestController

Manages capabilities queries.

get()

Returns a flattened dictionary of API capabilities.

Capabilities supported by the currently configured storage driver.

panko.api.controllers.v2.events module

class panko.api.controllers.v2.events.Event(**kw)

Bases: panko.api.controllers.v2.base.Base

A System event.

event_type

The type of the event

generated

The time the event occurred

get_traits()
message_id

The message ID for the notification

raw

The raw copy of notification

classmethod sample()
set_traits(traits)
property traits

Event specific properties

class panko.api.controllers.v2.events.EventQuery(**kw)

Bases: panko.api.controllers.v2.base.Query

Query arguments for Event Queries.

field

Name of the field to filter on. Can be either a trait name or field of an event. 1) Use start_timestamp/end_timestamp to filter on generated field. 2) Specify the ‘all_tenants=True’ query parameter to get all events for all projects, this is only allowed by admin users.

property op
classmethod sample()
type

the type of the trait filter, defaults to string

value

The value to compare against the stored data

class panko.api.controllers.v2.events.EventTypesController(*args, **kwargs)

Bases: pecan.rest.RestController

Works on Event Types in the system.

get_all()

Get all event types.

get_one(event_type)

Unused API, will always return 404.

Parameters

event_type – A event type

traits = <panko.api.controllers.v2.events.TraitsController object>
class panko.api.controllers.v2.events.EventsController(*args, **kwargs)

Bases: pecan.rest.RestController

Works on Events.

get_all(q=None, limit=None, sort=None, marker=None)

Return all events matching the query filters.

Parameters
  • q – Filter arguments for which Events to return

  • limit – Maximum number of samples to be returned.

  • sort – A pair of sort key and sort direction combined with “:”

  • marker – The pagination query marker, message id of the last item viewed

get_one(message_id)

Return a single event with the given message id.

Parameters

message_id – Message ID of the Event to be returned

class panko.api.controllers.v2.events.Trait(**kw)

Bases: panko.api.controllers.v2.base.Base

A Trait associated with an event.

name

The name of the trait

classmethod sample()
type

the type of the trait (string, integer, float or datetime)

value

the value of the trait

class panko.api.controllers.v2.events.TraitDescription(**kw)

Bases: panko.api.controllers.v2.base.Base

A description of a trait, with no associated value.

name

the name of the trait

classmethod sample()
type

the data type, defaults to string

class panko.api.controllers.v2.events.TraitsController(*args, **kwargs)

Bases: pecan.rest.RestController

Works on Event Traits.

get_all(event_type)

Return all trait names for an event type.

Parameters

event_type – Event type to filter traits by

get_one(event_type, trait_name)

Return all instances of a trait for an event type.

Parameters
  • event_type – Event type to filter traits by

  • trait_name – Trait to return values for

panko.api.controllers.v2.root module

class panko.api.controllers.v2.root.V2Controller

Bases: object

Version 2 API controller root.

capabilities = <panko.api.controllers.v2.capabilities.CapabilitiesController object>
event_types = <panko.api.controllers.v2.events.EventTypesController object>
events = <panko.api.controllers.v2.events.EventsController object>

panko.api.controllers.v2.utils module

panko.api.controllers.v2.utils.get_auth_project(on_behalf_of=None)
panko.api.controllers.v2.utils.requires_admin(func)
panko.api.controllers.v2.utils.requires_context(func)
panko.api.controllers.v2.utils.set_pagination_options(sort, limit, marker, api_model)

Sets the options for pagination specifying query options

Arguments: sort – List of sorting criteria. Each sorting option has to format <sort key>:<sort direction>

Valid sort keys: message_id, generated (SUPPORT_SORT_KEYS in panko/event/storage/models.py) Valid sort directions: asc (ascending), desc (descending) (SUPPORT_DIRS in panko/event/storage/models.py) This defaults to asc if unspecified (DEFAULT_DIR in panko/event/storage/models.py)

impl_sqlalchemy.py: (see _get_pagination_query) If sort list is empty, this defaults to [‘generated:asc’, ‘message_id:asc’] (DEFAULT_SORT in panko/event/storage/models.py)

limit – Integer specifying maximum number of values to return

If unspecified, this defaults to pecan.request.cfg.api.default_api_return_limit

marker – If specified, assumed to be an integer and assumed to be the message id of the last object on the previous page of the results

api_model – Specifies the class implementing the api model to use for this pagination. The class is expected to provide the following members:

SUPPORT_DIRS SUPPORT_SORT_KEYS DEFAULT_DIR DEFAULT_SORT PRIMARY_KEY

Module contents