Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

Note: You are viewing the documentation for an older major version of the AWS CLI (version 1).

AWS CLI version 2, the latest major version of AWS CLI, is now stable and recommended for general use. To view this page for the AWS CLI version 2, click here. For more information see the AWS CLI version 2 installation instructions and migration guide.

[ aws . iotsitewise ]

update-asset-model

Description

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 AWS IoT SiteWise User Guide .

Warning

This operation overwrites the existing model with the provided model. To avoid deleting your asset model's properties or hierarchies, you must include their IDs and definitions in the updated asset model payload. For more information, see DescribeAssetModel .

If you remove a property from an asset model or update a property's formula expression, AWS IoT SiteWise deletes all previous data for that property. If you remove a hierarchy definition from an asset model, AWS IoT SiteWise disassociates every asset associated with that hierarchy. You can't change the type or data type of an existing property.

See also: AWS API Documentation

See 'aws help' for descriptions of global parameters.

Synopsis

  update-asset-model
--asset-model-id <value>
--asset-model-name <value>
[--asset-model-description <value>]
[--asset-model-properties <value>]
[--asset-model-hierarchies <value>]
[--client-token <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Options

--asset-model-id (string)

The ID of the asset model to update.

--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 (list)

The updated property definitions of the asset model. For more information, see Asset Properties in the AWS IoT SiteWise User Guide .

You can specify up to 200 properties per asset model. For more information, see Quotas in the AWS IoT SiteWise User Guide .

JSON Syntax:

[
  {
    "id": "string",
    "name": "string",
    "dataType": "STRING"|"INTEGER"|"DOUBLE"|"BOOLEAN",
    "unit": "string",
    "type": {
      "attribute": {
        "defaultValue": "string"
      },
      "measurement": {

      },
      "transform": {
        "expression": "string",
        "variables": [
          {
            "name": "string",
            "value": {
              "propertyId": "string",
              "hierarchyId": "string"
            }
          }
          ...
        ]
      },
      "metric": {
        "expression": "string",
        "variables": [
          {
            "name": "string",
            "value": {
              "propertyId": "string",
              "hierarchyId": "string"
            }
          }
          ...
        ],
        "window": {
          "tumbling": {
            "interval": "string"
          }
        }
      }
    }
  }
  ...
]

--asset-model-hierarchies (list)

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 in the AWS IoT SiteWise User Guide .

You can specify up to 10 hierarchies per asset model. For more information, see Quotas in the AWS IoT SiteWise User Guide .

Shorthand Syntax:

id=string,name=string,childAssetModelId=string ...

JSON Syntax:

[
  {
    "id": "string",
    "name": "string",
    "childAssetModelId": "string"
  }
  ...
]

--client-token (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.

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

See 'aws help' for descriptions of global parameters.

Examples

To update an asset model

The following update-asset-model example updates a wind farm asset model's description. This example includes the model's existing IDs and definitions, because update-asset-model overwrites the existing model with the new model.

aws iotsitewise update-asset-model \
    --cli-input-json file://update-wind-farm-model.json

Contents of update-wind-farm-model.json:

{
    "assetModelName": "Wind Farm Model",
    "assetModelDescription": "Represents a wind farm that comprises many wind turbines",
    "assetModelProperties": [
        {
            "id": "a1b2c3d4-5678-90ab-cdef-88888EXAMPLE",
            "name": "Region",
            "dataType": "STRING",
            "type": {
                "attribute": {}
            }
        },
        {
            "id": "a1b2c3d4-5678-90ab-cdef-99999EXAMPLE",
            "name": "Total Generated Power",
            "dataType": "DOUBLE",
            "unit": "kW",
            "type": {
                "metric": {
                    "expression": "sum(power)",
                    "variables": [
                        {
                            "name": "power",
                            "value": {
                                "hierarchyId": "a1b2c3d4-5678-90ab-cdef-77777EXAMPLE",
                                "propertyId": "a1b2c3d4-5678-90ab-cdef-66666EXAMPLE"
                            }
                        }
                    ],
                    "window": {
                        "tumbling": {
                            "interval": "1h"
                        }
                    }
                }
            }
        }
    ],
    "assetModelHierarchies": [
        {
            "id": "a1b2c3d4-5678-90ab-cdef-77777EXAMPLE",
            "name": "Wind Turbines",
            "childAssetModelId": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE"
        }
    ]
}

Output:

{
    "assetModelId": "a1b2c3d4-5678-90ab-cdef-22222EXAMPLE",
    "assetModelArn": "arn:aws:iotsitewise:us-west-2:123456789012:asset-model/a1b2c3d4-5678-90ab-cdef-22222EXAMPLE",
    "assetModelStatus": {
        "state": "CREATING"
    }
}

For more information, see Updating asset models in the AWS IoT SiteWise User Guide.

Output

assetModelStatus -> (structure)

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 -> (structure)

Contains associated error information, if any.

code -> (string)

The error code.

message -> (string)

The error message.