create_asset_model
(**kwargs)¶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 .
See also: AWS API Documentation
Request Syntax
response = client.create_asset_model(
assetModelName='string',
assetModelDescription='string',
assetModelProperties=[
{
'name': 'string',
'dataType': 'STRING'|'INTEGER'|'DOUBLE'|'BOOLEAN'|'STRUCT',
'dataTypeSpec': 'string',
'unit': 'string',
'type': {
'attribute': {
'defaultValue': 'string'
},
'measurement': {
'processingConfig': {
'forwardingConfig': {
'state': 'DISABLED'|'ENABLED'
}
}
},
'transform': {
'expression': 'string',
'variables': [
{
'name': 'string',
'value': {
'propertyId': 'string',
'hierarchyId': 'string'
}
},
],
'processingConfig': {
'computeLocation': 'EDGE'|'CLOUD',
'forwardingConfig': {
'state': 'DISABLED'|'ENABLED'
}
}
},
'metric': {
'expression': 'string',
'variables': [
{
'name': 'string',
'value': {
'propertyId': 'string',
'hierarchyId': 'string'
}
},
],
'window': {
'tumbling': {
'interval': 'string',
'offset': 'string'
}
},
'processingConfig': {
'computeLocation': 'EDGE'|'CLOUD'
}
}
}
},
],
assetModelHierarchies=[
{
'name': 'string',
'childAssetModelId': 'string'
},
],
assetModelCompositeModels=[
{
'name': 'string',
'description': 'string',
'type': 'string',
'properties': [
{
'name': 'string',
'dataType': 'STRING'|'INTEGER'|'DOUBLE'|'BOOLEAN'|'STRUCT',
'dataTypeSpec': 'string',
'unit': 'string',
'type': {
'attribute': {
'defaultValue': 'string'
},
'measurement': {
'processingConfig': {
'forwardingConfig': {
'state': 'DISABLED'|'ENABLED'
}
}
},
'transform': {
'expression': 'string',
'variables': [
{
'name': 'string',
'value': {
'propertyId': 'string',
'hierarchyId': 'string'
}
},
],
'processingConfig': {
'computeLocation': 'EDGE'|'CLOUD',
'forwardingConfig': {
'state': 'DISABLED'|'ENABLED'
}
}
},
'metric': {
'expression': 'string',
'variables': [
{
'name': 'string',
'value': {
'propertyId': 'string',
'hierarchyId': 'string'
}
},
],
'window': {
'tumbling': {
'interval': 'string',
'offset': 'string'
}
},
'processingConfig': {
'computeLocation': 'EDGE'|'CLOUD'
}
}
}
},
]
},
],
clientToken='string',
tags={
'string': 'string'
}
)
[REQUIRED]
A unique, friendly name for the asset model.
The property definitions of the asset model. For more information, see Asset properties in the IoT SiteWise User Guide .
You can specify up to 200 properties per asset model. For more information, see Quotas in the IoT SiteWise User Guide .
Contains an asset model property definition. This property definition is applied to all assets created from the asset model.
The name of the property definition.
The data type of the property definition.
If you specify STRUCT
, you must also specify dataTypeSpec
to identify the type of the structure for this property.
The data type of the structure for this property. This parameter is required on properties that have the STRUCT
data type.
The options for this parameter depend on the type of the composite model in which you define this property. Use AWS/ALARM_STATE
for alarm state in alarm composite models.
The unit of the property definition, such as Newtons
or RPM
.
The property definition type (see PropertyType
). You can only specify one type in a property definition.
Specifies an asset attribute property. An attribute generally contains static information, such as the serial number of an IIoT wind turbine.
The default value of the asset model property attribute. All assets that you create from the asset model contain this attribute value. You can update an attribute's value after you create an asset. For more information, see Updating attribute values in the IoT SiteWise User Guide .
Specifies an asset measurement property. A measurement represents a device's raw sensor data stream, such as timestamped temperature values or timestamped power values.
The processing configuration for the given measurement property. You can configure measurements to be kept at the edge or forwarded to the Amazon Web Services Cloud. By default, measurements are forwarded to the cloud.
The forwarding configuration for the given measurement property.
The forwarding state for the given property.
Specifies an asset transform property. A transform contains a mathematical expression that maps a property's data points from one form to another, such as a unit conversion from Celsius to Fahrenheit.
The mathematical expression that defines the transformation function. You can specify up to 10 variables per expression. You can specify up to 10 functions per expression.
For more information, see Quotas in the IoT SiteWise User Guide .
The list of variables used in the expression.
Contains expression variable information.
The friendly name of the variable to be used in the expression.
The variable that identifies an asset property from which to use values.
The ID of the property to use as the variable. You can use the property name
if it's from the same asset model.
The ID of the hierarchy to query for the property ID. You can use the hierarchy's name instead of the hierarchy's ID.
You use a hierarchy ID instead of a model ID because you can have several hierarchies using the same model and therefore the same propertyId
. For example, you might have separately grouped assets that come from the same asset model. For more information, see Asset hierarchies in the IoT SiteWise User Guide .
The processing configuration for the given transform property. You can configure transforms to be kept at the edge or forwarded to the Amazon Web Services Cloud. You can also configure transforms to be computed at the edge or in the cloud.
The compute location for the given transform property.
The forwarding configuration for a given property.
The forwarding state for the given property.
Specifies an asset metric property. A metric contains a mathematical expression that uses aggregate functions to process all input data points over a time interval and output a single data point, such as to calculate the average hourly temperature.
The mathematical expression that defines the metric aggregation function. You can specify up to 10 variables per expression. You can specify up to 10 functions per expression.
For more information, see Quotas in the IoT SiteWise User Guide .
The list of variables used in the expression.
Contains expression variable information.
The friendly name of the variable to be used in the expression.
The variable that identifies an asset property from which to use values.
The ID of the property to use as the variable. You can use the property name
if it's from the same asset model.
The ID of the hierarchy to query for the property ID. You can use the hierarchy's name instead of the hierarchy's ID.
You use a hierarchy ID instead of a model ID because you can have several hierarchies using the same model and therefore the same propertyId
. For example, you might have separately grouped assets that come from the same asset model. For more information, see Asset hierarchies in the IoT SiteWise User Guide .
The window (time interval) over which IoT SiteWise computes the metric's aggregation expression. IoT SiteWise computes one data point per window
.
The tumbling time interval window.
The time interval for the tumbling window. The interval time must be between 1 minute and 1 week.
IoT SiteWise computes the 1w
interval the end of Sunday at midnight each week (UTC), the 1d
interval at the end of each day at midnight (UTC), the 1h
interval at the end of each hour, and so on.
When IoT SiteWise aggregates data points for metric computations, the start of each interval is exclusive and the end of each interval is inclusive. IoT SiteWise places the computed data point at the end of the interval.
The offset for the tumbling window. The offset
parameter accepts the following:
18h
for offset
and 1d
for interval
, IoT SiteWise aggregates data in one of the following ways:PT18H
for offset
and 1d
for interval
, IoT SiteWise aggregates data in one of the following ways:00:03:00
for offset
, 5m
for interval
, and you create the metric at 2 PM (UTC), you get the first aggregation result at 2:03 PM (UTC). You get the second aggregation result at 2:08 PM (UTC).2021-07-23T18:00-08
for offset
and 1d
for interval
, IoT SiteWise aggregates data in one of the following ways:The processing configuration for the given metric property. You can configure metrics to be computed at the edge or in the Amazon Web Services Cloud. By default, metrics are forwarded to the cloud.
The compute location for the given metric property.
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. For more information, see Asset hierarchies in the IoT SiteWise User Guide .
You can specify up to 10 hierarchies per asset model. For more information, see Quotas in the IoT SiteWise User Guide .
Contains an asset model hierarchy used in asset model creation. An asset model hierarchy determines the kind (or type) of asset that can belong to a hierarchy.
The name of the asset model hierarchy definition (as specified in the CreateAssetModel or UpdateAssetModel API operation).
The ID of an asset model for this hierarchy.
The composite asset models that are part of this asset model. Composite asset models are asset models that contain specific properties. Each composite model has a type that defines the properties that the composite model supports. Use composite asset models to define alarms on this asset model.
Contains a composite model definition in an asset model. This composite model definition is applied to all assets created from the asset model.
The name of the composite model.
The description of the composite model.
The type of the composite model. For alarm composite models, this type is AWS/ALARM
.
The asset property definitions for this composite model.
Contains an asset model property definition. This property definition is applied to all assets created from the asset model.
The name of the property definition.
The data type of the property definition.
If you specify STRUCT
, you must also specify dataTypeSpec
to identify the type of the structure for this property.
The data type of the structure for this property. This parameter is required on properties that have the STRUCT
data type.
The options for this parameter depend on the type of the composite model in which you define this property. Use AWS/ALARM_STATE
for alarm state in alarm composite models.
The unit of the property definition, such as Newtons
or RPM
.
The property definition type (see PropertyType
). You can only specify one type in a property definition.
Specifies an asset attribute property. An attribute generally contains static information, such as the serial number of an IIoT wind turbine.
The default value of the asset model property attribute. All assets that you create from the asset model contain this attribute value. You can update an attribute's value after you create an asset. For more information, see Updating attribute values in the IoT SiteWise User Guide .
Specifies an asset measurement property. A measurement represents a device's raw sensor data stream, such as timestamped temperature values or timestamped power values.
The processing configuration for the given measurement property. You can configure measurements to be kept at the edge or forwarded to the Amazon Web Services Cloud. By default, measurements are forwarded to the cloud.
The forwarding configuration for the given measurement property.
The forwarding state for the given property.
Specifies an asset transform property. A transform contains a mathematical expression that maps a property's data points from one form to another, such as a unit conversion from Celsius to Fahrenheit.
The mathematical expression that defines the transformation function. You can specify up to 10 variables per expression. You can specify up to 10 functions per expression.
For more information, see Quotas in the IoT SiteWise User Guide .
The list of variables used in the expression.
Contains expression variable information.
The friendly name of the variable to be used in the expression.
The variable that identifies an asset property from which to use values.
The ID of the property to use as the variable. You can use the property name
if it's from the same asset model.
The ID of the hierarchy to query for the property ID. You can use the hierarchy's name instead of the hierarchy's ID.
You use a hierarchy ID instead of a model ID because you can have several hierarchies using the same model and therefore the same propertyId
. For example, you might have separately grouped assets that come from the same asset model. For more information, see Asset hierarchies in the IoT SiteWise User Guide .
The processing configuration for the given transform property. You can configure transforms to be kept at the edge or forwarded to the Amazon Web Services Cloud. You can also configure transforms to be computed at the edge or in the cloud.
The compute location for the given transform property.
The forwarding configuration for a given property.
The forwarding state for the given property.
Specifies an asset metric property. A metric contains a mathematical expression that uses aggregate functions to process all input data points over a time interval and output a single data point, such as to calculate the average hourly temperature.
The mathematical expression that defines the metric aggregation function. You can specify up to 10 variables per expression. You can specify up to 10 functions per expression.
For more information, see Quotas in the IoT SiteWise User Guide .
The list of variables used in the expression.
Contains expression variable information.
The friendly name of the variable to be used in the expression.
The variable that identifies an asset property from which to use values.
The ID of the property to use as the variable. You can use the property name
if it's from the same asset model.
The ID of the hierarchy to query for the property ID. You can use the hierarchy's name instead of the hierarchy's ID.
You use a hierarchy ID instead of a model ID because you can have several hierarchies using the same model and therefore the same propertyId
. For example, you might have separately grouped assets that come from the same asset model. For more information, see Asset hierarchies in the IoT SiteWise User Guide .
The window (time interval) over which IoT SiteWise computes the metric's aggregation expression. IoT SiteWise computes one data point per window
.
The tumbling time interval window.
The time interval for the tumbling window. The interval time must be between 1 minute and 1 week.
IoT SiteWise computes the 1w
interval the end of Sunday at midnight each week (UTC), the 1d
interval at the end of each day at midnight (UTC), the 1h
interval at the end of each hour, and so on.
When IoT SiteWise aggregates data points for metric computations, the start of each interval is exclusive and the end of each interval is inclusive. IoT SiteWise places the computed data point at the end of the interval.
The offset for the tumbling window. The offset
parameter accepts the following:
18h
for offset
and 1d
for interval
, IoT SiteWise aggregates data in one of the following ways:PT18H
for offset
and 1d
for interval
, IoT SiteWise aggregates data in one of the following ways:00:03:00
for offset
, 5m
for interval
, and you create the metric at 2 PM (UTC), you get the first aggregation result at 2:03 PM (UTC). You get the second aggregation result at 2:08 PM (UTC).2021-07-23T18:00-08
for offset
and 1d
for interval
, IoT SiteWise aggregates data in one of the following ways:The processing configuration for the given metric property. You can configure metrics to be computed at the edge or in the Amazon Web Services Cloud. By default, metrics are forwarded to the cloud.
The compute location for the given metric property.
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.
This field is autopopulated if not provided.
A list of key-value pairs that contain metadata for the asset model. For more information, see Tagging your IoT SiteWise resources in the IoT SiteWise User Guide .
dict
Response Syntax
{
'assetModelId': 'string',
'assetModelArn': 'string',
'assetModelStatus': {
'state': 'CREATING'|'ACTIVE'|'UPDATING'|'PROPAGATING'|'DELETING'|'FAILED',
'error': {
'code': 'VALIDATION_ERROR'|'INTERNAL_FAILURE',
'message': 'string',
'details': [
{
'code': 'INCOMPATIBLE_COMPUTE_LOCATION'|'INCOMPATIBLE_FORWARDING_CONFIGURATION',
'message': 'string'
},
]
}
}
}
Response Structure
(dict) --
assetModelId (string) --
The ID of the asset model. You can use this ID when you call other IoT SiteWise APIs.
assetModelArn (string) --
The ARN of the asset model, which has the following format.
arn:${Partition}:iotsitewise:${Region}:${Account}:asset-model/${AssetModelId}
assetModelStatus (dict) --
The status of the asset model, which contains a state ( CREATING
after successfully calling this operation) and any error message.
state (string) --
The current state of the asset model.
error (dict) --
Contains associated error information, if any.
code (string) --
The error code.
message (string) --
The error message.
details (list) --
A list of detailed errors.
(dict) --
Contains detailed error information.
code (string) --
The error code.
message (string) --
The error message.
Exceptions
IoTSiteWise.Client.exceptions.InvalidRequestException
IoTSiteWise.Client.exceptions.ResourceAlreadyExistsException
IoTSiteWise.Client.exceptions.ResourceNotFoundException
IoTSiteWise.Client.exceptions.InternalFailureException
IoTSiteWise.Client.exceptions.ThrottlingException
IoTSiteWise.Client.exceptions.LimitExceededException
IoTSiteWise.Client.exceptions.ConflictingOperationException