Skip to main content

assets

Creates, updates, deletes or gets an asset resource or lists assets in a region

Overview

Nameassets
TypeResource
DescriptionResource schema for AWS::IoTSiteWise::Asset
Idawscc.iotsitewise.assets

Fields

NameDatatypeDescription
asset_idstringThe ID of the asset
asset_external_idstringThe External ID of the asset
asset_model_idstringThe ID of the asset model from which to create the asset.
asset_arnstringThe ARN of the asset
asset_namestringA unique, friendly name for the asset.
asset_descriptionstringA description for the asset
asset_propertiesarray
asset_hierarchiesarray
tagsarrayA list of key-value pairs that contain metadata for the asset.
regionstringAWS region.

For more information, see AWS::IoTSiteWise::Asset.

Methods

NameResourceAccessible byRequired Params
create_resourceassetsINSERTAssetName, AssetModelId, region
delete_resourceassetsDELETEIdentifier, region
update_resourceassetsUPDATEIdentifier, PatchDocument, region
list_resourcesassets_list_onlySELECTregion
get_resourceassetsSELECTIdentifier, region

SELECT examples

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 }}';

INSERT example

Use the following StackQL query and manifest file to create a new asset resource, using stack-deploy.

/*+ 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
;

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:

ParameterDescription
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:

iotsitewise:AssociateAssets,
iotsitewise:CreateAsset,
iotsitewise:DescribeAsset,
iotsitewise:DescribeAssetModel,
iotsitewise:ListAssociatedAssets,
iotsitewise:ListTagsForResource,
iotsitewise:TagResource,
iotsitewise:ListAssetModelProperties,
iotsitewise:ListAssetProperties,
iotsitewise:ListAssetModelCompositeModels,
iotsitewise:UpdateAssetProperty