update_access_token¶
- AccessTokensApi.update_access_token(id, operation, role_id=None, access_token_put_input=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)¶
Update an access token
Updates a token owned by the calling user. The operation query parameter is required and supports activate, deactivate, and update. The caller must own the token and be an active user, and the token must exist with a valid status (active, inactive, or disabled).
- Parameters:
id (str) – TokenId of the access token to update. (required)
operation (str) – Action to perform. Allowed: activate, deactivate, update. (required)
role_id (str) – Amorphic role ID header.
access_token_put_input (AccessTokenPutInput)
_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: PUT /access-tokens/{id}
Request¶
The request body is optional.
Update description and alerts
{
"Description": "Rotated CI token",
"ExpirationAlertOne": 10,
"ExpirationAlertTwo": 3
}
Success (HTTP 200)¶
Access token status updated successfully
operation=activate
{
"Message": "Successfully re-activated token"
}
operation=deactivate
{
"Message": "Successfully de-activated token"
}
operation=update
{
"Message": "Successfully updated the token"
}
Errors¶
Documented error codes: IPV-1041, GE-1001, IPV-1002, AUTH-1010, AUTH-1012, GE-1034, IPV-1008, IPV-1036, IPV-1012, DB-1002, RTE-1001, EMF-1001.
HTTP 400
Validation or authorization failure. Body is {“Message”: “<CODE> - <text>”}. Common codes: IPV-1041 (invalid/missing operation), GE-1001 (update without body), IPV-1002 (TokenId not found), AUTH-1010 (not owner), AUTH-1012 (inactive user), GE-1034 (invalid current status), IPV-1008/IPV-1036/IPV-1012 (alert validation), DB-1002 (DynamoDB update failed).
Unsupported operation
{
"Message": "IPV-1041 - Invalid parameter - operation, allowed values/keys are [activate, deactivate, update]"
}
TokenId not found
{
"Message": "IPV-1002 - Invalid TokenId - a2f7d3b1-8e5c-4a6f-9d1e-2b3c4d5e6f7a, resource not found."
}
Caller does not own token
{
"Message": "AUTH-1010 - User user1 is not authorized to perform this operation"
}
HTTP 500
Backend failure. Body is {“Message”: “<CODE> - <text>”} (typically RTE-1001 via EMF-1001).
Unexpected failure
{
"Message": "RTE-1001 - <exception text>"
}