gcloud beta pubsub topics update

NAME
gcloud beta pubsub topics update - updates an existing Cloud Pub/Sub topic
SYNOPSIS
gcloud beta pubsub topics updateTOPIC[--update-labels=[KEY=VALUE,…]][--clear-ingestion-data-source-settings    |--ingestion-log-severity=INGESTION_LOG_SEVERITY--aws-msk-ingestion-aws-role-arn=AWS_MSK_INGESTION_AWS_ROLE_ARN--aws-msk-ingestion-cluster-arn=AWS_MSK_INGESTION_CLUSTER_ARN--aws-msk-ingestion-service-account=AWS_MSK_INGESTION_SERVICE_ACCOUNT--aws-msk-ingestion-topic=AWS_MSK_INGESTION_TOPIC    |--azure-event-hubs-ingestion-client-id=AZURE_EVENT_HUBS_INGESTION_CLIENT_ID--azure-event-hubs-ingestion-event-hub=AZURE_EVENT_HUBS_INGESTION_EVENT_HUB--azure-event-hubs-ingestion-namespace=AZURE_EVENT_HUBS_INGESTION_NAMESPACE--azure-event-hubs-ingestion-resource-group=AZURE_EVENT_HUBS_INGESTION_RESOURCE_GROUP--azure-event-hubs-ingestion-service-account=AZURE_EVENT_HUBS_INGESTION_SERVICE_ACCOUNT--azure-event-hubs-ingestion-subscription-id=AZURE_EVENT_HUBS_INGESTION_SUBSCRIPTION_ID--azure-event-hubs-ingestion-tenant-id=AZURE_EVENT_HUBS_INGESTION_TENANT_ID    | [--cloud-storage-ingestion-bucket=CLOUD_STORAGE_INGESTION_BUCKET--cloud-storage-ingestion-input-format=INPUT_FORMAT :--cloud-storage-ingestion-text-delimiter=CLOUD_STORAGE_INGESTION_TEXT_DELIMITER--cloud-storage-ingestion-minimum-object-create-time=CLOUD_STORAGE_INGESTION_MINIMUM_OBJECT_CREATE_TIME--cloud-storage-ingestion-match-glob=CLOUD_STORAGE_INGESTION_MATCH_GLOB]    |--confluent-cloud-ingestion-bootstrap-server=CONFLUENT_CLOUD_INGESTION_BOOTSTRAP_SERVER--confluent-cloud-ingestion-cluster-id=CONFLUENT_CLOUD_INGESTION_CLUSTER_ID--confluent-cloud-ingestion-identity-pool-id=CONFLUENT_CLOUD_INGESTION_IDENTITY_POOL_ID--confluent-cloud-ingestion-service-account=CONFLUENT_CLOUD_INGESTION_SERVICE_ACCOUNT--confluent-cloud-ingestion-topic=CONFLUENT_CLOUD_INGESTION_TOPIC    |--kinesis-ingestion-consumer-arn=KINESIS_INGESTION_CONSUMER_ARN--kinesis-ingestion-role-arn=KINESIS_INGESTION_ROLE_ARN--kinesis-ingestion-service-account=KINESIS_INGESTION_SERVICE_ACCOUNT--kinesis-ingestion-stream-arn=KINESIS_INGESTION_STREAM_ARN][--clear-labels    |--remove-labels=[KEY,…]][--clear-message-retention-duration    |--message-retention-duration=MESSAGE_RETENTION_DURATION][--clear-message-transforms    |--message-transforms-file=MESSAGE_TRANSFORMS_FILE][--clear-schema-settings    | [--message-encoding=ENCODING (--schema=SCHEMA :--schema-project=SCHEMA_PROJECT) :--first-revision-id=FIRST_REVISION_ID--last-revision-id=LAST_REVISION_ID]][--recompute-message-storage-policy    | [--message-storage-policy-allowed-regions=[REGION,…] :--message-storage-policy-enforce-in-transit]][--topic-encryption-key=TOPIC_ENCRYPTION_KEY :--topic-encryption-key-keyring=TOPIC_ENCRYPTION_KEY_KEYRING--topic-encryption-key-location=TOPIC_ENCRYPTION_KEY_LOCATION--topic-encryption-key-project=TOPIC_ENCRYPTION_KEY_PROJECT][GCLOUD_WIDE_FLAG]
DESCRIPTION
(BETA) Updates an existing Cloud Pub/Sub topic.
EXAMPLES
To update existing labels on a Cloud Pub/Sub topic, run:
gcloudbetapubsubtopicsupdatemytopic--update-labels=KEY1=VAL1,KEY2=VAL2

