Skip to main content

kafka_topics

Creates, updates, deletes, gets or lists a kafka_topics resource.

Overview​

Namekafka_topics
TypeResource
Idovh.cloud_database.kafka_topics

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idstring (uuid)Topic ID
namestringName of the topic
min_insync_replicasintegerMinimum insync replica accepted for this topic (wire: minInsyncReplicas)
partitionsintegerNumber of partitions for this topic
replicationintegerNumber of replication for this topic
retention_bytesintegerNumber of bytes for the retention of the data for this topic (wire: retentionBytes)
retention_hoursintegerNumber of hours for the retention of the data for this topic (wire: retentionHours)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectcluster_id, topic_id, service_nameGet kafka topics
listselectcluster_id, service_namex_pagination_modeList topics of the kafka
createinsertcluster_id, service_name, nameCreate a new topic on the kafka cluster
updateupdatecluster_id, topic_id, service_nameUpdates the topic on the kafka cluster
deletedeletecluster_id, topic_id, service_nameDelete 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.

NameDatatypeDescription
api_hoststringThe 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_idstring (uuid)Cluster ID (wire: clusterId)
service_namestringThe Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set.
topic_idstring (uuid)Topic ID (wire: topicId)
x_pagination_modestringSent as CachedObjectList-Pages by default so the list returns the full objects rather than their identifiers. (wire: X-Pagination-Mode)

SELECT examples​

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
;

INSERT examples​

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
;

UPDATE examples​

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 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
;