Skip to main content

asset_models

Creates, updates, deletes, gets or lists an asset_models resource.

Overview

Nameasset_models
TypeResource
Idaws.iotsitewise.asset_models

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
asset_model_arnstringThe ARN of the asset model, which has the following format. arn:${Partition}:iotsitewise:${Region}:${Account}:asset-model/${AssetModelId} (pattern: <code>^arn:aws(-cn|-us-gov)?:[a-zA-Z0-9-:/_.]+$</code>)
asset_model_composite_model_summariesarrayThe list of the immediate child custom composite model summaries for the asset model.
asset_model_composite_modelsarrayThe list of built-in composite models for the asset model, such as those with those of type AWS/ALARMS.
asset_model_creation_datestring (date-time)The date the asset model was created, in Unix epoch time.
asset_model_descriptionstringThe asset model's description. (pattern: <code>[^\u0000-\u001F\u007F]+</code>)
asset_model_external_idstringThe external ID of the asset model, if any. (pattern: <code>[a-zA-Z0-9_][a-zA-Z_-0-9.:]*[a-zA-Z0-9_]+</code>)
asset_model_hierarchiesarrayA list of asset model hierarchies that each contain a childAssetModelId and a hierarchyId (named id). A hierarchy specifies allowed parent/child asset relationships for an asset model.
asset_model_idstringThe ID of the asset model, in UUID format. (pattern: <code>^(?!00000000-0000-0000-0000-000000000000)[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$</code>)
asset_model_last_update_datestring (date-time)The date the asset model was last updated, in Unix epoch time.
asset_model_namestringThe name of the asset model. (pattern: <code>[^\u0000-\u001F\u007F]+</code>)
asset_model_propertiesarrayThe list of asset properties for the asset model. This object doesn't include properties that you define in composite models. You can find composite model properties in the assetModelCompositeModels object.
asset_model_statusobjectContains current status information for an asset model. For more information, see Asset and model states in the IoT SiteWise User Guide.
asset_model_typestringThe type of asset model. ASSET_MODEL – (default) An asset model that you can use to create assets. Can't be included as a component in another asset model. COMPONENT_MODEL – A reusable component that you can include in the composite models of other asset models. You can't create assets directly from this type of asset model. (ASSET_MODEL, COMPONENT_MODEL, INTERFACE)
asset_model_versionstringThe version of the asset model. See Asset model versions in the IoT SiteWise User Guide. (pattern: <code>^(0|([1-9]{1}\d*))$</code>)
e_tagstringThe entity tag (ETag) is a hash of the retrieved version of the asset model. It's used to make concurrent updates safely to the resource. See Optimistic locking for asset model writes in the IoT SiteWise User Guide. See Optimistic locking for asset model writes in the IoT SiteWise User Guide. (pattern: <code>^[\w-]{43}$</code>)
interface_detailsarrayA list of interface details that describe the interfaces implemented by this asset model, including interface asset model IDs and property mappings.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_asset_modelselectasset_model_id, regionexcludeProperties, assetModelVersionRetrieves 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.
list_asset_modelsselectregionassetModelTypes, nextToken, maxResults, assetModelVersionRetrieves a paginated list of summaries of all asset models.
create_asset_modelinsertregion, assetModelNameCreates an asset model from specified property and hierarchy definitions. You create assets from asset models. With asset models, you can easily create assets of the same type that have standardized definitions. Each asset created from a model inherits the asset model's property and hierarchy definitions. For more information, see Defining asset models in the IoT SiteWise User Guide. You can create three types of asset models, ASSET_MODEL, COMPONENT_MODEL, or an INTERFACE. ASSET_MODEL – (default) An asset model that you can use to create assets. Can't be included as a component in another asset model. COMPONENT_MODEL – A reusable component that you can include in the composite models of other asset models. You can't create assets directly from this type of asset model. INTERFACE – An interface is a type of model that defines a standard structure that can be applied to different asset models.
update_asset_modelupdateasset_model_id, region, assetModelNameIf-Match, If-None-Match, Match-For-Version-TypeUpdates an asset 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. If you remove a property from an asset model, IoT SiteWise deletes all previous data for that property. You can’t change the type or data type of an existing property. To replace an existing asset model property with a new one with the same name, do the following: Submit an UpdateAssetModel request with the entire existing property removed. Submit a second UpdateAssetModel request that includes the new property. The new asset property will have the same name as the previous one and IoT SiteWise will generate a new unique id.
delete_asset_modeldeleteasset_model_id, regionclientToken, If-Match, If-None-Match, Match-For-Version-TypeDeletes an asset model. This action can't be undone. You must delete all assets created from an asset model before you can delete the model. Also, you can't delete an asset 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.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
asset_model_idstringThe ID of the asset model to delete. 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.
regionstringAWS region (default: us-east-1)
If-MatchstringThe 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.
If-None-MatchstringAccepts * to reject the delete request if an active version (specified using matchForVersionType as ACTIVE) already exists for the asset model.
Match-For-Version-TypestringSpecifies 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.
assetModelTypesarrayThe type of asset model. If you don't provide an assetModelTypes, all types of asset models are returned. ASSET_MODEL – An asset model that you can use to create assets. Can't be included as a component in another asset model. COMPONENT_MODEL – A reusable component that you can include in the composite models of other asset models. You can't create assets directly from this type of asset model. INTERFACE – An interface is a type of model that defines a standard structure that can be applied to different asset models.
assetModelVersionstringThe 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.
clientTokenstringA 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.
excludePropertiesbooleanWhether or not to exclude asset model properties from the response.
maxResultsintegerThe maximum number of results to return for each paginated request. Default: 50
nextTokenstringThe token to be used for the next set of paginated results.

SELECT examples

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.

SELECT
asset_model_arn,
asset_model_composite_model_summaries,
asset_model_composite_models,
asset_model_creation_date,
asset_model_description,
asset_model_external_id,
asset_model_hierarchies,
asset_model_id,
asset_model_last_update_date,
asset_model_name,
asset_model_properties,
asset_model_status,
asset_model_type,
asset_model_version,
e_tag,
interface_details
FROM aws.iotsitewise.asset_models
WHERE asset_model_id = '{{ asset_model_id }}' -- required
AND region = '{{ region }}' -- required
AND excludeProperties = '{{ excludeProperties }}'
AND assetModelVersion = '{{ assetModelVersion }}'
;

INSERT examples

Creates an asset model from specified property and hierarchy definitions. You create assets from asset models. With asset models, you can easily create assets of the same type that have standardized definitions. Each asset created from a model inherits the asset model's property and hierarchy definitions. For more information, see Defining asset models in the IoT SiteWise User Guide. You can create three types of asset models, ASSET_MODEL, COMPONENT_MODEL, or an INTERFACE. ASSET_MODEL – (default) An asset model that you can use to create assets. Can't be included as a component in another asset model. COMPONENT_MODEL – A reusable component that you can include in the composite models of other asset models. You can't create assets directly from this type of asset model. INTERFACE – An interface is a type of model that defines a standard structure that can be applied to different asset models.

INSERT INTO aws.iotsitewise.asset_models (
assetModelName,
assetModelType,
assetModelId,
assetModelExternalId,
assetModelDescription,
assetModelProperties,
assetModelHierarchies,
assetModelCompositeModels,
clientToken,
tags,
region
)
SELECT
'{{ assetModelName }}' /* required */,
'{{ assetModelType }}',
'{{ assetModelId }}',
'{{ assetModelExternalId }}',
'{{ assetModelDescription }}',
'{{ assetModelProperties }}',
'{{ assetModelHierarchies }}',
'{{ assetModelCompositeModels }}',
'{{ clientToken }}',
'{{ tags }}',
'{{ region }}'
RETURNING
asset_model_arn,
asset_model_id,
asset_model_status
;

UPDATE examples

Updates an asset 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. If you remove a property from an asset model, IoT SiteWise deletes all previous data for that property. You can’t change the type or data type of an existing property. To replace an existing asset model property with a new one with the same name, do the following: Submit an UpdateAssetModel request with the entire existing property removed. Submit a second UpdateAssetModel request that includes the new property. The new asset property will have the same name as the previous one and IoT SiteWise will generate a new unique id.

UPDATE aws.iotsitewise.asset_models
SET
assetModelExternalId = '{{ assetModelExternalId }}',
assetModelName = '{{ assetModelName }}',
assetModelDescription = '{{ assetModelDescription }}',
assetModelProperties = '{{ assetModelProperties }}',
assetModelHierarchies = '{{ assetModelHierarchies }}',
assetModelCompositeModels = '{{ assetModelCompositeModels }}',
clientToken = '{{ clientToken }}'
WHERE
asset_model_id = '{{ asset_model_id }}' --required
AND region = '{{ region }}' --required
AND assetModelName = '{{ assetModelName }}' --required
AND `If-Match` = '{{ If-Match}}'
AND `If-None-Match` = '{{ If-None-Match}}'
AND `Match-For-Version-Type` = '{{ Match-For-Version-Type}}'
RETURNING
asset_model_id,
asset_model_status;

DELETE examples

Deletes an asset model. This action can't be undone. You must delete all assets created from an asset model before you can delete the model. Also, you can't delete an asset 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.

DELETE FROM aws.iotsitewise.asset_models
WHERE asset_model_id = '{{ asset_model_id }}' --required
AND region = '{{ region }}' --required
AND clientToken = '{{ clientToken }}'
AND `If-Match` = '{{ If-Match }}'
AND `If-None-Match` = '{{ If-None-Match }}'
AND `Match-For-Version-Type` = '{{ Match-For-Version-Type }}'
;