updateAsset method
Updates an asset's name. For more information, see Updating assets and models in the IoT SiteWise User Guide.
May throw ConflictingOperationException.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw ResourceAlreadyExistsException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
Parameter assetId :
The ID of the asset to update. 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 assetName :
A friendly name for the asset.
Parameter assetDescription :
A description for the asset.
Parameter assetExternalId :
An external ID to assign to the asset. The asset must not already have an
external ID. The external ID must be unique within your Amazon Web
Services account. For more information, see Using
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.
Implementation
Future<UpdateAssetResponse> updateAsset({
required String assetId,
required String assetName,
String? assetDescription,
String? assetExternalId,
String? clientToken,
}) async {
final $payload = <String, dynamic>{
'assetName': assetName,
if (assetDescription != null) 'assetDescription': assetDescription,
if (assetExternalId != null) 'assetExternalId': assetExternalId,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri: '/assets/${Uri.encodeComponent(assetId)}',
hostPrefix: 'api.',
exceptionFnMap: _exceptionFns,
);
return UpdateAssetResponse.fromJson(response);
}