To clear all labels on a Cloud Pub/Sub topic, run:

gcloudbetapubsubtopicsupdatemytopic--clear-labels

To remove an existing label on a Cloud Pub/Sub topic, run:

gcloudbetapubsubtopicsupdatemytopic--remove-labels=KEY1,KEY2

To enable customer-managed encryption for a Cloud Pub/Sub topic by protectingmessage data with a Cloud KMS CryptoKey, run:

gcloudbetapubsubtopicsupdatemytopic--topic-encryption-key=projects/PROJECT_ID/locations/KMS_LOCATION/keyRings/KEYRING/cryptoKeys/KEY

To enable or update retention on a Cloud Pub/Sub topic, run:

gcloudbetapubsubtopicsupdatemytopic--message-retention-duration=MESSAGE_RETENTION_DURATION

To disable retention on a Cloud Pub/Sub topic, run:

gcloudbetapubsubtopicsupdatemytopic--clear-message-retention-duration

To update a Cloud Pub/Sub topic's message storage policy, run:

gcloudbetapubsubtopicsupdatemytopic--message-storage-policy-allowed-regions=some-cloud-region1,some-cloud-region2

To recompute a Cloud Pub/Sub topic's message storage policy based on yourorganization's "Resource Location Restriction" policy, run:

gcloudbetapubsubtopicsupdatemytopic--recompute-message-storage-policy

To enforce both at-rest and in-transit guarantees for messages published to thetopic, run:

gcloudbetapubsubtopicsupdatemytopic--message-storage-policy-allowed-regions=some-cloud-region1,some-cloud-region2--message-storage-policy-enforce-in-transit
POSITIONAL ARGUMENTS
Topic resource - Name of the topic to update. This represents a Cloud resource.(NOTE) Some attributes are not given arguments in this group but can be set inother ways.

To set theproject attribute:

  • provide the argumenttopic on the command line with a fullyspecified name;
  • provide the argument--project on the command line;
  • set the propertycore/project.

This must be specified.

TOPIC
ID of the topic or fully qualified identifier for the topic.

To set thetopic attribute:

  • provide the argumenttopic on the command line.
FLAGS
--update-labels=[KEY=VALUE,…]
List of label KEY=VALUE pairs to update. If a label exists, its value ismodified. Otherwise, a new label is created.

Keys must start with a lowercase character and contain only hyphens(-), underscores (_), lowercase characters, andnumbers. Values must contain only hyphens (-), underscores(_), lowercase characters, and numbers.

Specify either --clear-ingestion-data-source-settings or a new ingestion source.

At most one of these can be specified:

--clear-ingestion-data-source-settings
If set, clear the Ingestion Data Source Settings from the topic. Use--no-clear-ingestion-data-source-settings to disable this flag.
Following flags are for specifying the data source settings for an import topic

When updating IngestionDataSourceSettings flags, all IngestionDataSourceSettingsflags must be specified. Otherwise, any omitted IngestionDataSourceSettingsflags revert to their default value.

--ingestion-log-severity=INGESTION_LOG_SEVERITY
Log severity to use for ingestion.
At most one of these can be specified:
Flags that specify settings for an import topic from Amazon Web Services (AWS)Managed Streaming for Apache Kafka (MSK)

When updating AWS MSK Source flags, all AWS MSK Source flags must be specified.Otherwise, any omitted AWS MSK Source flags revert to their default value.

--aws-msk-ingestion-aws-role-arn=AWS_MSK_INGESTION_AWS_ROLE_ARN
AWS role ARN to be used for Federated Identity authentication with MSK.

This flag argument must be specified if any of the other arguments in this groupare specified.

--aws-msk-ingestion-cluster-arn=AWS_MSK_INGESTION_CLUSTER_ARN
ARN that uniquely identifies the MSK cluster.

