SchemaRegistryClient class
Client for Azure Schema Registry service.
Constructors
Schema |
Creates a new client for Azure Schema Registry service. |
Properties
fully |
The Schema Registry service fully qualified namespace URL. |
Methods
get |
Gets an existing schema by ID. If the schema was not found, a RestError with status code 404 will be thrown, which could be caught as follows:
|
get |
Gets an existing schema by version. If the schema was not found, a RestError with status code 404 will be thrown, which could be caught as follows:
|
get |
Gets the ID of an existing schema with matching name, group, type, and definition. |
register |
Registers a new schema and returns its ID. If schema of specified name does not exist in the specified group, a schema is created at version 1. If schema of specified name exists already in specified group, schema is created at latest version + 1. |
Constructor Details
SchemaRegistryClient(string, TokenCredential, SchemaRegistryClientOptions)
Creates a new client for Azure Schema Registry service.
new SchemaRegistryClient(fullyQualifiedNamespace: string, credential: TokenCredential, options?: SchemaRegistryClientOptions)
Parameters
- fullyQualifiedNamespace
-
string
The Schema Registry service qualified namespace URL, for example https://mynamespace.servicebus.windows.net.
- credential
- TokenCredential
Credential to authenticate requests to the service.
- options
- SchemaRegistryClientOptions
Options to configure API requests to the service.
Property Details
fullyQualifiedNamespace
The Schema Registry service fully qualified namespace URL.
fullyQualifiedNamespace: string
Property Value
string
Method Details
getSchema(string, GetSchemaOptions)
Gets an existing schema by ID. If the schema was not found, a RestError with status code 404 will be thrown, which could be caught as follows:
...
} catch (e) {
if (typeof e === "object" && e.statusCode === 404) {
...;
}
throw e;
}
function getSchema(schemaId: string, options?: GetSchemaOptions): Promise<Schema>
Parameters
- schemaId
-
string
Unique schema ID.
- options
- GetSchemaOptions
Returns
Promise<Schema>
Schema with given ID.
getSchema(string, string, number, GetSchemaOptions)
Gets an existing schema by version. If the schema was not found, a RestError with status code 404 will be thrown, which could be caught as follows:
...
} catch (e) {
if (typeof e === "object" && e.statusCode === 404) {
...;
}
throw e;
}
function getSchema(name: string, groupName: string, version: number, options?: GetSchemaOptions): Promise<Schema>
Parameters
- name
-
string
- groupName
-
string
- version
-
number
- options
- GetSchemaOptions
Returns
Promise<Schema>
Schema with given ID.
Remarks
If the client uses an older API version that does not support the format of the schema, the schema format may return the value in the content type header. Please upgrade to the client using the latest API version so that it can return the correct schema format.
getSchemaProperties(SchemaDescription, GetSchemaPropertiesOptions)
Gets the ID of an existing schema with matching name, group, type, and definition.
function getSchemaProperties(schema: SchemaDescription, options?: GetSchemaPropertiesOptions): Promise<SchemaProperties>
Parameters
- schema
- SchemaDescription
Schema to match.
- options
- GetSchemaPropertiesOptions
Returns
Promise<SchemaProperties>
Matched schema's ID.
registerSchema(SchemaDescription, RegisterSchemaOptions)
Registers a new schema and returns its ID.
If schema of specified name does not exist in the specified group, a schema is created at version 1. If schema of specified name exists already in specified group, schema is created at latest version + 1.
function registerSchema(schema: SchemaDescription, options?: RegisterSchemaOptions): Promise<SchemaProperties>
Parameters
- schema
- SchemaDescription
Schema to register.
- options
- RegisterSchemaOptions
Returns
Promise<SchemaProperties>
Registered schema's ID.