Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Ce document explique comment supprimer des transformations de message unique (SMT) d'un sujet Pub/Sub existant.
Pour supprimer des SMT de sujet, vous pouvez utiliser la console Google Cloud , Google Cloud CLI, la bibliothèque cliente ou l'API Pub/Sub.
Rôles et autorisations requis
Pour obtenir les autorisations nécessaires pour supprimer des SMT de thème, demandez à votre administrateur de vous accorder le rôle IAM Éditeur Pub/Sub (roles/pubsub.editor) sur votre projet.
Pour en savoir plus sur l'attribution de rôles, consultez la page Gérer l'accès aux projets, aux dossiers et aux organisations.
Ce rôle prédéfini contient les autorisations nécessaires pour supprimer les SMT de thèmes. Pour connaître les autorisations exactes requises, développez la section Autorisations requises :
Autorisations requises
Les autorisations suivantes sont requises pour supprimer des SMT de thèmes :
Accordez à la mise à jour une autorisation de thème sur le thème :
projects.topics.patch
Accordez l'autorisation "Afficher un thème" sur le projet. Cette autorisation n'est requise que si vous utilisez la console Google Cloud :
pubsub.topics.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.
Cette commande supprime tous les SMT associés au sujet spécifié.
TOPIC_ID : ID ou nom du thème que vous souhaitez modifier.
Pour supprimer un seul SMT, consultez Mettre à jour les SMT d'un thème et créez un message-transforms-file qui exclut le SMT que vous souhaitez supprimer.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/03 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/03 (UTC)."],[],[],null,["# Delete topic SMTs\n\nThis document explains how to delete Single Message Transforms (SMTs) from\nan existing Pub/Sub topic.\n\nTo delete topic 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 topic 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 topic 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 topic SMTs:\n\n- Grant the update a topic permission on the topic: ` ``projects.topics.patch`\n- Grant the view a topic permission on the project. This permission is only required if you are using the Google Cloud console: ` ``pubsub.topics.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 topic SMTs\n-----------------\n\nTo delete topic SMTs, follow these steps: \n\n### Console\n\n1. In the Google Cloud console, go to the Pub/Sub **Topics** page.\n\n [Go to Topics](https://console.cloud.google.com/cloudpubsub/topic)\n2. Click the topic for which you want to delete an SMT.\n\n3. In the topic details page, click **Edit**.\n\n The **Transforms** tab lists all the SMTs that are attached to the topic.\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 topic.\n\n Run the\n [`gcloud pubsub topics update`](/sdk/gcloud/reference/pubsub/topics/update) command with the `--clear-message-transforms` flag:\n\n \u003cbr /\u003e\n\n ```bash\n gcloud pubsub topics update TOPIC_ID --clear-message-transforms\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eTOPIC_ID\u003c/var\u003e: The ID or name of the topic you want to update.\n\n To instead remove a single SMT, refer to [Update topic SMTs](/pubsub/docs/smts/update-topic-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 topic with SMTs](/pubsub/docs/smts/create-topic-smt)\n\n- [Update topic SMTs](/pubsub/docs/smts/update-topic-smt)"]]