asset_models
Creates, updates, deletes, gets or lists an asset_models resource.
Overview
| Name | asset_models |
| Type | Resource |
| Id | aws.iotsitewise.asset_models |
Fields
The following fields are returned by SELECT queries:
- describe_asset_model
- list_asset_models
| Name | Datatype | Description |
|---|---|---|
asset_model_arn | string | The ARN of the asset model, which has the following format. arn:${Partition}:iotsitewise:${Region}:${Account}:asset-model/${AssetModelId} (pattern: <code>^arn:aws(-cn|-us-gov)?:[a-zA-Z0-9-:/_.]+$</code>) |
asset_model_composite_model_summaries | array | The list of the immediate child custom composite model summaries for the asset model. |
asset_model_composite_models | array | The list of built-in composite models for the asset model, such as those with those of type AWS/ALARMS. |
asset_model_creation_date | string (date-time) | The date the asset model was created, in Unix epoch time. |
asset_model_description | string | The asset model's description. (pattern: <code>[^\u0000-\u001F\u007F]+</code>) |
asset_model_external_id | string | The external ID of the asset model, if any. (pattern: <code>[a-zA-Z0-9_][a-zA-Z_-0-9.:]*[a-zA-Z0-9_]+</code>) |
asset_model_hierarchies | array | A list of asset model hierarchies that each contain a childAssetModelId and a hierarchyId (named id). A hierarchy specifies allowed parent/child asset relationships for an asset model. |
asset_model_id | string | The ID of the asset model, 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_model_last_update_date | string (date-time) | The date the asset model was last updated, in Unix epoch time. |
asset_model_name | string | The name of the asset model. (pattern: <code>[^\u0000-\u001F\u007F]+</code>) |
asset_model_properties | array | The list of asset properties for the asset model. This object doesn't include properties that you define in composite models. You can find composite model properties in the assetModelCompositeModels object. |
asset_model_status | object | Contains current status information for an asset model. For more information, see Asset and model states in the IoT SiteWise User Guide. |
asset_model_type | string | The type of asset model. ASSET_MODEL – (default) An asset model that you can use to create assets. Can't be included as a component in another asset model. COMPONENT_MODEL – A reusable component that you can include in the composite models of other asset models. You can't create assets directly from this type of asset model. (ASSET_MODEL, COMPONENT_MODEL, INTERFACE) |
asset_model_version | string | The version of the asset model. See Asset model versions in the IoT SiteWise User Guide. (pattern: <code>^(0|([1-9]{1}\d*))$</code>) |
e_tag | string | The entity tag (ETag) is a hash of the retrieved version of the asset model. It's used to make concurrent updates safely to the resource. See Optimistic locking for asset model writes in the IoT SiteWise User Guide. See Optimistic locking for asset model writes in the IoT SiteWise User Guide. (pattern: <code>^[\w-]{43}$</code>) |
interface_details | array | A list of interface details that describe the interfaces implemented by this asset model, including interface asset model IDs and property mappings. |
| Name | Datatype | Description |
|---|---|---|
id | string | The ID of the asset model (used with IoT SiteWise API operations). (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 model. (pattern: <code>[^\u0000-\u001F\u007F]+</code>) |
arn | string | The ARN of the asset model, which has the following format. arn:${Partition}:iotsitewise:${Region}:${Account}:asset-model/${AssetModelId} (pattern: <code>^arn:aws(-cn|-us-gov)?:[a-zA-Z0-9-:/_.]+$</code>) |
asset_model_type | string | The type of asset model. ASSET_MODEL – (default) An asset model that you can use to create assets. Can't be included as a component in another asset model. COMPONENT_MODEL – A reusable component that you can include in the composite models of other asset models. You can't create assets directly from this type of asset model. (ASSET_MODEL, COMPONENT_MODEL, INTERFACE) |
creation_date | string (date-time) | The date the asset model was created, in Unix epoch time. |
description | string | The asset model description. (pattern: <code>[^\u0000-\u001F\u007F]+</code>) |
external_id | string | The external ID of the asset model. 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>) |
last_update_date | string (date-time) | The date the asset model was last updated, in Unix epoch time. |
status | object | The current status of the asset model. |
version | string | The version number of the asset model. (pattern: <code>^(0|([1-9]{1}\d*))$</code>) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_asset_model | select | asset_model_id, region | excludeProperties, assetModelVersion | Retrieves information about an asset model. This includes details about the asset model's properties, hierarchies, composite models, and any interface relationships if the asset model implements interfaces. |
list_asset_models | select | region | assetModelTypes, nextToken, maxResults, assetModelVersion | Retrieves a paginated list of summaries of all asset models. |
create_asset_model | insert | region, assetModelName | Creates an asset model from specified property and hierarchy definitions. You create assets from asset models. With asset models, you can easily create assets of the same type that have standardized definitions. Each asset created from a model inherits the asset model's property and hierarchy definitions. For more information, see Defining asset models in the IoT SiteWise User Guide. You can create three types of asset models, ASSET_MODEL, COMPONENT_MODEL, or an INTERFACE. ASSET_MODEL – (default) An asset model that you can use to create assets. Can't be included as a component in another asset model. COMPONENT_MODEL – A reusable component that you can include in the composite models of other asset models. You can't create assets directly from this type of asset model. INTERFACE – An interface is a type of model that defines a standard structure that can be applied to different asset models. | |
update_asset_model | update | asset_model_id, region, assetModelName | If-Match, If-None-Match, Match-For-Version-Type | Updates an asset model and all of the assets that were created from the model. Each asset created from the model inherits the updated asset model's property and hierarchy definitions. For more information, see Updating assets and models in the IoT SiteWise User Guide. If you remove a property from an asset model, IoT SiteWise deletes all previous data for that property. You can’t change the type or data type of an existing property. To replace an existing asset model property with a new one with the same name, do the following: Submit an UpdateAssetModel request with the entire existing property removed. Submit a second UpdateAssetModel request that includes the new property. The new asset property will have the same name as the previous one and IoT SiteWise will generate a new unique id. |
delete_asset_model | delete | asset_model_id, region | clientToken, If-Match, If-None-Match, Match-For-Version-Type | Deletes an asset model. This action can't be undone. You must delete all assets created from an asset model before you can delete the model. Also, you can't delete an asset model if a parent asset model exists that contains a property formula expression that depends on the asset model that you want to delete. For more information, see Deleting assets and models in the IoT SiteWise User Guide. |
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_model_id | string | The ID of the asset model to delete. 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) |
If-Match | string | The expected current entity tag (ETag) for the asset model’s latest or active version (specified using matchForVersionType). The delete request is rejected if the tag does not match the latest or active version's current entity tag. See Optimistic locking for asset model writes in the IoT SiteWise User Guide. |
If-None-Match | string | Accepts * to reject the delete request if an active version (specified using matchForVersionType as ACTIVE) already exists for the asset model. |
Match-For-Version-Type | string | Specifies the asset model version type (LATEST or ACTIVE) used in conjunction with If-Match or If-None-Match headers to determine the target ETag for the delete operation. |
assetModelTypes | array | The type of asset model. If you don't provide an assetModelTypes, all types of asset models are returned. ASSET_MODEL – An asset model that you can use to create assets. Can't be included as a component in another asset model. COMPONENT_MODEL – A reusable component that you can include in the composite models of other asset models. You can't create assets directly from this type of asset model. INTERFACE – An interface is a type of model that defines a standard structure that can be applied to different asset models. |
assetModelVersion | string | The version alias that specifies the latest or active version of the asset model. The details are returned in the response. The default value is LATEST. See Asset model versions 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 model properties from the response. |
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_model
- list_asset_models
Retrieves information about an asset model. This includes details about the asset model's properties, hierarchies, composite models, and any interface relationships if the asset model implements interfaces.
SELECT
asset_model_arn,
asset_model_composite_model_summaries,
asset_model_composite_models,
asset_model_creation_date,
asset_model_description,
asset_model_external_id,
asset_model_hierarchies,
asset_model_id,
asset_model_last_update_date,
asset_model_name,
asset_model_properties,
asset_model_status,
asset_model_type,
asset_model_version,
e_tag,
interface_details
FROM aws.iotsitewise.asset_models
WHERE asset_model_id = '{{ asset_model_id }}' -- required
AND region = '{{ region }}' -- required
AND excludeProperties = '{{ excludeProperties }}'
AND assetModelVersion = '{{ assetModelVersion }}'
;
Retrieves a paginated list of summaries of all asset models.
SELECT
id,
name,
arn,
asset_model_type,
creation_date,
description,
external_id,
last_update_date,
status,
version
FROM aws.iotsitewise.asset_models
WHERE region = '{{ region }}' -- required
AND assetModelTypes = '{{ assetModelTypes }}'
AND nextToken = '{{ nextToken }}'
AND maxResults = '{{ maxResults }}'
AND assetModelVersion = '{{ assetModelVersion }}'
;
INSERT examples
- create_asset_model
- Manifest
Creates an asset model from specified property and hierarchy definitions. You create assets from asset models. With asset models, you can easily create assets of the same type that have standardized definitions. Each asset created from a model inherits the asset model's property and hierarchy definitions. For more information, see Defining asset models in the IoT SiteWise User Guide. You can create three types of asset models, ASSET_MODEL, COMPONENT_MODEL, or an INTERFACE. ASSET_MODEL – (default) An asset model that you can use to create assets. Can't be included as a component in another asset model. COMPONENT_MODEL – A reusable component that you can include in the composite models of other asset models. You can't create assets directly from this type of asset model. INTERFACE – An interface is a type of model that defines a standard structure that can be applied to different asset models.
INSERT INTO aws.iotsitewise.asset_models (
assetModelName,
assetModelType,
assetModelId,
assetModelExternalId,
assetModelDescription,
assetModelProperties,
assetModelHierarchies,
assetModelCompositeModels,
clientToken,
tags,
region
)
SELECT
'{{ assetModelName }}' /* required */,
'{{ assetModelType }}',
'{{ assetModelId }}',
'{{ assetModelExternalId }}',
'{{ assetModelDescription }}',
'{{ assetModelProperties }}',
'{{ assetModelHierarchies }}',
'{{ assetModelCompositeModels }}',
'{{ clientToken }}',
'{{ tags }}',
'{{ region }}'
RETURNING
asset_model_arn,
asset_model_id,
asset_model_status
;
# Description fields are for documentation purposes
- name: asset_models
props:
- name: region
value: "{{ region }}"
description: Required parameter for the asset_models resource.
- name: assetModelName
value: "{{ assetModelName }}"
- name: assetModelType
value: "{{ assetModelType }}"
valid_values: ['ASSET_MODEL', 'COMPONENT_MODEL', 'INTERFACE']
- name: assetModelId
value: "{{ assetModelId }}"
- name: assetModelExternalId
value: "{{ assetModelExternalId }}"
- name: assetModelDescription
value: "{{ assetModelDescription }}"
- name: assetModelProperties
value:
- id: "{{ id }}"
externalId: "{{ externalId }}"
name: "{{ name }}"
dataType: "{{ dataType }}"
dataTypeSpec: "{{ dataTypeSpec }}"
unit: "{{ unit }}"
type_:
attribute:
defaultValue: "{{ defaultValue }}"
measurement:
processingConfig:
forwardingConfig:
state: "{{ state }}"
transform:
expression: "{{ expression }}"
variables:
- name: "{{ name }}"
value:
propertyId: "{{ propertyId }}"
hierarchyId: "{{ hierarchyId }}"
propertyPath: "{{ propertyPath }}"
processingConfig:
computeLocation: "{{ computeLocation }}"
forwardingConfig:
state: "{{ state }}"
metric:
expression: "{{ expression }}"
variables:
- name: "{{ name }}"
value:
propertyId: "{{ propertyId }}"
hierarchyId: "{{ hierarchyId }}"
propertyPath: "{{ propertyPath }}"
window:
tumbling:
interval: "{{ interval }}"
offset: "{{ offset }}"
processingConfig:
computeLocation: "{{ computeLocation }}"
- name: assetModelHierarchies
value:
- id: "{{ id }}"
externalId: "{{ externalId }}"
name: "{{ name }}"
childAssetModelId: "{{ childAssetModelId }}"
- name: assetModelCompositeModels
value:
- id: "{{ id }}"
externalId: "{{ externalId }}"
name: "{{ name }}"
description: "{{ description }}"
type_: "{{ type_ }}"
properties_: "{{ properties_ }}"
- name: clientToken
value: "{{ clientToken }}"
- name: tags
value: "{{ tags }}"
UPDATE examples
- update_asset_model
Updates an asset model and all of the assets that were created from the model. Each asset created from the model inherits the updated asset model's property and hierarchy definitions. For more information, see Updating assets and models in the IoT SiteWise User Guide. If you remove a property from an asset model, IoT SiteWise deletes all previous data for that property. You can’t change the type or data type of an existing property. To replace an existing asset model property with a new one with the same name, do the following: Submit an UpdateAssetModel request with the entire existing property removed. Submit a second UpdateAssetModel request that includes the new property. The new asset property will have the same name as the previous one and IoT SiteWise will generate a new unique id.
UPDATE aws.iotsitewise.asset_models
SET
assetModelExternalId = '{{ assetModelExternalId }}',
assetModelName = '{{ assetModelName }}',
assetModelDescription = '{{ assetModelDescription }}',
assetModelProperties = '{{ assetModelProperties }}',
assetModelHierarchies = '{{ assetModelHierarchies }}',
assetModelCompositeModels = '{{ assetModelCompositeModels }}',
clientToken = '{{ clientToken }}'
WHERE
asset_model_id = '{{ asset_model_id }}' --required
AND region = '{{ region }}' --required
AND assetModelName = '{{ assetModelName }}' --required
AND `If-Match` = '{{ If-Match}}'
AND `If-None-Match` = '{{ If-None-Match}}'
AND `Match-For-Version-Type` = '{{ Match-For-Version-Type}}'
RETURNING
asset_model_id,
asset_model_status;
DELETE examples
- delete_asset_model
Deletes an asset model. This action can't be undone. You must delete all assets created from an asset model before you can delete the model. Also, you can't delete an asset model if a parent asset model exists that contains a property formula expression that depends on the asset model that you want to delete. For more information, see Deleting assets and models in the IoT SiteWise User Guide.
DELETE FROM aws.iotsitewise.asset_models
WHERE asset_model_id = '{{ asset_model_id }}' --required
AND region = '{{ region }}' --required
AND clientToken = '{{ clientToken }}'
AND `If-Match` = '{{ If-Match }}'
AND `If-None-Match` = '{{ If-None-Match }}'
AND `Match-For-Version-Type` = '{{ Match-For-Version-Type }}'
;