TokenChangeHistoryStore#
- class gafaelfawr.storage.history.TokenChangeHistoryStore(session)#
Bases:
object
Stores and retrieves the history of changes to tokens.
- Parameters:
session (
async_scoped_session
) – The database session proxy.
Methods Summary
add
(entry)Record a change to a token.
delete
(*, older_than)Delete older entries.
list
(*[, cursor, limit, since, until, ...])Return all changes to a specific token.
Methods Documentation
- async add(entry)#
Record a change to a token.
- Parameters:
entry (
TokenChangeHistoryEntry
) – New entry to add to the database.- Return type:
- async delete(*, older_than)#
Delete older entries.
- async list(*, cursor=None, limit=None, since=None, until=None, username=None, actor=None, key=None, token=None, token_type=None, ip_or_cidr=None)#
Return all changes to a specific token.
- Parameters:
cursor (
Optional
[HistoryCursor
], default:None
) – A pagination cursor specifying where to start in the results.limit (
Optional
[int
], default:None
) – Limit the number of returned results.since (
Optional
[datetime
], default:None
) – Limit the results to events at or after this time.until (
Optional
[datetime
], default:None
) – Limit the results to events before or at this time.username (
Optional
[str
], default:None
) – Limit the results to tokens owned by this user.actor (
Optional
[str
], default:None
) – Limit the results to actions performed by this user.key (
Optional
[str
], default:None
) – Limit the results to this token and any subtokens of this token. Note that this will currently pick up direct subtokens but not subtokens of subtokens.token (
Optional
[str
], default:None
) – Limit the results to only this token.token_type (
Optional
[TokenType
], default:None
) – Limit the results to tokens of this type.ip_or_cidr (
Optional
[str
], default:None
) – Limit the results to changes made from this IPv4 or IPv6 address or CIDR block. Unless the underlying database is PostgreSQL, the CIDR block must be on an octet boundary.
- Returns:
List of change history entries, which may be empty.
- Return type: