topics
Creates, updates, deletes, gets or lists a topics
resource.
Overview
Name | topics |
Type | Resource |
Id | google.managedkafka.topics |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Successful response
Name | Datatype | Description |
---|---|---|
name | string | Identifier. The name of the topic. The topic segment is used when connecting directly to the cluster. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic} |
configs | object | Optional. Configurations for the topic that are overridden from the cluster defaults. The key of the map is a Kafka topic property name, for example: cleanup.policy , compression.type . |
partitionCount | integer (int32) | Required. The number of partitions this topic has. The partition count can only be increased, not decreased. Please note that if partitions are increased for a topic that has a key, the partitioning logic or the ordering of the messages will be affected. |
replicationFactor | integer (int32) | Required. Immutable. The number of replicas of each partition. A replication factor of 3 is recommended for high availability. |
Successful response
Name | Datatype | Description |
---|---|---|
name | string | Identifier. The name of the topic. The topic segment is used when connecting directly to the cluster. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic} |
configs | object | Optional. Configurations for the topic that are overridden from the cluster defaults. The key of the map is a Kafka topic property name, for example: cleanup.policy , compression.type . |
partitionCount | integer (int32) | Required. The number of partitions this topic has. The partition count can only be increased, not decreased. Please note that if partitions are increased for a topic that has a key, the partitioning logic or the ordering of the messages will be affected. |
replicationFactor | integer (int32) | Required. Immutable. The number of replicas of each partition. A replication factor of 3 is recommended for high availability. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | projectsId , locationsId , clustersId , topicsId | Returns the properties of a single topic. | |
list | select | projectsId , locationsId , clustersId | pageSize , pageToken | Lists the topics in a given cluster. |
create | insert | projectsId , locationsId , clustersId | topicId | Creates a new topic in a given project and location. |
patch | update | projectsId , locationsId , clustersId , topicsId | updateMask | Updates the properties of a single topic. |
delete | delete | projectsId , locationsId , clustersId , topicsId | Deletes a single topic. |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
clustersId | string | |
locationsId | string | |
projectsId | string | |
topicsId | string | |
pageSize | integer (int32) | |
pageToken | string | |
topicId | string | |
updateMask | string (google-fieldmask) |
SELECT
examples
- get
- list
Returns the properties of a single topic.
SELECT
name,
configs,
partitionCount,
replicationFactor
FROM google.managedkafka.topics
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND clustersId = '{{ clustersId }}' -- required
AND topicsId = '{{ topicsId }}' -- required;
Lists the topics in a given cluster.
SELECT
name,
configs,
partitionCount,
replicationFactor
FROM google.managedkafka.topics
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND clustersId = '{{ clustersId }}' -- required
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}';
INSERT
examples
- create
- Manifest
Creates a new topic in a given project and location.
INSERT INTO google.managedkafka.topics (
data__name,
data__partitionCount,
data__replicationFactor,
data__configs,
projectsId,
locationsId,
clustersId,
topicId
)
SELECT
'{{ name }}',
{{ partitionCount }},
{{ replicationFactor }},
'{{ configs }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ clustersId }}',
'{{ topicId }}'
RETURNING
name,
configs,
partitionCount,
replicationFactor
;
# Description fields are for documentation purposes
- name: topics
props:
- name: projectsId
value: string
description: Required parameter for the topics resource.
- name: locationsId
value: string
description: Required parameter for the topics resource.
- name: clustersId
value: string
description: Required parameter for the topics resource.
- name: name
value: string
description: >
Identifier. The name of the topic. The `topic` segment is used when connecting directly to the cluster. Structured like: projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}
- name: partitionCount
value: integer
description: >
Required. The number of partitions this topic has. The partition count can only be increased, not decreased. Please note that if partitions are increased for a topic that has a key, the partitioning logic or the ordering of the messages will be affected.
- name: replicationFactor
value: integer
description: >
Required. Immutable. The number of replicas of each partition. A replication factor of 3 is recommended for high availability.
- name: configs
value: object
description: >
Optional. Configurations for the topic that are overridden from the cluster defaults. The key of the map is a Kafka topic property name, for example: `cleanup.policy`, `compression.type`.
- name: topicId
value: string
UPDATE
examples
- patch
Updates the properties of a single topic.
UPDATE google.managedkafka.topics
SET
data__name = '{{ name }}',
data__partitionCount = {{ partitionCount }},
data__replicationFactor = {{ replicationFactor }},
data__configs = '{{ configs }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND clustersId = '{{ clustersId }}' --required
AND topicsId = '{{ topicsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
configs,
partitionCount,
replicationFactor;
DELETE
examples
- delete
Deletes a single topic.
DELETE FROM google.managedkafka.topics
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND clustersId = '{{ clustersId }}' --required
AND topicsId = '{{ topicsId }}' --required;