# Class Topic (2.39.0)

2.39.0 (latest) 2.38.0 2.35.0 2.34.0 2.33.0 2.32.0 2.31.0 2.30.0 2.29.1 2.28.0 2.27.3 2.26.1 2.25.2 2.23.1 2.22.0 2.21.5 2.20.3 2.19.8 2.18.4 2.17.1 2.16.1 2.15.2 2.14.1 2.13.12 2.12.1 2.11.1 2.10.0 2.9.0 2.8.0 2.7.1 2.6.1 2.5.0 2.4.2 2.3.0 2.2.0 2.1.0 2.0.0 1.7.2 1.6.1 1.5.0 1.4.3 1.3.1 1.2.0 1.1.0 1.0.2 0.45.0 0.44.0 0.43.0

    Topic(mapping=None, *, ignore_unknown_fields=False, **kwargs)

A topic resource.

| ## Attributes ||
|---|---|
| **Name** | **Description** |
| `name :noindex:` | `str` Required. Identifier. The name of the topic. It must have the format `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (\``_``), periods (``.`\`), tildes ( ``` ``` ), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in length, and it must not start with `"goog"`. |
| `labels :noindex:` | `MutableMapping[str, str]` Optional. See \[Creating and managing labels\] (https://cloud.google.com/pubsub/docs/labels). |
| `message_storage_policy :noindex:` | `google.pubsub_v1.types.MessageStoragePolicy` Optional. 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. |
| `kms_key_name :noindex:` | `str` Optional. 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/*`. |
| `schema_settings :noindex:` | `google.pubsub_v1.types.SchemaSettings` Optional. Settings for validating messages published against a schema. |
| `satisfies_pzs :noindex:` | `bool` Optional. Reserved for future use. This field is set only in responses from the server; it is ignored if it is set in any requests. |
| `message_retention_duration :noindex:` | `google.protobuf.duration_pb2.Duration` Optional. 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 |
| `state :noindex:` | `google.pubsub_v1.types.Topic.State` Output only. An output-only field indicating the state of the topic. |
| `ingestion_data_source_settings :noindex:` | `google.pubsub_v1.types.IngestionDataSourceSettings` Optional. Settings for ingestion from a data source into this topic. |
| `message_transforms :noindex:` | `MutableSequence[google.pubsub_v1.types.MessageTransform]` Optional. Transforms to be applied to messages published to the topic. Transforms are applied in the order specified. |
| `tags :noindex:` | `MutableMapping[str, str]` Optional. Input only. Immutable. Tag keys/values directly bound to this resource. For .. rubric:: Example "123/environment": "production", "123/costCenter": "marketing" See https://docs.cloud.google.com/pubsub/docs/tags for more information on using tags with Pub/Sub resources. |

## Classes

### LabelsEntry

    LabelsEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

The abstract base class for a message.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `kwargs` | `dict` Keys and values corresponding to the fields of the message. |
| `mapping` | ``Union[dict, `.Message`]`` A dictionary or message to be used to determine the values for this message. |
| `ignore_unknown_fields` | `Optional(bool)` If True, do not raise errors for unknown fields. Only applied if `mapping` is a mapping type or there are keyword parameters. |

### State

    State(value)

The state of the topic.

### TagsEntry

    TagsEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

The abstract base class for a message.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `kwargs` | `dict` Keys and values corresponding to the fields of the message. |
| `mapping` | ``Union[dict, `.Message`]`` A dictionary or message to be used to determine the values for this message. |
| `ignore_unknown_fields` | `Optional(bool)` If True, do not raise errors for unknown fields. Only applied if `mapping` is a mapping type or there are keyword parameters. |