Docs
Live demo
POST/api/v2/cleanup-tasks/{id}/retry
access:applyAPI token

Re-enqueue a failed cleanup task and return the updated cleanup task state. When the task reports pending_decision, the request body must carry the answer: owned_objects_decision for kind owned_objects (the revoked account still owns objects on the target), account_decision for kind unproven_account (Principal cannot prove the ClickHouse account of the rule). A retry without the answer of an owned_objects request is rejected with 409 cleanup.decision_required. A retry without an answer to an unproven_account request checks the account again, for a user fixed on the target meanwhile. A failed target deletion can instead finish with remove_from_principal_only: the target leaves Principal and nothing more is sent to it. A decision sent for a task without a pending decision is rejected with 409 cleanup.decision_not_pending. While the task's job is still pending, queued or running (a failed attempt waiting for its automatic retry keeps its job pending), or when a concurrent retry already requeued the task, the retry is rejected with 409 cleanup.retry_already_scheduled and the scheduled attempt is left in place. details.next_retry_at and Retry-After tell when it runs, if known. The refusal names the cleanup job in details.job_id. Once Principal has read that job, it also names it like every launch that meets a running job: details.existing_job_id, details.started_at when that job was started, resources (relation running_operation) and resolution.code operation.view_running.

pending_decision.kind Body Meaning
owned_objects
{"owned_objects_decision": "keep_data"} or "delete_data"
Keep or drop objects owned by the revoked account
unproven_account
{"account_decision": "forget"}
Forget an unproven ClickHouse account

Missing decision returns 409 cleanup.decision_required. Retrying while running or scheduled returns 409 cleanup.retry_already_scheduled (with Retry-After if known).

Parameters

Path1 required of 1
idstringpathrequired

Cleanup Task ID (UUID)

Request body application/json · RetryCleanupTaskRequest

The body is optional.

Optional3 fields
owned_objects_decisionstring

Answer to a pending owned objects decision. keep_data reassigns the objects to the Principal service account before the role is dropped. delete_data drops the objects together with the role. Omit when the task has no pending decision.

keep_datadelete_data
account_decisionstring

Answer to a pending unproven_account request. forget stops Principal managing the account: the rule is deleted with Principal's records and stored credentials of the account, and nothing is sent to the target, so the user and its rights stay there. Omit when the task has no such request. Send it without owned_objects_decision.

forget
remove_from_principal_onlyboolean

Finish a failed target deletion without touching the target again: Principal deletes the target and its rules, and everything the failed attempts did not revoke stays on the target. Only for a target cleanup task in cleanup_failed. Send it without owned_objects_decision and account_decision. Any other state is rejected with 409.

Responses

202

Accepted

CleanupTaskResponse · 22 fields

Safe operation failure. Explanation and recommended_action come from the static failure-code registry. The only text not written by Principal is cluster_answer.

8 fields
codestring (JobFailureCode)required

Closed registry of asynchronous operation failure causes, independent of HTTP problem codes.

