antimatter.session_mixins.capsule_mixin#

Module Contents#

Classes#

CapsuleMixin

Session mixin defining CRUD functionality for capsules and tags.

class antimatter.session_mixins.capsule_mixin.CapsuleMixin(authz: antimatter.authz.Authorization, **kwargs)#

Bases: antimatter.session_mixins.base.BaseMixin

Session mixin defining CRUD functionality for capsules and tags.

list_capsules(start_date: datetime.datetime | str | None = None, end_date: datetime.datetime | str | None = None, duration: datetime.timedelta | dateutil.relativedelta.relativedelta | str | None = None, span_tag: str | None = None, sort_on: str | None = None, ascending: bool | None = None) Iterator[antimatter_api.CapsuleInfo]#

Returns an iterator over the capsules available for the current domain and auth

Parameters:
  • start_date – The earlier date of the date range. As results are returned in reverse chronological order, this date corresponds with the end of the result set. This should be a timezone-aware datetime, or else will be treated as the system timezone

  • end_date – The later date of the date range. As results are returned in reverse chronological order, this date corresponds with the beginning of the result set. If not specified, defaults to the current time. This should be a timezone-aware datetime, or else will be treated as the system timezone

  • duration – The query time range duration. This can be a timedelta or a string such as ‘2h’. When using duration, by default the query time range ends ‘now’, unless one of start_date or end_date is specified. If both start_date and end_date are specified, duration is ignored. If using a string value, valid time units are “ns”, “us” (or “µs”), “ms”, “s”, “m”, “h”, “d”, “mo”, “y”. These can be grouped together, such as 1h5m30s.

  • span_tag – The span tag you would like to filter on. This accepts a tag key only and will return all span tag key results matching the provided tag key. If not specified, this field is ignored.

  • sort_on – The capsule field you would like to sort on. This accepts the field only and will return results ordered on the provided field. If not specified, this field is ignored.

  • ascending – This defines whether a sorted result should be order ascending. This accepts a boolean value and when true will work in combination with the sort_on and start_after parameters to return values in ascending order. If not specified, this field is ignored and treated as false.

get_capsule_info(capsule_id: str) antimatter_api.CapsuleInfo#

Get the summary information about the capsule.

Parameters:

capsule_id – The identifier for the capsule

Returns:

The summary information about the capsule

upsert_capsule_tags(capsule_id: str, tags: List[antimatter.tags.CapsuleTag]) None#

Upsert the capsule-level tags to apply to a capsule.

Parameters:
  • capsule_id – The capsule to apply tags to

  • tags – The tags to apply to the capsule

delete_capsule_tags(capsule_id: str, tag_names: List[str]) None#

Delete capsule-level tags

Parameters:
  • capsule_id – The capsule to delete tags from

  • tag_names – The names of the tags to delete