Anda hanya dapat menghapus gambar kustom yang telah ditambahkan oleh Anda, atau seseorang yang memiliki akses ke project.
Jika Anda ingin menyimpan cadangan image, ekspor image kustom ke Cloud Storage sebelum menghapusnya.
Sebelum memulai
- Baca dokumen Gambar.
-
Jika Anda belum melakukannya, siapkan autentikasi.
Autentikasi adalah
proses yang digunakan untuk memverifikasi identitas Anda untuk mengakses Trusted Cloud by S3NS layanan dan API.
Untuk menjalankan kode atau sampel dari lingkungan pengembangan lokal, Anda dapat melakukan autentikasi ke
Compute Engine dengan memilih salah satu opsi berikut:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Trusted Cloud console to access Trusted Cloud by S3NS services and APIs, you don't need to set up authentication.
gcloud
-
Instal Google Cloud CLI, lalu login ke gcloud CLI dengan identitas gabungan Anda. Setelah login, lakukan inisialisasi Google Cloud CLI dengan menjalankan perintah berikut:
gcloud init
- Set a default region and zone.
Python
Untuk menggunakan contoh Python di halaman ini dalam lingkungan pengembangan lokal, instal dan lakukan inisialisasi gcloud CLI, lalu siapkan Kredensial Default Aplikasi dengan kredensial pengguna Anda.
Instal Google Cloud CLI, lalu login ke gcloud CLI dengan identitas gabungan Anda.
Create local authentication credentials for your user account:
gcloud auth application-default login
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
Untuk informasi selengkapnya, lihat Set up authentication for a local development environment.
REST
Untuk menggunakan contoh REST API di halaman ini dalam lingkungan pengembangan lokal, Anda menggunakan kredensial yang Anda berikan ke gcloud CLI.
Instal Google Cloud CLI, lalu login ke gcloud CLI dengan identitas gabungan Anda.
Untuk mengetahui informasi selengkapnya, lihat Melakukan autentikasi untuk menggunakan REST dalam dokumentasi autentikasi Trusted Cloud .
Menghapus image kustom
Gunakan salah satu metode berikut untuk menghapus gambar.
Konsol
Di konsol Trusted Cloud , buka halaman Images.
Centang kotak di sebelah kiri gambar yang ingin Anda hapus.
Klik Hapus di bagian atas halaman. Gambar Anda dihapus.
gcloud
Gunakan perintah
gcloud compute images delete
untuk menghapus image:gcloud compute images delete IMAGE_NAME
Ganti
IMAGE_NAME
dengan nama image yang akan dihapus.Go
Java
Python
REST
Buat permintaan
POST
ke metodeimages().delete
. Tentukan nama gambar yang ingin Anda hapus.POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/images/RESOURCE_ID
Ganti kode berikut:
PROJECT_ID
: project tempat image berada.RESOURCE_ID
: nama image yang ingin Anda hapus.
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-08-08 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-08 UTC."],[[["Custom images can only be deleted by the user who created them or someone with project access, and this action is irreversible, so exporting a backup to Cloud Storage beforehand is recommended."],["Before deleting an image, it is recommended to read the Images document and set up authentication, which varies depending on whether you're using the Console, gcloud CLI, Python, or REST API."],["Deleting an image can be done through the Google Cloud console by navigating to the **Images** page, selecting the image, and clicking **Delete**, or through the `gcloud compute images delete` command in the gcloud CLI."],["The provided code samples demonstrate how to programmatically delete images using Go, Java, and Python, including the necessary steps for setting up the environment and handling potential errors."],["To delete an image using the REST API, you need to make a `POST` request to the `images().delete` method, specifying the project ID and the name of the image you want to delete."]]],[]] -