

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# AWS IoT SiteWise 使用 的範例 AWS CLI
<a name="cli_iotsitewise_code_examples"></a>

下列程式碼範例示範如何使用 AWS Command Line Interface 搭配 來執行動作和實作常見案例 AWS IoT SiteWise。

*Actions* 是大型程式的程式碼摘錄，必須在內容中執行。雖然動作會告訴您如何呼叫個別服務函數，但您可以在其相關情境中查看內容中的動作。

每個範例均包含完整原始碼的連結，您可在連結中找到如何設定和執行內容中程式碼的相關指示。

**Topics**
+ [動作](#actions)

## 動作
<a name="actions"></a>

### `associate-assets`
<a name="iotsitewise_AssociateAssets_cli_topic"></a>

以下程式碼範例顯示如何使用 `associate-assets`。

**AWS CLI**  
**將子資產與父資產建立關聯**  
下列 `associate-assets` 範例會將風力發電機資產與風力發電廠資產建立關聯，其中風力發電機資產模型以階層形式存在於風力發電廠資產模型中。  

```
aws iotsitewise associate-assets \
    --asset-id a1b2c3d4-5678-90ab-cdef-44444EXAMPLE \
    --hierarchy-id a1b2c3d4-5678-90ab-cdef-77777EXAMPLE \
    --child-asset-id a1b2c3d4-5678-90ab-cdef-33333EXAMPLE
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[將資產建立關聯](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/add-associated-assets.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [AssociateAssets](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/associate-assets.html)。

### `batch-associate-project-assets`
<a name="iotsitewise_BatchAssociateProjectAssets_cli_topic"></a>

以下程式碼範例顯示如何使用 `batch-associate-project-assets`。

**AWS CLI**  
**將資產與專案建立關聯**  
下列 `batch-associate-project-assets` 範例會將風力發電廠資產與專案建立關聯。  

```
aws iotsitewise batch-associate-project-assets \
    --project-id a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE \
    --asset-ids a1b2c3d4-5678-90ab-cdef-44444EXAMPLE
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《AWS IoT SiteWise Monitor 應用程式指南》**中的[將資產新增至專案](https://docs.aws.amazon.com/iot-sitewise/latest/appguide/add-assets-to-projects-sd.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [BatchAssociateProjectAssets](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/batch-associate-project-assets.html)。

### `batch-disassociate-project-assets`
<a name="iotsitewise_BatchDisassociateProjectAssets_cli_topic"></a>

以下程式碼範例顯示如何使用 `batch-disassociate-project-assets`。

**AWS CLI**  
**將資產與專案取消關聯**  
下列 `batch-disassociate-project-assets` 範例會將風力發電廠資產與專案取消關聯。  

```
aws iotsitewise batch-disassociate-project-assets \
    --project-id a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE \
    --asset-ids a1b2c3d4-5678-90ab-cdef-44444EXAMPLE
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《AWS IoT SiteWise Monitor 應用程式指南》**中的[將資產新增至專案](https://docs.aws.amazon.com/iot-sitewise/latest/appguide/add-assets-to-projects-sd.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [BatchDisassociateProjectAssets](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/batch-disassociate-project-assets.html)。

### `batch-put-asset-property-value`
<a name="iotsitewise_BatchPutAssetPropertyValue_cli_topic"></a>

以下程式碼範例顯示如何使用 `batch-put-asset-property-value`。

**AWS CLI**  
**將資料傳送至資產屬性**  
下列 `batch-put-asset-property-value` 範例會將電源和溫度資料傳送至屬性別名識別的資產屬性。  

```
aws iotsitewise batch-put-asset-property-value \
    --cli-input-json file://batch-put-asset-property-value.json
```
`batch-put-asset-property-value.json` 的內容：  

```
{
    "entries": [
        {
            "entryId": "1575691200-company-windfarm-3-turbine-7-power",
            "propertyAlias": "company-windfarm-3-turbine-7-power",
            "propertyValues": [
                {
                    "value": {
                        "doubleValue": 4.92
                    },
                    "timestamp": {
                        "timeInSeconds": 1575691200
                    },
                    "quality": "GOOD"
                }
            ]
        },
        {
            "entryId": "1575691200-company-windfarm-3-turbine-7-temperature",
            "propertyAlias": "company-windfarm-3-turbine-7-temperature",
            "propertyValues": [
                {
                    "value": {
                        "integerValue": 38
                    },
                    "timestamp": {
                        "timeInSeconds": 1575691200
                    }
                }
            ]
        }
    ]
}
```
輸出：  

```
{
    "errorEntries": []
}
```
如需詳細資訊，請參閱 IoT [ SiteWise 使用者指南中的使用 AWS IoT SiteWise API 擷取資料](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/ingest-api.html)。 *AWS IoT SiteWise *  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [BatchPutAssetPropertyValue](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/batch-put-asset-property-value.html)。

### `create-access-policy`
<a name="iotsitewise_CreateAccessPolicy_cli_topic"></a>

以下程式碼範例顯示如何使用 `create-access-policy`。

**AWS CLI**  
**範例 1：授予使用者入口網站的管理存取權**  
下列 `create-access-policy` 範例會建立存取政策，授予使用者對風力發電廠公司 Web 入口網站的管理存取權。  

```
aws iotsitewise create-access-policy \
    --cli-input-json file://create-portal-administrator-access-policy.json
```
`create-portal-administrator-access-policy.json` 的內容：  

```
{
    "accessPolicyIdentity": {
        "user": {
            "id": "a1b2c3d4e5-a1b2c3d4-5678-90ab-cdef-bbbbbEXAMPLE"
        }
    },
    "accessPolicyPermission": "ADMINISTRATOR",
    "accessPolicyResource": {
        "portal": {
            "id": "a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE"
        }
    }
}
```
輸出：  

```
{
    "accessPolicyId": "a1b2c3d4-5678-90ab-cdef-cccccEXAMPLE",
    "accessPolicyArn": "arn:aws:iotsitewise:us-west-2:123456789012:access-policy/a1b2c3d4-5678-90ab-cdef-cccccEXAMPLE"
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[新增或移除入口網站管理員](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/administer-portals.html#portal-change-admins)。  
**範例 2：授予使用者對專案的唯讀存取權**  
下列 `create-access-policy` 範例會建立存取政策，授予使用者對風力發電廠專案的唯讀存取權。  

```
aws iotsitewise create-access-policy \
    --cli-input-json file://create-project-viewer-access-policy.json
```
`create-project-viewer-access-policy.json` 的內容：  

```
{
    "accessPolicyIdentity": {
        "user": {
            "id": "a1b2c3d4e5-a1b2c3d4-5678-90ab-cdef-bbbbbEXAMPLE"
        }
    },
    "accessPolicyPermission": "VIEWER",
    "accessPolicyResource": {
        "project": {
            "id": "a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE"
        }
    }
}
```
輸出：  

```
{
    "accessPolicyId": "a1b2c3d4-5678-90ab-cdef-dddddEXAMPLE",
    "accessPolicyArn": "arn:aws:iotsitewise:us-west-2:123456789012:access-policy/a1b2c3d4-5678-90ab-cdef-dddddEXAMPLE"
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise Monitor 應用程式指南》**中的[指派專案檢視者](https://docs.aws.amazon.com/iot-sitewise/latest/appguide/assign-project-viewers.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [CreateAccessPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/create-access-policy.html)。

### `create-asset-model`
<a name="iotsitewise_CreateAssetModel_cli_topic"></a>

以下程式碼範例顯示如何使用 `create-asset-model`。

**AWS CLI**  
**建立資產模型**  
下列 `create-asset-model` 範例會建立資產模型，以定義具有下列屬性的風力發電機：  
序號 - 風力發電機的序號產生的功率 - 風力發電機發電量資料串流溫度 C - 風力發電機的攝氏溫度資料串流溫度 F - 攝氏轉華氏的對應溫度資料點  

```
aws iotsitewise create-asset-model \
    --cli-input-json file://create-wind-turbine-model.json
```
`create-wind-turbine-model.json` 的內容：  

```
{
    "assetModelName": "Wind Turbine Model",
    "assetModelDescription": "Represents a wind turbine",
    "assetModelProperties": [
        {
            "name": "Serial Number",
            "dataType": "STRING",
            "type": {
                "attribute": {}
            }
        },
        {
            "name": "Generated Power",
            "dataType": "DOUBLE",
            "unit": "kW",
            "type": {
                "measurement": {}
            }
        },
        {
            "name": "Temperature C",
            "dataType": "DOUBLE",
            "unit": "Celsius",
            "type": {
                "measurement": {}
            }
        },
        {
            "name": "Temperature F",
            "dataType": "DOUBLE",
            "unit": "Fahrenheit",
            "type": {
                "transform": {
                    "expression": "temp_c * 9 / 5 + 32",
                    "variables": [
                        {
                            "name": "temp_c",
                            "value": {
                                "propertyId": "Temperature C"
                            }
                        }
                    ]
                }
            }
        },
        {
            "name": "Total Generated Power",
            "dataType": "DOUBLE",
            "unit": "kW",
            "type": {
                "metric": {
                    "expression": "sum(power)",
                    "variables": [
                        {
                            "name": "power",
                            "value": {
                                "propertyId": "Generated Power"
                            }
                        }
                    ],
                    "window": {
                        "tumbling": {
                            "interval": "1h"
                        }
                    }
                }
            }
        }
    ]
}
```
輸出：  

```
{
    "assetModelId": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE",
    "assetModelArn": "arn:aws:iotsitewise:us-west-2:123456789012:asset-model/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE",
    "assetModelStatus": {
        "state": "CREATING"
    }
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[定義資產模型](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/define-models.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [CreateAssetModel](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/create-asset-model.html)。

### `create-asset`
<a name="iotsitewise_CreateAsset_cli_topic"></a>

以下程式碼範例顯示如何使用 `create-asset`。

**AWS CLI**  
**建立資產**  
下列 `create-asset` 範例會從風力發電機資產模型建立風力發電機資產。  

```
aws iotsitewise create-asset \
    --asset-model-id a1b2c3d4-5678-90ab-cdef-11111EXAMPLE \
    --asset-name "Wind Turbine 1"
```
輸出：  

```
{
    "assetId": "a1b2c3d4-5678-90ab-cdef-33333EXAMPLE",
    "assetArn": "arn:aws:iotsitewise:us-west-2:123456789012:asset/a1b2c3d4-5678-90ab-cdef-33333EXAMPLE",
    "assetStatus": {
        "state": "CREATING"
    }
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[建立資產](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/create-assets.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [CreateAsset](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/create-asset.html)。

### `create-dashboard`
<a name="iotsitewise_CreateDashboard_cli_topic"></a>

以下程式碼範例顯示如何使用 `create-dashboard`。

**AWS CLI**  
**建立儀表板**  
下列 `create-dashboard` 範例會建立儀表板，其中的折線圖會顯示風力發電廠產生的總功率。  

```
aws iotsitewise create-dashboard \
    --project-id a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE \
    --dashboard-name "Wind Farm" \
    --dashboard-definition file://create-wind-farm-dashboard.json
```
`create-wind-farm-dashboard.json` 的內容：  

```
{
    "widgets": [
        {
            "type": "monitor-line-chart",
            "title": "Generated Power",
            "x": 0,
            "y": 0,
            "height": 3,
            "width": 3,
            "metrics": [
                {
                    "label": "Power",
                    "type": "iotsitewise",
                    "assetId": "a1b2c3d4-5678-90ab-cdef-44444EXAMPLE",
                    "propertyId": "a1b2c3d4-5678-90ab-cdef-99999EXAMPLE"
                }
            ]
        }
    ]
}
```
輸出：  

```
{
    "dashboardId": "a1b2c3d4-5678-90ab-cdef-fffffEXAMPLE",
    "dashboardArn": "arn:aws:iotsitewise:us-west-2:123456789012:dashboard/a1b2c3d4-5678-90ab-cdef-fffffEXAMPLE"
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[建立儀表板 (CLI)](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/create-dashboards-using-aws-cli.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [CreateDashboard](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/create-dashboard.html)。

### `create-gateway`
<a name="iotsitewise_CreateGateway_cli_topic"></a>

以下程式碼範例顯示如何使用 `create-gateway`。

**AWS CLI**  
**建立閘道**  
下列`create-gateway`範例會建立在 AWS IoT Greengrass 上執行的閘道。  

```
aws iotsitewise create-gateway \
    --gateway-name ExampleCorpGateway \
    --gateway-platform greengrass={groupArn=arn:aws:greengrass:us-west-2:123456789012:/greengrass/groups/a1b2c3d4-5678-90ab-cdef-1b1b1EXAMPLE}
```
輸出：  

```
{
    "gatewayId": "a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE",
    "gatewayArn": "arn:aws:iotsitewise:us-west-2:123456789012:gateway/a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE"
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[設定閘道](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/configure-gateway.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [CreateGateway](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/create-gateway.html)。

### `create-portal`
<a name="iotsitewise_CreatePortal_cli_topic"></a>

以下程式碼範例顯示如何使用 `create-portal`。

**AWS CLI**  
**建立入口網站**  
下列 `create-portal` 範例會為風力發電廠公司建立 Web 入口網站。您只能在啟用 AWS 單一登入的相同區域中建立入口網站。  

```
aws iotsitewise create-portal \
    --portal-name WindFarmPortal \
    --portal-description "A portal that contains wind farm projects for Example Corp." \
    --portal-contact-email support@example.com \
    --role-arn arn:aws:iam::123456789012:role/service-role/MySiteWiseMonitorServiceRole
```
輸出：  

```
{
    "portalId": "a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE",
    "portalArn": "arn:aws:iotsitewise:us-west-2:123456789012:portal/a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE",
    "portalStartUrl": "https://a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE.app.iotsitewise.aws",
    "portalStatus": {
        "state": "CREATING"
    },
    "ssoApplicationId": "ins-a1b2c3d4-EXAMPLE"
}
```
如需詳細資訊，請參閱 IoT [ SiteWise 使用者指南中的 AWS IoT SiteWise Monitor 入門](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/monitor-getting-started.html)和 *AWS IoT SiteWise 使用者指南*中的[啟用 AWS SSO](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/monitor-getting-started.html#monitor-enable-sso)。 *AWS IoT SiteWise *   
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [CreatePortal](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/create-portal.html)。

### `create-project`
<a name="iotsitewise_CreateProject_cli_topic"></a>

以下程式碼範例顯示如何使用 `create-project`。

**AWS CLI**  
**建立專案**  
以下 `create-project` 範例將建立風力發電廠專案。  

```
aws iotsitewise create-project \
    --portal-id a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE \
    --project-name "Wind Farm 1" \
    --project-description "Contains asset visualizations for Wind Farm #1 for Example Corp."
```
輸出：  

```
{
    "projectId": "a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE",
    "projectArn": "arn:aws:iotsitewise:us-west-2:123456789012:project/a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE"
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise Monitor 應用程式指南》**中的[建立專案](https://docs.aws.amazon.com/iot-sitewise/latest/appguide/create-projects.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [CreateProject](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/create-project.html)。

### `delete-access-policy`
<a name="iotsitewise_DeleteAccessPolicy_cli_topic"></a>

以下程式碼範例顯示如何使用 `delete-access-policy`。

**AWS CLI**  
**撤銷使用者對專案或入口網站的存取權**  
下列 `delete-access-policy` 範例會將授予使用者入口網站管理存取權的存取政策予以刪除。  

```
aws iotsitewise delete-access-policy \
    --access-policy-id a1b2c3d4-5678-90ab-cdef-cccccEXAMPLE
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[新增或移除入口網站管理員](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/administer-portals.html#portal-change-admins)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DeleteAccessPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/delete-access-policy.html)。

### `delete-asset-model`
<a name="iotsitewise_DeleteAssetModel_cli_topic"></a>

以下程式碼範例顯示如何使用 `delete-asset-model`。

**AWS CLI**  
**刪除資產模型**  
下列 `delete-asset-model` 範例會刪除風力發電機資產模型。  

```
aws iotsitewise delete-asset-model \
    --asset-model-id a1b2c3d4-5678-90ab-cdef-11111EXAMPLE
```
輸出：  

```
{
    "assetModelStatus": {
        "state": "DELETING"
    }
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[刪除資產模型](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/delete-assets-and-models.html#delete-asset-models)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DeleteAssetModel](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/delete-asset-model.html)。

### `delete-asset`
<a name="iotsitewise_DeleteAsset_cli_topic"></a>

以下程式碼範例顯示如何使用 `delete-asset`。

**AWS CLI**  
**刪除資產**  
下列 `delete-asset` 範例會刪除風力發電機資產。  

```
aws iotsitewise delete-asset \
    --asset-id a1b2c3d4-5678-90ab-cdef-33333EXAMPLE
```
輸出：  

```
{
    "assetStatus": {
        "state": "DELETING"
    }
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[刪除資產](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/delete-assets-and-models.html#delete-assets)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DeleteAsset](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/delete-asset.html)。

### `delete-dashboard`
<a name="iotsitewise_DeleteDashboard_cli_topic"></a>

以下程式碼範例顯示如何使用 `delete-dashboard`。

**AWS CLI**  
**刪除儀表板**  
下列 `delete-dashboard` 範例會刪除風力發電機儀表板。  

```
aws iotsitewise delete-dashboard \
    --dashboard-id a1b2c3d4-5678-90ab-cdef-fffffEXAMPLE
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《AWS IoT SiteWise Monitor 應用程式指南》**中的[刪除儀表板](https://docs.aws.amazon.com/iot-sitewise/latest/appguide/delete-dashboards.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DeleteDashboard](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/delete-dashboard.html)。

### `delete-gateway`
<a name="iotsitewise_DeleteGateway_cli_topic"></a>

以下程式碼範例顯示如何使用 `delete-gateway`。

**AWS CLI**  
**刪除閘道**  
下列 `delete-gateway` 範例會刪除閘道。  

```
aws iotsitewise delete-gateway \
    --gateway-id a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[使用閘道擷取資料](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/gateways.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DeleteGateway](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/delete-gateway.html)。

### `delete-portal`
<a name="iotsitewise_DeletePortal_cli_topic"></a>

以下程式碼範例顯示如何使用 `delete-portal`。

**AWS CLI**  
**刪除入口網站**  
下列 `delete-portal` 範例會刪除風力發電廠公司的 Web 入口網站。  

```
aws iotsitewise delete-portal \
    --portal-id a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE
```
輸出：  

```
{
    "portalStatus": {
        "state": "DELETING"
    }
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[刪除入口網站](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/administer-portals.html#portal-delete-portal)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DeletePortal](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/delete-portal.html)。

### `delete-project`
<a name="iotsitewise_DeleteProject_cli_topic"></a>

以下程式碼範例顯示如何使用 `delete-project`。

**AWS CLI**  
**刪除專案**  
下列 `delete-project` 範例會刪除風力發電廠專案。  

```
aws iotsitewise delete-project \
    --project-id a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《AWS IoT SiteWise Monitor 應用程式指南》**中的[刪除專案](https://docs.aws.amazon.com/iot-sitewise/latest/appguide/delete-projects.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DeleteProject](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/delete-project.html)。

### `describe-access-policy`
<a name="iotsitewise_DescribeAccessPolicy_cli_topic"></a>

以下程式碼範例顯示如何使用 `describe-access-policy`。

**AWS CLI**  
**描述存取政策**  
下列 `describe-access-policy` 範例會描述存取政策，該政策會授予使用者對風力發電廠公司 Web 入口網站的管理存取權。  

```
aws iotsitewise describe-access-policy \
    --access-policy-id a1b2c3d4-5678-90ab-cdef-cccccEXAMPLE
```
輸出：  

```
{
    "accessPolicyId": "a1b2c3d4-5678-90ab-cdef-cccccEXAMPLE",
    "accessPolicyArn": "arn:aws:iotsitewise:us-west-2:123456789012:access-policy/a1b2c3d4-5678-90ab-cdef-cccccEXAMPLE",
    "accessPolicyIdentity": {
        "user": {
            "id": "a1b2c3d4e5-a1b2c3d4-5678-90ab-cdef-bbbbbEXAMPLE"
        }
    },
    "accessPolicyResource": {
        "portal": {
            "id": "a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE"
        }
    },
    "accessPolicyPermission": "ADMINISTRATOR",
    "accessPolicyCreationDate": "2020-02-20T22:35:15.552880124Z",
    "accessPolicyLastUpdateDate": "2020-02-20T22:35:15.552880124Z"
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[新增或移除入口網站管理員](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/administer-portals.html#portal-change-admins)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DescribeAccessPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/describe-access-policy.html)。

### `describe-asset-model`
<a name="iotsitewise_DescribeAssetModel_cli_topic"></a>

以下程式碼範例顯示如何使用 `describe-asset-model`。

**AWS CLI**  
**描述資產模型**  
下列 `describe-asset-model` 範例會描述風力發電廠資產模型。  

```
aws iotsitewise describe-asset-model \
    --asset-model-id a1b2c3d4-5678-90ab-cdef-22222EXAMPLE
```
輸出：  

```
{
    "assetModelId": "a1b2c3d4-5678-90ab-cdef-22222EXAMPLE",
    "assetModelArn": "arn:aws:iotsitewise:us-west-2:123456789012:asset-model/a1b2c3d4-5678-90ab-cdef-22222EXAMPLE",
    "assetModelName": "Wind Farm Model",
    "assetModelDescription": "Represents a wind farm that comprises many wind turbines",
    "assetModelProperties": [
        {
            "id": "a1b2c3d4-5678-90ab-cdef-99999EXAMPLE",
            "name": "Total Generated Power",
            "dataType": "DOUBLE",
            "unit": "kW",
            "type": {
                "metric": {
                    "expression": "sum(power)",
                    "variables": [
                        {
                            "name": "power",
                            "value": {
                                "propertyId": "a1b2c3d4-5678-90ab-cdef-66666EXAMPLE",
                                "hierarchyId": "a1b2c3d4-5678-90ab-cdef-77777EXAMPLE"
                            }
                        }
                    ],
                    "window": {
                        "tumbling": {
                            "interval": "1h"
                        }
                    }
                }
            }
        },
        {
            "id": "a1b2c3d4-5678-90ab-cdef-88888EXAMPLE",
            "name": "Region",
            "dataType": "STRING",
            "type": {
                "attribute": {
                    "defaultValue": " "
                }
            }
        }
    ],
    "assetModelHierarchies": [
        {
            "id": "a1b2c3d4-5678-90ab-cdef-77777EXAMPLE",
            "name": "Wind Turbines",
            "childAssetModelId": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE"
        }
    ],
    "assetModelCreationDate": 1575671284.0,
    "assetModelLastUpdateDate": 1575671988.0,
    "assetModelStatus": {
        "state": "ACTIVE"
    }
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[描述特定資產模型](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/discover-asset-resources.html#describe-asset-model)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DescribeAssetModel](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/describe-asset-model.html)。

### `describe-asset-property`
<a name="iotsitewise_DescribeAssetProperty_cli_topic"></a>

以下程式碼範例顯示如何使用 `describe-asset-property`。

**AWS CLI**  
**描述資產屬性**  
下列 `describe-asset-property` 範例描述風力發電廠資產的總產生功率屬性。  

```
aws iotsitewise describe-asset-property \
    --asset-id a1b2c3d4-5678-90ab-cdef-44444EXAMPLE \
    --property-id a1b2c3d4-5678-90ab-cdef-99999EXAMPLE
```
輸出：  

```
{
    "assetId": "a1b2c3d4-5678-90ab-cdef-44444EXAMPLE",
    "assetName": "Wind Farm 1",
    "assetModelId": "a1b2c3d4-5678-90ab-cdef-22222EXAMPLE",
    "assetProperty": {
        "id": "a1b2c3d4-5678-90ab-cdef-99999EXAMPLE",
        "name": "Total Generated Power",
        "notification": {
            "topic": "$aws/sitewise/asset-models/a1b2c3d4-5678-90ab-cdef-22222EXAMPLE/assets/a1b2c3d4-5678-90ab-cdef-44444EXAMPLE/properties/a1b2c3d4-5678-90ab-cdef-99999EXAMPLE",
            "state": "DISABLED"
        },
        "dataType": "DOUBLE",
        "unit": "kW",
        "type": {
            "metric": {
                "expression": "sum(power)",
                "variables": [
                    {
                        "name": "power",
                        "value": {
                            "propertyId": "a1b2c3d4-5678-90ab-cdef-66666EXAMPLE",
                            "hierarchyId": "a1b2c3d4-5678-90ab-cdef-77777EXAMPLE"
                        }
                    }
                ],
                "window": {
                    "tumbling": {
                        "interval": "1h"
                    }
                }
            }
        }
    }
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[描述特定資產屬性](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/discover-asset-resources.html#describe-asset-property)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DescribeAssetProperty](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/describe-asset-property.html)。

### `describe-asset`
<a name="iotsitewise_DescribeAsset_cli_topic"></a>

以下程式碼範例顯示如何使用 `describe-asset`。

**AWS CLI**  
**描述資產**  
下列 `describe-asset` 範例會描述風力發電廠資產。  

```
aws iotsitewise describe-asset \
    --asset-id a1b2c3d4-5678-90ab-cdef-44444EXAMPLE
```
輸出：  

```
{
    "assetId": "a1b2c3d4-5678-90ab-cdef-44444EXAMPLE",
    "assetArn": "arn:aws:iotsitewise:us-west-2:123456789012:asset/a1b2c3d4-5678-90ab-cdef-44444EXAMPLE",
    "assetName": "Wind Farm 1",
    "assetModelId": "a1b2c3d4-5678-90ab-cdef-22222EXAMPLE",
    "assetProperties": [
        {
            "id": "a1b2c3d4-5678-90ab-cdef-88888EXAMPLE",
            "name": "Region",
            "dataType": "STRING"
        },
        {
            "id": "a1b2c3d4-5678-90ab-cdef-99999EXAMPLE",
            "name": "Total Generated Power",
            "dataType": "DOUBLE",
            "unit": "kW"
        }
    ],
    "assetHierarchies": [
        {
            "id": "a1b2c3d4-5678-90ab-cdef-77777EXAMPLE",
            "name": "Wind Turbines"
        }
    ],
    "assetCreationDate": 1575672453.0,
    "assetLastUpdateDate": 1575672453.0,
    "assetStatus": {
        "state": "ACTIVE"
    }
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[描述特定資產](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/discover-asset-resources.html#describe-asset)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DescribeAsset](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/describe-asset.html)。

### `describe-dashboard`
<a name="iotsitewise_DescribeDashboard_cli_topic"></a>

以下程式碼範例顯示如何使用 `describe-dashboard`。

**AWS CLI**  
**描述儀表板**  
下列 `describe-dashboard` 範例會描述指定風力發電廠儀表板。  

```
aws iotsitewise describe-dashboard \
    --dashboard-id a1b2c3d4-5678-90ab-cdef-fffffEXAMPLE
```
輸出：  

```
{
    "dashboardId": "a1b2c3d4-5678-90ab-cdef-fffffEXAMPLE",
    "dashboardArn": "arn:aws:iotsitewise:us-west-2:123456789012:dashboard/a1b2c3d4-5678-90ab-cdef-fffffEXAMPLE",
    "dashboardName": "Wind Farm",
    "projectId": "a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE",
    "dashboardDefinition": "{\"widgets\":[{\"type\":\"monitor-line-chart\",\"title\":\"Generated Power\",\"x\":0,\"y\":0,\"height\":3,\"width\":3,\"metrics\":[{\"label\":\"Power\",\"type\":\"iotsitewise\",\"assetId\":\"a1b2c3d4-5678-90ab-cdef-44444EXAMPLE\",\"propertyId\":\"a1b2c3d4-5678-90ab-cdef-99999EXAMPLE\"}]}]}",
    "dashboardCreationDate": "2020-05-01T20:32:12.228476348Z",
    "dashboardLastUpdateDate": "2020-05-01T20:32:12.228476348Z"
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise Monitor 應用程式指南》**中的[檢視儀表板](https://docs.aws.amazon.com/iot-sitewise/latest/appguide/view-dashboards.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DescribeDashboard](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/describe-dashboard.html)。

### `describe-gateway-capability-configuration`
<a name="iotsitewise_DescribeGatewayCapabilityConfiguration_cli_topic"></a>

以下程式碼範例顯示如何使用 `describe-gateway-capability-configuration`。

**AWS CLI**  
**描述閘道功能**  
下列 `describe-gateway-capability-configuration` 範例會描述 OPC-UA 來源功能。  

```
aws iotsitewise describe-gateway-capability-configuration \
    --gateway-id a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE \
    --capability-namespace "iotsitewise:opcuacollector:1"
```
輸出：  

```
{
    "gatewayId": "a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE",
    "capabilityNamespace": "iotsitewise:opcuacollector:1",
    "capabilityConfiguration": "{\"sources\":[{\"name\":\"Wind Farm #1\",\"endpoint\":{\"certificateTrust\":{\"type\":\"TrustAny\"},\"endpointUri\":\"opc.tcp://203.0.113.0:49320\",\"securityPolicy\":\"BASIC256\",\"messageSecurityMode\":\"SIGN_AND_ENCRYPT\",\"identityProvider\":{\"type\":\"Username\",\"usernameSecretArn\":\"arn:aws:secretsmanager:us-east-1:123456789012:secret:greengrass-factory1-auth-3QNDmM\"},\"nodeFilterRules\":[]},\"measurementDataStreamPrefix\":\"\"}]}",
    "capabilitySyncStatus": "IN_SYNC"
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[設定資料來源](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/configure-sources.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DescribeGatewayCapabilityConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/describe-gateway-capability-configuration.html)。

### `describe-gateway`
<a name="iotsitewise_DescribeGateway_cli_topic"></a>

以下程式碼範例顯示如何使用 `describe-gateway`。

**AWS CLI**  
**描述閘道**  
下列 `describe-gateway` 範例會描述閘道。  

```
aws iotsitewise describe-gateway \
    --gateway-id a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE
```
輸出：  

```
{
    "gatewayId": "a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE",
    "gatewayName": "ExampleCorpGateway",
    "gatewayArn": "arn:aws:iotsitewise:us-west-2:123456789012:gateway/a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE",
    "gatewayPlatform": {
        "greengrass": {
            "groupArn": "arn:aws:greengrass:us-west-2:123456789012:/greengrass/groups/a1b2c3d4-5678-90ab-cdef-1b1b1EXAMPLE"
        }
    },
    "gatewayCapabilitySummaries": [
        {
            "capabilityNamespace": "iotsitewise:opcuacollector:1",
            "capabilitySyncStatus": "IN_SYNC"
        }
    ],
    "creationDate": 1588369971.457,
    "lastUpdateDate": 1588369971.457
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[使用閘道擷取資料](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/gateways.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DescribeGateway](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/describe-gateway.html)。

### `describe-logging-options`
<a name="iotsitewise_DescribeLoggingOptions_cli_topic"></a>

以下程式碼範例顯示如何使用 `describe-logging-options`。

**AWS CLI**  
**擷取目前的 AWS IoT SiteWise 記錄選項**  
下列`describe-logging-options`範例會擷取目前區域中 AWS 您帳戶的目前 AWS IoT SiteWise 記錄選項。  

```
aws iotsitewise describe-logging-options
```
輸出：  

```
{
    "loggingOptions": {
        "level": "INFO"
    }
}
```
如需詳細資訊，請參閱 [AWS IoT SiteWise 使用者指南中的使用 Amazon CloudWatch Logs 監控](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/monitor-cloudwatch-logs.html)IoT SiteWise。 *AWS IoT SiteWise *  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DescribeLoggingOptions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/describe-logging-options.html)。

### `describe-portal`
<a name="iotsitewise_DescribePortal_cli_topic"></a>

以下程式碼範例顯示如何使用 `describe-portal`。

**AWS CLI**  
**描述入口網站**  
下列 `describe-portal` 範例描述風力發電廠公司的 Web 入口網站。  

```
aws iotsitewise describe-portal \
    --portal-id a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE
```
輸出：  

```
{
    "portalId": "a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE",
    "portalArn": "arn:aws:iotsitewise:us-west-2:123456789012:portal/a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE",
    "portalName": "WindFarmPortal",
    "portalDescription": "A portal that contains wind farm projects for Example Corp.",
    "portalClientId": "E-a1b2c3d4e5f6_a1b2c3d4e5f6EXAMPLE",
    "portalStartUrl": "https://a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE.app.iotsitewise.aws",
    "portalContactEmail": "support@example.com",
    "portalStatus": {
        "state": "ACTIVE"
    },
    "portalCreationDate": "2020-02-04T23:01:52.90248068Z",
    "portalLastUpdateDate": "2020-02-04T23:01:52.90248078Z",
    "roleArn": "arn:aws:iam::123456789012:role/MySiteWiseMonitorServiceRole"
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[管理入口網站](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/administer-portals.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DescribePortal](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/describe-portal.html)。

### `describe-project`
<a name="iotsitewise_DescribeProject_cli_topic"></a>

以下程式碼範例顯示如何使用 `describe-project`。

**AWS CLI**  
**描述專案**  
下列 `describe-project` 範例描述風力發電廠專案。  

```
aws iotsitewise describe-project \
    --project-id a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE
```
輸出：  

```
{
    "projectId": "a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE",
    "projectArn": "arn:aws:iotsitewise:us-west-2:123456789012:project/a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE",
    "projectName": "Wind Farm 1",
    "portalId": "a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE",
    "projectDescription": "Contains asset visualizations for Wind Farm #1 for Example Corp.",
    "projectCreationDate": "2020-02-20T21:58:43.362246001Z",
    "projectLastUpdateDate": "2020-02-20T21:58:43.362246095Z"
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise Monitor 應用程式指南》**中的[檢視專案詳細資訊](https://docs.aws.amazon.com/iot-sitewise/latest/appguide/view-project-details.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DescribeProject](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/describe-project.html)。

### `disassociate-assets`
<a name="iotsitewise_DisassociateAssets_cli_topic"></a>

以下程式碼範例顯示如何使用 `disassociate-assets`。

**AWS CLI**  
**將子資產與父資產取消關聯**  
下列 `disassociate-assets` 範例會將風力發電機資產與風力發電廠資產取消關聯。  

```
aws iotsitewise disassociate-assets \
    --asset-id a1b2c3d4-5678-90ab-cdef-44444EXAMPLE \
    --hierarchy-id a1b2c3d4-5678-90ab-cdef-77777EXAMPLE \
    --child-asset-id a1b2c3d4-5678-90ab-cdef-33333EXAMPLE
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[將資產建立關聯](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/add-associated-assets.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DisassociateAssets](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/disassociate-assets.html)。

### `get-asset-property-aggregates`
<a name="iotsitewise_GetAssetPropertyAggregates_cli_topic"></a>

以下程式碼範例顯示如何使用 `get-asset-property-aggregates`。

**AWS CLI**  
**擷取資產屬性的彙總平均值和計數值**  
下列 `get-asset-property-aggregates` 範例會擷取風力發電機資產在 1 小時內的平均總功率以及功率總計資料點計數。  

```
aws iotsitewise get-asset-property-aggregates \
    --asset-id a1b2c3d4-5678-90ab-cdef-33333EXAMPLE \
    --property-id a1b2c3d4-5678-90ab-cdef-66666EXAMPLE \
    --start-date 1580849400 \
    --end-date 1580853000 \
    --aggregate-types AVERAGE COUNT \
    --resolution 1h
```
輸出：  

```
{
    "aggregatedValues": [
        {
            "timestamp": 1580850000.0,
            "quality": "GOOD",
            "value": {
                "average": 8723.46538886233,
                "count": 12.0
            }
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[查詢資產屬性彙總](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/query-industrial-data.html#aggregates)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [GetAssetPropertyAggregates](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/get-asset-property-aggregates.html)。

### `get-asset-property-value-history`
<a name="iotsitewise_GetAssetPropertyValueHistory_cli_topic"></a>

以下程式碼範例顯示如何使用 `get-asset-property-value-history`。

**AWS CLI**  
**擷取資產屬性的歷史值**  
下列 `get-asset-property-value-history` 範例會擷取 20 分鐘內風力渦輪機資產的功率總計值。  

```
aws iotsitewise get-asset-property-value-history \
    --asset-id a1b2c3d4-5678-90ab-cdef-33333EXAMPLE \
    --property-id a1b2c3d4-5678-90ab-cdef-66666EXAMPLE \
    --start-date 1580851800 \
    --end-date 1580853000
```
輸出：  

```
{
    "assetPropertyValueHistory": [
        {
            "value": {
                "doubleValue": 7217.787046814844
            },
            "timestamp": {
                "timeInSeconds": 1580852100,
                "offsetInNanos": 0
            },
            "quality": "GOOD"
        },
        {
            "value": {
                "doubleValue": 6941.242811875451
            },
            "timestamp": {
                "timeInSeconds": 1580852400,
                "offsetInNanos": 0
            },
            "quality": "GOOD"
        },
        {
            "value": {
                "doubleValue": 6976.797662266717
            },
            "timestamp": {
                "timeInSeconds": 1580852700,
                "offsetInNanos": 0
            },
            "quality": "GOOD"
        },
        {
            "value": {
                "doubleValue": 6890.8677520453875
            },
            "timestamp": {
                "timeInSeconds": 1580853000,
                "offsetInNanos": 0
            },
            "quality": "GOOD"
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[查詢歷史資產屬性值](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/query-industrial-data.html#historical-values)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [GetAssetPropertyValueHistory](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/get-asset-property-value-history.html)。

### `get-asset-property-value`
<a name="iotsitewise_GetAssetPropertyValue_cli_topic"></a>

以下程式碼範例顯示如何使用 `get-asset-property-value`。

**AWS CLI**  
**擷取資產屬性的目前值**  
下列 `get-asset-property-value` 範例會擷取風力發電機資產目前的功率總計。  

```
aws iotsitewise get-asset-property-value \
    --asset-id a1b2c3d4-5678-90ab-cdef-33333EXAMPLE \
    --property-id a1b2c3d4-5678-90ab-cdef-66666EXAMPLE
```
輸出：  

```
{
    "propertyValue": {
        "value": {
            "doubleValue": 6890.8677520453875
        },
        "timestamp": {
            "timeInSeconds": 1580853000,
            "offsetInNanos": 0
        },
        "quality": "GOOD"
    }
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[查詢目前資產屬性值](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/query-industrial-data.html#current-values)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [GetAssetPropertyValue](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/get-asset-property-value.html)。

### `list-access-policies`
<a name="iotsitewise_ListAccessPolicies_cli_topic"></a>

以下程式碼範例顯示如何使用 `list-access-policies`。

**AWS CLI**  
**列出所有存取政策**  
下列 `list-access-policies` 範例列出身為入口網站管理員之使用者的所有存取政策。  

```
aws iotsitewise list-access-policies \
    --identity-type USER \
    --identity-id a1b2c3d4e5-a1b2c3d4-5678-90ab-cdef-bbbbbEXAMPLE
```
輸出：  

```
{
    "accessPolicySummaries": [
        {
            "id": "a1b2c3d4-5678-90ab-cdef-cccccEXAMPLE",
            "identity": {
                "user": {
                    "id": "a1b2c3d4e5-a1b2c3d4-5678-90ab-cdef-bbbbbEXAMPLE"
                }
            },
            "resource": {
                "portal": {
                    "id": "a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE"
                }
            },
            "permission": "ADMINISTRATOR"
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[管理入口網站](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/administer-portals.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [ListAccessPolicies](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/list-access-policies.html)。

### `list-asset-models`
<a name="iotsitewise_ListAssetModels_cli_topic"></a>

以下程式碼範例顯示如何使用 `list-asset-models`。

**AWS CLI**  
**列出所有資產模型**  
下列`list-asset-models`範例列出目前區域中 AWS 您帳戶中定義的所有資產模型。  

```
aws iotsitewise list-asset-models
```
輸出：  

```
{
    "assetModelSummaries": [
        {
            "id": "a1b2c3d4-5678-90ab-cdef-22222EXAMPLE",
            "arn": "arn:aws:iotsitewise:us-west-2:123456789012:asset-model/a1b2c3d4-5678-90ab-cdef-22222EXAMPLE",
            "name": "Wind Farm Model",
            "description": "Represents a wind farm that comprises many wind turbines",
            "creationDate": 1575671284.0,
            "lastUpdateDate": 1575671988.0,
            "status": {
                "state": "ACTIVE"
            }
        },
        {
            "id": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE",
            "arn": "arn:aws:iotsitewise:us-west-2:123456789012:asset-model/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE",
            "name": "Wind Turbine Model",
            "description": "Represents a wind turbine manufactured by Example Corp",
            "creationDate": 1575671207.0,
            "lastUpdateDate": 1575686273.0,
            "status": {
                "state": "ACTIVE"
            }
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[列出所有資產模型](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/discover-asset-resources.html#list-asset-models)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [ListAssetModels](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/list-asset-models.html)。

### `list-assets`
<a name="iotsitewise_ListAssets_cli_topic"></a>

以下程式碼範例顯示如何使用 `list-assets`。

**AWS CLI**  
**範例 1：列出所有最上層資產**  
下列`list-assets`範例列出資產階層樹狀結構中最上層並在目前區域中 AWS 的帳戶中定義的所有資產。  

```
aws iotsitewise list-assets \
    --filter TOP_LEVEL
```
輸出：  

```
{
    "assetSummaries": [
        {
            "id": "a1b2c3d4-5678-90ab-cdef-44444EXAMPLE",
            "arn": "arn:aws:iotsitewise:us-west-2:123456789012:asset/a1b2c3d4-5678-90ab-cdef-44444EXAMPLE",
            "name": "Wind Farm 1",
            "assetModelId": "a1b2c3d4-5678-90ab-cdef-22222EXAMPLE",
            "creationDate": 1575672453.0,
            "lastUpdateDate": 1575672453.0,
            "status": {
                "state": "ACTIVE"
            },
            "hierarchies": [
                {
                    "id": "a1b2c3d4-5678-90ab-cdef-77777EXAMPLE",
                    "name": "Wind Turbines"
                }
            ]
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[列出資產](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/discover-asset-resources.html#list-assets)。  
**範例 2：根據資產模型列出所有資產**  
下列`list-assets`範例會根據資產模型列出所有資產，並在目前區域中 AWS 的帳戶中定義。  

```
aws iotsitewise list-assets \
    --asset-model-id a1b2c3d4-5678-90ab-cdef-11111EXAMPLE
```
輸出：  

```
{
    "assetSummaries": [
        {
            "id": "a1b2c3d4-5678-90ab-cdef-33333EXAMPLE",
            "arn": "arn:aws:iotsitewise:us-west-2:123456789012:asset/a1b2c3d4-5678-90ab-cdef-33333EXAMPLE",
            "name": "Wind Turbine 1",
            "assetModelId": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE",
            "creationDate": 1575671550.0,
            "lastUpdateDate": 1575686308.0,
            "status": {
                "state": "ACTIVE"
            },
            "hierarchies": []
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[列出資產](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/discover-asset-resources.html#list-assets)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [ListAssets](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/list-assets.html)。

### `list-associated-assets`
<a name="iotsitewise_ListAssociatedAssets_cli_topic"></a>

以下程式碼範例顯示如何使用 `list-associated-assets`。

**AWS CLI**  
**列出與特定階層中資產相關聯的所有資產**  
下列 `list-associated-assets` 範例列出與指定風力發電廠資產相關聯之所有風力發電機資產。  

```
aws iotsitewise list-associated-assets \
    --asset-id a1b2c3d4-5678-90ab-cdef-44444EXAMPLE \
    --hierarchy-id a1b2c3d4-5678-90ab-cdef-77777EXAMPLE
```
輸出：  

```
{
    "assetSummaries": [
        {
            "id": "a1b2c3d4-5678-90ab-cdef-33333EXAMPLE",
            "arn": "arn:aws:iotsitewise:us-west-2:123456789012:asset/a1b2c3d4-5678-90ab-cdef-33333EXAMPLE",
            "name": "Wind Turbine 1",
            "assetModelId": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE",
            "creationDate": 1575671550.0,
            "lastUpdateDate": 1575686308.0,
            "status": {
                "state": "ACTIVE"
            },
            "hierarchies": []
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[列出與特定資產相關聯的資產](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/discover-asset-resources.html#list-associated-assets)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [ListAssociatedAssets](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/list-associated-assets.html)。

### `list-dashboards`
<a name="iotsitewise_ListDashboards_cli_topic"></a>

以下程式碼範例顯示如何使用 `list-dashboards`。

**AWS CLI**  
**列出專案中的所有儀表板**  
下列 `list-dashboards` 範例列出專案中定義的所有儀表板。  

```
aws iotsitewise list-dashboards \
    --project-id a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE
```
輸出：  

```
{
    "dashboardSummaries": [
        {
            "id": "a1b2c3d4-5678-90ab-cdef-fffffEXAMPLE",
            "name": "Wind Farm",
            "creationDate": "2020-05-01T20:32:12.228476348Z",
            "lastUpdateDate": "2020-05-01T20:32:12.228476348Z"
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise Monitor 應用程式指南》**中的[檢視儀表板](https://docs.aws.amazon.com/iot-sitewise/latest/appguide/view-dashboards.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [ListDashboards](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/list-dashboards.html)。

### `list-gateways`
<a name="iotsitewise_ListGateways_cli_topic"></a>

以下程式碼範例顯示如何使用 `list-gateways`。

**AWS CLI**  
**列出所有閘道**  
下列`list-gateways`範例列出目前區域中 AWS 您帳戶中定義的所有閘道。  

```
aws iotsitewise list-gateways
```
輸出：  

```
{
    "gatewaySummaries": [
        {
            "gatewayId": "a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE",
            "gatewayName": "ExampleCorpGateway",
            "gatewayCapabilitySummaries": [
                {
                    "capabilityNamespace": "iotsitewise:opcuacollector:1",
                    "capabilitySyncStatus": "IN_SYNC"
                }
            ],
            "creationDate": 1588369971.457,
            "lastUpdateDate": 1588369971.457
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[使用閘道擷取資料](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/gateways.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [ListGateways](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/list-gateways.html)。

### `list-portals`
<a name="iotsitewise_ListPortals_cli_topic"></a>

以下程式碼範例顯示如何使用 `list-portals`。

**AWS CLI**  
**列出所有入口網站**  
下列`list-portals`範例列出目前區域中 AWS 您帳戶中定義的所有入口網站。  

```
aws iotsitewise list-portals
```
輸出：  

```
{
    "portalSummaries": [
        {
            "id": "a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE",
            "name": "WindFarmPortal",
            "description": "A portal that contains wind farm projects for Example Corp.",
            "startUrl": "https://a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE.app.iotsitewise.aws",
            "creationDate": "2020-02-04T23:01:52.90248068Z",
            "lastUpdateDate": "2020-02-04T23:01:52.90248078Z",
            "roleArn": "arn:aws:iam::123456789012:role/service-role/MySiteWiseMonitorServiceRole"
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[管理入口網站](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/administer-portals.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [ListPortals](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/list-portals.html)。

### `list-project-assets`
<a name="iotsitewise_ListProjectAssets_cli_topic"></a>

以下程式碼範例顯示如何使用 `list-project-assets`。

**AWS CLI**  
**列出與專案相關聯的所有資產**  
下列 `list-project-assets` 範例列出與風力發電廠專案相關聯的所有資產。  

```
aws iotsitewise list-projects \
    --project-id a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE
```
輸出：  

```
{
    "assetIds": [
        "a1b2c3d4-5678-90ab-cdef-44444EXAMPLE"
    ]
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise Monitor 應用程式指南》**中的[將資產新增至專案](https://docs.aws.amazon.com/iot-sitewise/latest/appguide/add-assets-to-projects-sd.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [ListProjectAssets](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/list-project-assets.html)。

### `list-projects`
<a name="iotsitewise_ListProjects_cli_topic"></a>

以下程式碼範例顯示如何使用 `list-projects`。

**AWS CLI**  
**列出入口網站中的所有專案**  
下列 `list-projects` 範例列出入口網站中定義的所有專案。  

```
aws iotsitewise list-projects \
    --portal-id a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE
```
輸出：  

```
{
    "projectSummaries": [
        {
            "id": "a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE",
            "name": "Wind Farm 1",
            "description": "Contains asset visualizations for Wind Farm #1 for Example Corp.",
            "creationDate": "2020-02-20T21:58:43.362246001Z",
            "lastUpdateDate": "2020-02-20T21:58:43.362246095Z"
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise Monitor 應用程式指南》**中的[檢視專案詳細資訊](https://docs.aws.amazon.com/iot-sitewise/latest/appguide/view-project-details.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [ListProjects](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/list-projects.html)。

### `list-tags-for-resource`
<a name="iotsitewise_ListTagsForResource_cli_topic"></a>

以下程式碼範例顯示如何使用 `list-tags-for-resource`。

**AWS CLI**  
**列出資源的所有標籤**  
下列 `list-tags-for-resource` 範例列出風力發電機資產的所有標籤。  

```
aws iotsitewise list-tags-for-resource \
    --resource-arn arn:aws:iotsitewise:us-west-2:123456789012:asset/a1b2c3d4-5678-90ab-cdef-33333EXAMPLE
```
輸出：  

```
{
    "tags": {
        "Owner": "richard-roe"
    }
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[標記資源](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/tag-resources.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [ListTagsForResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/list-tags-for-resource.html)。

### `put-logging-options`
<a name="iotsitewise_PutLoggingOptions_cli_topic"></a>

以下程式碼範例顯示如何使用 `put-logging-options`。

**AWS CLI**  
**指定記錄層級**  
下列`put-logging-options`範例會在 AWS IoT SiteWise 中啟用`INFO`關卡記錄。其他層級包括 `DEBUG` 和 `OFF`。  

```
aws iotsitewise put-logging-options \
    --logging-options level=INFO
```
此命令不會產生輸出。  
如需詳細資訊，請參閱 [AWS IoT SiteWise 使用者指南中的使用 Amazon CloudWatch Logs 監控](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/monitor-cloudwatch-logs.html)IoT SiteWise。 *AWS IoT SiteWise *  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [PutLoggingOptions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/put-logging-options.html)。

### `tag-resource`
<a name="iotsitewise_TagResource_cli_topic"></a>

以下程式碼範例顯示如何使用 `tag-resource`。

**AWS CLI**  
**將標籤加入資源**  
下列 `tag-resource` 範例會將擁有者標籤新增至風力發電機資產。這可讓您根據擁有資產的人員來控制對資產的存取。  

```
aws iotsitewise tag-resource \
    --resource-arn arn:aws:iotsitewise:us-west-2:123456789012:asset/a1b2c3d4-5678-90ab-cdef-33333EXAMPLE \
    --tags Owner=richard-roe
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[標記資源](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/tag-resources.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [TagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/tag-resource.html)。

### `untag-resource`
<a name="iotsitewise_UntagResource_cli_topic"></a>

以下程式碼範例顯示如何使用 `untag-resource`。

**AWS CLI**  
**將標籤從資源中移除**  
下列 `untag-resource` 範例會從將擁有者標籤從風力發電機資產中移除。  

```
aws iotsitewise untag-resource \
    --resource-arn arn:aws:iotsitewise:us-west-2:123456789012:asset/a1b2c3d4-5678-90ab-cdef-33333EXAMPLE \
    --tag-keys Owner
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[標記資源](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/tag-resources.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [UntagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/untag-resource.html)。

### `update-access-policy`
<a name="iotsitewise_UpdateAccessPolicy_cli_topic"></a>

以下程式碼範例顯示如何使用 `update-access-policy`。

**AWS CLI**  
**授予專案的專案檢視者擁有權**  
下列 `update-access-policy` 範例會更新存取政策，該政策會授予專案的專案檢視者擁有權。  

```
aws iotsitewise update-access-policy \
    --access-policy-id a1b2c3d4-5678-90ab-cdef-dddddEXAMPLE \
    --cli-input-json file://update-project-viewer-access-policy.json
```
`update-project-viewer-access-policy.json` 的內容：  

```
{
    "accessPolicyIdentity": {
        "user": {
            "id": "a1b2c3d4e5-a1b2c3d4-5678-90ab-cdef-bbbbbEXAMPLE"
        }
    },
    "accessPolicyPermission": "ADMINISTRATOR",
    "accessPolicyResource": {
        "project": {
            "id": "a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE"
        }
    }
}
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《AWS IoT SiteWise Monitor 應用程式指南》**中的[指派專案擁有者](https://docs.aws.amazon.com/iot-sitewise/latest/appguide/assign-project-owners.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [UpdateAccessPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/update-access-policy.html)。

### `update-asset-model`
<a name="iotsitewise_UpdateAssetModel_cli_topic"></a>

以下程式碼範例顯示如何使用 `update-asset-model`。

**AWS CLI**  
**更新資產模型**  
下列 `update-asset-model` 範例會更新風力發電廠資產模型的描述。此範例包含模型的現有 ID 和定義，因為 `update-asset-model` 會使用新模型覆寫現有模型。  

```
aws iotsitewise update-asset-model \
    --cli-input-json file://update-wind-farm-model.json
```
`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"
        }
    ]
}
```
輸出：  

```
{
    "assetModelId": "a1b2c3d4-5678-90ab-cdef-22222EXAMPLE",
    "assetModelArn": "arn:aws:iotsitewise:us-west-2:123456789012:asset-model/a1b2c3d4-5678-90ab-cdef-22222EXAMPLE",
    "assetModelStatus": {
        "state": "CREATING"
    }
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[更新資產模型](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/update-assets-and-models.html#update-asset-models)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [UpdateAssetModel](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/update-asset-model.html)。

### `update-asset-property`
<a name="iotsitewise_UpdateAssetProperty_cli_topic"></a>

以下程式碼範例顯示如何使用 `update-asset-property`。

**AWS CLI**  
**範例 1：更新資產屬性的別名**  
下列 `update-asset-property` 範例會更新風力發電機資產的功率屬性別名。  

```
aws iotsitewise update-asset-property \
    --asset-id a1b2c3d4-5678-90ab-cdef-33333EXAMPLE \
    --property-id a1b2c3d4-5678-90ab-cdef-55555EXAMPLE \
    --property-alias "/examplecorp/windfarm/1/turbine/1/power" \
    --property-notification-state DISABLED
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[將工業資料串流映射至資產屬性](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/connect-data-streams.html)。  
**範例 2：啟用資產屬性通知**  
下列 `update-asset-property` 範例會啟用風力發電機資產功率屬性的資產屬性更新通知。屬性值更新會發佈至 MQTT 主題 `$aws/sitewise/asset-models/<assetModelId>/assets/<assetId>/properties/<propertyId>`，其中每個 ID 都會由資產屬性的屬性、資產和模型 ID 所取代。  

```
aws iotsitewise update-asset-property \
    --asset-id a1b2c3d4-5678-90ab-cdef-33333EXAMPLE \
    --property-id a1b2c3d4-5678-90ab-cdef-66666EXAMPLE \
    --property-notification-state ENABLED \
    --property-alias "/examplecorp/windfarm/1/turbine/1/power"
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[與其他服務互動](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/interact-with-other-services.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [UpdateAssetProperty](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/update-asset-property.html)。

### `update-asset`
<a name="iotsitewise_UpdateAsset_cli_topic"></a>

以下程式碼範例顯示如何使用 `update-asset`。

**AWS CLI**  
**更新資產的名稱**  
下列 `update-asset` 範例會更新風力發電機資產的名稱。  

```
aws iotsitewise update-asset \
    --asset-id a1b2c3d4-5678-90ab-cdef-33333EXAMPLE \
    --asset-name "Wind Turbine 2"
```
輸出：  

```
{
    "assetStatus": {
        "state": "UPDATING"
    }
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[更新資產](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/update-assets-and-models.html#update-assets)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [UpdateAsset](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/update-asset.html)。

### `update-dashboard`
<a name="iotsitewise_UpdateDashboard_cli_topic"></a>

以下程式碼範例顯示如何使用 `update-dashboard`。

**AWS CLI**  
**更新儀表板**  
下列 `update-dashboard` 範例會變更儀表板折線圖的標題，其中會顯示風力發電廠的產生功率總計。  

```
aws iotsitewise update-dashboard \
    --project-id a1b2c3d4-5678-90ab-cdef-fffffEXAMPLE \
    --dashboard-name "Wind Farm" \
    --dashboard-definition file://update-wind-farm-dashboard.json
```
`update-wind-farm-dashboard.json` 的內容：  

```
{
    "widgets": [
        {
            "type": "monitor-line-chart",
            "title": "Total Generated Power",
            "x": 0,
            "y": 0,
            "height": 3,
            "width": 3,
            "metrics": [
                {
                    "label": "Power",
                    "type": "iotsitewise",
                    "assetId": "a1b2c3d4-5678-90ab-cdef-44444EXAMPLE",
                    "propertyId": "a1b2c3d4-5678-90ab-cdef-99999EXAMPLE"
                }
            ]
        }
    ]
}
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[建立儀表板 (CLI)](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/create-dashboards-using-aws-cli.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [UpdateDashboard](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/update-dashboard.html)。

### `update-gateway-capability-configuration`
<a name="iotsitewise_UpdateGatewayCapabilityConfiguration_cli_topic"></a>

以下程式碼範例顯示如何使用 `update-gateway-capability-configuration`。

**AWS CLI**  
**更新閘道功能**  
下列 `update-gateway-capability-configuration` 範例會使用下列屬性設定 OPC-UA 來源：  
信任任何憑證。使用 Basic256 演算法來保護訊息。使用 SignAndEncrypt 模式來保護連線。使用存放在 AWS Secrets Manager 秘密中的身分驗證憑證。  

```
aws iotsitewise update-gateway-capability-configuration \
    --gateway-id a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE \
    --capability-namespace "iotsitewise:opcuacollector:1" \
    --capability-configuration file://opc-ua-capability-configuration.json
```
`opc-ua-capability-configuration.json` 的內容：  

```
{
    "sources": [
        {
            "name": "Wind Farm #1",
            "endpoint": {
                "certificateTrust": {
                    "type": "TrustAny"
                },
                "endpointUri": "opc.tcp://203.0.113.0:49320",
                "securityPolicy": "BASIC256",
                "messageSecurityMode": "SIGN_AND_ENCRYPT",
                "identityProvider": {
                    "type": "Username",
                    "usernameSecretArn": "arn:aws:secretsmanager:us-west-2:123456789012:secret:greengrass-windfarm1-auth-1ABCDE"
                },
                "nodeFilterRules": []
            },
            "measurementDataStreamPrefix": ""
        }
    ]
}
```
輸出：  

```
{
    "capabilityNamespace": "iotsitewise:opcuacollector:1",
    "capabilitySyncStatus": "OUT_OF_SYNC"
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[設定資料來源](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/configure-sources.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [UpdateGatewayCapabilityConfiguration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/update-gateway-capability-configuration.html)。

### `update-gateway`
<a name="iotsitewise_UpdateGateway_cli_topic"></a>

以下程式碼範例顯示如何使用 `update-gateway`。

**AWS CLI**  
**更新閘道的名稱**  
下列 `update-gateway` 範例會更新閘道的名稱。  

```
aws iotsitewise update-gateway \
    --gateway-id a1b2c3d4-5678-90ab-cdef-1a1a1EXAMPLE \
    --gateway-name ExampleCorpGateway1
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[使用閘道擷取資料](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/gateways.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [UpdateGateway](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/update-gateway.html)。

### `update-portal`
<a name="iotsitewise_UpdatePortal_cli_topic"></a>

以下程式碼範例顯示如何使用 `update-portal`。

**AWS CLI**  
**更新入口網站的詳細資訊**  
下列 `update-portal` 範例會更新風力發電廠公司的 Web 入口網站。  

```
aws iotsitewise update-portal \
    --portal-id a1b2c3d4-5678-90ab-cdef-aaaaaEXAMPLE \
    --portal-name WindFarmPortal \
    --portal-description "A portal that contains wind farm projects for Example Corp." \
    --portal-contact-email support@example.com \
    --role-arn arn:aws:iam::123456789012:role/MySiteWiseMonitorServiceRole
```
輸出：  

```
{
    "portalStatus": {
        "state": "UPDATING"
    }
}
```
如需詳細資訊，請參閱《AWS IoT SiteWise 使用者指南》**中的[管理入口網站](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/administer-portals.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [UpdatePortal](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/update-portal.html)。

### `update-project`
<a name="iotsitewise_UpdateProject_cli_topic"></a>

以下程式碼範例顯示如何使用 `update-project`。

**AWS CLI**  
**更新專案的詳細資訊**  
下列 `update-project` 範例會更新風力發電廠專案。  

```
aws iotsitewise update-project \
    --project-id a1b2c3d4-5678-90ab-cdef-eeeeeEXAMPLE \
    --project-name "Wind Farm 1" \
    --project-description "Contains asset visualizations for Wind Farm #1 for Example Corp."
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《AWS IoT SiteWise Monitor 應用程式指南》**中的[變更專案詳細資訊](https://docs.aws.amazon.com/iot-sitewise/latest/appguide/edit-project-details.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [UpdateProject](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotsitewise/update-project.html)。