This page describes how to cancel an export operation for CSV files and SQL dump files.
Before you begin
To cancel the export of data, find the ID of the export operation that you want to cancel. To find the ID, do one of the following:
Follow the instructions in Export a SQL file. The operation ID is returned in the
name
field of the response.Make an
operations.list
call on the AlloyDB cluster.
Cancel the export operation
You can use gcloud
or REST API commands to cancel an export 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 export operation. For more information, see Before you begin.
To send your request, expand one of the following options:
curl (Linux, macOS, or Cloud Shell)
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 \ POST https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID:cancel
PowerShell (Windows)
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 "POST https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID:cancel" | Select-Object -Expand Content
You receive a JSON response similar to the following:
This REST API call doesn't return any response. For more information about checking the cancellation status of the export operation, see Check the canceled status.
Check the canceled status
You can use gcloud
or REST API commands to check the status of a canceled
export operation.
gcloud
Use the gcloud alloydb operations describe
command to check the status of the canceled operation.
gcloud alloydb operations describe OPERATION_ID --region=REGION
Replace the OPERATION_ID
variable with the ID of the canceled operation.
For more information, see Before you begin.
REST v1
Run the following:
GET https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID:describe
For more information, see get
.
Before you use any of the request data, make the following replacements:
- REGION: the region in which the AlloyDB cluster is deployed.
- PROJECT_ID: the project ID.
- OPERATION_ID: the ID of the export operation. For more information, see Before you begin.
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Execute the following command:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID:describe
PowerShell (Windows)
Execute the following command:
$cred = gcloud auth print-access-token $headers = @{ "Authorization" = "Bearer $cred" } Invoke-WebRequest ` -Method GET ` -Headers $headers ` -Uri "https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID:describe
You receive a JSON response similar to the following:
If successful, the response body contains an instance of Operation.
What's next
- Learn how to export a CSV file.
- Learn how to export a SQL dump file.
- Troubleshoot a data export.