This flag argument must be specified if any of the other arguments in this groupare specified.

--aws-msk-ingestion-service-account=AWS_MSK_INGESTION_SERVICE_ACCOUNT
Google Cloud service account to be used for Federated Identity authenticationwith MSK.

This flag argument must be specified if any of the other arguments in this groupare specified.

--aws-msk-ingestion-topic=AWS_MSK_INGESTION_TOPIC
Name of the MSK topic that Pub/Sub will import from.

This flag argument must be specified if any of the other arguments in this groupare specified.

Flags that specify settings for an import topic from Azure Event Hubs

When updating AzureEventHubs Source flags, all AzureEventHubs Source flags mustbe specified. Otherwise, any omitted AzureEventHubs Source flags revert to theirdefault value.

--azure-event-hubs-ingestion-client-id=AZURE_EVENT_HUBS_INGESTION_CLIENT_ID
Azure Event Hubs client ID to use for ingestion.

This flag argument must be specified if any of the other arguments in this groupare specified.

--azure-event-hubs-ingestion-event-hub=AZURE_EVENT_HUBS_INGESTION_EVENT_HUB
Azure event hub from which to ingest data.

This flag argument must be specified if any of the other arguments in this groupare specified.

--azure-event-hubs-ingestion-namespace=AZURE_EVENT_HUBS_INGESTION_NAMESPACE
Azure Event Hubs namespace from which to ingest data.

This flag argument must be specified if any of the other arguments in this groupare specified.

--azure-event-hubs-ingestion-resource-group=AZURE_EVENT_HUBS_INGESTION_RESOURCE_GROUP
Azure Event Hubs resource group from within an Azure subscription.

This flag argument must be specified if any of the other arguments in this groupare specified.

--azure-event-hubs-ingestion-service-account=AZURE_EVENT_HUBS_INGESTION_SERVICE_ACCOUNT
Google Cloud service account to be used for Federated Identity authenticationwith Azure Event Hubs.

This flag argument must be specified if any of the other arguments in this groupare specified.

--azure-event-hubs-ingestion-subscription-id=AZURE_EVENT_HUBS_INGESTION_SUBSCRIPTION_ID
Azure Event Hubs subscription ID to use for ingestion.

This flag argument must be specified if any of the other arguments in this groupare specified.

--azure-event-hubs-ingestion-tenant-id=AZURE_EVENT_HUBS_INGESTION_TENANT_ID
Azure Event Hubs tenant ID to use for ingestion.

This flag argument must be specified if any of the other arguments in this groupare specified.

Flags that specify settings for an import topic from Cloud Storage

When updating CloudStorage Source flags, all CloudStorage Source flags must bespecified. Otherwise, any omitted CloudStorage Source flags revert to theirdefault value.

--cloud-storage-ingestion-bucket=CLOUD_STORAGE_INGESTION_BUCKET
Cloud Storage bucket from which to ingest data.

This flag argument must be specified if any of the other arguments in this groupare specified.

--cloud-storage-ingestion-input-format=INPUT_FORMAT
Format of the data in the Cloud Storage bucket.INPUT_FORMAT must be one of:text,avro,pubsub_avro.

This flag argument must be specified if any of the other arguments in this groupare specified.

--cloud-storage-ingestion-text-delimiter=CLOUD_STORAGE_INGESTION_TEXT_DELIMITER
Delimiter to use with text format when partitioning the object.
--cloud-storage-ingestion-minimum-object-create-time=CLOUD_STORAGE_INGESTION_MINIMUM_OBJECT_CREATE_TIME
Only Cloud Storage objects with a larger or equal creation timestamp will beingested.
--cloud-storage-ingestion-match-glob=CLOUD_STORAGE_INGESTION_MATCH_GLOB
Glob pattern used to match Cloud Storage objects that will be ingested. Ifunset, all objects will be ingested.
Flags that specify settings for an import topic from Confluent Cloud

When updating ConfluentCloud Source flags, all ConfluentCloud Source flags mustbe specified. Otherwise, any omitted ConfluentCloud Source flags revert to theirdefault value.

