Interface IMetadataContainer
This interface provides methods to read, update and delete metadata of an entity that implements the interface.
Namespace: Unity.Cloud.Storage
Syntax
public interface IMetadataContainer
Properties
Metadata
Gets the metadata of the entity.
Declaration
IReadOnlyDictionary<string, object> Metadata { get; }
Property Value
Type | Description |
---|---|
IReadOnlyDictionary<String, Object> |
Methods
AddOrUpdateMetadataAsync(String, String, CancellationToken)
Asynchronously updates a metadata record with a given key in the entity if the key already exists. Otherwise, creates a metadata record with a given key.
Declaration
Task AddOrUpdateMetadataAsync(string key, string value, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
String | key | The key of the metadata record to add or update. |
String | value | The value to add or update the metadata record with. |
CancellationToken | cancellationToken | An optional cancellation token. |
Returns
Type | Description |
---|---|
Task | Task without a result. |
Exceptions
Type | Condition |
---|---|
HttpRequestException | Thrown when the request fails to complete. See the returned StatusCode for more details. |
UnauthorizedException | |
ConnectionException | |
ForbiddenException |
DeleteMetadataAsync(String, CancellationToken)
Asynchronously deletes a metadata record with a given key from the entity.
Declaration
Task DeleteMetadataAsync(string key, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
String | key | The key of the metadata record to delete. |
CancellationToken | cancellationToken | An optional cancellation token. |
Returns
Type | Description |
---|---|
Task | Task without a result. |
Exceptions
Type | Condition |
---|---|
HttpRequestException | Thrown when the request fails to complete. See the returned StatusCode for more details. |
UnauthorizedException | |
ConnectionException | |
ForbiddenException |
Events
MetadataChanged
Calls the methods in its invocation list when metadata of the entity is changed.
Declaration
event Action MetadataChanged
Event Type
Type | Description |
---|---|
Action |