Delete subscription SMTs

This document explains how to delete Single Message Transforms (SMTs) from an existing Pub/Sub subscription.

To delete subscription SMTs, you can use the Google Cloud console, the Google Cloud CLI, the client library, or the Pub/Sub API.

Required roles and permissions

To get the permissions that you need to delete subscription SMTs, ask your administrator to grant you the Pub/Sub Editor (roles/pubsub.editor) IAM role on your project. For more information about granting roles, see Manage access to projects, folders, and organizations.

This predefined role contains the permissions required to delete subscription SMTs. To see the exact permissions that are required, expand the Required permissions section:

Required permissions

The following permissions are required to delete subscription SMTs:

  • Grant the delete a subscription permission on the subscription: pubsub.subscriptions.delete
  • 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

You might also be able to get these permissions with custom roles or other predefined roles.

You can configure access control at the project level and at the individual resource level.

Delete subscription SMTs

To delete subscription SMTs, follow these steps:

Console

  1. In the Google Cloud console, go to the Pub/Sub Subscriptions page.

    Go to Subscriptions

  2. Click the subscription for which you want to delete an SMT.

  3. In the subscription details page, click Edit.

    The Transforms tab lists all the SMTs that are attached to the subscription.

  4. Click the delete button for the SMT you would like to delete.

  5. Click Update.

gcloud

  1. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    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.

  2. This command deletes all SMTs associated with the specified subscription.

    Run the gcloud pubsub subscriptions update command with the --clear-message-transforms flag:

    gcloud pubsub subscriptions update SUBSCRIPTION_ID \
        --clear-message-transforms

    Replace the following:

    • SUBSCRIPTION_ID: The ID or name of the subscription you want to update.

    To instead remove a single SMT, refer to Update subscription SMTs and create a new message-transforms-file that excludes the SMT you wish to delete.

What's next