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
applicationContextApplicationContextThe shared application context.
mqttClientIMqttPubSubClientThe 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
groupTypestringThe Group type (the xRegistry Group collection name).
groupIdGroupIdThe Group. Use CloudDefault for the cloud-default Group (the configured namespace).
attributesCoreGroupAttributesThe attributes of the Group to create.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupTypestringThe Group type (the xRegistry Group collection name).
groupIdGroupIdThe owning Group. Use CloudDefault for the cloud-default Group (the configured namespace).
resourceTypestringThe Resource type (the xRegistry Resource collection name).
resourceIdstringThe Resource identifier.
metaCoreResourceMetaAttributesThe Resource-level metadata attributes.
resourceExtensionsDictionary<string, byte[]>Resource-level extension attributes, keyed by extension name.
defaultVersionIdCreateVersionIdThe Version id to assign to the Resource's default Version. Use ServerAssigned to let the service choose.
defaultVersionCoreVersionAttributesThe attributes of the Resource's default Version.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupIdGroupIdThe Schema Group. Use CloudDefault for the cloud-default Group (the configured namespace).
schemaIdstringThe Schema (Resource) identifier.
schemaLabelsIReadOnlyList<Label>Labels applied to the parent Schema.
versionSchemaVersionAttributesThe attributes of the Schema Version to create.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupIdGroupIdThe Thing Description Group. Use CloudDefault for the cloud-default Group (the configured namespace).
thingDescriptionIdstringThe Thing Description (Resource) identifier.
thingDescriptionLabelsIReadOnlyList<Label>Labels applied to the parent Thing Description.
versionThingDescriptionVersionAttributesThe attributes of the Thing Description Version to create.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupIdGroupIdThe Thing Model Group. Use CloudDefault for the cloud-default Group (the configured namespace).
thingModelIdstringThe Thing Model (Resource) identifier.
thingModelLabelsIReadOnlyList<Label>Labels applied to the parent Thing Model.
versionThingModelVersionAttributesThe attributes of the Thing Model Version to create.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupTypestringThe Group type (the xRegistry Group collection name).
groupIdGroupIdThe owning Group. Use CloudDefault for the cloud-default Group (the configured namespace).
resourceTypestringThe Resource type (the xRegistry Resource collection name).
resourceIdstringThe owning Resource identifier.
resourceLabelsIReadOnlyList<Label>Labels applied to the parent Resource.
versionIdCreateVersionIdThe Version id to assign. Use ServerAssigned to let the service choose.
versionCoreVersionAttributesThe attributes of the Version to create.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupTypestringThe Group type (the xRegistry Group collection name).
groupIdGroupIdThe Group. Use CloudDefault for the cloud-default Group (the configured namespace).
optionsDeleteOptionsThe DeleteOptions that control the behavior of the delete operation; when null, Default is used.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupTypestringThe Group type (the xRegistry Group collection name).
groupIdGroupIdThe owning Group. Use CloudDefault for the cloud-default Group (the configured namespace).
resourceTypestringThe Resource type (the xRegistry Resource collection name).
resourceIdstringThe Resource identifier.
optionsDeleteOptionsThe DeleteOptions that control the behavior of the delete operation; when null, Default is used.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupIdGroupIdThe Schema Group. Use CloudDefault for the cloud-default Group (the configured namespace).
schemaIdstringThe Schema (Resource) identifier.
versionIdulongThe identifier of the Schema Version to delete.
optionsDeleteOptionsThe DeleteOptions that control the behavior of the delete operation; when null, Default is used.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupIdGroupIdThe Thing Description Group. Use CloudDefault for the cloud-default Group (the configured namespace).
thingDescriptionIdstringThe Thing Description (Resource) identifier.
versionIdulongThe identifier of the Thing Description Version to delete.
optionsDeleteOptionsThe DeleteOptions that control the behavior of the delete operation; when null, Default is used.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupIdGroupIdThe Thing Model Group. Use CloudDefault for the cloud-default Group (the configured namespace).
thingModelIdstringThe Thing Model (Resource) identifier.
versionIdulongThe identifier of the Thing Model Version to delete.
optionsDeleteOptionsThe DeleteOptions that control the behavior of the delete operation; when null, Default is used.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupTypestringThe Group type (the xRegistry Group collection name).
groupIdGroupIdThe owning Group. Use CloudDefault for the cloud-default Group (the configured namespace).
resourceTypestringThe Resource type (the xRegistry Resource collection name).
resourceIdstringThe owning Resource identifier.
versionIdstringThe identifier of the Version to delete.
optionsDeleteOptionsThe DeleteOptions that control the behavior of the delete operation; when null, Default is used.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupTypestringThe Group type (the xRegistry Group collection name).
groupIdGroupIdThe Group. Use CloudDefault for the cloud-default Group (the configured namespace).
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupTypestringThe Group type (the xRegistry Group collection name).
groupIdGroupIdThe owning Group. Use CloudDefault for the cloud-default Group (the configured namespace).
resourceTypestringThe Resource type (the xRegistry Resource collection name).
resourceIdstringThe Resource identifier.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupIdGroupIdThe Schema Group. Use CloudDefault for the cloud-default Group (the configured namespace).
schemaIdstringThe Schema (Resource) identifier.
versionIdGetSchemaVersionIdThe Version to retrieve. Use ResourceDefault for the Schema's default (latest) Version.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupIdGroupIdThe Thing Description Group. Use CloudDefault for the cloud-default Group (the configured namespace).
thingDescriptionIdstringThe Thing Description (Resource) identifier.
versionIdGetThingDescriptionVersionIdThe Version to retrieve. Use ResourceDefault for the Thing Description's default (latest) Version.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupIdGroupIdThe Thing Model Group. Use CloudDefault for the cloud-default Group (the configured namespace).
thingModelIdstringThe Thing Model (Resource) identifier.
versionIdGetThingModelVersionIdThe Version to retrieve. Use ResourceDefault for the Thing Model's default (latest) Version.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupTypestringThe Group type (the xRegistry Group collection name).
groupIdGroupIdThe owning Group. Use CloudDefault for the cloud-default Group (the configured namespace).
resourceTypestringThe Resource type (the xRegistry Resource collection name).
resourceIdstringThe owning Resource identifier.
versionIdGetVersionIdThe Version to retrieve. Use ResourceDefault for the Resource's default (latest) Version.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupTypestringThe Group type (the xRegistry Group collection name).
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupsGroupQueryThe Groups to search; see GroupQuery for the available scopes.
resourceTypestringWhen set, restricts the results to this Resource type.
labelLabelWhen set, restricts the results to entities carrying this label.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupsGroupSelectorThe Groups to search; see GroupSelector for the available scopes.
schemaIdstringWhen set, restricts the results to this Schema.
labelLabelWhen set, restricts the results to entities carrying this label.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupsGroupSelectorThe Groups to search; see GroupSelector for the available scopes.
thingDescriptionIdstringWhen set, restricts the results to this Thing Description.
labelLabelWhen set, restricts the results to entities carrying this label.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupsGroupSelectorThe Groups to search; see GroupSelector for the available scopes.
thingModelIdstringWhen set, restricts the results to this Thing Model.
labelLabelWhen set, restricts the results to entities carrying this label.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
groupsGroupQueryThe Groups to search; see GroupQuery for the available scopes.
resourceTypestringWhen set, restricts the results to this Resource type.
resourceIdstringWhen set, restricts the results to this Resource.
labelLabelWhen set, restricts the results to entities carrying this label.
timeoutTimeSpan?The command timeout; when null, the client's default timeout is used.
cancellationTokenCancellationTokenA 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
cancellationTokenCancellationTokenA token to cancel the operation.
Returns
- Task
A task that completes once the client has stopped.