asset_models
Creates, updates, deletes or gets an asset_model resource or lists asset_models in a region
Overview
| Name | asset_models |
| Type | Resource |
| Description | Resource schema for AWS::IoTSiteWise::AssetModel |
| Id | awscc.iotsitewise.asset_models |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
asset_model_id | string | The ID of the asset model. |
asset_model_type | string | The type of the asset model (ASSET_MODEL OR COMPONENT_MODEL or INTERFACE) |
asset_model_external_id | string | The external ID of the asset model. |
asset_model_arn | string | The ARN of the asset model, which has the following format. |
asset_model_name | string | A unique, friendly name for the asset model. |
asset_model_description | string | A description for the asset model. |
asset_model_properties | array | The property definitions of the asset model. You can specify up to 200 properties per asset model. |
asset_model_composite_models | array | The composite asset models that are part of this asset model. Composite asset models are asset models that contain specific properties. |
asset_model_hierarchies | array | The hierarchy definitions of the asset model. Each hierarchy specifies an asset model whose assets can be children of any other assets created from this asset model. You can specify up to 10 hierarchies per asset model. |
enforced_asset_model_interface_relationships | array | a list of asset model and interface relationships |
tags | array | A list of key-value pairs that contain metadata for the asset model. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
asset_model_id | string | The ID of the asset model. |
region | string | AWS region. |
For more information, see AWS::IoTSiteWise::AssetModel.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | asset_models | INSERT | AssetModelName, region |
delete_resource | asset_models | DELETE | Identifier, region |
update_resource | asset_models | UPDATE | Identifier, PatchDocument, region |
list_resources | asset_models_list_only | SELECT | region |
get_resource | asset_models | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual asset_model.
SELECT
region,
asset_model_id,
asset_model_type,
asset_model_external_id,
asset_model_arn,
asset_model_name,
asset_model_description,
asset_model_properties,
asset_model_composite_models,
asset_model_hierarchies,
enforced_asset_model_interface_relationships,
tags
FROM awscc.iotsitewise.asset_models
WHERE
region = '{{ region }}' AND
Identifier = '{{ asset_model_id }}';
Lists all asset_models in a region.
SELECT
region,
asset_model_id
FROM awscc.iotsitewise.asset_models_list_only
WHERE
region = '{{ region }}';
INSERT example
Use the following StackQL query and manifest file to create a new asset_model resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.iotsitewise.asset_models (
AssetModelName,
region
)
SELECT
'{{ asset_model_name }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.iotsitewise.asset_models (
AssetModelType,
AssetModelExternalId,
AssetModelName,
AssetModelDescription,
AssetModelProperties,
AssetModelCompositeModels,
AssetModelHierarchies,
EnforcedAssetModelInterfaceRelationships,
Tags,
region
)
SELECT
'{{ asset_model_type }}',
'{{ asset_model_external_id }}',
'{{ asset_model_name }}',
'{{ asset_model_description }}',
'{{ asset_model_properties }}',
'{{ asset_model_composite_models }}',
'{{ asset_model_hierarchies }}',
'{{ enforced_asset_model_interface_relationships }}',
'{{ 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_model
props:
- name: asset_model_type
value: '{{ asset_model_type }}'
- name: asset_model_external_id
value: '{{ asset_model_external_id }}'
- name: asset_model_name
value: '{{ asset_model_name }}'
- name: asset_model_description
value: '{{ asset_model_description }}'
- name: asset_model_properties
value:
- logical_id: '{{ logical_id }}'
id: '{{ id }}'
external_id: '{{ external_id }}'
name: '{{ name }}'
data_type: '{{ data_type }}'
data_type_spec: '{{ data_type_spec }}'
unit: '{{ unit }}'
type:
type_name: '{{ type_name }}'
attribute:
default_value: '{{ default_value }}'
transform:
expression: '{{ expression }}'
variables:
- name: '{{ name }}'
value:
property_logical_id: '{{ property_logical_id }}'
property_id: '{{ property_id }}'
property_external_id: '{{ property_external_id }}'
property_path:
- name: '{{ name }}'
hierarchy_logical_id: '{{ hierarchy_logical_id }}'
hierarchy_id: '{{ hierarchy_id }}'
hierarchy_external_id: '{{ hierarchy_external_id }}'
metric:
expression: '{{ expression }}'
variables:
- null
window:
tumbling:
interval: '{{ interval }}'
offset: '{{ offset }}'
- name: asset_model_composite_models
value:
- id: '{{ id }}'
external_id: '{{ external_id }}'
composed_asset_model_id: '{{ composed_asset_model_id }}'
parent_asset_model_composite_model_external_id: '{{ parent_asset_model_composite_model_external_id }}'
path:
- '{{ path[0] }}'
description: '{{ description }}'
name: '{{ name }}'
type: '{{ type }}'
composite_model_properties:
- null
- name: asset_model_hierarchies
value:
- id: '{{ id }}'
external_id: '{{ external_id }}'
logical_id: '{{ logical_id }}'
name: '{{ name }}'
child_asset_model_id: '{{ child_asset_model_id }}'
- name: enforced_asset_model_interface_relationships
value:
- interface_asset_model_id: '{{ interface_asset_model_id }}'
property_mappings:
- asset_model_property_external_id: '{{ asset_model_property_external_id }}'
asset_model_property_logical_id: '{{ asset_model_property_logical_id }}'
interface_asset_model_property_external_id: '{{ interface_asset_model_property_external_id }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
UPDATE example
Use the following StackQL query and manifest file to update a asset_model resource, using stack-deploy.
/*+ update */
UPDATE awscc.iotsitewise.asset_models
SET PatchDocument = string('{{ {
"AssetModelExternalId": asset_model_external_id,
"AssetModelName": asset_model_name,
"AssetModelDescription": asset_model_description,
"EnforcedAssetModelInterfaceRelationships": enforced_asset_model_interface_relationships,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ asset_model_id }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.iotsitewise.asset_models
WHERE
Identifier = '{{ asset_model_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 asset_models resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
iotsitewise:CreateAssetModel,
iotsitewise:ListTagsForResource,
iotsitewise:TagResource,
iotsitewise:DescribeAssetModel,
iotsitewise:UpdateAssetModel,
iotsitewise:ListAssetModelProperties,
iotsitewise:ListAssetModelCompositeModels,
iotsitewise:UpdateAssetModelCompositeModel,
iotsitewise:DescribeAssetModelCompositeModel,
iotsitewise:CreateAssetModelCompositeModel,
iotsitewise:PutAssetModelInterfaceRelationship,
iotsitewise:DescribeAssetModelInterfaceRelationship
iotsitewise:DescribeAssetModel,
iotsitewise:ListAssetModelProperties,
iotsitewise:DescribeAssetModelCompositeModel,
iotsitewise:ListAssetModelCompositeModels,
iotsitewise:ListTagsForResource,
iotsitewise:DescribeAssetModelInterfaceRelationship
iotsitewise:DescribeAssetModel,
iotsitewise:ListTagsForResource,
iotsitewise:TagResource,
iotsitewise:UntagResource,
iotsitewise:ListAssetModelProperties,
iotsitewise:ListAssetModelCompositeModels,
iotsitewise:CreateAssetModelCompositeModel,
iotsitewise:UpdateAssetModelCompositeModel,
iotsitewise:DeleteAssetModelCompositeModel,
iotsitewise:DescribeAssetModelCompositeModel,
iotsitewise:UpdateAssetModel,
iotsitewise:PutAssetModelInterfaceRelationship,
iotsitewise:DeleteAssetModelInterfaceRelationship,
iotsitewise:DescribeAssetModelInterfaceRelationship
iotsitewise:DescribeAssetModel,
iotsitewise:DeleteAssetModel,
iotsitewise:ListAssetModelProperties,
iotsitewise:ListAssetModelCompositeModels
iotsitewise:DescribeAssetModel,
iotsitewise:ListAssetModels,
iotsitewise:ListTagsForResource,
iotsitewise:ListAssetModelProperties,
iotsitewise:ListAssetModelCompositeModels