:doc:`IoTSiteWise <../../iotsitewise>` / Client / update_asset_model

******************
update_asset_model
******************



.. py:method:: IoTSiteWise.Client.update_asset_model(**kwargs)

  

  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 <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/update-assets-and-models.html>`__ in the *IoT SiteWise User Guide*.

   

  .. warning::

     

    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``.
    

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/iotsitewise-2019-12-02/UpdateAssetModel>`_  


  **Request Syntax**
  ::

    response = client.update_asset_model(
        assetModelId='string',
        assetModelExternalId='string',
        assetModelName='string',
        assetModelDescription='string',
        assetModelProperties=[
            {
                'id': 'string',
                'externalId': 'string',
                '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',
                                    'propertyPath': [
                                        {
                                            'id': 'string',
                                            'name': 'string'
                                        },
                                    ]
                                }
                            },
                        ],
                        'processingConfig': {
                            'computeLocation': 'EDGE'|'CLOUD',
                            'forwardingConfig': {
                                'state': 'DISABLED'|'ENABLED'
                            }
                        }
                    },
                    'metric': {
                        'expression': 'string',
                        'variables': [
                            {
                                'name': 'string',
                                'value': {
                                    'propertyId': 'string',
                                    'hierarchyId': 'string',
                                    'propertyPath': [
                                        {
                                            'id': 'string',
                                            'name': 'string'
                                        },
                                    ]
                                }
                            },
                        ],
                        'window': {
                            'tumbling': {
                                'interval': 'string',
                                'offset': 'string'
                            }
                        },
                        'processingConfig': {
                            'computeLocation': 'EDGE'|'CLOUD'
                        }
                    }
                },
                'path': [
                    {
                        'id': 'string',
                        'name': 'string'
                    },
                ]
            },
        ],
        assetModelHierarchies=[
            {
                'id': 'string',
                'externalId': 'string',
                'name': 'string',
                'childAssetModelId': 'string'
            },
        ],
        assetModelCompositeModels=[
            {
                'name': 'string',
                'description': 'string',
                'type': 'string',
                'properties': [
                    {
                        'id': 'string',
                        'externalId': 'string',
                        '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',
                                            'propertyPath': [
                                                {
                                                    'id': 'string',
                                                    'name': 'string'
                                                },
                                            ]
                                        }
                                    },
                                ],
                                'processingConfig': {
                                    'computeLocation': 'EDGE'|'CLOUD',
                                    'forwardingConfig': {
                                        'state': 'DISABLED'|'ENABLED'
                                    }
                                }
                            },
                            'metric': {
                                'expression': 'string',
                                'variables': [
                                    {
                                        'name': 'string',
                                        'value': {
                                            'propertyId': 'string',
                                            'hierarchyId': 'string',
                                            'propertyPath': [
                                                {
                                                    'id': 'string',
                                                    'name': 'string'
                                                },
                                            ]
                                        }
                                    },
                                ],
                                'window': {
                                    'tumbling': {
                                        'interval': 'string',
                                        'offset': 'string'
                                    }
                                },
                                'processingConfig': {
                                    'computeLocation': 'EDGE'|'CLOUD'
                                }
                            }
                        },
                        'path': [
                            {
                                'id': 'string',
                                'name': 'string'
                            },
                        ]
                    },
                ],
                'id': 'string',
                'externalId': 'string'
            },
        ],
        clientToken='string',
        ifMatch='string',
        ifNoneMatch='string',
        matchForVersionType='LATEST'|'ACTIVE'
    )
    
  :type assetModelId: string
  :param assetModelId: **[REQUIRED]** 

    The ID of the asset model to update. 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 <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-id-references>`__ in the *IoT SiteWise User Guide*.

    

  
  :type assetModelExternalId: string
  :param assetModelExternalId: 

    An external ID to assign to the asset model. The asset model must not already have an external ID. The external ID must be unique within your Amazon Web Services account. For more information, see `Using external IDs <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-ids>`__ in the *IoT SiteWise User Guide*.

    

  
  :type assetModelName: string
  :param assetModelName: **[REQUIRED]** 

    A unique name for the asset model.

    

  
  :type assetModelDescription: string
  :param assetModelDescription: 

    A description for the asset model.

    

  
  :type assetModelProperties: list
  :param assetModelProperties: 

    The updated property definitions of the asset model. For more information, see `Asset properties <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/asset-properties.html>`__ in the *IoT SiteWise User Guide*.

     

    You can specify up to 200 properties per asset model. For more information, see `Quotas <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/quotas.html>`__ in the *IoT SiteWise User Guide*.

    

  
    - *(dict) --* 

      Contains information about an asset model property.

      

    
      - **id** *(string) --* 

        The ID of the asset model property.

         

        
        * If you are callling `UpdateAssetModel <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_UpdateAssetModel.html>`__ to create a *new* property: You can specify its ID here, if desired. IoT SiteWise automatically generates a unique ID for you, so this parameter is never required. However, if you prefer to supply your own ID instead, you can specify it here in UUID format. If you specify your own ID, it must be globally unique.
         
        * If you are calling UpdateAssetModel to modify an *existing* property: 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 <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-id-references>`__ in the *IoT SiteWise User Guide*.
        

        

      
      - **externalId** *(string) --* 

        The external ID (if any) provided in the `CreateAssetModel <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_CreateAssetModel.html>`__ or `UpdateAssetModel <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_UpdateAssetModel.html>`__ operation. You can assign an external ID by specifying this value as part of a call to `UpdateAssetModel <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_UpdateAssetModel.html>`__. However, you can't change the external ID if one is already assigned. For more information, see `Using external IDs <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-ids>`__ in the *IoT SiteWise User Guide*.

        

      
      - **name** *(string) --* **[REQUIRED]** 

        The name of the asset model property.

        

      
      - **dataType** *(string) --* **[REQUIRED]** 

        The data type of the asset model property.

         

        If you specify ``STRUCT``, you must also specify ``dataTypeSpec`` to identify the type of the structure for this property.

        

      
      - **dataTypeSpec** *(string) --* 

        The data type of the structure for this property. This parameter exists on properties that have the ``STRUCT`` data type.

        

      
      - **unit** *(string) --* 

        The unit of the asset model property, such as ``Newtons`` or ``RPM``.

        

      
      - **type** *(dict) --* **[REQUIRED]** 

        The property type (see ``PropertyType``).

        

      
        - **attribute** *(dict) --* 

          Specifies an asset attribute property. An attribute generally contains static information, such as the serial number of an `IIoT <https://en.wikipedia.org/wiki/Internet_of_things#Industrial_applications>`__ wind turbine.

          

        
          - **defaultValue** *(string) --* 

            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 <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/update-attribute-values.html>`__ in the *IoT SiteWise User Guide*.

            

          
        
        - **measurement** *(dict) --* 

          Specifies an asset measurement property. A measurement represents a device's raw sensor data stream, such as timestamped temperature values or timestamped power values.

          

        
          - **processingConfig** *(dict) --* 

            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.

            

          
            - **forwardingConfig** *(dict) --* **[REQUIRED]** 

              The forwarding configuration for the given measurement property.

              

            
              - **state** *(string) --* **[REQUIRED]** 

                The forwarding state for the given property.

                

              
            
          
        
        - **transform** *(dict) --* 

          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.

          

        
          - **expression** *(string) --* **[REQUIRED]** 

            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 <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/quotas.html>`__ in the *IoT SiteWise User Guide*.

            

          
          - **variables** *(list) --* **[REQUIRED]** 

            The list of variables used in the expression.

            

          
            - *(dict) --* 

              Contains expression variable information.

              

            
              - **name** *(string) --* **[REQUIRED]** 

                The friendly name of the variable to be used in the expression.

                

              
              - **value** *(dict) --* **[REQUIRED]** 

                The variable that identifies an asset property from which to use values.

                

              
                - **propertyId** *(string) --* 

                  The ID of the property to use as the variable. You can use the property ``name`` if it's from the same asset model. If the property has an external ID, you can specify ``externalId:`` followed by the external ID. For more information, see `Using external IDs <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-ids>`__ in the *IoT SiteWise User Guide*.

                  

                
                - **hierarchyId** *(string) --* 

                  The ID of the hierarchy to query for the property ID. You can use the hierarchy's name instead of the hierarchy's ID. If the hierarchy has an external ID, you can specify ``externalId:`` followed by the external ID. For more information, see `Using external IDs <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-ids>`__ in the *IoT SiteWise User Guide*.

                   

                  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 <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/asset-hierarchies.html>`__ in the *IoT SiteWise User Guide*.

                  

                
                - **propertyPath** *(list) --* 

                  The path of the property.

                  

                
                  - *(dict) --* 

                    Represents one level between a property and the root of the asset model.

                    

                  
                    - **id** *(string) --* 

                      The ID of the path segment.

                      

                    
                    - **name** *(string) --* 

                      The name of the path segment.

                      

                    
                  
              
              
            
        
          - **processingConfig** *(dict) --* 

            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.

            

          
            - **computeLocation** *(string) --* **[REQUIRED]** 

              The compute location for the given transform property.

              

            
            - **forwardingConfig** *(dict) --* 

              The forwarding configuration for a given property.

              

            
              - **state** *(string) --* **[REQUIRED]** 

                The forwarding state for the given property.

                

              
            
          
        
        - **metric** *(dict) --* 

          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.

          

        
          - **expression** *(string) --* 

            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 <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/quotas.html>`__ in the *IoT SiteWise User Guide*.

            

          
          - **variables** *(list) --* 

            The list of variables used in the expression.

            

          
            - *(dict) --* 

              Contains expression variable information.

              

            
              - **name** *(string) --* **[REQUIRED]** 

                The friendly name of the variable to be used in the expression.

                

              
              - **value** *(dict) --* **[REQUIRED]** 

                The variable that identifies an asset property from which to use values.

                

              
                - **propertyId** *(string) --* 

                  The ID of the property to use as the variable. You can use the property ``name`` if it's from the same asset model. If the property has an external ID, you can specify ``externalId:`` followed by the external ID. For more information, see `Using external IDs <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-ids>`__ in the *IoT SiteWise User Guide*.

                  

                
                - **hierarchyId** *(string) --* 

                  The ID of the hierarchy to query for the property ID. You can use the hierarchy's name instead of the hierarchy's ID. If the hierarchy has an external ID, you can specify ``externalId:`` followed by the external ID. For more information, see `Using external IDs <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-ids>`__ in the *IoT SiteWise User Guide*.

                   

                  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 <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/asset-hierarchies.html>`__ in the *IoT SiteWise User Guide*.

                  

                
                - **propertyPath** *(list) --* 

                  The path of the property.

                  

                
                  - *(dict) --* 

                    Represents one level between a property and the root of the asset model.

                    

                  
                    - **id** *(string) --* 

                      The ID of the path segment.

                      

                    
                    - **name** *(string) --* 

                      The name of the path segment.

                      

                    
                  
              
              
            
        
          - **window** *(dict) --* **[REQUIRED]** 

            The window (time interval) over which IoT SiteWise computes the metric's aggregation expression. IoT SiteWise computes one data point per ``window``.

            

          
            - **tumbling** *(dict) --* 

              The tumbling time interval window.

              

            
              - **interval** *(string) --* **[REQUIRED]** 

                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.

                

              
              - **offset** *(string) --* 

                The offset for the tumbling window. The ``offset`` parameter accepts the following:

                 

                
                * The offset time. For example, if you specify ``18h`` for ``offset`` and ``1d`` for ``interval``, IoT SiteWise aggregates data in one of the following ways: 

                  
                  * If you create the metric before or at 6 PM (UTC), you get the first aggregation result at 6 PM (UTC) on the day when you create the metric.
                   
                  * If you create the metric after 6 PM (UTC), you get the first aggregation result at 6 PM (UTC) the next day.
                  

                
                 
                * The ISO 8601 format. For example, if you specify ``PT18H`` for ``offset`` and ``1d`` for ``interval``, IoT SiteWise aggregates data in one of the following ways: 

                  
                  * If you create the metric before or at 6 PM (UTC), you get the first aggregation result at 6 PM (UTC) on the day when you create the metric.
                   
                  * If you create the metric after 6 PM (UTC), you get the first aggregation result at 6 PM (UTC) the next day.
                  

                
                 
                * The 24-hour clock. For example, if you specify ``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).
                 
                * The offset time zone. For example, if you specify ``2021-07-23T18:00-08`` for ``offset`` and ``1d`` for ``interval``, IoT SiteWise aggregates data in one of the following ways: 

                  
                  * If you create the metric before or at 6 PM (PST), you get the first aggregation result at 6 PM (PST) on the day when you create the metric.
                   
                  * If you create the metric after 6 PM (PST), you get the first aggregation result at 6 PM (PST) the next day.
                  

                
                

                

              
            
          
          - **processingConfig** *(dict) --* 

            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.

            

          
            - **computeLocation** *(string) --* **[REQUIRED]** 

              The compute location for the given metric property.

              

            
          
        
      
      - **path** *(list) --* 

        The structured path to the property from the root of the asset model.

        

      
        - *(dict) --* 

          Represents one level between a property and the root of the asset model.

          

        
          - **id** *(string) --* 

            The ID of the path segment.

            

          
          - **name** *(string) --* 

            The name of the path segment.

            

          
        
    
    

  :type assetModelHierarchies: list
  :param assetModelHierarchies: 

    The updated 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 <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/asset-hierarchies.html>`__ in the *IoT SiteWise User Guide*.

     

    You can specify up to 10 hierarchies per asset model. For more information, see `Quotas <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/quotas.html>`__ in the *IoT SiteWise User Guide*.

    

  
    - *(dict) --* 

      Describes an asset hierarchy that contains a hierarchy's name, ID, and child asset model ID that specifies the type of asset that can be in this hierarchy.

      

    
      - **id** *(string) --* 

        The ID of the asset model hierarchy. This ID is a ``hierarchyId``.

         

        
        * If you are callling `UpdateAssetModel <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_UpdateAssetModel.html>`__ to create a *new* hierarchy: You can specify its ID here, if desired. IoT SiteWise automatically generates a unique ID for you, so this parameter is never required. However, if you prefer to supply your own ID instead, you can specify it here in UUID format. If you specify your own ID, it must be globally unique.
         
        * If you are calling UpdateAssetModel to modify an *existing* hierarchy: 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 <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-id-references>`__ in the *IoT SiteWise User Guide*.
        

        

      
      - **externalId** *(string) --* 

        The external ID (if any) provided in the `CreateAssetModel <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_CreateAssetModel.html>`__ or `UpdateAssetModel <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_UpdateAssetModel.html>`__ operation. You can assign an external ID by specifying this value as part of a call to `UpdateAssetModel <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_UpdateAssetModel.html>`__. However, you can't change the external ID if one is already assigned. For more information, see `Using external IDs <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-ids>`__ in the *IoT SiteWise User Guide*.

        

      
      - **name** *(string) --* **[REQUIRED]** 

        The name of the asset model hierarchy that you specify by using the `CreateAssetModel <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_CreateAssetModel.html>`__ or `UpdateAssetModel <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_UpdateAssetModel.html>`__ API operation.

        

      
      - **childAssetModelId** *(string) --* **[REQUIRED]** 

        The ID of the asset model, in UUID format. All assets in this hierarchy must be instances of the ``childAssetModelId`` asset model. IoT SiteWise will always return the actual asset model ID for this value. However, when you are specifying this value as part of a call to `UpdateAssetModel <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_UpdateAssetModel.html>`__, you may provide either the asset model ID or else ``externalId:`` followed by the asset model's external ID. For more information, see `Using external IDs <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-ids>`__ in the *IoT SiteWise User Guide*.

        

      
    

  :type assetModelCompositeModels: list
  :param assetModelCompositeModels: 

    The composite models that are part of this asset model. It groups properties (such as attributes, measurements, transforms, and metrics) and child composite models that model parts of your industrial equipment. Each composite model has a type that defines the properties that the composite model supports. Use composite models to define alarms on this asset model.

     

    .. note::

      

      When creating custom composite models, you need to use `CreateAssetModelCompositeModel <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_CreateAssetModelCompositeModel.html>`__. For more information, see `Creating custom composite models (Components) <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/create-custom-composite-models.html>`__ in the *IoT SiteWise User Guide*.

      

    

  
    - *(dict) --* 

      Contains information about a composite model in an asset model. This object contains the asset property definitions that you define in the composite model.

      

    
      - **name** *(string) --* **[REQUIRED]** 

        The name of the composite model.

        

      
      - **description** *(string) --* 

        The description of the composite model.

        

      
      - **type** *(string) --* **[REQUIRED]** 

        The type of the composite model. For alarm composite models, this type is ``AWS/ALARM``.

        

      
      - **properties** *(list) --* 

        The asset property definitions for this composite model.

        

      
        - *(dict) --* 

          Contains information about an asset model property.

          

        
          - **id** *(string) --* 

            The ID of the asset model property.

             

            
            * If you are callling `UpdateAssetModel <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_UpdateAssetModel.html>`__ to create a *new* property: You can specify its ID here, if desired. IoT SiteWise automatically generates a unique ID for you, so this parameter is never required. However, if you prefer to supply your own ID instead, you can specify it here in UUID format. If you specify your own ID, it must be globally unique.
             
            * If you are calling UpdateAssetModel to modify an *existing* property: 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 <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-id-references>`__ in the *IoT SiteWise User Guide*.
            

            

          
          - **externalId** *(string) --* 

            The external ID (if any) provided in the `CreateAssetModel <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_CreateAssetModel.html>`__ or `UpdateAssetModel <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_UpdateAssetModel.html>`__ operation. You can assign an external ID by specifying this value as part of a call to `UpdateAssetModel <https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_UpdateAssetModel.html>`__. However, you can't change the external ID if one is already assigned. For more information, see `Using external IDs <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-ids>`__ in the *IoT SiteWise User Guide*.

            

          
          - **name** *(string) --* **[REQUIRED]** 

            The name of the asset model property.

            

          
          - **dataType** *(string) --* **[REQUIRED]** 

            The data type of the asset model property.

             

            If you specify ``STRUCT``, you must also specify ``dataTypeSpec`` to identify the type of the structure for this property.

            

          
          - **dataTypeSpec** *(string) --* 

            The data type of the structure for this property. This parameter exists on properties that have the ``STRUCT`` data type.

            

          
          - **unit** *(string) --* 

            The unit of the asset model property, such as ``Newtons`` or ``RPM``.

            

          
          - **type** *(dict) --* **[REQUIRED]** 

            The property type (see ``PropertyType``).

            

          
            - **attribute** *(dict) --* 

              Specifies an asset attribute property. An attribute generally contains static information, such as the serial number of an `IIoT <https://en.wikipedia.org/wiki/Internet_of_things#Industrial_applications>`__ wind turbine.

              

            
              - **defaultValue** *(string) --* 

                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 <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/update-attribute-values.html>`__ in the *IoT SiteWise User Guide*.

                

              
            
            - **measurement** *(dict) --* 

              Specifies an asset measurement property. A measurement represents a device's raw sensor data stream, such as timestamped temperature values or timestamped power values.

              

            
              - **processingConfig** *(dict) --* 

                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.

                

              
                - **forwardingConfig** *(dict) --* **[REQUIRED]** 

                  The forwarding configuration for the given measurement property.

                  

                
                  - **state** *(string) --* **[REQUIRED]** 

                    The forwarding state for the given property.

                    

                  
                
              
            
            - **transform** *(dict) --* 

              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.

              

            
              - **expression** *(string) --* **[REQUIRED]** 

                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 <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/quotas.html>`__ in the *IoT SiteWise User Guide*.

                

              
              - **variables** *(list) --* **[REQUIRED]** 

                The list of variables used in the expression.

                

              
                - *(dict) --* 

                  Contains expression variable information.

                  

                
                  - **name** *(string) --* **[REQUIRED]** 

                    The friendly name of the variable to be used in the expression.

                    

                  
                  - **value** *(dict) --* **[REQUIRED]** 

                    The variable that identifies an asset property from which to use values.

                    

                  
                    - **propertyId** *(string) --* 

                      The ID of the property to use as the variable. You can use the property ``name`` if it's from the same asset model. If the property has an external ID, you can specify ``externalId:`` followed by the external ID. For more information, see `Using external IDs <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-ids>`__ in the *IoT SiteWise User Guide*.

                      

                    
                    - **hierarchyId** *(string) --* 

                      The ID of the hierarchy to query for the property ID. You can use the hierarchy's name instead of the hierarchy's ID. If the hierarchy has an external ID, you can specify ``externalId:`` followed by the external ID. For more information, see `Using external IDs <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-ids>`__ in the *IoT SiteWise User Guide*.

                       

                      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 <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/asset-hierarchies.html>`__ in the *IoT SiteWise User Guide*.

                      

                    
                    - **propertyPath** *(list) --* 

                      The path of the property.

                      

                    
                      - *(dict) --* 

                        Represents one level between a property and the root of the asset model.

                        

                      
                        - **id** *(string) --* 

                          The ID of the path segment.

                          

                        
                        - **name** *(string) --* 

                          The name of the path segment.

                          

                        
                      
                  
                  
                
            
              - **processingConfig** *(dict) --* 

                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.

                

              
                - **computeLocation** *(string) --* **[REQUIRED]** 

                  The compute location for the given transform property.

                  

                
                - **forwardingConfig** *(dict) --* 

                  The forwarding configuration for a given property.

                  

                
                  - **state** *(string) --* **[REQUIRED]** 

                    The forwarding state for the given property.

                    

                  
                
              
            
            - **metric** *(dict) --* 

              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.

              

            
              - **expression** *(string) --* 

                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 <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/quotas.html>`__ in the *IoT SiteWise User Guide*.

                

              
              - **variables** *(list) --* 

                The list of variables used in the expression.

                

              
                - *(dict) --* 

                  Contains expression variable information.

                  

                
                  - **name** *(string) --* **[REQUIRED]** 

                    The friendly name of the variable to be used in the expression.

                    

                  
                  - **value** *(dict) --* **[REQUIRED]** 

                    The variable that identifies an asset property from which to use values.

                    

                  
                    - **propertyId** *(string) --* 

                      The ID of the property to use as the variable. You can use the property ``name`` if it's from the same asset model. If the property has an external ID, you can specify ``externalId:`` followed by the external ID. For more information, see `Using external IDs <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-ids>`__ in the *IoT SiteWise User Guide*.

                      

                    
                    - **hierarchyId** *(string) --* 

                      The ID of the hierarchy to query for the property ID. You can use the hierarchy's name instead of the hierarchy's ID. If the hierarchy has an external ID, you can specify ``externalId:`` followed by the external ID. For more information, see `Using external IDs <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-ids>`__ in the *IoT SiteWise User Guide*.

                       

                      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 <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/asset-hierarchies.html>`__ in the *IoT SiteWise User Guide*.

                      

                    
                    - **propertyPath** *(list) --* 

                      The path of the property.

                      

                    
                      - *(dict) --* 

                        Represents one level between a property and the root of the asset model.

                        

                      
                        - **id** *(string) --* 

                          The ID of the path segment.

                          

                        
                        - **name** *(string) --* 

                          The name of the path segment.

                          

                        
                      
                  
                  
                
            
              - **window** *(dict) --* **[REQUIRED]** 

                The window (time interval) over which IoT SiteWise computes the metric's aggregation expression. IoT SiteWise computes one data point per ``window``.

                

              
                - **tumbling** *(dict) --* 

                  The tumbling time interval window.

                  

                
                  - **interval** *(string) --* **[REQUIRED]** 

                    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.

                    

                  
                  - **offset** *(string) --* 

                    The offset for the tumbling window. The ``offset`` parameter accepts the following:

                     

                    
                    * The offset time. For example, if you specify ``18h`` for ``offset`` and ``1d`` for ``interval``, IoT SiteWise aggregates data in one of the following ways: 

                      
                      * If you create the metric before or at 6 PM (UTC), you get the first aggregation result at 6 PM (UTC) on the day when you create the metric.
                       
                      * If you create the metric after 6 PM (UTC), you get the first aggregation result at 6 PM (UTC) the next day.
                      

                    
                     
                    * The ISO 8601 format. For example, if you specify ``PT18H`` for ``offset`` and ``1d`` for ``interval``, IoT SiteWise aggregates data in one of the following ways: 

                      
                      * If you create the metric before or at 6 PM (UTC), you get the first aggregation result at 6 PM (UTC) on the day when you create the metric.
                       
                      * If you create the metric after 6 PM (UTC), you get the first aggregation result at 6 PM (UTC) the next day.
                      

                    
                     
                    * The 24-hour clock. For example, if you specify ``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).
                     
                    * The offset time zone. For example, if you specify ``2021-07-23T18:00-08`` for ``offset`` and ``1d`` for ``interval``, IoT SiteWise aggregates data in one of the following ways: 

                      
                      * If you create the metric before or at 6 PM (PST), you get the first aggregation result at 6 PM (PST) on the day when you create the metric.
                       
                      * If you create the metric after 6 PM (PST), you get the first aggregation result at 6 PM (PST) the next day.
                      

                    
                    

                    

                  
                
              
              - **processingConfig** *(dict) --* 

                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.

                

              
                - **computeLocation** *(string) --* **[REQUIRED]** 

                  The compute location for the given metric property.

                  

                
              
            
          
          - **path** *(list) --* 

            The structured path to the property from the root of the asset model.

            

          
            - *(dict) --* 

              Represents one level between a property and the root of the asset model.

              

            
              - **id** *(string) --* 

                The ID of the path segment.

                

              
              - **name** *(string) --* 

                The name of the path segment.

                

              
            
        
        
    
      - **id** *(string) --* 

        The ID of the asset model composite model.

        

      
      - **externalId** *(string) --* 

        The external ID of the asset model composite model. For more information, see `Using external IDs <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/object-ids.html#external-ids>`__ in the *IoT SiteWise User Guide*.

        

      
    

  :type clientToken: string
  :param clientToken: 

    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.

  
  :type ifMatch: string
  :param ifMatch: 

    The expected current entity tag (ETag) for the asset model’s latest or active version (specified using ``matchForVersionType``). The update 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 <https://docs.aws.amazon.com/iot-sitewise/latest/userguide/opt-locking-for-model.html>`__ in the *IoT SiteWise User Guide*.

    

  
  :type ifNoneMatch: string
  :param ifNoneMatch: 

    Accepts ***** to reject the update request if an active version (specified using ``matchForVersionType`` as ``ACTIVE``) already exists for the asset model.

    

  
  :type matchForVersionType: string
  :param matchForVersionType: 

    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 update operation.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          '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) --* 
      

      - **assetModelStatus** *(dict) --* 

        The status of the asset model, which contains a state ( ``UPDATING`` 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**
  
  *   :py:class:`IoTSiteWise.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`IoTSiteWise.Client.exceptions.ResourceAlreadyExistsException`

  
  *   :py:class:`IoTSiteWise.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`IoTSiteWise.Client.exceptions.InternalFailureException`

  
  *   :py:class:`IoTSiteWise.Client.exceptions.LimitExceededException`

  
  *   :py:class:`IoTSiteWise.Client.exceptions.ThrottlingException`

  
  *   :py:class:`IoTSiteWise.Client.exceptions.ConflictingOperationException`

  
  *   :py:class:`IoTSiteWise.Client.exceptions.PreconditionFailedException`

  