--confluent-cloud-ingestion-bootstrap-server=CONFLUENT_CLOUD_INGESTION_BOOTSTRAP_SERVER
Confluent Cloud bootstrap server. The format is url:port.

This flag argument must be specified if any of the other arguments in this groupare specified.

--confluent-cloud-ingestion-cluster-id=CONFLUENT_CLOUD_INGESTION_CLUSTER_ID
Confluent Cloud cluster ID.

This flag argument must be specified if any of the other arguments in this groupare specified.

--confluent-cloud-ingestion-identity-pool-id=CONFLUENT_CLOUD_INGESTION_IDENTITY_POOL_ID
Identity pool ID to be used for Federated Identity authentication with ConfluentCloud.

This flag argument must be specified if any of the other arguments in this groupare specified.

--confluent-cloud-ingestion-service-account=CONFLUENT_CLOUD_INGESTION_SERVICE_ACCOUNT
Google Cloud service account to be used for Federated Identity authenticationwith Confluent Cloud.

This flag argument must be specified if any of the other arguments in this groupare specified.

--confluent-cloud-ingestion-topic=CONFLUENT_CLOUD_INGESTION_TOPIC
Name of the Confluent Cloud topic that Pub/Sub will import from.

This flag argument must be specified if any of the other arguments in this groupare specified.

Flags that specify settings for an import topic from Amazon Web Services (AWS)Kinesis Data Streams

When updating AWSKinesis Source flags, all AWSKinesis Source flags must bespecified. Otherwise, any omitted AWSKinesis Source flags revert to theirdefault value.

--kinesis-ingestion-consumer-arn=KINESIS_INGESTION_CONSUMER_ARN
Kinesis data streams consumer Amazon Resource Name (ARN) to use for ingestion.

This flag argument must be specified if any of the other arguments in this groupare specified.

--kinesis-ingestion-role-arn=KINESIS_INGESTION_ROLE_ARN
AWS role ARN to be used for Federated Identity authentication with Kinesis.

This flag argument must be specified if any of the other arguments in this groupare specified.

--kinesis-ingestion-service-account=KINESIS_INGESTION_SERVICE_ACCOUNT
Google Cloud service account to be used for Federated Identity authenticationwith Kinesis.

This flag argument must be specified if any of the other arguments in this groupare specified.

--kinesis-ingestion-stream-arn=KINESIS_INGESTION_STREAM_ARN
Kinesis data stream ARN from which to ingest data.

This flag argument must be specified if any of the other arguments in this groupare specified.

At most one of these can be specified:
--clear-labels
Remove all labels. If--update-labels is also specified then--clear-labels is applied first.

For example, to remove all labels:

gcloudbetapubsubtopicsupdate--clear-labels

To remove all existing labels and create two new labels,foo andbaz:

gcloudbetapubsubtopicsupdate--clear-labels--update-labelsfoo=bar,baz=qux
--remove-labels=[KEY,…]
List of label keys to remove. If a label does not exist it is silently ignored.If--update-labels is also specified then--update-labels is applied first.
At most one of these can be specified:
--clear-message-retention-duration
If set, clear the message retention duration from the topic. Use--no-clear-message-retention-duration to disable this flag.
--message-retention-duration=MESSAGE_RETENTION_DURATION
Indicates the minimum duration to retain a message after it is published to thetopic. If this field is set, messages published to the topic in the lastMESSAGE_RETENTION_DURATION are always available to subscribers. For instance, itallows any attached subscription to seek to a timestamp that is up toMESSAGE_RETENTION_DURATION in the past. If this field is not set, messageretention is controlled by settings on individual subscriptions. The minimum is10 minutes and the maximum is 31 days. Valid values are strings of the formINTEGER[UNIT], where UNIT is one of "s", "m", "h", and "d" for seconds, minutes,hours, and days, respectively. If the unit is omitted, seconds is assumed.
At most one of these can be specified:
--clear-message-transforms
If set, clears the message transforms field. Use --no-clear-message-transformsto disable this flag.
--message-transforms-file=MESSAGE_TRANSFORMS_FILE
Path to YAML or JSON file containing message transforms.
At most one of these can be specified:
--clear-schema-settings
If set, clear the Schema Settings from the topic. Use --no-clear-schema-settingsto disable this flag.
Schema settings. The schema that messages published to this topic must conformto and the expected message encoding.

