Events API

class cloudify_rest_client.events.EventsClient(api)[source]

Bases: object

get(execution_id, from_event=0, batch_size=100, include_logs=False)[source]

Returns event for the provided execution id.

Parameters:
  • execution_id – Id of execution to get events for.

  • from_event – Index of first event to retrieve on pagination.

  • batch_size – Maximum number of events to retrieve per call.

  • include_logs – Whether to also get logs.

Returns:

Events list and total number of currently available events (tuple).

list(include_logs=False, message=None, from_datetime=None, to_datetime=None, _include=None, sort=None, **kwargs)[source]

List events

Parameters:
  • include_logs – Whether to also get logs.

  • message – an expression used for wildcard search events by their message text

  • from_datetime – search for events later or equal to datetime

  • to_datetime – search for events earlier or equal to datetime

  • _include – return only an exclusive list of fields

  • sort – Key for sorting the list.

Returns:

dict with ‘metadata’ and ‘items’ fields

create(events=None, logs=None, execution_id=None, agent_name=None, manager_name=None, execution_group_id=None)[source]

Create events & logs

Parameters:
  • events – List of events to be created

  • logs – List of logs to be created

  • execution_id – Create logs/events for this execution

  • execution_group_id – Create logs/events for this execution group

Returns:

None

delete(deployment_id, include_logs=False, message=None, from_datetime=None, to_datetime=None, sort=None, **kwargs)[source]

Delete events connected to a Deployment ID

Parameters:
  • deployment_id – The ID of the deployment

  • include_logs – Whether to also get logs.

  • message – an expression used for wildcard search events by their message text

  • from_datetime – search for events later or equal to datetime

  • to_datetime – search for events earlier or equal to datetime

  • sort – Key for sorting the list.

Returns:

dict with ‘metadata’ and ‘items’ fields

dump(execution_ids=None, execution_group_ids=None, include_logs=None, event_storage_ids=None)[source]

Generate events’ attributes for a snapshot.

Parameters:
  • execution_ids – A list of executions’ identifiers used to select events to be dumped.

  • execution_group_ids – A list of execution groups’ identifiers used to select events to be dumped.

  • include_logs – A flag, which determines if cloudify_log entries should be included in the snapshot.

  • event_storage_ids – A list of events’ storage identifiers, if not empty, used to select specific events to be dumped.

Returns:

A generator of dictionaries, which describe events’ attributes.

restore(entities, logger, source_type, source_id)[source]

Restore events from a snapshot.

Parameters:
  • entities – An iterable (e.g. a list) of dictionaries describing node instances to be restored.

  • logger – A logger instance.

  • source_type – Type of events’ “parent” entity: executions or execution_groups.

  • source_id – An identifier of the entity, which these events belong to.