Table of Contents

Class EdgeRegistryClient

Namespace
Azure.Iot.Operations.Services.EdgeRegistry
Assembly
Azure.Iot.Operations.Services.dll

EdgeRegistryClient implementation of the core xRegistry surface (ICoreClient): Group, Resource, and Version APIs.

public sealed class EdgeRegistryClient : IEdgeRegistryClient, ICoreClient, IAsyncDisposable, ISchemaRegistryClient, IThingDescriptionClient, IThingModelClient
Inheritance
EdgeRegistryClient
Implements
Inherited Members

Remarks

The implementation is split across partial files, one per interface surface, so that new extensions follow a consistent pattern. This file holds the shared composition: the stub fields, constructor, topic-token helpers, and disposal. EdgeRegistryClient.Core.cs implements ICoreClient; EdgeRegistryClient.Schema.cs, EdgeRegistryClient.ThingDescription.cs, and EdgeRegistryClient.ThingModel.cs implement the extension surfaces. To add an extension, add a new EdgeRegistryClient.<Name>.cs partial plus its stub field, constructor wiring, and disposal here.

Constructors

EdgeRegistryClient(ApplicationContext, IMqttPubSubClient)

Initializes a new instance of the EdgeRegistryClient class.

public EdgeRegistryClient(ApplicationContext applicationContext, IMqttPubSubClient mqttClient)

Parameters

applicationContext ApplicationContext

The shared application context.

mqttClient IMqttPubSubClient

The MQTT client used for RPC.

Methods

CreateGroupAsync(string, GroupId, CoreGroupAttributes, TimeSpan?, CancellationToken)

Creates a Group.