ACCESS_PROFILE_STALEAMBIGUOUS_TARGET_OUTCOMEAPPLY_INTERRUPTEDAUTHENTICATION_FAILEDCLICKHOUSE_REPLICAS_OUT_OF_SYNCCLICKHOUSE_USER_NAME_RESERVEDCONNECTION_FAILEDCONNECTION_REFUSEDCONNECTION_TIMEOUTCONNECTOR_CREDENTIALS_MISSINGCONNECTOR_PAUSEDCONNECTOR_SOURCE_CHANGEDCONNECTOR_TYPE_UNAVAILABLECONSTRAINT_VIOLATIONCREDENTIAL_EXPIREDCREDENTIAL_NOT_FOUNDDATABASE_NOT_FOUNDDRIFT_BINDING_NOT_FOUNDDRIFT_DEFAULT_INHERITED_SKIPPEDDRIFT_NO_EXECUTABLE_DIFFDRIFT_PARTIAL_APPLYDRIFT_PLAN_GENERATION_FAILEDDRIFT_RESOURCE_MISMATCHDRIFT_RULE_DELETINGDRIFT_RUN_OUTDATEDDRIFT_SCOPE_MISMATCHGROUP_EXPANSION_LIMIT_EXCEEDEDHANDLER_NOT_FOUNDK8S_CHANGE_REJECTEDK8S_CLUSTER_UNREACHABLEK8S_NAMESPACE_FORBIDDENK8S_NAMESPACE_NOT_FOUNDK8S_RBAC_FORBIDDENKUBERNETES_MEMBER_CREDENTIALS_PENDINGKUBERNETES_SERVICE_ACCOUNT_KUBECONFIG_NOT_ISSUEDMARIADB_TRUNCATE_UNSUPPORTEDMARIADB_USAGE_UNSUPPORTEDMARIADB_GRANTS_AMBIGUOUSMUTATION_LOCKEDMYSQL_MANAGEMENT_PRIVILEGES_MISSING
34 more values
NOT_FOUNDOPERATION_BACKOFFOPERATION_CANCELLEDOPERATION_TIMEOUTOWNED_OBJECTS_DECISION_REQUIREDPERMISSION_DENIEDPLAN_APPLY_ARTIFACT_INVALIDPLAN_APPLY_ORPHANED_LOCKPLAN_APPLY_ROLLBACK_BASELINE_INVALIDPLAN_APPLY_RULE_CHANGEDPLAN_APPLY_TARGET_STATE_CHANGEDPLAN_APPLY_ACCESS_IMPACT_CHANGEDPOSTGRES_FUTURE_OBJECT_CREATORS_MISSINGPOSTGRES_GRANT_AUTHORITY_MISSINGPOSTGRES_MANAGEMENT_PRIVILEGES_MISSINGPOSTGRES_ROLE_ATTRIBUTE_UNSUPPORTEDPOSTGRES_ROLE_NAME_RESERVEDPOSTGRES_TLS_FILE_NOT_ALLOWEDPROVIDER_REQUEST_FAILEDRATE_LIMITEDROLE_EXISTSROLE_NOT_FOUNDROTATION_CHECK_REQUIREDSECRET_STORE_UNAVAILABLESERIALIZATION_ERRORTARGET_ACCOUNT_IDENTITY_MISMATCHTARGET_ACCOUNT_IDENTITY_UNVERIFIEDTARGET_ACCOUNT_IMPORT_PENDINGTARGET_ACCOUNT_PRINCIPAL_LOGINTARGET_ACCOUNT_TAKENTARGET_CONNECTION_MISSINGTARGET_REPAIR_REQUIREDUNKNOWN_ERRORVALIDATION_FAILED
titlestring

Short name of the failure from the same registry, for lists and queues where the explanation is too long. Absent on failures saved before the field existed.

max length 32
explanationstringrequired
recommended_actionstringrequired
retryablebooleanrequired

Whether the failed attempt was eligible for an automatic retry under the actual queue policy.

phasestring

Known operation phase at failure, when available.

resolution_codestring

Stable code of the action that can resolve this failure, the same vocabulary as a problem's resolution.code, for example upstream.check_connection. Absent when no single action does. A screen that offers the action shows it next to the failure, otherwise it shows recommended_action.

max length 128 · pattern ^[a-z][a-z0-9_-]*(\.[a-z0-9_-]+)*$
cluster_answerstring

The Kubernetes cluster's own answer to a change its admission policy or webhook refused: the policy or webhook name and its message. Only a step failure with code K8S_CHANGE_REJECTED carries it, as plain text without control characters, cut to 500 characters. The cluster administrator writes it, not Principal. Given only to callers with access:read in the rule's organization. Absent for runs saved before the field existed.

max length 500

State of the background job that runs this cleanup, present while the task has a job: whether a retry is queued, running or waiting, and when it runs next.

21 fields
statusstring (entity.OperationLifecycle)required

Where a background operation is in the shared lifecycle (decision S1). outcome says how a finished operation ended and substate qualifies the state.

queuedrunningfinished
terminalbooleanrequired

Whether the job has finished.

outcomestring (entity.OperationOutcome)required

Final operation result, or null while the operation is active.

successfailurecancelledpartial
can be null
substatestring (entity.OperationSubstate)required

Qualifies the status and outcome of an operation where they alone would hide what the operator must know. Null when none applies.

