Skip to main content

versions

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

Overview

Nameversions
TypeResource
Idgoogle.managedkafka.versions

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
idinteger (int32)Required. The schema ID.
referencesarrayOptional. The schema references used by the schema.
schemastringRequired. The schema payload.
schemaTypestringOptional. The schema type of the schema.
subjectstringRequired. The subject of the version.
versioninteger (int32)Required. The version ID

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, schemaRegistriesId, subjectsId, versionsIddeletedGet a versioned schema (schema with subject/version) of a subject.
listselectprojectsId, locationsId, schemaRegistriesId, subjectsIddeletedGet all versions of a subject. The response will be an array of versions of the subject.
createinsertprojectsId, locationsId, schemaRegistriesId, subjectsIdRegister a new version under a given subject with the given schema.
deletedeleteprojectsId, locationsId, schemaRegistriesId, subjectsId, versionsIdpermanentDelete a version of a subject. The response will be the deleted version id.

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
locationsIdstring
projectsIdstring
schemaRegistriesIdstring
subjectsIdstring
versionsIdstring
deletedboolean
permanentboolean

SELECT examples

Get a versioned schema (schema with subject/version) of a subject.

SELECT
id,
references,
schema,
schemaType,
subject,
version
FROM google.managedkafka.versions
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND schemaRegistriesId = '{{ schemaRegistriesId }}' -- required
AND subjectsId = '{{ subjectsId }}' -- required
AND versionsId = '{{ versionsId }}' -- required
AND deleted = '{{ deleted }}';

INSERT examples

Register a new version under a given subject with the given schema.

INSERT INTO google.managedkafka.versions (
data__version,
data__id,
data__schemaType,
data__schema,
data__references,
data__normalize,
projectsId,
locationsId,
schemaRegistriesId,
subjectsId
)
SELECT
{{ version }},
{{ id }},
'{{ schemaType }}',
'{{ schema }}',
'{{ references }}',
{{ normalize }},
'{{ projectsId }}',
'{{ locationsId }}',
'{{ schemaRegistriesId }}',
'{{ subjectsId }}'
RETURNING
id
;

DELETE examples

Delete a version of a subject. The response will be the deleted version id.

DELETE FROM google.managedkafka.versions
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND schemaRegistriesId = '{{ schemaRegistriesId }}' --required
AND subjectsId = '{{ subjectsId }}' --required
AND versionsId = '{{ versionsId }}' --required
AND permanent = '{{ permanent }}';