Method: projects.topics.patch

Updates an existing topic. Note that certain properties of a topic are not modifiable.

HTTP request

PATCH https://pubsub.googleapis.com/v1/{topic.name}

Path parameters

Parameters
topic.name

string

Required. Name of the topic. Format is projects/{project}/topics/{topic}.

Request body

The request body contains data with the following structure:

JSON representation
{
  "topic": {
    "name": string,
    "labels": {
      string: string,
      ...
    },
    "messageStoragePolicy": {
      "allowedPersistenceRegions": [
        string
      ]
    },
    "kmsKeyName": string,
    "schemaSettings": {
      "schema": string,
      "encoding": enum (Encoding)
    },
    "satisfiesPzs": boolean,
    "messageRetentionDuration": string
  },
  "updateMask": string
}
Fields
topic.labels

map (key: string, value: string)

See Creating and managing labels.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

topic.messageStoragePolicy

object (MessageStoragePolicy)

Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored. If not present, then no constraints are in effect.

topic.kmsKeyName

string

The resource name of the Cloud KMS CryptoKey to be used to protect access to messages published on this topic.

The expected format is projects/*/locations/*/keyRings/*/cryptoKeys/*.

topic.schemaSettings

object (SchemaSettings)

Settings for validating messages published against a schema.

topic.satisfiesPzs

boolean

Reserved for future use. This field is set only in responses from the server; it is ignored if it is set in any requests.

topic.messageRetentionDuration

string (Duration format)

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 messageRetentionDuration are always available to subscribers. For instance, it allows any attached subscription to seek to a timestamp that is up to messageRetentionDuration in the past. If this field is not set, message retention is controlled by settings on individual subscriptions. Cannot be more than 7 days or less than 10 minutes.

A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

updateMask

string (FieldMask format)

Required. Indicates which fields in the provided topic to update. Must be specified and non-empty. Note that if updateMask contains "messageStoragePolicy" but the messageStoragePolicy is not set in the topic provided above, then the updated value is determined by the policy configured at the project or organization level.

This is a comma-separated list of fully qualified names of fields. Example: "user.displayName,photo".

Response body

If successful, the response body contains an instance of Topic.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/pubsub
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.