Skip to main content

assets

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

Overview

Nameassets
TypeResource
Idaws.iotsitewise.assets

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
asset_arnstringThe ARN of the asset, which has the following format. arn:${Partition}:iotsitewise:${Region}:${Account}:asset/${AssetId} (pattern: <code>^arn:aws(-cn|-us-gov)?:[a-zA-Z0-9-:/_.]+$</code>)
asset_composite_model_summariesarrayThe list of the immediate child custom composite model summaries for the asset.
asset_composite_modelsarrayThe composite models for the asset.
asset_creation_datestring (date-time)The date the asset was created, in Unix epoch time.
asset_descriptionstringA description for the asset. (pattern: <code>[^\u0000-\u001F\u007F]+</code>)
asset_external_idstringThe external ID of the asset, if any. (pattern: <code>[a-zA-Z0-9_][a-zA-Z_-0-9.:]*[a-zA-Z0-9_]+</code>)
asset_hierarchiesarrayA list of asset hierarchies that each contain a hierarchyId. A hierarchy specifies allowed parent/child asset relationships.
asset_idstringThe ID of the asset, 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_last_update_datestring (date-time)The date the asset was last updated, in Unix epoch time.
asset_model_idstringThe ID of the asset model that was used to create the asset. (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_namestringThe name of the asset. (pattern: <code>[^\u0000-\u001F\u007F]+</code>)
asset_propertiesarrayThe list of asset properties for the asset. This object doesn't include properties that you define in composite models. You can find composite model properties in the assetCompositeModels object.
asset_statusobjectThe current status of the asset, which contains a state and any error message.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_assetselectasset_id, regionexcludePropertiesRetrieves information about an asset.
list_assetsselectregionnextToken, maxResults, assetModelId, filterRetrieves a paginated list of asset summaries. You can use this operation to do the following: List assets based on a specific asset model. List top-level assets. You can't use this operation to list all assets. To retrieve summaries for all of your assets, use ListAssetModels to get all of your asset model IDs. Then, use ListAssets to get all assets for each asset model.
create_assetinsertregion, assetName, assetModelIdCreates an asset from an existing asset model. For more information, see Creating assets in the IoT SiteWise User Guide.
associate_assetsupdateasset_id, region, hierarchyId, childAssetIdAssociates a child asset with the given parent asset through a hierarchy defined in the parent asset's model. For more information, see Associating assets in the IoT SiteWise User Guide.
update_assetupdateasset_id, region, assetNameUpdates an asset's name. For more information, see Updating assets and models in the IoT SiteWise User Guide.
delete_assetdeleteasset_id, regionclientTokenDeletes an asset. This action can't be undone. For more information, see Deleting assets and models in the IoT SiteWise User Guide. You can't delete an asset that's associated to another asset. For more information, see DisassociateAssets.
disassociate_assetsexecasset_id, region, hierarchyId, childAssetIdDisassociates a child asset from the given parent asset through a hierarchy defined in the parent asset's model.

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_idstringThe ID of the parent asset from which to disassociate the child asset. 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)
assetModelIdstringThe ID of the asset model by which to filter the list of assets. This parameter is required if you choose ALL for filter. 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.
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 properties from the response.
filterstringThe filter for the requested list of assets. Choose one of the following options: ALL – The list includes all assets for a given asset model ID. The assetModelId parameter is required if you filter by ALL. TOP_LEVEL – The list includes only top-level assets in the asset hierarchy tree. Default: ALL
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.

SELECT
asset_arn,
asset_composite_model_summaries,
asset_composite_models,
asset_creation_date,
asset_description,
asset_external_id,
asset_hierarchies,
asset_id,
asset_last_update_date,
asset_model_id,
asset_name,
asset_properties,
asset_status
FROM aws.iotsitewise.assets
WHERE asset_id = '{{ asset_id }}' -- required
AND region = '{{ region }}' -- required
AND excludeProperties = '{{ excludeProperties }}'
;

INSERT examples

Creates an asset from an existing asset model. For more information, see Creating assets in the IoT SiteWise User Guide.

INSERT INTO aws.iotsitewise.assets (
assetName,
assetModelId,
assetId,
assetExternalId,
clientToken,
tags,
assetDescription,
region
)
SELECT
'{{ assetName }}' /* required */,
'{{ assetModelId }}' /* required */,
'{{ assetId }}',
'{{ assetExternalId }}',
'{{ clientToken }}',
'{{ tags }}',
'{{ assetDescription }}',
'{{ region }}'
RETURNING
asset_arn,
asset_id,
asset_status
;

UPDATE examples

Associates a child asset with the given parent asset through a hierarchy defined in the parent asset's model. For more information, see Associating assets in the IoT SiteWise User Guide.

UPDATE aws.iotsitewise.assets
SET
hierarchyId = '{{ hierarchyId }}',
childAssetId = '{{ childAssetId }}',
clientToken = '{{ clientToken }}'
WHERE
asset_id = '{{ asset_id }}' --required
AND region = '{{ region }}' --required
AND hierarchyId = '{{ hierarchyId }}' --required
AND childAssetId = '{{ childAssetId }}' --required;

DELETE examples

Deletes an asset. This action can't be undone. For more information, see Deleting assets and models in the IoT SiteWise User Guide. You can't delete an asset that's associated to another asset. For more information, see DisassociateAssets.

DELETE FROM aws.iotsitewise.assets
WHERE asset_id = '{{ asset_id }}' --required
AND region = '{{ region }}' --required
AND clientToken = '{{ clientToken }}'
;

Lifecycle Methods

Disassociates a child asset from the given parent asset through a hierarchy defined in the parent asset's model.

EXEC aws.iotsitewise.assets.disassociate_assets
@asset_id='{{ asset_id }}' --required,
@region='{{ region }}' --required
@@json=
'{
"hierarchyId": "{{ hierarchyId }}",
"childAssetId": "{{ childAssetId }}",
"clientToken": "{{ clientToken }}"
}'
;