Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Dokumen ini menjelaskan cara menghapus Transformasi Pesan Tunggal (SMT) dari langganan Pub/Sub yang ada.
Untuk menghapus SMT langganan, Anda dapat menggunakan Google Cloud konsol, Google Cloud CLI,
library klien, atau Pub/Sub API.
Peran dan izin yang diperlukan
Untuk mendapatkan izin yang
diperlukan guna menghapus SMT langganan,
minta administrator Anda untuk memberi Anda
peran IAM Pub/Sub Editor (roles/pubsub.editor)
di project Anda.
Untuk mengetahui informasi selengkapnya tentang cara memberikan peran, lihat Mengelola akses ke project, folder, dan organisasi.
Peran bawaan ini berisi
izin yang diperlukan untuk menghapus SMT langganan. Untuk melihat izin yang benar-benar diperlukan, luaskan bagian Izin yang diperlukan:
Izin yang diperlukan
Izin berikut diperlukan untuk menghapus SMT langganan:
Berikan izin hapus langganan pada langganan:
pubsub.subscriptions.delete
Berikan izin lihat langganan pada project. Izin ini hanya diperlukan jika Anda menggunakan konsol Google Cloud :
pubsub.subscriptions.view
At the bottom of the Google Cloud console, a
Cloud Shell
session starts and displays a command-line prompt. Cloud Shell is a shell environment
with the Google Cloud CLI
already installed and with values already set for
your current project. It can take a few seconds for the session to initialize.
Perintah ini menghapus semua SMT yang terkait dengan langganan yang ditentukan.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-17 UTC."],[],[],null,["# Delete subscription SMTs\n\nThis document explains how to delete Single Message Transforms (SMTs) from an\nexisting Pub/Sub subscription.\n\nTo delete subscription SMTs, you can use the Google Cloud console, the Google Cloud CLI,\nthe client library, or the Pub/Sub API.\n\nRequired roles and permissions\n------------------------------\n\n\nTo get the permissions that\nyou need to delete subscription SMTs,\n\nask your administrator to grant you the\n\n\n[Pub/Sub Editor](/iam/docs/roles-permissions/pubsub#pubsub.editor) (`roles/pubsub.editor`)\nIAM role on your project.\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nThis predefined role contains\n\nthe permissions required to delete subscription SMTs. To see the exact permissions that are\nrequired, expand the **Required permissions** section:\n\n\n#### Required permissions\n\nThe following permissions are required to delete subscription SMTs:\n\n- Grant the delete a subscription permission on the subscription: ` ``pubsub.subscriptions.delete`\n- Grant the view a subscription permission on the project. This permission is only required if you are using the Google Cloud console: ` ``pubsub.subscriptions.view`\n\n\nYou might also be able to get\nthese permissions\nwith [custom roles](/iam/docs/creating-custom-roles) or\nother [predefined roles](/iam/docs/roles-overview#predefined).\n\nYou can configure access control at the project level and at the individual\nresource level.\n\nDelete subscription SMTs\n------------------------\n\nTo delete subscription SMTs, follow these steps: \n\n### Console\n\n1. In the Google Cloud console, go to the Pub/Sub **Subscriptions** page.\n\n [Go to Subscriptions](https://console.cloud.google.com/cloudpubsub/subscriptions)\n2. Click the subscription for which you want to delete an SMT.\n\n3. In the subscription details page, click **Edit**.\n\n The **Transforms** tab lists all the SMTs that are attached to the\n subscription.\n4. Click the delete button for the SMT you would like to delete.\n\n5. Click **Update**.\n\n### gcloud\n\n1. In the Google Cloud console, activate Cloud Shell.\n\n [Activate Cloud Shell](https://console.cloud.google.com/?cloudshell=true)\n\n\n At the bottom of the Google Cloud console, a\n [Cloud Shell](/shell/docs/how-cloud-shell-works)\n session starts and displays a command-line prompt. Cloud Shell is a shell environment\n with the Google Cloud CLI\n already installed and with values already set for\n your current project. It can take a few seconds for the session to initialize.\n2. This command deletes all SMTs associated with the specified subscription.\n\n Run the\n [`gcloud pubsub subscriptions update`](/sdk/gcloud/reference/pubsub/subscriptions/update) command with the `--clear-message-transforms` flag:\n\n \u003cbr /\u003e\n\n ```bash\n gcloud pubsub subscriptions update SUBSCRIPTION_ID \\\n --clear-message-transforms\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eSUBSCRIPTION_ID\u003c/var\u003e: The ID or name of the subscription you want to update.\n\n To instead remove a single SMT, refer to [Update subscription SMTs](/pubsub/docs/smts/update-subscription-smt) and create a new `message-transforms-file` that excludes the SMT you wish to delete.\n\n \u003cbr /\u003e\n\n\u003cbr /\u003e\n\nWhat's next\n-----------\n\n- [Create a subscription with SMTs](/pubsub/docs/smts/create-subscription-smt)\n\n- [Update subscription SMTs](/pubsub/docs/smts/update-subscription-smt)"]]