public Task<CoreGroupEntity> CreateGroupAsync(string groupType, GroupId groupId, CoreGroupAttributes attributes, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupType string

The Group type (the xRegistry Group collection name).

groupId GroupId

The Group. Use CloudDefault for the cloud-default Group (the configured namespace).

attributes CoreGroupAttributes

The attributes of the Group to create.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<CoreGroupEntity>

A task whose result is the created CoreGroupEntity.

CreateResourceAsync(string, GroupId, string, string, CoreResourceMetaAttributes, Dictionary<string, byte[]>, CreateVersionId, CoreVersionAttributes, TimeSpan?, CancellationToken)

Creates a Resource together with its default Version.

public Task<CoreResourceEntity> CreateResourceAsync(string groupType, GroupId groupId, string resourceType, string resourceId, CoreResourceMetaAttributes meta, Dictionary<string, byte[]> resourceExtensions, CreateVersionId defaultVersionId, CoreVersionAttributes defaultVersion, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupType string

The Group type (the xRegistry Group collection name).

groupId GroupId

The owning Group. Use CloudDefault for the cloud-default Group (the configured namespace).

resourceType string

The Resource type (the xRegistry Resource collection name).

resourceId string

The Resource identifier.

meta CoreResourceMetaAttributes

The Resource-level metadata attributes.

resourceExtensions Dictionary<string, byte[]>

Resource-level extension attributes, keyed by extension name.

defaultVersionId CreateVersionId

The Version id to assign to the Resource's default Version. Use ServerAssigned to let the service choose.

defaultVersion CoreVersionAttributes

The attributes of the Resource's default Version.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<CoreResourceEntity>

A task whose result is the created CoreResourceEntity.

CreateSchemaVersionAsync(GroupId, string, IReadOnlyList<Label>, SchemaVersionAttributes, TimeSpan?, CancellationToken)

Creates a Schema Version under the given Schema, implicitly creating the parent Schema if needed.

public Task<SchemaVersion> CreateSchemaVersionAsync(GroupId groupId, string schemaId, IReadOnlyList<Label> schemaLabels, SchemaVersionAttributes version, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupId GroupId

The Schema Group. Use CloudDefault for the cloud-default Group (the configured namespace).

schemaId string

The Schema (Resource) identifier.

schemaLabels IReadOnlyList<Label>

Labels applied to the parent Schema.

version SchemaVersionAttributes

The attributes of the Schema Version to create.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<SchemaVersion>

A task whose result is the created SchemaVersion.

CreateThingDescriptionVersionAsync(GroupId, string, IReadOnlyList<Label>, ThingDescriptionVersionAttributes, TimeSpan?, CancellationToken)

Creates a Thing Description Version under the given Thing Description, implicitly creating the parent Thing Description if needed.

public Task<ThingDescriptionVersion> CreateThingDescriptionVersionAsync(GroupId groupId, string thingDescriptionId, IReadOnlyList<Label> thingDescriptionLabels, ThingDescriptionVersionAttributes version, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupId GroupId

The Thing Description Group. Use CloudDefault for the cloud-default Group (the configured namespace).

thingDescriptionId string

The Thing Description (Resource) identifier.

thingDescriptionLabels IReadOnlyList<Label>

Labels applied to the parent Thing Description.

version ThingDescriptionVersionAttributes

The attributes of the Thing Description Version to create.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<ThingDescriptionVersion>

A task whose result is the created ThingDescriptionVersion.

CreateThingModelVersionAsync(GroupId, string, IReadOnlyList<Label>, ThingModelVersionAttributes, TimeSpan?, CancellationToken)

Creates a Thing Model Version under the given Thing Model, implicitly creating the parent Thing Model if needed.

public Task<ThingModelVersion> CreateThingModelVersionAsync(GroupId groupId, string thingModelId, IReadOnlyList<Label> thingModelLabels, ThingModelVersionAttributes version, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupId GroupId

The Thing Model Group. Use CloudDefault for the cloud-default Group (the configured namespace).

thingModelId string

The Thing Model (Resource) identifier.

thingModelLabels IReadOnlyList<Label>

Labels applied to the parent Thing Model.

version ThingModelVersionAttributes

The attributes of the Thing Model Version to create.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<ThingModelVersion>

A task whose result is the created ThingModelVersion.

CreateVersionAsync(string, GroupId, string, string, IReadOnlyList<Label>, CreateVersionId, CoreVersionAttributes, TimeSpan?, CancellationToken)

Creates a Version under a Resource, implicitly creating the parent Resource if needed. Idempotent per the create-or-match-latest contract.

public Task<CoreVersionEntity> CreateVersionAsync(string groupType, GroupId groupId, string resourceType, string resourceId, IReadOnlyList<Label> resourceLabels, CreateVersionId versionId, CoreVersionAttributes version, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupType string

The Group type (the xRegistry Group collection name).

groupId GroupId

The owning Group. Use CloudDefault for the cloud-default Group (the configured namespace).

resourceType string

The Resource type (the xRegistry Resource collection name).

resourceId string

The owning Resource identifier.

resourceLabels IReadOnlyList<Label>

Labels applied to the parent Resource.

versionId CreateVersionId

The Version id to assign. Use ServerAssigned to let the service choose.

version CoreVersionAttributes

The attributes of the Version to create.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<CoreVersionEntity>

A task whose result is the created CoreVersionEntity.

DeleteGroupAsync(string, GroupId, DeleteOptions?, TimeSpan?, CancellationToken)

Deletes a Group. Deletes cascade to all contained Resources and their Versions.

public Task DeleteGroupAsync(string groupType, GroupId groupId, DeleteOptions? options = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupType string

The Group type (the xRegistry Group collection name).

groupId GroupId

The Group. Use CloudDefault for the cloud-default Group (the configured namespace).

options DeleteOptions

The DeleteOptions that control the behavior of the delete operation; when null, Default is used.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task

A task that completes when the Group has been deleted.

DeleteResourceAsync(string, GroupId, string, string, DeleteOptions?, TimeSpan?, CancellationToken)

Deletes a Resource. Deletes cascade to all of its Versions.

public Task DeleteResourceAsync(string groupType, GroupId groupId, string resourceType, string resourceId, DeleteOptions? options = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupType string

The Group type (the xRegistry Group collection name).

groupId GroupId

The owning Group. Use CloudDefault for the cloud-default Group (the configured namespace).

resourceType string

The Resource type (the xRegistry Resource collection name).

resourceId string

The Resource identifier.

options DeleteOptions

The DeleteOptions that control the behavior of the delete operation; when null, Default is used.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task

A task that completes when the Resource has been deleted.

DeleteSchemaVersionAsync(GroupId, string, ulong, DeleteOptions?, TimeSpan?, CancellationToken)

Deletes a specific Schema Version.

public Task DeleteSchemaVersionAsync(GroupId groupId, string schemaId, ulong versionId, DeleteOptions? options = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupId GroupId

The Schema Group. Use CloudDefault for the cloud-default Group (the configured namespace).

schemaId string

The Schema (Resource) identifier.

versionId ulong

The identifier of the Schema Version to delete.

options DeleteOptions

The DeleteOptions that control the behavior of the delete operation; when null, Default is used.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task

A task that completes when the Schema Version has been deleted.

DeleteThingDescriptionVersionAsync(GroupId, string, ulong, DeleteOptions?, TimeSpan?, CancellationToken)

Deletes a specific Thing Description Version.

public Task DeleteThingDescriptionVersionAsync(GroupId groupId, string thingDescriptionId, ulong versionId, DeleteOptions? options = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupId GroupId

The Thing Description Group. Use CloudDefault for the cloud-default Group (the configured namespace).

thingDescriptionId string

The Thing Description (Resource) identifier.

versionId ulong

The identifier of the Thing Description Version to delete.

options DeleteOptions

The DeleteOptions that control the behavior of the delete operation; when null, Default is used.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task

A task that completes when the Thing Description Version has been deleted.

DeleteThingModelVersionAsync(GroupId, string, ulong, DeleteOptions?, TimeSpan?, CancellationToken)

Deletes a specific Thing Model Version.

public Task DeleteThingModelVersionAsync(GroupId groupId, string thingModelId, ulong versionId, DeleteOptions? options = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupId GroupId

The Thing Model Group. Use CloudDefault for the cloud-default Group (the configured namespace).

thingModelId string

The Thing Model (Resource) identifier.

versionId ulong

The identifier of the Thing Model Version to delete.

options DeleteOptions

The DeleteOptions that control the behavior of the delete operation; when null, Default is used.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task

A task that completes when the Thing Model Version has been deleted.

DeleteVersionAsync(string, GroupId, string, string, string, DeleteOptions?, TimeSpan?, CancellationToken)

Deletes a specific Version of a Resource.

public Task DeleteVersionAsync(string groupType, GroupId groupId, string resourceType, string resourceId, string versionId, DeleteOptions? options = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupType string

The Group type (the xRegistry Group collection name).

groupId GroupId

The owning Group. Use CloudDefault for the cloud-default Group (the configured namespace).

resourceType string

The Resource type (the xRegistry Resource collection name).

resourceId string

The owning Resource identifier.

versionId string

The identifier of the Version to delete.

options DeleteOptions

The DeleteOptions that control the behavior of the delete operation; when null, Default is used.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task

A task that completes when the Version has been deleted.

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

public ValueTask DisposeAsync()

Returns

ValueTask

A task that represents the asynchronous dispose operation.

GetGroupAsync(string, GroupId, TimeSpan?, CancellationToken)

Retrieves a Group.

public Task<CoreGroupEntity> GetGroupAsync(string groupType, GroupId groupId, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupType string

The Group type (the xRegistry Group collection name).

groupId GroupId

The Group. Use CloudDefault for the cloud-default Group (the configured namespace).

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<CoreGroupEntity>

A task whose result is the requested CoreGroupEntity.

GetResourceAsync(string, GroupId, string, string, TimeSpan?, CancellationToken)

Retrieves a Resource.

public Task<CoreResourceEntity> GetResourceAsync(string groupType, GroupId groupId, string resourceType, string resourceId, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupType string

The Group type (the xRegistry Group collection name).

groupId GroupId

The owning Group. Use CloudDefault for the cloud-default Group (the configured namespace).

resourceType string

The Resource type (the xRegistry Resource collection name).

resourceId string

The Resource identifier.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<CoreResourceEntity>

A task whose result is the requested CoreResourceEntity.

GetSchemaVersionAsync(GroupId, string, GetSchemaVersionId, TimeSpan?, CancellationToken)

Retrieves a Schema Version.

public Task<SchemaVersion> GetSchemaVersionAsync(GroupId groupId, string schemaId, GetSchemaVersionId versionId, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupId GroupId

The Schema Group. Use CloudDefault for the cloud-default Group (the configured namespace).

schemaId string

The Schema (Resource) identifier.

versionId GetSchemaVersionId

The Version to retrieve. Use ResourceDefault for the Schema's default (latest) Version.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<SchemaVersion>

A task whose result is the requested SchemaVersion.

GetThingDescriptionVersionAsync(GroupId, string, GetThingDescriptionVersionId, TimeSpan?, CancellationToken)

Retrieves a Thing Description Version.

public Task<ThingDescriptionVersion> GetThingDescriptionVersionAsync(GroupId groupId, string thingDescriptionId, GetThingDescriptionVersionId versionId, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupId GroupId

The Thing Description Group. Use CloudDefault for the cloud-default Group (the configured namespace).

thingDescriptionId string

The Thing Description (Resource) identifier.

versionId GetThingDescriptionVersionId

The Version to retrieve. Use ResourceDefault for the Thing Description's default (latest) Version.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<ThingDescriptionVersion>

A task whose result is the requested ThingDescriptionVersion.

GetThingModelVersionAsync(GroupId, string, GetThingModelVersionId, TimeSpan?, CancellationToken)

Retrieves a Thing Model Version.

public Task<ThingModelVersion> GetThingModelVersionAsync(GroupId groupId, string thingModelId, GetThingModelVersionId versionId, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupId GroupId

The Thing Model Group. Use CloudDefault for the cloud-default Group (the configured namespace).

thingModelId string

The Thing Model (Resource) identifier.

versionId GetThingModelVersionId

The Version to retrieve. Use ResourceDefault for the Thing Model's default (latest) Version.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<ThingModelVersion>

A task whose result is the requested ThingModelVersion.

GetVersionAsync(string, GroupId, string, string, GetVersionId, TimeSpan?, CancellationToken)

Retrieves a Version. Pass ResourceDefault for the Resource's default (latest) Version.

public Task<CoreVersionEntity> GetVersionAsync(string groupType, GroupId groupId, string resourceType, string resourceId, GetVersionId versionId, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupType string

The Group type (the xRegistry Group collection name).

groupId GroupId

The owning Group. Use CloudDefault for the cloud-default Group (the configured namespace).

resourceType string

The Resource type (the xRegistry Resource collection name).

resourceId string

The owning Resource identifier.

versionId GetVersionId

The Version to retrieve. Use ResourceDefault for the Resource's default (latest) Version.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<CoreVersionEntity>

A task whose result is the requested CoreVersionEntity.

ListGroupsAsync(string, TimeSpan?, CancellationToken)

Lists the IDs of all Groups of the given groupType.

public Task<IReadOnlyList<string>> ListGroupsAsync(string groupType, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groupType string

The Group type (the xRegistry Group collection name).

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<IReadOnlyList<string>>

A task whose result is the IDs of all Groups of the given groupType.

ListResourcesAsync(GroupQuery, string?, Label?, TimeSpan?, CancellationToken)

Lists the XIDs of Resources matching the query, optionally filtered by Resource type and/or a single label.

public Task<IReadOnlyList<ResourceXId>> ListResourcesAsync(GroupQuery groups, string? resourceType = null, Label? label = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groups GroupQuery

The Groups to search; see GroupQuery for the available scopes.

resourceType string

When set, restricts the results to this Resource type.

label Label

When set, restricts the results to entities carrying this label.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<IReadOnlyList<ResourceXId>>

A task whose result is the XIDs of the matching Resources.

ListSchemaVersionsAsync(GroupSelector, string?, Label?, TimeSpan?, CancellationToken)

Lists the XIDs of Schema Versions matching the query, optionally filtered by Schema id and/or a single label.

public Task<IReadOnlyList<SchemaVersionXid>> ListSchemaVersionsAsync(GroupSelector groups, string? schemaId = null, Label? label = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groups GroupSelector

The Groups to search; see GroupSelector for the available scopes.

schemaId string

When set, restricts the results to this Schema.

label Label

When set, restricts the results to entities carrying this label.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<IReadOnlyList<SchemaVersionXid>>

A task whose result is the XIDs of the matching Schema Versions.

ListThingDescriptionVersionsAsync(GroupSelector, string?, Label?, TimeSpan?, CancellationToken)

Lists the XIDs of Thing Description Versions matching the query, optionally filtered by Thing Description id and/or a single label.

public Task<IReadOnlyList<ThingDescriptionVersionXid>> ListThingDescriptionVersionsAsync(GroupSelector groups, string? thingDescriptionId = null, Label? label = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groups GroupSelector

The Groups to search; see GroupSelector for the available scopes.

thingDescriptionId string

When set, restricts the results to this Thing Description.

label Label

When set, restricts the results to entities carrying this label.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<IReadOnlyList<ThingDescriptionVersionXid>>

A task whose result is the XIDs of the matching Thing Description Versions.

ListThingModelVersionsAsync(GroupSelector, string?, Label?, TimeSpan?, CancellationToken)

Lists the XIDs of Thing Model Versions matching the query, optionally filtered by Thing Model id and/or a single label.

public Task<IReadOnlyList<ThingModelVersionXid>> ListThingModelVersionsAsync(GroupSelector groups, string? thingModelId = null, Label? label = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groups GroupSelector

The Groups to search; see GroupSelector for the available scopes.

thingModelId string

When set, restricts the results to this Thing Model.

label Label

When set, restricts the results to entities carrying this label.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<IReadOnlyList<ThingModelVersionXid>>

A task whose result is the XIDs of the matching Thing Model Versions.

ListVersionsAsync(GroupQuery, string?, string?, Label?, TimeSpan?, CancellationToken)

Lists the XIDs of Versions matching the query, optionally filtered by Resource type, Resource id, and/or a single label.

public Task<IReadOnlyList<VersionXId>> ListVersionsAsync(GroupQuery groups, string? resourceType = null, string? resourceId = null, Label? label = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Parameters

groups GroupQuery

The Groups to search; see GroupQuery for the available scopes.

resourceType string

When set, restricts the results to this Resource type.

resourceId string

When set, restricts the results to this Resource.

label Label

When set, restricts the results to entities carrying this label.

timeout TimeSpan?

The command timeout; when null, the client's default timeout is used.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<IReadOnlyList<VersionXId>>

A task whose result is the XIDs of the matching Versions.

StopAsync(CancellationToken)

Makes this client unsubscribe from any broker topics it subscribed to, without disposing it.

public Task StopAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task

A task that completes once the client has stopped.