TokenChangeHistoryEntry#

class gafaelfawr.models.history.TokenChangeHistoryEntry(*, token, username, token_type, token_name=None, parent=None, scopes, service=None, expires=None, actor, action, old_token_name=None, old_scopes=None, old_expires=None, ip_address=None, event_time=<factory>, github_project_id=None)#

Bases: BaseModel

A record of a change to a token.

Parameters:

Attributes Summary

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Methods Summary

model_dump_reduced()

Convert to a dictionary while suppressing some fields.

Attributes Documentation

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Methods Documentation

model_dump_reduced()#

Convert to a dictionary while suppressing some fields.

The same as the standard Pydantic model_dump method, but excludes the old_ fields for changes other than edits and when the edit doesn’t change those fields.

Returns:

Dictionary representation of the object.

Return type:

dict[str, Any]

Notes

Knowing which fields to exclude requires understanding the semantics of the change (particularly when deciding whether to drop old_expires) in ways that are too complex to do with the standard Pydantic filtering API, hence the hand-rolled method.