versions
Creates, updates, deletes, gets or lists a versions
resource.
Overview
Name | versions |
Type | Resource |
Id | google.managedkafka.versions |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Successful response
Name | Datatype | Description |
---|---|---|
id | integer (int32) | Required. The schema ID. |
references | array | Optional. The schema references used by the schema. |
schema | string | Required. The schema payload. |
schemaType | string | Optional. The schema type of the schema. |
subject | string | Required. The subject of the version. |
version | integer (int32) | Required. The version ID |
Successful response
Name | Datatype | Description |
---|---|---|
contentType | string | The HTTP Content-Type header value specifying the content type of the body. |
data | string (byte) | The HTTP request/response body as raw binary. |
extensions | array | Application specific response metadata. Must be set in the first response for streaming APIs. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | projectsId , locationsId , schemaRegistriesId , subjectsId , versionsId | deleted | Get a versioned schema (schema with subject/version) of a subject. |
list | select | projectsId , locationsId , schemaRegistriesId , subjectsId | deleted | Get all versions of a subject. The response will be an array of versions of the subject. |
create | insert | projectsId , locationsId , schemaRegistriesId , subjectsId | Register a new version under a given subject with the given schema. | |
delete | delete | projectsId , locationsId , schemaRegistriesId , subjectsId , versionsId | permanent | Delete 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.
Name | Datatype | Description |
---|---|---|
locationsId | string | |
projectsId | string | |
schemaRegistriesId | string | |
subjectsId | string | |
versionsId | string | |
deleted | boolean | |
permanent | boolean |
SELECT
examples
- get
- list
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 }}';
Get all versions of a subject. The response will be an array of versions of the subject.
SELECT
contentType,
data,
extensions
FROM google.managedkafka.versions
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND schemaRegistriesId = '{{ schemaRegistriesId }}' -- required
AND subjectsId = '{{ subjectsId }}' -- required
AND deleted = '{{ deleted }}';
INSERT
examples
- create
- Manifest
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
;
# Description fields are for documentation purposes
- name: versions
props:
- name: projectsId
value: string
description: Required parameter for the versions resource.
- name: locationsId
value: string
description: Required parameter for the versions resource.
- name: schemaRegistriesId
value: string
description: Required parameter for the versions resource.
- name: subjectsId
value: string
description: Required parameter for the versions resource.
- name: version
value: integer
description: >
Optional. The version to create. It is optional. If not specified, the version will be created with the max version ID of the subject increased by 1. If the version ID is specified, it will be used as the new version ID and must not be used by an existing version of the subject.
- name: id
value: integer
description: >
Optional. The schema ID of the schema. If not specified, the schema ID will be generated by the server. If the schema ID is specified, it must not be used by an existing schema that is different from the schema to be created.
- name: schemaType
value: string
description: >
Optional. The type of the schema. It is optional. If not specified, the schema type will be AVRO.
valid_values: ['SCHEMA_TYPE_UNSPECIFIED', 'AVRO', 'JSON', 'PROTOBUF']
- name: schema
value: string
description: >
Required. The schema payload
- name: references
value: array
description: >
Optional. The schema references used by the schema.
- name: normalize
value: boolean
description: >
Optional. If true, the schema will be normalized before being stored. The default is false.
DELETE
examples
- delete
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 }}';