Table of Contents

Class AssetMonitor

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

This class allows for getting and monitor changes to assets and asset endpoint profiles.

public class AssetMonitor : IAssetMonitor
Inheritance
AssetMonitor
Implements
Inherited Members

Remarks

This class is only applicable for connector applications that have been deployed by the Akri operator.

Constructors

AssetMonitor()

public AssetMonitor()

Methods

GetAssetAsync(string, CancellationToken)

Get the asset with the provided Id.

public Task<Asset?> GetAssetAsync(string assetName, CancellationToken cancellationToken = default)

Parameters

assetName string

The Id of the asset to retrieve.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<Asset>

The requested asset.

GetAssetEndpointProfileAsync(CancellationToken)

Get the asset endpoint profile of the asset with the provided Id.

public Task<AssetEndpointProfile?> GetAssetEndpointProfileAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

Task<AssetEndpointProfile>

The requested asset endpoint profile. This value may be null if no asset endpoint profile is configured yet.

GetAssetNamesAsync(CancellationToken)

Returns the complete list of assets deployed by the operator to this pod.

public Task<List<string>> GetAssetNamesAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

Task<List<string>>

The complete list of assets deployed by the operator to this pod.

ObserveAssetEndpointProfile(TimeSpan?, CancellationToken)

Start receiving notifications on AssetEndpointProfileChanged when the asset endpoint profile changes for the asset with the provided Id.

public void ObserveAssetEndpointProfile(TimeSpan? pollingInterval = null, CancellationToken cancellationToken = default)

Parameters

pollingInterval TimeSpan?

How frequently to check for changes to the asset endpoint profile.

cancellationToken CancellationToken

Cancellation token.

ObserveAssets(TimeSpan?, CancellationToken)

Start receiving notifications on AssetChanged when any asset changes.

public void ObserveAssets(TimeSpan? pollingInterval = null, CancellationToken cancellationToken = default)

Parameters

pollingInterval TimeSpan?

How frequently to check for changes to the asset.

cancellationToken CancellationToken

Cancellation token.

UnobserveAssetEndpointProfile(CancellationToken)

Stop receiving notifications on AssetEndpointProfileChanged when the asset endpoint profile changes for the asset with the provided Id.

public void UnobserveAssetEndpointProfile(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancellation token.

UnobserveAssets(CancellationToken)

Stop receiving notifications on AssetChanged when an asset changes.

public void UnobserveAssets(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancellation token.

Events

AssetChanged

The callback that executes when an asset has changed once you start observing an asset with ObserveAssets(TimeSpan?, CancellationToken).

public event EventHandler<AssetChangedEventArgs>? AssetChanged

Event Type

EventHandler<AssetChangedEventArgs>

AssetEndpointProfileChanged

The callback that executes when the asset endpoint profile has changed once you start observing it with ObserveAssetEndpointProfile(TimeSpan?, CancellationToken).

public event EventHandler<AssetEndpointProfileChangedEventArgs>? AssetEndpointProfileChanged

Event Type

EventHandler<AssetEndpointProfileChangedEventArgs>