rollback_in_progressrolled_backneeds_repairoutcome_unknowninterruptedrequires_approvalholds_lockawaiting_confirmationexpiredtimed_outrescheduled
can be null

Safe operation failure. Explanation and recommended_action come from the static failure-code registry. The only text not written by Principal is cluster_answer.

8 fields
codestring (JobFailureCode)required

Closed registry of asynchronous operation failure causes, independent of HTTP problem codes.

ACCESS_PROFILE_STALEAMBIGUOUS_TARGET_OUTCOMEAPPLY_INTERRUPTEDAUTHENTICATION_FAILEDCLICKHOUSE_REPLICAS_OUT_OF_SYNCCLICKHOUSE_USER_NAME_RESERVEDCONNECTION_FAILEDCONNECTION_REFUSEDCONNECTION_TIMEOUTCONNECTOR_CREDENTIALS_MISSINGCONNECTOR_PAUSEDCONNECTOR_SOURCE_CHANGEDCONNECTOR_TYPE_UNAVAILABLECONSTRAINT_VIOLATIONCREDENTIAL_EXPIREDCREDENTIAL_NOT_FOUNDDATABASE_NOT_FOUNDDRIFT_BINDING_NOT_FOUNDDRIFT_DEFAULT_INHERITED_SKIPPEDDRIFT_NO_EXECUTABLE_DIFFDRIFT_PARTIAL_APPLYDRIFT_PLAN_GENERATION_FAILEDDRIFT_RESOURCE_MISMATCHDRIFT_RULE_DELETINGDRIFT_RUN_OUTDATEDDRIFT_SCOPE_MISMATCHGROUP_EXPANSION_LIMIT_EXCEEDEDHANDLER_NOT_FOUNDK8S_CHANGE_REJECTEDK8S_CLUSTER_UNREACHABLEK8S_NAMESPACE_FORBIDDENK8S_NAMESPACE_NOT_FOUNDK8S_RBAC_FORBIDDENKUBERNETES_MEMBER_CREDENTIALS_PENDINGKUBERNETES_SERVICE_ACCOUNT_KUBECONFIG_NOT_ISSUEDMARIADB_TRUNCATE_UNSUPPORTEDMARIADB_USAGE_UNSUPPORTEDMARIADB_GRANTS_AMBIGUOUSMUTATION_LOCKEDMYSQL_MANAGEMENT_PRIVILEGES_MISSING
34 more values
NOT_FOUNDOPERATION_BACKOFFOPERATION_CANCELLEDOPERATION_TIMEOUTOWNED_OBJECTS_DECISION_REQUIREDPERMISSION_DENIEDPLAN_APPLY_ARTIFACT_INVALIDPLAN_APPLY_ORPHANED_LOCKPLAN_APPLY_ROLLBACK_BASELINE_INVALIDPLAN_APPLY_RULE_CHANGEDPLAN_APPLY_TARGET_STATE_CHANGEDPLAN_APPLY_ACCESS_IMPACT_CHANGEDPOSTGRES_FUTURE_OBJECT_CREATORS_MISSINGPOSTGRES_GRANT_AUTHORITY_MISSINGPOSTGRES_MANAGEMENT_PRIVILEGES_MISSINGPOSTGRES_ROLE_ATTRIBUTE_UNSUPPORTEDPOSTGRES_ROLE_NAME_RESERVEDPOSTGRES_TLS_FILE_NOT_ALLOWEDPROVIDER_REQUEST_FAILEDRATE_LIMITEDROLE_EXISTSROLE_NOT_FOUNDROTATION_CHECK_REQUIREDSECRET_STORE_UNAVAILABLESERIALIZATION_ERRORTARGET_ACCOUNT_IDENTITY_MISMATCHTARGET_ACCOUNT_IDENTITY_UNVERIFIEDTARGET_ACCOUNT_IMPORT_PENDINGTARGET_ACCOUNT_PRINCIPAL_LOGINTARGET_ACCOUNT_TAKENTARGET_CONNECTION_MISSINGTARGET_REPAIR_REQUIREDUNKNOWN_ERRORVALIDATION_FAILED
titlestring

Short name of the failure from the same registry, for lists and queues where the explanation is too long. Absent on failures saved before the field existed.

