Cancel an import operation

This page describes how to cancel an AlloyDB for PostgreSQL import operation for CSV files and SQL files.

Before you begin

To cancel the import of data, find the ID of the import operation that you want to cancel. To find the ID, do one of the following:

Cancel the import operation

You can use the Google Cloud CLI or REST API commands to cancel an import operation.

gcloud

Use the gcloud alloydb operations cancel command to cancel the operation:

gcloud alloydb operations cancel OPERATION_ID --region=REGION

Replace OPERATION_ID with the ID of the operation. For more information, see Before you begin.

REST v1

Use the following HTTP method and URL:

POST https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID:cancel

For more information, see cancel.

Before you use any of the request data, make the following replacements:

  • PROJECT_ID: the project ID.
  • REGION: the region in which the AlloyDB cluster is deployed.
  • OPERATION_ID: the ID of the import operation. For more information, see Before you begin.

    To send your request, expand one of these options:

    curl (Linux, macOS, or Cloud Shell)

    Save the request body in a file named request.json and execute the following command:

       curl -X POST \
             -H "Authorization: Bearer $(gcloud auth print-access-token)" \
             -H "Content-Type: application/json; charset=utf-8" \
             -d @request.json \
             "https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID:cancel"
    

    PowerShell (Windows)

    Save the request body in a file named request.json and execute the following command:

    $cred = gcloud auth print-access-token
    $headers = @{ "Authorization" = "Bearer $cred" }
    
    Invoke-WebRequest `
      -Method POST `
      -Headers $headers `
      -ContentType: "application/json; charset=utf-8" `
      -InFile request.json `
      -Uri "https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID:cancel"| Select-Object -Expand Content