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
name
respons. - Lakukan panggilan
operations.list
di 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=REGION
Ganti OPERATION_ID
dengan ID operasi. Untuk 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 informasi selengkapnya, lihat cancel.
Sebelum menggunakan data permintaan apa pun, buat 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.json
dan 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.json
dan 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 Content
Anda akan menerima respons JSON yang mirip dengan 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 perintah gcloud alloydb operations describe
untuk memeriksa status operasi yang dibatalkan.
gcloud alloydb operations describe OPERATION_ID --region=REGION
Ganti 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 informasi selengkapnya, lihat get
.
Sebelum menggunakan data permintaan apa pun, buat 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 berikut ini:
Jika berhasil, isi respons akan berisi instance Operation.
Langkah berikutnya
- Pelajari cara mengimpor file CSV.
- Pelajari cara mengimpor file SQL.