max length 32
explanationstringrequired
recommended_actionstringrequired
retryablebooleanrequired

Whether the failed attempt was eligible for an automatic retry under the actual queue policy.

phasestring

Known operation phase at failure, when available.

resolution_codestring

Stable code of the action that can resolve this failure, the same vocabulary as a problem's resolution.code, for example upstream.check_connection. Absent when no single action does. A screen that offers the action shows it next to the failure, otherwise it shows recommended_action.

max length 128 · pattern ^[a-z][a-z0-9_-]*(\.[a-z0-9_-]+)*$
cluster_answerstring

The Kubernetes cluster's own answer to a change its admission policy or webhook refused: the policy or webhook name and its message. Only a step failure with code K8S_CHANGE_REJECTED carries it, as plain text without control characters, cut to 500 characters. The cluster administrator writes it, not Principal. Given only to callers with access:read in the rule's organization. Absent for runs saved before the field existed.

max length 500
next_retry_atstring · date-time
attemptsintegerrequired
max_attemptsintegerrequired
idstring

The job, with the fields below under the same names as in GET /admin/jobs/{id}. Present only when the caller may read jobs (jobs:read). Without that right the job carries only its state above.

job_typestring
created_atstring · date-time
completed_atstring · date-time
failed_atstring · date-time
updated_atstring · date-time
created_bystring
payload_summaryJobMetadataResponse
49 fields

Safe operation failure. Explanation and recommended_action come from the static failure-code registry. The only text not written by Principal is cluster_answer.

actionstring
action_symbolstring
addressstring
critical_countinteger
current_stepinteger
descriptionstring
drift_countinteger
duration_msinteger
errorstring
error_codestring
error_explanationstring
failed_countinteger
failure_countinteger
indexinteger
info_countinteger
job_idstring
messagestring
operation_idstring

Bulk action that this job runs. GET /bulk-operations/{id} reads it.

phasestring
plan_idstring
policy_idstring
progressnumber
raw_errorstring
recommended_actionstring
remediated_countinteger

Items remediated. For kubernetes_credential_refresh, kubeconfigs re-issued for the target's current authentication mode.

removed_countinteger

For kubernetes_credential_refresh, kubeconfigs of another authentication mode removed because the identity has no access in the current mode.

duplicates_newinteger

Connector sync only. Accounts this sync added to the duplicates of the connector.

duplicates_waitinginteger

Connector sync only. Accounts the sync skipped as duplicates, the new ones included.

resource_idstring
resource_typestring
risk_levelstring
run_idstring
stagestring
statusstring
pendingqueuedrunningcompletedfailedcancelledtimeoutokerrorrescheduledsucceededpartially_succeededrollback_in_progressrolled_backfailed_needs_repairsuccesspartial_success
success_countinteger
target_idstring
totalinteger
total_countinteger
total_findingsinteger
total_stepsinteger
warningsarray of string
warning_countinteger
recoverableboolean
retained_shared_rbacarray of entity.RetainedSharedRBACObject

Shared Kubernetes roles the cleanup kept because another binding still uses them. After a target deletion they stay in the cluster and Principal no longer removes them.

kept_unconfirmed_accountsarray of string

Accounts a target deletion with revoke left on the target because Principal can't confirm it created or adopted them. The target is deleted. The accounts keep their access.

removed_from_principal_onlyboolean

True when a failed target deletion ended with remove_from_principal_only. Principal deleted the target without revoking what the failed attempts left. That access stays on the target.

Operator decision about a job whose attempt a worker of the previous job protocol left running, recorded by the maintenance CLI registry (docs/maintenance-cutover.md). Returned to job administrators only.

instance_idstring

ID of the target the job works on.

target_namestring
last_errorstring

Raw error of the job, only for a caller who may manage jobs, as in GET /admin/jobs/{id}.

4 fields
stagestring (entity.DiscoveryStage)required

A stage actually emitted by a discovery worker.

