kafka_schemas
Creates, updates, deletes, gets or lists a kafka_schemas
resource.
Overview
Name | kafka_schemas |
Type | Resource |
Id | digitalocean.databases.kafka_schemas |
Fields
The following fields are returned by SELECT
queries:
- databases_get_kafka_schema
- databases_list_kafka_schemas
A JSON object.
Name | Datatype | Description |
---|---|---|
schema_id | integer | The id for schema. |
subject_name | string | The name of the schema subject. (example: customer-schema) |
schema | string | The schema definition in the specified format. (example: { "type": "record", "name": "Customer", "fields": [ {"name": "id", "type": "int"}, {"name": "name", "type": "string"} ] } ) |
schema_type | string | The type of the schema. (example: AVRO) |
version | string | The version of the schema. (example: 1) |
A JSON object with a key of subjects
.
Name | Datatype | Description |
---|---|---|
schema_id | integer | The id for schema. |
subject_name | string | The name of the schema subject. (example: customer-schema) |
schema | string | The schema definition in the specified format. (example: { "type": "record", "name": "Customer", "fields": [ {"name": "id", "type": "int"}, {"name": "name", "type": "string"} ] } ) |
schema_type | string | The type of the schema. (example: AVRO) |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
databases_get_kafka_schema | select | database_cluster_uuid , subject_name | To get a specific schema by subject name for a Kafka cluster, send a GET request to/v2/databases/$DATABASE_ID/schema-registry/$SUBJECT_NAME . | |
databases_list_kafka_schemas | select | database_cluster_uuid | To list all schemas for a Kafka cluster, send a GET request to/v2/databases/$DATABASE_ID/schema-registry . | |
databases_create_kafka_schema | insert | database_cluster_uuid , data__subject_name , data__schema_type , data__schema | To create a Kafka schema for a database cluster, send a POST request to/v2/databases/$DATABASE_ID/schema-registry . | |
databases_delete_kafka_schema | delete | database_cluster_uuid , subject_name | To delete a specific schema by subject name for a Kafka cluster, send a DELETE request to/v2/databases/$DATABASE_ID/schema-registry/$SUBJECT_NAME . |
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) |
subject_name | string | The name of the Kafka schema subject. (example: customer-schema) |
SELECT
examples
- databases_get_kafka_schema
- databases_list_kafka_schemas
To get a specific schema by subject name for a Kafka cluster, send a GET request to/v2/databases/$DATABASE_ID/schema-registry/$SUBJECT_NAME
.
SELECT
schema_id,
subject_name,
schema,
schema_type,
version
FROM digitalocean.databases.kafka_schemas
WHERE database_cluster_uuid = '{{ database_cluster_uuid }}' -- required
AND subject_name = '{{ subject_name }}' -- required;
To list all schemas for a Kafka cluster, send a GET request to/v2/databases/$DATABASE_ID/schema-registry
.
SELECT
schema_id,
subject_name,
schema,
schema_type
FROM digitalocean.databases.kafka_schemas
WHERE database_cluster_uuid = '{{ database_cluster_uuid }}' -- required;
INSERT
examples
- databases_create_kafka_schema
- Manifest
To create a Kafka schema for a database cluster, send a POST request to/v2/databases/$DATABASE_ID/schema-registry
.
INSERT INTO digitalocean.databases.kafka_schemas (
data__subject_name,
data__schema_type,
data__schema,
database_cluster_uuid
)
SELECT
'{{ subject_name }}' --required,
'{{ schema_type }}' --required,
'{{ schema }}' --required,
'{{ database_cluster_uuid }}'
RETURNING
schema_id,
subject_name,
schema,
schema_type
;
# Description fields are for documentation purposes
- name: kafka_schemas
props:
- name: database_cluster_uuid
value: string (uuid)
description: Required parameter for the kafka_schemas resource.
- name: subject_name
value: string
description: >
The name of the schema subject.
- name: schema_type
value: string
description: >
The type of the schema.
valid_values: ['AVRO', 'JSON', 'PROTOBUF']
- name: schema
value: string
description: >
The schema definition in the specified format.
DELETE
examples
- databases_delete_kafka_schema
To delete a specific schema by subject name for a Kafka cluster, send a DELETE request to/v2/databases/$DATABASE_ID/schema-registry/$SUBJECT_NAME
.
DELETE FROM digitalocean.databases.kafka_schemas
WHERE database_cluster_uuid = '{{ database_cluster_uuid }}' --required
AND subject_name = '{{ subject_name }}' --required;