kafka_topics
Creates, updates, deletes, gets or lists a kafka_topics resource.
Overview
| Name | kafka_topics |
| Type | Resource |
| Id | digitalocean.databases.kafka_topics |
Fields
The following fields are returned by SELECT queries:
- databases_get_kafka_topic
- databases_list_kafka_topics
A JSON object with a key of topic.
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the Kafka topic. (example: events) |
config | object | |
partitions | array | |
replication_factor | integer | The number of nodes to replicate data across the cluster. |
state | string | The state of the Kafka topic. (active, configuring, deleting, unknown) (example: active) |
A JSON object with a key of topics.
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the Kafka topic. (example: events) |
partition_count | integer | The number of partitions available for the topic. On update, this value can only be increased. |
replication_factor | integer | The number of nodes to replicate data across the cluster. |
state | string | The state of the Kafka topic. (active, configuring, deleting, unknown) (example: active) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
databases_get_kafka_topic | select | database_cluster_uuid, topic_name | To retrieve a given topic by name from the set of a Kafka cluster's topics, send a GET request to /v2/databases/$DATABASE_ID/topics/$TOPIC_NAME.The result will be a JSON object with a topic key. | |
databases_list_kafka_topics | select | database_cluster_uuid | To list all of a Kafka cluster's topics, send a GET request to/v2/databases/$DATABASE_ID/topics.The result will be a JSON object with a topics key. | |
databases_create_kafka_topic | insert | database_cluster_uuid, name | To create a topic attached to a Kafka cluster, send a POST request to/v2/databases/$DATABASE_ID/topics.The result will be a JSON object with a topic key. | |
databases_update_kafka_topic | replace | database_cluster_uuid, topic_name | To update a topic attached to a Kafka cluster, send a PUT request to/v2/databases/$DATABASE_ID/topics/$TOPIC_NAME.The result will be a JSON object with a topic key. | |
databases_delete_kafka_topic | delete | database_cluster_uuid, topic_name | To delete a single topic within a Kafka cluster, send a DELETE request to /v2/databases/$DATABASE_ID/topics/$TOPIC_NAME.A status of 204 will be given. This indicates that the request was processed successfully, but that no response body is needed. |
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 |
|---|---|---|
database_cluster_uuid | string (uuid) | A unique identifier for a database cluster. (example: 9cc10173-e9ea-4176-9dbc-a4cee4c4ff30) |
topic_name | string | The name used to identify the Kafka topic. (example: customer-events) |
SELECT examples
- databases_get_kafka_topic
- databases_list_kafka_topics
To retrieve a given topic by name from the set of a Kafka cluster's topics,
send a GET request to /v2/databases/$DATABASE_ID/topics/$TOPIC_NAME.
The result will be a JSON object with a topic key.
SELECT
name,
config,
partitions,
replication_factor,
state
FROM digitalocean.databases.kafka_topics
WHERE database_cluster_uuid = '{{ database_cluster_uuid }}' -- required
AND topic_name = '{{ topic_name }}' -- required
;
To list all of a Kafka cluster's topics, send a GET request to/v2/databases/$DATABASE_ID/topics.
The result will be a JSON object with a topics key.
SELECT
name,
partition_count,
replication_factor,
state
FROM digitalocean.databases.kafka_topics
WHERE database_cluster_uuid = '{{ database_cluster_uuid }}' -- required
;
INSERT examples
- databases_create_kafka_topic
- Manifest
To create a topic attached to a Kafka cluster, send a POST request to/v2/databases/$DATABASE_ID/topics.
The result will be a JSON object with a topic key.
INSERT INTO digitalocean.databases.kafka_topics (
name,
replication_factor,
partition_count,
config,
database_cluster_uuid
)
SELECT
'{{ name }}' /* required */,
{{ replication_factor }},
{{ partition_count }},
'{{ config }}',
'{{ database_cluster_uuid }}'
RETURNING
topic
;
# Description fields are for documentation purposes
- name: kafka_topics
props:
- name: database_cluster_uuid
value: "{{ database_cluster_uuid }}"
description: Required parameter for the kafka_topics resource.
- name: name
value: "{{ name }}"
description: |
The name of the Kafka topic.
- name: replication_factor
value: {{ replication_factor }}
description: |
The number of nodes to replicate data across the cluster.
- name: partition_count
value: {{ partition_count }}
description: |
The number of partitions available for the topic. On update, this value can only be increased.
- name: config
value:
cleanup_policy: "{{ cleanup_policy }}"
compression_type: "{{ compression_type }}"
delete_retention_ms: {{ delete_retention_ms }}
file_delete_delay_ms: {{ file_delete_delay_ms }}
flush_messages: {{ flush_messages }}
flush_ms: {{ flush_ms }}
index_interval_bytes: {{ index_interval_bytes }}
max_compaction_lag_ms: {{ max_compaction_lag_ms }}
max_message_bytes: {{ max_message_bytes }}
message_down_conversion_enable: {{ message_down_conversion_enable }}
message_format_version: "{{ message_format_version }}"
message_timestamp_type: "{{ message_timestamp_type }}"
min_cleanable_dirty_ratio: {{ min_cleanable_dirty_ratio }}
min_compaction_lag_ms: {{ min_compaction_lag_ms }}
min_insync_replicas: {{ min_insync_replicas }}
preallocate: {{ preallocate }}
retention_bytes: {{ retention_bytes }}
retention_ms: {{ retention_ms }}
segment_bytes: {{ segment_bytes }}
segment_jitter_ms: {{ segment_jitter_ms }}
segment_ms: {{ segment_ms }}
REPLACE examples
- databases_update_kafka_topic
To update a topic attached to a Kafka cluster, send a PUT request to/v2/databases/$DATABASE_ID/topics/$TOPIC_NAME.
The result will be a JSON object with a topic key.
REPLACE digitalocean.databases.kafka_topics
SET
replication_factor = {{ replication_factor }},
partition_count = {{ partition_count }},
config = '{{ config }}'
WHERE
database_cluster_uuid = '{{ database_cluster_uuid }}' --required
AND topic_name = '{{ topic_name }}' --required
RETURNING
topic;
DELETE examples
- databases_delete_kafka_topic
To delete a single topic within a Kafka cluster, send a DELETE request
to /v2/databases/$DATABASE_ID/topics/$TOPIC_NAME.
A status of 204 will be given. This indicates that the request was
processed successfully, but that no response body is needed.
DELETE FROM digitalocean.databases.kafka_topics
WHERE database_cluster_uuid = '{{ database_cluster_uuid }}' --required
AND topic_name = '{{ topic_name }}' --required
;