describeAssetModel method

Future<DescribeAssetModelResponse> describeAssetModel({
  1. required String assetModelId,
  2. String? assetModelVersion,
  3. bool? excludeProperties,
})

Retrieves information about an asset model. This includes details about the asset model's properties, hierarchies, composite models, and any interface relationships if the asset model implements interfaces.

May throw InternalFailureException. May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter assetModelId : The ID of the asset model. 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 assetModelVersion : The version alias that specifies the latest or active version of the asset model. The details are returned in the response. The default value is LATEST. See Asset model versions in the IoT SiteWise User Guide.

Parameter excludeProperties : Whether or not to exclude asset model properties from the response.

Implementation

Future<DescribeAssetModelResponse> describeAssetModel({
  required String assetModelId,
  String? assetModelVersion,
  bool? excludeProperties,
}) async {
  final $query = <String, List<String>>{
    if (assetModelVersion != null) 'assetModelVersion': [assetModelVersion],
    if (excludeProperties != null)
      'excludeProperties': [excludeProperties.toString()],
  };
  final response = await _protocol.sendRaw(
    payload: null,
    method: 'GET',
    requestUri: '/asset-models/${Uri.encodeComponent(assetModelId)}',
    queryParams: $query,
    hostPrefix: 'api.',
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return DescribeAssetModelResponse(
    assetModelArn: ($json['assetModelArn'] as String?) ?? '',
    assetModelCreationDate:
        nonNullableTimeStampFromJson($json['assetModelCreationDate'] ?? 0),
    assetModelDescription: ($json['assetModelDescription'] as String?) ?? '',
    assetModelHierarchies: (($json['assetModelHierarchies'] as List?) ??
            const [])
        .nonNulls
        .map((e) => AssetModelHierarchy.fromJson(e as Map<String, dynamic>))
        .toList(),
    assetModelId: ($json['assetModelId'] as String?) ?? '',
    assetModelLastUpdateDate:
        nonNullableTimeStampFromJson($json['assetModelLastUpdateDate'] ?? 0),
    assetModelName: ($json['assetModelName'] as String?) ?? '',
    assetModelProperties: (($json['assetModelProperties'] as List?) ??
            const [])
        .nonNulls
        .map((e) => AssetModelProperty.fromJson(e as Map<String, dynamic>))
        .toList(),
    assetModelStatus: AssetModelStatus.fromJson(
        ($json['assetModelStatus'] as Map<String, dynamic>?) ??
            const <String, dynamic>{}),
    assetModelCompositeModelSummaries:
        ($json['assetModelCompositeModelSummaries'] as List?)
            ?.nonNulls
            .map((e) => AssetModelCompositeModelSummary.fromJson(
                e as Map<String, dynamic>))
            .toList(),
    assetModelCompositeModels: ($json['assetModelCompositeModels'] as List?)
        ?.nonNulls
        .map((e) =>
            AssetModelCompositeModel.fromJson(e as Map<String, dynamic>))
        .toList(),
    assetModelExternalId: $json['assetModelExternalId'] as String?,
    assetModelType:
        ($json['assetModelType'] as String?)?.let(AssetModelType.fromString),
    assetModelVersion: $json['assetModelVersion'] as String?,
    interfaceDetails: ($json['interfaceDetails'] as List?)
        ?.nonNulls
        .map((e) => InterfaceRelationship.fromJson(e as Map<String, dynamic>))
        .toList(),
    eTag: _s.extractHeaderStringValue(response.headers, 'ETag'),
  );
}