Skip to main content

kafka_topics

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

Overview​

Namekafka_topics
TypeResource
Idovh.public_cloud_analytics.kafka_topics

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idstring (uuid)Unique identifier of the topic
namestringName of the Kafka topic
checksumstringHash of the resource used for concurrency control
created_atstring (date-time)Date at which the resource was created (wire: createdAt)
minimum_in_sync_replicasintegerMinimum number of in-sync replicas required before a write is acknowledged (wire: minimumInSyncReplicas)
partitionsintegerNumber of partitions for this topic
replicationintegerReplication factor for this topic
retention_bytesintegerMaximum size in bytes retained per partition. -1 means unlimited. (wire: retentionBytes)
retention_hoursintegerMaximum time in hours that messages are retained. -1 means unlimited. (wire: retentionHours)
updated_atstring (date-time)Date of the last update to the resource (wire: updatedAt)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectservice_id, topic_id, project_idReturns the partitions, replication factor, minimum in-sync replicas and retention settings of the topic. (Beta version)
listselectservice_id, project_idx_pagination_cursor, x_pagination_sizeReturns the topics of the service with their partitions, replication and retention settings. (Beta version)
createinsertservice_id, project_id, nameCreates a topic. By default it has 1 partition, a replication factor of 1 and a retention of 168 hours (7 days). The replication factor must not exceed the number of brokers. (Beta version)
updateupdateservice_id, topic_id, project_idPartially updates the partitions, replication, minimum in-sync replicas or retention of the topic. The number of partitions can only be increased. (Beta version)
deletedeleteservice_id, topic_id, project_idPermanently deletes the topic and its messages. (Beta version)
replaceexecserviceId, topicId, project_id, minimumInSyncReplicas, partitions, replication, retentionBytes, retentionHoursUpdates the partitions, replication, minimum in-sync replicas and retention of the topic. Every field is required. The number of partitions can only be increased. (Beta version)

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"}})
project_idstringThe Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set.
serviceIdstring (uuid)Service ID
service_idstring (uuid)Service ID (wire: serviceId)
topicIdstring (uuid)Topic ID
topic_idstring (uuid)Topic ID (wire: topicId)
x_pagination_cursorstringPagination cursor (wire: X-Pagination-Cursor)
x_pagination_sizeintegerPagination size (wire: X-Pagination-Size)

SELECT examples​

Returns the partitions, replication factor, minimum in-sync replicas and retention settings of the topic. (Beta version)

SELECT
id,
name,
checksum,
created_at,
minimum_in_sync_replicas,
partitions,
replication,
retention_bytes,
retention_hours,
updated_at
FROM ovh.public_cloud_analytics.kafka_topics
WHERE service_id = '{{ service_id }}' -- required
AND topic_id = '{{ topic_id }}' -- required
AND project_id = '{{ project_id }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
;

INSERT examples​

Creates a topic. By default it has 1 partition, a replication factor of 1 and a retention of 168 hours (7 days). The replication factor must not exceed the number of brokers. (Beta version)

INSERT INTO ovh.public_cloud_analytics.kafka_topics (
minimum_in_sync_replicas,
name,
partitions,
replication,
retention_bytes,
retention_hours,
service_id,
project_id
)
SELECT
{{ minimum_in_sync_replicas }},
'{{ name }}' /* required */,
{{ partitions }},
{{ replication }},
{{ retention_bytes }},
{{ retention_hours }},
'{{ service_id }}',
'{{ project_id }}'
RETURNING
id,
name,
checksum,
created_at,
minimum_in_sync_replicas,
partitions,
replication,
retention_bytes,
retention_hours,
updated_at
;

UPDATE examples​

Partially updates the partitions, replication, minimum in-sync replicas or retention of the topic. The number of partitions can only be increased. (Beta version)

UPDATE ovh.public_cloud_analytics.kafka_topics
SET
minimum_in_sync_replicas = {{ minimum_in_sync_replicas }},
partitions = {{ partitions }},
replication = {{ replication }},
retention_bytes = {{ retention_bytes }},
retention_hours = {{ retention_hours }}
WHERE
service_id = '{{ service_id }}' --required
AND topic_id = '{{ topic_id }}' --required
AND project_id = '{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
RETURNING
id,
name,
checksum,
created_at,
minimum_in_sync_replicas,
partitions,
replication,
retention_bytes,
retention_hours,
updated_at;

DELETE examples​

Permanently deletes the topic and its messages. (Beta version)

DELETE FROM ovh.public_cloud_analytics.kafka_topics
WHERE service_id = '{{ service_id }}' --required
AND topic_id = '{{ topic_id }}' --required
AND project_id = '{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;

Lifecycle Methods​

EXEC variables use wire (API) names.

Updates the partitions, replication, minimum in-sync replicas and retention of the topic. Every field is required. The number of partitions can only be increased. (Beta version)

EXEC ovh.public_cloud_analytics.kafka_topics.replace
@serviceId='{{ serviceId }}' --required,
@topicId='{{ topicId }}' --required,
@project_id='{{ project_id }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
@@json=
'{
"minimumInSyncReplicas": {{ minimumInSyncReplicas }},
"partitions": {{ partitions }},
"replication": {{ replication }},
"retentionBytes": {{ retentionBytes }},
"retentionHours": {{ retentionHours }}
}'
;