kafka_topics
Creates, updates, deletes, gets or lists a kafka_topics resource.
Overview​
| Name | kafka_topics |
| Type | Resource |
| Id | ovh.cloud_database.kafka_topics |
Fields​
The following fields are returned by SELECT queries:
- get
- list
successful operation
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | Topic ID |
name | string | Name of the topic |
min_insync_replicas | integer | Minimum insync replica accepted for this topic (wire: minInsyncReplicas) |
partitions | integer | Number of partitions for this topic |
replication | integer | Number of replication for this topic |
retention_bytes | integer | Number of bytes for the retention of the data for this topic (wire: retentionBytes) |
retention_hours | integer | Number of hours for the retention of the data for this topic (wire: retentionHours) |
Cloud database kafka topic definition
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | Topic ID |
name | string | Name of the topic |
min_insync_replicas | integer | Minimum insync replica accepted for this topic (wire: minInsyncReplicas) |
partitions | integer | Number of partitions for this topic |
replication | integer | Number of replication for this topic |
retention_bytes | integer | Number of bytes for the retention of the data for this topic (wire: retentionBytes) |
retention_hours | integer | Number of hours for the retention of the data for this topic (wire: retentionHours) |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | cluster_id, topic_id, service_name | Get kafka topics | |
list | select | cluster_id, service_name | x_pagination_mode | List topics of the kafka |
create | insert | cluster_id, service_name, name | Create a new topic on the kafka cluster | |
update | update | cluster_id, topic_id, service_name | Updates the topic on the kafka cluster | |
delete | delete | cluster_id, topic_id, service_name | Delete a kafka 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 |
|---|---|---|
api_host | string | The OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}}) |
cluster_id | string (uuid) | Cluster ID (wire: clusterId) |
service_name | string | The Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set. |
topic_id | string (uuid) | Topic ID (wire: topicId) |
x_pagination_mode | string | Sent as CachedObjectList-Pages by default so the list returns the full objects rather than their identifiers. (wire: X-Pagination-Mode) |
SELECT examples​
- get
- list
Get kafka topics
SELECT
id,
name,
min_insync_replicas,
partitions,
replication,
retention_bytes,
retention_hours
FROM ovh.cloud_database.kafka_topics
WHERE cluster_id = '{{ cluster_id }}' -- required
AND topic_id = '{{ topic_id }}' -- required
AND service_name = '{{ service_name }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
;
List topics of the kafka
SELECT
id,
name,
min_insync_replicas,
partitions,
replication,
retention_bytes,
retention_hours
FROM ovh.cloud_database.kafka_topics
WHERE cluster_id = '{{ cluster_id }}' -- required
AND service_name = '{{ service_name }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
AND x_pagination_mode = '{{ x_pagination_mode }}'
;
INSERT examples​
- create
- Manifest
Create a new topic on the kafka cluster
INSERT INTO ovh.cloud_database.kafka_topics (
min_insync_replicas,
name,
partitions,
replication,
retention_bytes,
retention_hours,
cluster_id,
service_name
)
SELECT
{{ min_insync_replicas }},
'{{ name }}' /* required */,
{{ partitions }},
{{ replication }},
{{ retention_bytes }},
{{ retention_hours }},
'{{ cluster_id }}',
'{{ service_name }}'
RETURNING
id,
name,
min_insync_replicas,
partitions,
replication,
retention_bytes,
retention_hours
;
# Description fields are for documentation purposes
- name: kafka_topics
props:
- name: cluster_id
value: "{{ cluster_id }}"
description: Required parameter for the kafka_topics resource.
- name: service_name
value: "{{ service_name }}"
description: Required parameter for the kafka_topics resource.
- name: min_insync_replicas
value: {{ min_insync_replicas }}
description: |
Minimum insync replica accepted for this topic
- name: name
value: "{{ name }}"
description: |
Name of the topic
- name: partitions
value: {{ partitions }}
description: |
Number of partitions for this topic
- name: replication
value: {{ replication }}
description: |
Number of replication for this topic
- name: retention_bytes
value: {{ retention_bytes }}
description: |
Number of bytes for the retention of the data for this topic
- name: retention_hours
value: {{ retention_hours }}
description: |
Number of hours for the retention of the data for this topic
UPDATE examples​
- update
Updates the topic on the kafka cluster
UPDATE ovh.cloud_database.kafka_topics
SET
min_insync_replicas = {{ min_insync_replicas }},
partitions = {{ partitions }},
replication = {{ replication }},
retention_bytes = {{ retention_bytes }},
retention_hours = {{ retention_hours }}
WHERE
cluster_id = '{{ cluster_id }}' --required
AND topic_id = '{{ topic_id }}' --required
AND service_name = '{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
RETURNING
id,
name,
min_insync_replicas,
partitions,
replication,
retention_bytes,
retention_hours;
DELETE examples​
- delete
Delete a kafka topic
DELETE FROM ovh.cloud_database.kafka_topics
WHERE cluster_id = '{{ cluster_id }}' --required
AND topic_id = '{{ topic_id }}' --required
AND service_name = '{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;