assets
Creates, updates, deletes, gets or lists an assets resource.
Overview
| Name | assets |
| Type | Resource |
| Id | aws.iotsitewise.assets |
Fields
The following fields are returned by SELECT queries:
- describe_asset
- list_assets
| Name | Datatype | Description |
|---|---|---|
asset_arn | string | The 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_summaries | array | The list of the immediate child custom composite model summaries for the asset. |
asset_composite_models | array | The composite models for the asset. |
asset_creation_date | string (date-time) | The date the asset was created, in Unix epoch time. |
asset_description | string | A description for the asset. (pattern: <code>[^\u0000-\u001F\u007F]+</code>) |
asset_external_id | string | The external ID of the asset, if any. (pattern: <code>[a-zA-Z0-9_][a-zA-Z_-0-9.:]*[a-zA-Z0-9_]+</code>) |
asset_hierarchies | array | A list of asset hierarchies that each contain a hierarchyId. A hierarchy specifies allowed parent/child asset relationships. |
asset_id | string | The 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_date | string (date-time) | The date the asset was last updated, in Unix epoch time. |
asset_model_id | string | The 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_name | string | The name of the asset. (pattern: <code>[^\u0000-\u001F\u007F]+</code>) |
asset_properties | array | The 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_status | object | The current status of the asset, which contains a state and any error message. |
| Name | Datatype | Description |
|---|---|---|
id | string | The 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>) |
name | string | The name of the asset. (pattern: <code>[^\u0000-\u001F\u007F]+</code>) |
arn | string | The 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_model_id | string | The ID of the asset model used to create this 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>) |
creation_date | string (date-time) | The date the asset was created, in Unix epoch time. |
description | string | A description for the asset. (pattern: <code>[^\u0000-\u001F\u007F]+</code>) |
external_id | string | The external ID of the asset. For more information, see Using external IDs in the IoT SiteWise User Guide. (pattern: <code>[a-zA-Z0-9_][a-zA-Z_-0-9.:]*[a-zA-Z0-9_]+</code>) |
hierarchies | array | A list of asset hierarchies that each contain a hierarchyId. A hierarchy specifies allowed parent/child asset relationships. |
last_update_date | string (date-time) | The date the asset was last updated, in Unix epoch time. |
status | object | The current status of the asset. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_asset | select | asset_id, region | excludeProperties | Retrieves information about an asset. |
list_assets | select | region | nextToken, maxResults, assetModelId, filter | Retrieves 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_asset | insert | region, assetName, assetModelId | Creates an asset from an existing asset model. For more information, see Creating assets in the IoT SiteWise User Guide. | |
associate_assets | update | asset_id, region, hierarchyId, childAssetId | 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_asset | update | asset_id, region, assetName | Updates an asset's name. For more information, see Updating assets and models in the IoT SiteWise User Guide. | |
delete_asset | delete | asset_id, region | clientToken | 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. |
disassociate_assets | exec | asset_id, region, hierarchyId, childAssetId | Disassociates 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.
| Name | Datatype | Description |
|---|---|---|
asset_id | string | The 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. |
region | string | AWS region (default: us-east-1) |
assetModelId | string | The 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. |
clientToken | string | 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. |
excludeProperties | boolean | Whether or not to exclude asset properties from the response. |
filter | string | The 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 |
maxResults | integer | The maximum number of results to return for each paginated request. Default: 50 |
nextToken | string | The token to be used for the next set of paginated results. |
SELECT examples
- describe_asset
- list_assets
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 }}'
;
Retrieves 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.
SELECT
id,
name,
arn,
asset_model_id,
creation_date,
description,
external_id,
hierarchies,
last_update_date,
status
FROM aws.iotsitewise.assets
WHERE region = '{{ region }}' -- required
AND nextToken = '{{ nextToken }}'
AND maxResults = '{{ maxResults }}'
AND assetModelId = '{{ assetModelId }}'
AND filter = '{{ filter }}'
;
INSERT examples
- create_asset
- Manifest
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
;
# Description fields are for documentation purposes
- name: assets
props:
- name: region
value: "{{ region }}"
description: Required parameter for the assets resource.
- name: assetName
value: "{{ assetName }}"
- name: assetModelId
value: "{{ assetModelId }}"
- name: assetId
value: "{{ assetId }}"
- name: assetExternalId
value: "{{ assetExternalId }}"
- name: clientToken
value: "{{ clientToken }}"
- name: tags
value: "{{ tags }}"
- name: assetDescription
value: "{{ assetDescription }}"
UPDATE examples
- associate_assets
- update_asset
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;
Updates an asset's name. For more information, see Updating assets and models in the IoT SiteWise User Guide.
UPDATE aws.iotsitewise.assets
SET
assetExternalId = '{{ assetExternalId }}',
assetName = '{{ assetName }}',
clientToken = '{{ clientToken }}',
assetDescription = '{{ assetDescription }}'
WHERE
asset_id = '{{ asset_id }}' --required
AND region = '{{ region }}' --required
AND assetName = '{{ assetName }}' --required
RETURNING
asset_id,
asset_status;
DELETE examples
- delete_asset
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
- disassociate_assets
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 }}"
}'
;