assets
Creates, updates, deletes or gets an asset resource or lists assets in a region
Overview
| Name | assets |
| Type | Resource |
| Description | Resource schema for AWS::IoTSiteWise::Asset |
| Id | awscc.iotsitewise.assets |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
asset_id | string | The ID of the asset |
asset_external_id | string | The External ID of the asset |
asset_model_id | string | The ID of the asset model from which to create the asset. |
asset_arn | string | The ARN of the asset |
asset_name | string | A unique, friendly name for the asset. |
asset_description | string | A description for the asset |
asset_properties | array | |
asset_hierarchies | array | |
tags | array | A list of key-value pairs that contain metadata for the asset. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
asset_id | string | The ID of the asset |
region | string | AWS region. |
For more information, see AWS::IoTSiteWise::Asset.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | assets | INSERT | AssetName, AssetModelId, region |
delete_resource | assets | DELETE | Identifier, region |
update_resource | assets | UPDATE | Identifier, PatchDocument, region |
list_resources | assets_list_only | SELECT | region |
get_resource | assets | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual asset.
SELECT
region,
asset_id,
asset_external_id,
asset_model_id,
asset_arn,
asset_name,
asset_description,
asset_properties,
asset_hierarchies,
tags
FROM awscc.iotsitewise.assets
WHERE
region = '{{ region }}' AND
Identifier = '{{ asset_id }}';
Lists all assets in a region.
SELECT
region,
asset_id
FROM awscc.iotsitewise.assets_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new asset resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.iotsitewise.assets (
AssetModelId,
AssetName,
region
)
SELECT
'{{ asset_model_id }}',
'{{ asset_name }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.iotsitewise.assets (
AssetExternalId,
AssetModelId,
AssetName,
AssetDescription,
AssetProperties,
AssetHierarchies,
Tags,
region
)
SELECT
'{{ asset_external_id }}',
'{{ asset_model_id }}',
'{{ asset_name }}',
'{{ asset_description }}',
'{{ asset_properties }}',
'{{ asset_hierarchies }}',
'{{ tags }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: asset
props:
- name: asset_external_id
value: '{{ asset_external_id }}'
- name: asset_model_id
value: '{{ asset_model_id }}'
- name: asset_name
value: '{{ asset_name }}'
- name: asset_description
value: '{{ asset_description }}'
- name: asset_properties
value:
- id: '{{ id }}'
external_id: '{{ external_id }}'
logical_id: '{{ logical_id }}'
alias: '{{ alias }}'
notification_state: '{{ notification_state }}'
unit: '{{ unit }}'
- name: asset_hierarchies
value:
- id: '{{ id }}'
external_id: '{{ external_id }}'
logical_id: '{{ logical_id }}'
child_asset_id: '{{ child_asset_id }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
UPDATE example
Use the following StackQL query and manifest file to update a asset resource, using stack-deploy.
/*+ update */
UPDATE awscc.iotsitewise.assets
SET PatchDocument = string('{{ {
"AssetExternalId": asset_external_id,
"AssetModelId": asset_model_id,
"AssetName": asset_name,
"AssetDescription": asset_description,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ asset_id }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.iotsitewise.assets
WHERE
Identifier = '{{ asset_id }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the assets resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
iotsitewise:AssociateAssets,
iotsitewise:CreateAsset,
iotsitewise:DescribeAsset,
iotsitewise:DescribeAssetModel,
iotsitewise:ListAssociatedAssets,
iotsitewise:ListTagsForResource,
iotsitewise:TagResource,
iotsitewise:ListAssetModelProperties,
iotsitewise:ListAssetProperties,
iotsitewise:ListAssetModelCompositeModels,
iotsitewise:UpdateAssetProperty
iotsitewise:DescribeAsset,
iotsitewise:DescribeAssetModel,
iotsitewise:ListAssociatedAssets,
iotsitewise:ListAssetModelProperties,
iotsitewise:ListAssetModelCompositeModels,
iotsitewise:ListAssetProperties,
iotsitewise:ListTagsForResource
iotsitewise:AssociateAssets,
iotsitewise:DescribeAsset,
iotsitewise:DescribeAssetModel,
iotsitewise:DisassociateAssets,
iotsitewise:ListAssociatedAssets,
iotsitewise:ListTagsForResource,
iotsitewise:TagResource,
iotsitewise:UpdateAsset,
iotsitewise:UpdateAssetProperty,
iotsitewise:ListAssetModelProperties,
iotsitewise:ListAssetProperties,
iotsitewise:ListAssetModelCompositeModels,
iotsitewise:UntagResource
iotsitewise:DeleteAsset,
iotsitewise:DescribeAsset,
iotsitewise:DescribeAssetModel,
iotsitewise:DisassociateAssets,
iotsitewise:ListAssociatedAssets,
iotsitewise:ListAssetProperties,
iotsitewise:ListTagsForResource,
iotsitewise:ListAssetModelCompositeModels,
iotsitewise:ListAssetModelProperties,
iotsitewise:ListAssetProperties
iotsitewise:ListAssetModels,
iotsitewise:ListAssets