Essa chamada da API REST não retorna nenhuma resposta. Para mais informações
sobre como verificar o status de cancelamento da importação, consulte
Verificar o status cancelado.
Verificar o status cancelado
Use os comandos da API REST ou da CLI gcloud para verificar o status de uma operação de importação
cancelada.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-09-04 UTC."],[[["\u003cp\u003eThis guide details how to cancel an ongoing import operation for CSV or SQL files in AlloyDB for PostgreSQL.\u003c/p\u003e\n"],["\u003cp\u003eTo cancel an import, you must first locate the specific operation's ID, which can be found through import instructions or via an \u003ccode\u003eoperations.list\u003c/code\u003e call.\u003c/p\u003e\n"],["\u003cp\u003eThe cancellation can be executed using the \u003ccode\u003egcloud alloydb operations cancel\u003c/code\u003e command with the operation ID and region, or through a REST API \u003ccode\u003ePOST\u003c/code\u003e request.\u003c/p\u003e\n"],["\u003cp\u003eYou can verify the status of a canceled import operation with the \u003ccode\u003egcloud alloydb operations describe\u003c/code\u003e command or by using a REST API \u003ccode\u003eGET\u003c/code\u003e request.\u003c/p\u003e\n"]]],[],null,["# Cancel an import operation\n\nThis page describes how to cancel an AlloyDB for PostgreSQL import\noperation for CSV files and SQL files.\n\nBefore you begin\n----------------\n\nTo cancel the import of data, find the ID of the import operation that you want\nto cancel. To find the ID, do one of the following:\n\n- Follow the instructions in [Import a CSV file](/alloydb/docs/import-csv-file) or [Import a SQL file](/alloydb/docs/import-sql-file). The operation ID is returned in the `name` field of the response.\n- Make an [`operations.list`](/sdk/gcloud/reference/alloydb/operations/list) call on the AlloyDB cluster.\n\nCancel the import operation\n---------------------------\n\nYou can use the Google Cloud CLI or REST API commands to cancel an import\noperation. \n\n### gcloud\n\nUse the [`gcloud alloydb operations cancel`](/sdk/gcloud/reference/alloydb/operations/cancel)\ncommand to cancel the operation: \n\n gcloud alloydb operations cancel \u003cvar translate=\"no\"\u003eOPERATION_ID\u003c/var\u003e --region=\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e\n\nReplace `OPERATION_ID` with the ID of the operation. For more information,\nsee [Before you begin](#before-you-begin).\n\n### REST v1\n\nUse the following HTTP method and URL: \n\n POST https://alloydb.googleapis.com/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/locations/\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e/operations/\u003cvar translate=\"no\"\u003eOPERATION_ID\u003c/var\u003e:cancel\n\nFor more information, see [cancel](/alloydb/docs/reference/rest/v1/projects.locations.operations/cancel).\n\nBefore you use any of the request data, make the following replacements:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID.\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the region in which the AlloyDB cluster is deployed.\n- \u003cvar translate=\"no\"\u003eOPERATION_ID\u003c/var\u003e: the ID of the import operation.\n For more information, see [Before you begin](#before-you-begin).\n\n To send your request, expand one of these options:\n\n #### curl (Linux, macOS, or Cloud Shell)\n\n | The following command assumes that you signed into the Google Cloud CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login), or by using [Cloud Shell](/shell/docs), which automatically signs you into the gcloud CLI. You can check the active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n Save the request body in a file named `request.json`\n and execute the following command: \n\n ```\n curl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json; charset=utf-8\" \\\n -d @request.json \\\n \"https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID:cancel\"\n ```\n\n #### PowerShell (Windows)\n\n | The following command assumes that you signed into the Google Cloud CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login), or by using [Cloud Shell](/shell/docs), which automatically signs you into the gcloud CLI. You can check the active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n Save the request body in a file named `request.json`\n and execute the following command: \n\n ```\n $cred = gcloud auth print-access-token\n $headers = @{ \"Authorization\" = \"Bearer $cred\" }\n\n Invoke-WebRequest `\n -Method POST `\n -Headers $headers `\n -ContentType: \"application/json; charset=utf-8\" `\n -InFile request.json `\n -Uri \"https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID:cancel\"| Select-Object -Expand Content\n ```\n\n You receive a JSON response similar to the following:\n\n This REST API call doesn't return any response. For more information\n about checking the cancellation status of the import, see\n [Check the cancelled status](#check-cancelled-status).\n\nCheck the cancelled status\n--------------------------\n\nYou can use the gcloud CLI or REST API commands to check the status of a cancelled\nimport operation. \n\n### gcloud\n\nUse the [`gcloud alloydb operations describe`](/sdk/gcloud/reference/alloydb/operations/describe)\ncommand to check the status of the cancelled operation. \n\n gcloud alloydb operations describe \u003cvar translate=\"no\"\u003eOPERATION_ID\u003c/var\u003e --region=\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e\n\nReplace the `OPERATION_ID` variable with the ID of the cancelled operation.\nFor more information, see [Before you begin](#before-you-begin).\n\n### REST v1\n\nRun the following: \n\n```\nGET https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID\n```\n\nFor more information, see [`get`](/alloydb/docs/reference/rest/v1/projects.locations.operations/get).\n\nBefore you use any of the request data, make the following replacements:\n\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the region in which the AlloyDB cluster is deployed.\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the project ID.\n- \u003cvar translate=\"no\"\u003eOPERATION_ID\u003c/var\u003e: the ID of the import operation. For more information, see [Before you begin](#before-you-begin).\n\nTo send your request, expand one of these options:\n\n#### *curl (Linux, macOS, or Cloud Shell)*\n\n| The following command assumes that you signed into the gcloud CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login), or by using [Cloud Shell](/shell/docs), which automatically signs you into the gcloud CLI. You can check the active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\nExecute the following command: \n\n```\n curl -X GET \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json; charset=utf-8\" \\\n -d @request.json \\\n POST https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID\n \n```\n\n#### *PowerShell (Windows)*\n\n| The following command assumes that you signed into the gcloud CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login). You can check the active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\nExecute the following command: \n\n```\n$cred = gcloud auth print-access-token\n$headers = @{ \"Authorization\" = \"Bearer $cred\" }\n\nInvoke-WebRequest `\n -Method GET `\n -Headers $headers `\n -Uri \"https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID\" | Select-Object -Expand Content\n```\n\nYou receive a JSON response similar to the following:\n\n\u003cbr /\u003e\n\n\nIf successful, the response body contains an instance of\n[Operation](/alloydb/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation).\n\n\u003cbr /\u003e\n\nWhat's next\n-----------\n\n- Learn how to [import a CSV file](/alloydb/docs/import-csv-file).\n- Learn how to [import a SQL file](/alloydb/docs/import-sql-file)."]]