updateAssetProperty method
Updates an asset property's alias and notification state.
May throw ConflictingOperationException.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
Parameter assetId :
The ID of the asset to be updated. This can be either the actual ID in
UUID format, or else externalId: followed by the external ID,
if it has one. For more information, see Referencing
objects with external IDs in the IoT SiteWise User Guide.
Parameter propertyId :
The ID of the asset property to be updated. This can be either the actual
ID in UUID format, or else externalId: followed by the
external ID, if it has one. For more information, see Referencing
objects with external IDs in the IoT SiteWise User Guide.
Parameter clientToken :
A unique case-sensitive identifier that you can provide to ensure the
idempotency of the request. Don't reuse this client token if a new
idempotent request is required.
Parameter propertyAlias :
The alias that identifies the property, such as an OPC-UA server data
stream path (for example,
/company/windfarm/3/turbine/7/temperature). For more
information, see Mapping
industrial data streams to asset properties in the IoT SiteWise
User Guide.
If you omit this parameter, the alias is removed from the property.
Parameter propertyNotificationState :
The MQTT notification state (enabled or disabled) for this asset property.
When the notification state is enabled, IoT SiteWise publishes property
value updates to a unique MQTT topic. For more information, see Interacting
with other services in the IoT SiteWise User Guide.
If you omit this parameter, the notification state is set to
DISABLED.
Parameter propertyUnit :
The unit of measure (such as Newtons or RPM) of the asset property. If you
don't specify a value for this parameter, the service uses the value of
the assetModelProperty in the asset model.
Implementation
Future<void> updateAssetProperty({
required String assetId,
required String propertyId,
String? clientToken,
String? propertyAlias,
PropertyNotificationState? propertyNotificationState,
String? propertyUnit,
}) async {
final $payload = <String, dynamic>{
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (propertyAlias != null) 'propertyAlias': propertyAlias,
if (propertyNotificationState != null)
'propertyNotificationState': propertyNotificationState.value,
if (propertyUnit != null) 'propertyUnit': propertyUnit,
};
await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri:
'/assets/${Uri.encodeComponent(assetId)}/properties/${Uri.encodeComponent(propertyId)}',
hostPrefix: 'api.',
exceptionFnMap: _exceptionFns,
);
}