cancelExportJobV2

Cancels a findings export job that is in progress. Security Hub transitions a running job to the CANCELLED state and returns the ExportJobId and its new Status. Canceling a job that is already in the CANCELLED state succeeds and returns the same result, so you can safely retry a cancel request.

You can't cancel an export job that has already reached a terminal SUCCEEDED or FAILED state; in that case, this operation returns a ConflictException. If no export job matches the ExportJobId that you provide, this operation returns a ResourceNotFoundException.

The Status value returned by this operation reflects the cancellation immediately, even though the job can take a short time to stop completely.

Samples

// The following example cancels an export job that is in progress. Security Hub transitions the job to
// the CANCELLED state and returns its new status.
val resp = securityHubClient.cancelExportJobV2 {
    exportJobId = "a1b2c3d4e5f6"
}