deleteAssetModelCompositeModel method

Future<DeleteAssetModelCompositeModelResponse> deleteAssetModelCompositeModel({
  1. required String assetModelCompositeModelId,
  2. required String assetModelId,
  3. String? clientToken,
  4. String? ifMatch,
  5. String? ifNoneMatch,
  6. AssetModelVersionType? matchForVersionType,
})

Deletes a composite model. This action can't be undone. You must delete all assets created from a composite model before you can delete the model. Also, you can't delete a composite model if a parent asset model exists that contains a property formula expression that depends on the asset model that you want to delete. For more information, see Deleting assets and models in the IoT SiteWise User Guide.

May throw ConflictingOperationException. May throw InternalFailureException. May throw InvalidRequestException. May throw PreconditionFailedException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter assetModelCompositeModelId : The ID of a composite model on this asset model.

Parameter assetModelId : The ID of the asset model, in UUID format.

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 delete 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 delete 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 delete operation.

Implementation

Future<DeleteAssetModelCompositeModelResponse>
    deleteAssetModelCompositeModel({
  required String assetModelCompositeModelId,
  required String assetModelId,
  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 $query = <String, List<String>>{
    if (clientToken != null) 'clientToken': [clientToken],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'DELETE',
    requestUri:
        '/asset-models/${Uri.encodeComponent(assetModelId)}/composite-models/${Uri.encodeComponent(assetModelCompositeModelId)}',
    queryParams: $query,
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return DeleteAssetModelCompositeModelResponse.fromJson(response);
}