SchemaRegistryClient class
Azure 架构注册表服务的客户端。
构造函数
| Schema |
为 Azure 架构注册表服务创建新的客户端。 |
属性
| fully |
架构注册表服务完全限定的命名空间 URL。 |
方法
| get |
按 ID 获取现有架构。 如果未找到架构,将引发状态代码为 404 的 RestError,可能会捕获如下所示:
|
| get |
按版本获取现有架构。 如果未找到架构,将引发状态代码为 404 的 RestError,可能会捕获如下所示:
|
| get |
获取具有匹配名称、组、类型和定义的现有架构的 ID。 |
| register |
注册新架构并返回其 ID。 如果指定名称的架构在指定组中不存在,则会在版本 1 中创建架构。 如果指定名称的架构已存在于指定组中,则会在最新版本 + 1 中创建架构。 |
构造函数详细信息
SchemaRegistryClient(string, TokenCredential, SchemaRegistryClientOptions)
为 Azure 架构注册表服务创建新的客户端。
new SchemaRegistryClient(fullyQualifiedNamespace: string, credential: TokenCredential, options?: SchemaRegistryClientOptions)
参数
- fullyQualifiedNamespace
-
string
架构注册表服务限定的命名空间 URL,例如 https://mynamespace.servicebus.windows.net。
- credential
- TokenCredential
用于对服务的请求进行身份验证的凭据。
- options
- SchemaRegistryClientOptions
用于配置向服务发出的 API 请求的选项。
属性详细信息
fullyQualifiedNamespace
架构注册表服务完全限定的命名空间 URL。
fullyQualifiedNamespace: string
属性值
string
方法详细信息
getSchema(string, GetSchemaOptions)
按 ID 获取现有架构。 如果未找到架构,将引发状态代码为 404 的 RestError,可能会捕获如下所示:
...
} catch (e) {
if (typeof e === "object" && e.statusCode === 404) {
...;
}
throw e;
}
function getSchema(schemaId: string, options?: GetSchemaOptions): Promise<Schema>
参数
- schemaId
-
string
唯一架构 ID。
- options
- GetSchemaOptions
返回
Promise<Schema>
具有给定 ID 的架构。
getSchema(string, string, number, GetSchemaOptions)
按版本获取现有架构。 如果未找到架构,将引发状态代码为 404 的 RestError,可能会捕获如下所示:
...
} catch (e) {
if (typeof e === "object" && e.statusCode === 404) {
...;
}
throw e;
}
function getSchema(name: string, groupName: string, version: number, options?: GetSchemaOptions): Promise<Schema>
参数
- name
-
string
- groupName
-
string
- version
-
number
- options
- GetSchemaOptions
返回
Promise<Schema>
具有给定 ID 的架构。
注解
如果客户端使用不支持架构格式的较旧 API 版本,架构格式可能会返回内容类型标头中的值。 请使用最新的 API 版本升级到客户端,以便它可以返回正确的架构格式。
getSchemaProperties(SchemaDescription, GetSchemaPropertiesOptions)
获取具有匹配名称、组、类型和定义的现有架构的 ID。
function getSchemaProperties(schema: SchemaDescription, options?: GetSchemaPropertiesOptions): Promise<SchemaProperties>
参数
- schema
- SchemaDescription
要匹配的架构。
- options
- GetSchemaPropertiesOptions
返回
Promise<SchemaProperties>
匹配架构的 ID。
registerSchema(SchemaDescription, RegisterSchemaOptions)
注册新架构并返回其 ID。
如果指定名称的架构在指定组中不存在,则会在版本 1 中创建架构。 如果指定名称的架构已存在于指定组中,则会在最新版本 + 1 中创建架构。
function registerSchema(schema: SchemaDescription, options?: RegisterSchemaOptions): Promise<SchemaProperties>
参数
- schema
- SchemaDescription
要注册的架构。
- options
- RegisterSchemaOptions
返回
Promise<SchemaProperties>
已注册架构的 ID。