When updating SchemaSettings flags, all SchemaSettings flags must be specified.Otherwise, any omitted SchemaSettings flags revert to their default value.

--message-encoding=ENCODING
The encoding of messages validated against the schema.ENCODING must be one of:json,binary.

This flag argument must be specified if any of the other arguments in this groupare specified.

--first-revision-id=FIRST_REVISION_ID
The id of the oldest revision allowed for the specified schema.
--last-revision-id=LAST_REVISION_ID
The id of the most recent revision allowed for the specified schema
Schema resource - Name of the schema that messages published to this topic mustconform to. The arguments in this group can be used to specify the attributes ofthis resource.

This must be specified.

--schema=SCHEMA
ID of the schema or fully qualified identifier for the schema.

To set theschema attribute:

  • provide the argument--schema on the command line.

This flag argument must be specified if any of the other arguments in this groupare specified.

--schema-project=SCHEMA_PROJECT
Project ID of the Google Cloud project for the schema.

To set theproject attribute:

  • provide the argument--schema on the command line with a fullyspecified name;
  • provide the argument--schema-project on the command line;
  • provide the argument--project on the command line;
  • set the propertycore/project.
Message storage policy options.

At most one of these can be specified:

--recompute-message-storage-policy
If given, Pub/Sub recomputes the regions where messages can be stored at rest,based on your organization's "Resource Location Restriction" policy.
Options for explicitly specifying themessagestorage policy for a topic.

When updating MessageStoragePolicy flags, all MessageStoragePolicy flags must bespecified. Otherwise, any omitted MessageStoragePolicy flags revert to theirdefault value. These fields can be set only if the--recompute-message-storage-policy flag is not set.

--message-storage-policy-allowed-regions=[REGION,…]
A list of one or more Cloud regions where messages are allowed to be stored atrest.

This flag argument must be specified if any of the other arguments in this groupare specified.

--message-storage-policy-enforce-in-transit
Whether or not to enforce in-transit guarantees for this topic using the allowedregions. This ensures that publishing, pulling, and push delivery are onlyhandled in allowed Cloud regions.
Key resource - The Cloud KMS (Key Management Service) cryptokey that will beused to protect the topic. The specified Cloud KMS key should have purpose setto "ENCRYPT_DECRYPT". The service account,"service-${CONSUMER_PROJECT_NUMBER}@gcp-sa-pubsub.iam.gserviceaccount.com"requires the IAM cryptoKeyEncrypterDecrypter role for the given Cloud KMS key.CONSUMER_PROJECT_NUMBER is the project number of the project that is the parentof the topic being updated. The arguments in this group can be used to specifythe attributes of this resource.
--topic-encryption-key=TOPIC_ENCRYPTION_KEY
ID of the key or fully qualified identifier for the key.

To set thekms-key attribute:

  • provide the argument--topic-encryption-key on the command line.

This flag argument must be specified if any of the other arguments in this groupare specified.

--topic-encryption-key-keyring=TOPIC_ENCRYPTION_KEY_KEYRING
The KMS keyring of the key.

To set thekms-keyring attribute:

  • provide the argument--topic-encryption-key on the command linewith a fully specified name;
  • provide the argument--topic-encryption-key-keyring on the commandline.
--topic-encryption-key-location=TOPIC_ENCRYPTION_KEY_LOCATION
The Google Cloud location for the key.

To set thekms-location attribute:

  • provide the argument--topic-encryption-key on the command linewith a fully specified name;
  • provide the argument--topic-encryption-key-location on the commandline.
--topic-encryption-key-project=TOPIC_ENCRYPTION_KEY_PROJECT
The Google Cloud project for the key.

To set thekms-project attribute:

  • provide the argument--topic-encryption-key on the command linewith a fully specified name;
  • provide the argument--topic-encryption-key-project on the commandline;
  • set the propertycore/project.
GCLOUD WIDE FLAGS
These flags are available to all commands:--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.

Run$gcloud help for details.

NOTES
This command is currently in beta and might change without notice. Thesevariants are also available:
gcloudpubsubtopicsupdate
gcloudalphapubsubtopicsupdate

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-05-07 UTC.