Halaman ini menjelaskan cara membatalkan operasi impor AlloyDB untuk PostgreSQL untuk file CSV dan file SQL.
Sebelum memulai
Untuk membatalkan impor data, temukan ID operasi impor yang ingin Anda batalkan. Untuk menemukan ID, lakukan salah satu hal berikut:
- Ikuti petunjuk di
Mengimpor file CSV
atau
Mengimpor file SQL.
ID operasi ditampilkan di kolom
namerespons. - Lakukan panggilan
operations.listpada cluster AlloyDB.
Membatalkan operasi impor
Anda dapat menggunakan perintah Google Cloud CLI atau REST API untuk membatalkan operasi impor.
gcloud
Gunakan perintah gcloud alloydb operations cancel
untuk membatalkan operasi:
gcloud alloydb operations cancel OPERATION_ID --region=REGIONGanti OPERATION_ID dengan ID operasi. Untuk mengetahui informasi selengkapnya,
lihat Sebelum memulai.
REST v1
Gunakan metode HTTP dan URL berikut:
POST https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID:cancel
Untuk mengetahui informasi selengkapnya, lihat cancel.
Sebelum menggunakan salah satu data permintaan, lakukan penggantian berikut:
- PROJECT_ID: project ID.
- REGION: region tempat cluster AlloyDB di-deploy.
OPERATION_ID: ID operasi impor. Untuk mengetahui informasi selengkapnya, lihat Sebelum memulai.
Untuk mengirim permintaan Anda, perluas salah satu opsi berikut:
curl (Linux, macOS, atau Cloud Shell)
Simpan isi permintaan dalam file bernama
request.jsondan jalankan perintah berikut: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)
Simpan isi permintaan dalam file bernama
request.jsondan jalankan perintah berikut:$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 ContentAnda akan menerima respons JSON yang mirip dengan yang berikut ini:
Panggilan REST API ini tidak menampilkan respons apa pun. Untuk mengetahui informasi selengkapnya tentang cara memeriksa status pembatalan impor, lihat Memeriksa status yang dibatalkan.
Memeriksa status yang dibatalkan
Anda dapat menggunakan perintah gcloud CLI atau REST API untuk memeriksa status operasi impor yang dibatalkan.
gcloud
Gunakan gcloud alloydb operations describe
perintah untuk memeriksa status operasi yang dibatalkan.
gcloud alloydb operations describe OPERATION_ID --region=REGIONGanti variabel OPERATION_ID dengan ID operasi yang dibatalkan.
Untuk mengetahui informasi selengkapnya, lihat Sebelum memulai.
REST v1
Jalankan perintah berikut:
GET https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID
Untuk mengetahui informasi selengkapnya, lihat get.
Sebelum menggunakan salah satu data permintaan, lakukan penggantian berikut:
- REGION: region tempat cluster AlloyDB di-deploy.
- PROJECT_ID: project ID.
- OPERATION_ID: ID operasi impor. Untuk mengetahui informasi selengkapnya, lihat Sebelum memulai.
Untuk mengirim permintaan Anda, perluas salah satu opsi berikut:
curl (Linux, macOS, atau Cloud Shell)
Jalankan perintah berikut:
curl -X GET \
-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
PowerShell (Windows)
Jalankan perintah berikut:
$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" | Select-Object -Expand Content
Anda akan menerima respons JSON yang mirip dengan yang berikut ini:
Jika berhasil, isi respons memuat instance Operation.