updateAssetModelCompositeModel method
- required String assetModelCompositeModelId,
- required String assetModelCompositeModelName,
- required String assetModelId,
- String? assetModelCompositeModelDescription,
- String? assetModelCompositeModelExternalId,
- List<
AssetModelProperty> ? assetModelCompositeModelProperties, - String? clientToken,
- String? ifMatch,
- String? ifNoneMatch,
- AssetModelVersionType? matchForVersionType,
Updates a composite model and all of the assets that were created from the model. Each asset created from the model inherits the updated asset model's property and hierarchy definitions. For more information, see Updating assets and models in the IoT SiteWise User Guide.
To replace an existing composite asset model property with a new one with
the same name, do the following:
-
Submit an
UpdateAssetModelCompositeModelrequest with the entire existing property removed. -
Submit a second
UpdateAssetModelCompositeModelrequest that includes the new property. The new asset property will have the samenameas the previous one and IoT SiteWise will generate a new uniqueid.
May throw ConflictingOperationException.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw LimitExceededException.
May throw PreconditionFailedException.
May throw ResourceAlreadyExistsException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
Parameter assetModelCompositeModelId :
The ID of a composite model on this asset model.
Parameter assetModelCompositeModelName :
A unique name for the composite model.
Parameter assetModelId :
The ID of the asset model, in UUID format.
Parameter assetModelCompositeModelDescription :
A description for the composite model.
Parameter assetModelCompositeModelExternalId :
An external ID to assign to the asset model. You can only set the external
ID of the asset model if it wasn't set when it was created, or you're
setting it to the exact same thing as when it was created.
Parameter assetModelCompositeModelProperties :
The property definitions of the composite model. For more information, see
Inline custom composite models in the IoT SiteWise User Guide.
You can specify up to 200 properties per composite model. For more information, see Quotas 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 ifMatch :
The expected current entity tag (ETag) for the asset model’s latest or
active version (specified using matchForVersionType). The
update request is rejected if the tag does not match the latest or active
version's current entity tag. See Optimistic
locking for asset model writes in the IoT SiteWise User Guide.
Parameter ifNoneMatch :
Accepts * to reject the update request if an active version
(specified using matchForVersionType as ACTIVE)
already exists for the asset model.
Parameter matchForVersionType :
Specifies the asset model version type (LATEST or
ACTIVE) used in conjunction with If-Match or
If-None-Match headers to determine the target ETag for the
update operation.
Implementation
Future<UpdateAssetModelCompositeModelResponse>
updateAssetModelCompositeModel({
required String assetModelCompositeModelId,
required String assetModelCompositeModelName,
required String assetModelId,
String? assetModelCompositeModelDescription,
String? assetModelCompositeModelExternalId,
List<AssetModelProperty>? assetModelCompositeModelProperties,
String? clientToken,
String? ifMatch,
String? ifNoneMatch,
AssetModelVersionType? matchForVersionType,
}) async {
final headers = <String, String>{
if (ifMatch != null) 'If-Match': ifMatch.toString(),
if (ifNoneMatch != null) 'If-None-Match': ifNoneMatch.toString(),
if (matchForVersionType != null)
'Match-For-Version-Type': matchForVersionType.value,
};
final $payload = <String, dynamic>{
'assetModelCompositeModelName': assetModelCompositeModelName,
if (assetModelCompositeModelDescription != null)
'assetModelCompositeModelDescription':
assetModelCompositeModelDescription,
if (assetModelCompositeModelExternalId != null)
'assetModelCompositeModelExternalId':
assetModelCompositeModelExternalId,
if (assetModelCompositeModelProperties != null)
'assetModelCompositeModelProperties':
assetModelCompositeModelProperties,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri:
'/asset-models/${Uri.encodeComponent(assetModelId)}/composite-models/${Uri.encodeComponent(assetModelCompositeModelId)}',
headers: headers,
exceptionFnMap: _exceptionFns,
);
return UpdateAssetModelCompositeModelResponse.fromJson(response);
}