application_discovery_warningchecking_stalenesscleaned_stalecleaning_stalecompleteconnectconnectingdatabases_completediscovered_api_resourcesdiscovered_application_candidatesdiscovered_cluster_role_bindingsdiscovered_cluster_rolesdiscovered_namespacesdiscovered_role_bindingsdiscovered_rolesdiscovered_tablesdiscovering_api_resourcesdiscovering_application_candidatesdiscovering_cluster_role_bindingsdiscovering_cluster_rolesdiscovering_completediscovering_databasesdiscovering_namespacesdiscovering_role_bindingsdiscovering_role_bindings_warningdiscovering_rolesdiscovering_roles_warningdiscovering_schemasdiscovering_tablesdiscovering_usersfinalizingpropagating_future_objectspropagation_warningresources_completeresources_connectingresources_databases_completeresources_discovering_databasesresources_discovering_tablesresources_finalizingresources_scanned_database
6 more values
roles_completescanned_databasescanning_completestaleness_warningusersusers_complete
percentintegerrequired

Persisted worker progress. Even 100 does not imply that the job is terminal.

min 0 · max 100
messagestringrequired

Safe static English presentation of the stage.

updated_atstring · date-timerequired
execution_stepsarray of object

Steps of the job. Error_message only for a caller who may manage jobs.

9 fields

Safe operation failure. Explanation and recommended_action come from the static failure-code registry. The only text not written by Principal is cluster_answer.

terminalbooleanrequired
outcomestring (entity.OperationOutcome)required

Final operation result, or null while the operation is active.

successfailurecancelledpartial
can be null
namestring
statusstring
pendingrunningcompletedfailedskipped
started_atstring
finished_atstring
duration_msinteger
error_messagestring
terminalbooleanrequired

Whether this operation has finished.

outcomestring (entity.OperationOutcome)required

Final operation result, or null while the operation is active.

successfailurecancelledpartial
can be null
substatestring (entity.OperationSubstate)required

Qualifies the status and outcome of an operation where they alone would hide what the operator must know. Null when none applies.

rollback_in_progressrolled_backneeds_repairoutcome_unknowninterruptedrequires_approvalholds_lockawaiting_confirmationexpiredtimed_outrescheduled
can be null
attemptsinteger
created_atstring
engine_kindstring
idstring
job_idstring
last_errorstring
not_startedboolean

The removal was accepted, but its job was never queued (for example the database failed in between) and nothing has run for two minutes. A retry or another delete request queues it again.

owned_objects_decisionstring

Operator's recorded answer to the owned objects decision, if any.

keep_datadelete_data
account_decisionstring

Operator's recorded answer to an unproven account request, if any.

forget

Set while a cleanup task is stopped in cleanup_failed waiting for the operator. Principal never deletes data owned by a revoked account on its own.

3 fields
kindstringrequired

Decision kind: owned_objects (keep or delete the objects a revoked account owns) or unproven_account (forget a ClickHouse account Principal cannot prove).

owned_objectsunproven_account
bindingsarray of CleanupPendingDecisionBindingResponserequired
4 fields
binding_idstringrequired
role_namestringrequired
reasonstring

Why Principal cannot prove the account (kind unproven_account).

requested_atstringrequired
removes_from_principal_onlyboolean

True after a failed target deletion was told to finish with remove_from_principal_only.

kept_unconfirmed_accountsarray of string

Accounts the target deletion left on the target because Principal can't confirm it created them.

accounts_left_on_targetarray of CleanupAccountLeftResponse

Only for a target cleanup task in cleanup_failed: the accounts Principal still manages on the target, created by Principal or adopted. They stay on the target when the deletion finishes with remove_from_principal_only. Absent when there are none.

4 fields
namestringrequired

The account as the target names it, for example the PostgreSQL role or user@host on MariaDB, or the name of a Kubernetes object.

kindstring

The kind of a Kubernetes object or account, for example RoleBinding or ServiceAccount. Absent on other engines.

namespacestring

The namespace of a namespaced Kubernetes object or account. Absent for a cluster-wide object and on other engines.

created_by_principalbooleanrequired

True when Principal created the account. False when it was adopted.

scope_idstring
scope_kindstring

Where a background operation is in the shared lifecycle (decision S1). outcome says how a finished operation ended and substate qualifies the state.

queuedrunningfinished
updated_atstring
409

Conflict

Common errors: 400 401 403 404 413 429 503 504. They mean the same for every operation, see Errors.

↑ ↓ to moveEnter to openEsc to close