- NAME
-
- gcloud pubsub topics update - updates an existing Cloud Pub/Sub topic
- SYNOPSIS
-
-
gcloud pubsub topics update
TOPIC
[--update-labels
=[KEY
=VALUE
,…]] [--clear-ingestion-data-source-settings
|--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-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
- Updates an existing Cloud Pub/Sub topic.
- EXAMPLES
-
To update existing labels on a Cloud Pub/Sub topic, run:
gcloud pubsub topics update mytopic --update-labels=KEY1=VAL1,KEY2=VAL2
To clear all labels on a Cloud Pub/Sub topic, run:
gcloud pubsub topics update mytopic --clear-labels
To remove an existing label on a Cloud Pub/Sub topic, run:
gcloud pubsub topics update mytopic --remove-labels=KEY1,KEY2
To enable customer-managed encryption for a Cloud Pub/Sub topic by protecting message data with a Cloud KMS CryptoKey, run:
gcloud pubsub topics update mytopic --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:
gcloud pubsub topics update mytopic --message-retention-duration=MESSAGE_RETENTION_DURATION
To disable retention on a Cloud Pub/Sub topic, run:
gcloud pubsub topics update mytopic --clear-message-retention-duration
To update a Cloud Pub/Sub topic's message storage policy, run:
gcloud pubsub topics update mytopic --message-storage-policy-allowed-regions=some-cloud-region1,some-cloud-region2
To recompute a Cloud Pub/Sub topic's message storage policy based on your organization's "Resource Location Restriction" policy, run:
gcloud pubsub topics update mytopic --recompute-message-storage-policy
To enforce both at-rest and in-transit guarantees for messages published to the topic, run:
gcloud pubsub topics update mytopic --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 in
other ways.
To set the
project
attribute:-
provide the argument
topic
on the command line with a fully specified name; -
provide the argument
--project
on the command line; -
set the property
core/project
.
This must be specified.
TOPIC
-
ID of the topic or fully qualified identifier for the topic.
To set the
topic
attribute:-
provide the argument
topic
on the command line.
-
provide the argument
-
provide the argument
-
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 in
other ways.
- FLAGS
-
--update-labels
=[KEY
=VALUE
,…]-
List of label KEY=VALUE pairs to update. If a label exists, its value is
modified. Otherwise, a new label is created.
Keys must start with a lowercase character and contain only hyphens (
-
), underscores (_
), lowercase characters, and numbers. 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.
-
The following flags are for specifying ingestion settings for an import topic
from Amazon Web Services (AWS) Kinesis Data Streams
--kinesis-ingestion-consumer-arn
=KINESIS_INGESTION_CONSUMER_ARN
-
The 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 group are 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 group are specified.
--kinesis-ingestion-service-account
=KINESIS_INGESTION_SERVICE_ACCOUNT
-
The service account to be used for Federated Identity authentication with
Kinesis.
This flag argument must be specified if any of the other arguments in this group are specified.
--kinesis-ingestion-stream-arn
=KINESIS_INGESTION_STREAM_ARN
-
The Kinesis data stream ARN from which to ingest data.
This flag argument must be specified if any of the other arguments in this group are 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:
gcloud pubsub topics update --clear-labels
To remove all existing labels and create two new labels,
andfoo
:baz
gcloud pubsub topics update --clear-labels --update-labels foo=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 the topic. If this field is set, messages published to the topic in the last MESSAGE_RETENTION_DURATION are always available to subscribers. For instance, it allows any attached subscription to seek to a timestamp that is up to MESSAGE_RETENTION_DURATION in the past. If this field is not set, message retention is controlled by settings on individual subscriptions. The minimum is 10 minutes and the maximum is 31 days. Valid values are strings of the form INTEGER[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-schema-settings
- If set, clear the Schema Settings from the topic. Use --no-clear-schema-settings to disable this flag.
-
Schema settings. The schema that messages published to this topic must conform
to and the expected message encoding.
--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 group are 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 must
conform to. The arguments in this group can be used to specify the attributes of
this resource.
This must be specified.
--schema
=SCHEMA
-
ID of the schema or fully qualified identifier for the schema.
To set the
schema
attribute:-
provide the argument
--schema
on the command line.
This flag argument must be specified if any of the other arguments in this group are specified.
-
provide the argument
--schema-project
=SCHEMA_PROJECT
-
Project ID of the Google Cloud project for the schema.
To set the
project
attribute:-
provide the argument
--schema
on the command line with a fully specified name; -
provide the argument
--schema-project
on the command line; -
provide the argument
--project
on the command line; -
set the property
core/project
.
-
provide the argument
-
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 the message
storage policy for a topic. 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 at
rest.
This flag argument must be specified if any of the other arguments in this group are specified.
--message-storage-policy-enforce-in-transit
- Whether or not to enforce in-transit guarantees for this topic using the allowed regions. This ensures that publishing, pulling, and push delivery are only handled in allowed Cloud regions.
-
Key resource - The Cloud KMS (Key Management Service) cryptokey that will be
used to protect the topic. The specified Cloud KMS key should have purpose set
to "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 parent
of the topic being updated. The arguments in this group can be used to specify
the attributes of this resource.
--topic-encryption-key
=TOPIC_ENCRYPTION_KEY
-
ID of the key or fully qualified identifier for the key.
To set the
kms-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 group are specified.
-
provide the argument
--topic-encryption-key-keyring
=TOPIC_ENCRYPTION_KEY_KEYRING
-
The KMS keyring of the key.
To set the
kms-keyring
attribute:-
provide the argument
--topic-encryption-key
on the command line with a fully specified name; -
provide the argument
--topic-encryption-key-keyring
on the command line.
-
provide the argument
--topic-encryption-key-location
=TOPIC_ENCRYPTION_KEY_LOCATION
-
The Google Cloud location for the key.
To set the
kms-location
attribute:-
provide the argument
--topic-encryption-key
on the command line with a fully specified name; -
provide the argument
--topic-encryption-key-location
on the command line.
-
provide the argument
--topic-encryption-key-project
=TOPIC_ENCRYPTION_KEY_PROJECT
-
The Google Cloud project for the key.
To set the
kms-project
attribute:-
provide the argument
--topic-encryption-key
on the command line with a fully specified name; -
provide the argument
--topic-encryption-key-project
on the command line; -
set the property
core/project
.
-
provide the argument
- 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
-
These variants are also available:
gcloud alpha pubsub topics update
gcloud beta pubsub topics update
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-06-11 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{
"lastModified": "Last updated 2024-06-11 UTC.",
"confidential": False
}