list_access_tokens¶
- AccessTokensApi.list_access_tokens(role_id=None, projection_expression=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)¶
List access tokens
Returns personal access tokens owned by the calling user. Tokens named lineage-schedule-token are omitted. Tokens whose ExpiresOn is past are marked expired (and persisted) during this call. Optional projectionExpression is a comma-separated list of DynamoDB attribute names; only matching keys are returned per item.
- Parameters:
role_id (str) – Amorphic role ID.
projection_expression (str) – Comma-separated attribute names to include. When omitted, all fields on each token item are returned.
_request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
_request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
_content_type (str, Optional) – force content-type for the request.
_headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
_host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
- Return type:
- Returns:
Returns the result object.
Request and Response Examples¶
HTTP: GET /access-tokens
Success (HTTP 200)¶
Returns the caller’s AccessTokens array. For older tokens, ExpirationAlertOne and ExpirationAlertTwo may be “n/a”. TokenStatus can be active, inactive, disabled, or expired.
Tokens for calling user
{
"AccessTokens": [
{
"TokenId": "a2f7d3b1-8e5c-4a6f-9d1e-2b3c4d5e6f7a",
"Name": "ci-bot",
"UserId": "user1",
"RoleId": "role-123",
"TokenStatus": "active",
"CreatedOn": "2024-06-01 12:00:00",
"ExpiresOn": "2025-06-01 12:00:00",
"Description": "CI access",
"ExpirationAlertOne": 7,
"ExpirationAlertTwo": 2,
"LastModifiedBy": "user1",
"LastModifiedTime": "2024-06-01 12:00:00",
"TokenVersionId": "abc-version-id"
}
]
}
Errors¶
Documented error codes: GE-1034, RTE-1001, EMF-1001.
HTTP 400
Validation failure. Body is {“Message”: “<CODE> - <text>”}. GE-1034 if listing fails in get_user_tokens.
Unable to list tokens
{
"Message": "GE-1034 - Unable to get the values for user user1 from access-tokens table"
}
HTTP 500
Backend failure. Body is {“Message”: “<CODE> - <text>”} (typically RTE-1001 via EMF-1001).
Unexpected failure
{
"Message": "RTE-1001 - <exception text>"
}