Membatalkan operasi impor

Untuk menghentikan impor CSV atau SQL yang sedang berlangsung dan mengosongkan resource cluster, Anda dapat membatalkan operasi impor AlloyDB untuk PostgreSQL menggunakan Google Cloud CLI atau REST API.

Sebelum memulai

Untuk membatalkan impor data, temukan ID operasi impor yang ingin Anda batalkan. Untuk menemukan ID, lakukan salah satu hal berikut:

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 kode berikut:

  • OPERATION_ID: ID operasi. Untuk mengetahui informasi selengkapnya, lihat Sebelum memulai.
  • REGION: region tempat cluster AlloyDB di-deploy.

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 operations.cancel.

Sebelum menggunakan data permintaan apa pun, 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, luaskan 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
    

    Panggilan REST API ini tidak menampilkan respons apa pun. Untuk mengetahui informasi selengkapnya tentang cara memeriksa status pembatalan impor, lihat Periksa 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 kode berikut:

  • OPERATION_ID: ID operasi yang dibatalkan. Untuk mengetahui informasi selengkapnya, lihat Sebelum memulai.
  • REGION: region tempat cluster AlloyDB di-deploy.

REST v1

Jalankan perintah berikut:

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

Untuk informasi selengkapnya, lihat operations.get.

Sebelum menggunakan data permintaan apa pun, 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, luaskan salah satu opsi berikut:

curl (Linux, macOS, atau Cloud Shell)

Jalankan perintah berikut:

  curl -X GET \
       -H "Authorization: Bearer $(gcloud auth print-access-token)" \
       "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

Jika berhasil, isi respons akan memuat instance Operation.

Langkah berikutnya