

文件 AWS 開發套件範例 GitHub 儲存庫中有更多可用的 [AWS SDK 範例](https://github.com/awsdocs/aws-doc-sdk-examples)。

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

# AWS IoT Things Graph 使用 的範例 AWS CLI
<a name="cli_2_iotthingsgraph_code_examples"></a>

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

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

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

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

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

### `associate-entity-to-thing`
<a name="iotthingsgraph_AssociateEntityToThing_cli_2_topic"></a>

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

**AWS CLI**  
**將物件與裝置建立關聯**  
下列 `associate-entity-to-thing` 範例會將物件與裝置建立關聯。此範例使用位於公有命名空間中的動作感應器裝置。  

```
aws iotthingsgraph associate-entity-to-thing \
    --thing-name "MotionSensorName" \
    --entity-id "urn:tdm:aws/examples:Device:HCSR501MotionSensor"
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[建立和上傳模型](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-models-gs.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [AssociateEntityToThing](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/associate-entity-to-thing.html)。

### `create-flow-template`
<a name="iotthingsgraph_CreateFlowTemplate_cli_2_topic"></a>

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

**AWS CLI**  
**建立流程**  
下列 `create-flow-template` 範例會建立流程 (工作流程)。`MyFlowDefinition` 的值是建立流程模型的 GraphQL。  

```
aws iotthingsgraph create-flow-template \
    --definition language=GRAPHQL,text="MyFlowDefinition"
```
輸出：  

```
{
    "summary": {
        "createdAt": 1559248067.545,
        "id": "urn:tdm:us-west-2/123456789012/default:Workflow:MyFlow",
        "revisionNumber": 1
    }
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[使用流程](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-workflows.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [CreateFlowTemplate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/create-flow-template.html)。

### `create-system-instance`
<a name="iotthingsgraph_CreateSystemInstance_cli_2_topic"></a>

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

**AWS CLI**  
**建立系統執行個體**  
以下 `create-system-instance` 範例會建立系統執行個體。`MySystemInstanceDefinition` 的值是建立系統執行個體模型的 GraphQL。  

```
aws iotthingsgraph create-system-instance -\
    -definition language=GRAPHQL,text="MySystemInstanceDefinition" \
    --target CLOUD \
    --flow-actions-role-arn myRoleARN
```
輸出：  

```
{
    "summary": {
        "id": "urn:tdm:us-west-2/123456789012/default:Deployment:Room218",
        "arn": "arn:aws:iotthingsgraph:us-west-2:123456789012:Deployment/default/Room218",
        "status": "NOT_DEPLOYED",
        "target": "CLOUD",
        "createdAt": 1559249315.208,
        "updatedAt": 1559249315.208
    }
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[使用系統和流程組態](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-sysdeploy.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [CreateSystemInstance](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/create-system-instance.html)。

### `create-system-template`
<a name="iotthingsgraph_CreateSystemTemplate_cli_2_topic"></a>

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

**AWS CLI**  
**建立系統**  
下列 `create-system-template` 範例會建立系統。MySystemDefinition 的值是建立系統模型的 GraphQL。  

```
aws iotthingsgraph create-system-template \
    --definition language=GRAPHQL,text="MySystemDefinition"
```
輸出：  

```
{
    "summary": {
        "createdAt": 1559249776.254,
        "id": "urn:tdm:us-west-2/123456789012/default:System:MySystem",
        "arn": "arn:aws:iotthingsgraph:us-west-2:123456789012:System/default/MySystem",
        "revisionNumber": 1
    }
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[建立系統](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-sysdeploy-systems.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [CreateSystemTemplate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/create-system-template.html)。

### `delete-flow-template`
<a name="iotthingsgraph_DeleteFlowTemplate_cli_2_topic"></a>

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

**AWS CLI**  
**刪除流程**  
下列 `delete-flow-template` 範例會刪除流程 (工作流程)。  

```
aws iotthingsgraph delete-flow-template \
    --id "urn:tdm:us-west-2/123456789012/default:Workflow:MyFlow"
```
此命令不會產生輸出。  
如需詳細資訊，請參閱 [AWS IoT Things Graph 使用者指南中的 IoT Things Graph 實體、流程、系統和部署的生命週期管理](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-lifecycle.html)。 *AWS IoT *  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DeleteFlowTemplate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/delete-flow-template.html)。

### `delete-namespace`
<a name="iotthingsgraph_DeleteNamespace_cli_2_topic"></a>

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

**AWS CLI**  
**刪除命名空間**  
以下 `delete-namespace` 範例會刪除命名空間。  

```
aws iotthingsgraph delete-namespace
```
輸出：  

```
{
   "namespaceArn": "arn:aws:iotthingsgraph:us-west-2:123456789012",
   "namespaceName": "us-west-2/123456789012/default"
}
```
如需詳細資訊，請參閱 [AWS IoT Things Graph 使用者指南中的 IoT Things Graph 實體、流程、系統和部署的生命週期管理](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-lifecycle.html)。 *AWS IoT *  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DeleteNamespace](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/delete-namespace.html)。

### `delete-system-instance`
<a name="iotthingsgraph_DeleteSystemInstance_cli_2_topic"></a>

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

**AWS CLI**  
**刪除系統執行個體**  
以下 `delete-system-instance` 範例會刪除系統執行個體。  

```
aws iotthingsgraph delete-system-instance \
    --id "urn:tdm:us-west-2/123456789012/default:Deployment:Room218"
```
此命令不會產生輸出。  
如需詳細資訊，請參閱 [AWS IoT Things Graph 使用者指南中的 IoT Things Graph 實體、流程、系統和部署的生命週期管理](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-lifecycle.html)。 *AWS IoT *  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DeleteSystemInstance](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/delete-system-instance.html)。

### `delete-system-template`
<a name="iotthingsgraph_DeleteSystemTemplate_cli_2_topic"></a>

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

**AWS CLI**  
**刪除系統**  
以下 `delete-system-template` 範例會刪除系統。  

```
aws iotthingsgraph delete-system-template \
    --id "urn:tdm:us-west-2/123456789012/default:System:MySystem"
```
此命令不會產生輸出。  
如需詳細資訊，請參閱 [AWS IoT Things Graph 使用者指南中的 IoT Things Graph 實體、流程、系統和部署的生命週期管理](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-lifecycle.html)。 *AWS IoT *  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DeleteSystemTemplate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/delete-system-template.html)。

### `deploy-system-instance`
<a name="iotthingsgraph_DeploySystemInstance_cli_2_topic"></a>

以下程式碼範例顯示如何使用 `deploy-system-instance`。

**AWS CLI**  
**部署系統執行個體**  
下列 `delete-system-template` 範例會部署系統執行個體。  

```
aws iotthingsgraph deploy-system-instance \
    --id "urn:tdm:us-west-2/123456789012/default:Deployment:Room218"
```
輸出：  

```
{
   "summary": {
      "arn": "arn:aws:iotthingsgraph:us-west-2:123456789012:Deployment:Room218",
      "createdAt": 1559249776.254,
      "id": "urn:tdm:us-west-2/123456789012/default:Deployment:Room218",
      "status": "DEPLOYED_IN_TARGET",
      "target": "CLOUD",
      "updatedAt": 1559249776.254
   }
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[使用系統和流程組態](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-sysdeploy.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DeploySystemInstance](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/deploy-system-instance.html)。

### `deprecate-flow-template`
<a name="iotthingsgraph_DeprecateFlowTemplate_cli_2_topic"></a>

以下程式碼範例顯示如何使用 `deprecate-flow-template`。

**AWS CLI**  
**棄用流程**  
下列 `deprecate-flow-template` 範例會取代流程 (工作流程)。  

```
aws iotthingsgraph deprecate-flow-template \
    --id "urn:tdm:us-west-2/123456789012/default:Workflow:MyFlow"
```
此命令不會產生輸出。  
如需詳細資訊，請參閱 [AWS IoT Things Graph 使用者指南中的 IoT Things Graph 實體、流程、系統和部署的生命週期管理](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-lifecycle.html)。 *AWS IoT *  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DeprecateFlowTemplate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/deprecate-flow-template.html)。

### `deprecate-system-template`
<a name="iotthingsgraph_DeprecateSystemTemplate_cli_2_topic"></a>

以下程式碼範例顯示如何使用 `deprecate-system-template`。

**AWS CLI**  
**棄用系統**  
下列 `deprecate-system-template` 範例會取代系統。  

```
aws iotthingsgraph deprecate-system-template \
    --id "urn:tdm:us-west-2/123456789012/default:System:MySystem"
```
此命令不會產生輸出。  
如需詳細資訊，請參閱 [AWS IoT Things Graph 使用者指南中的 IoT Things Graph 實體、流程、系統和部署的生命週期管理](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-lifecycle.html)。 *AWS IoT *  
+  如需 API 詳細資訊，請參閱《*AWS CLI 命令參考*》中的 [DeprecateSystemTemplate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/deprecate-system-template.html)。

### `describe-namespace`
<a name="iotthingsgraph_DescribeNamespace_cli_2_topic"></a>

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

**AWS CLI**  
**取得命名空間的描述**  
下列 `describe-namespace` 範例會取得命名空間的描述。  

```
aws iotthingsgraph describe-namespace
```
輸出：  

```
{
    "namespaceName": "us-west-2/123456789012/default",
    "trackingNamespaceName": "aws",
    "trackingNamespaceVersion": 1,
    "namespaceVersion": 5
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[命名空間](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-whatis-namespace.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DescribeNamespace](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/describe-namespace.html)。

### `dissociate-entity-from-thing`
<a name="iotthingsgraph_DissociateEntityFromThing_cli_2_topic"></a>

以下程式碼範例顯示如何使用 `dissociate-entity-from-thing`。

**AWS CLI**  
**取消物件與裝置的關聯**  
下列 `dissociate-entity-from-thing` 範例會取消物件與裝置的關聯。  

```
aws iotthingsgraph dissociate-entity-from-thing \
    --thing-name "MotionSensorName" \
    --entity-type "DEVICE"
```
此命令不會產生輸出。  
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[建立和上傳模型](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-models-gs.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [DissociateEntityFromThing](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/dissociate-entity-from-thing.html)。

### `get-entities`
<a name="iotthingsgraph_GetEntities_cli_2_topic"></a>

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

**AWS CLI**  
**取得實體的定義**  
下列 `get-entities` 範例會取得裝置模型的定義。  

```
aws iotthingsgraph get-entities \
    --ids "urn:tdm:aws/examples:DeviceModel:MotionSensor"
```
輸出：  

```
{
    "descriptions": [
        {
            "id": "urn:tdm:aws/examples:DeviceModel:MotionSensor",
            "type": "DEVICE_MODEL",
            "createdAt": 1559256190.599,
            "definition": {
                "language": "GRAPHQL",
                "text": "##\n# Specification of motion sensor devices interface.\n##\ntype MotionSensor @deviceModel(id: \"urn:tdm:aws/examples:deviceModel:MotionSensor\",\n        capability: \"urn:tdm:aws/examples:capability:MotionSensorCapability\") {ignore:void}"
            }
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[建立和上傳模型](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-models-gs.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [GetEntities](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/get-entities.html)。

### `get-flow-template-revisions`
<a name="iotthingsgraph_GetFlowTemplateRevisions_cli_2_topic"></a>

以下程式碼範例顯示如何使用 `get-flow-template-revisions`。

**AWS CLI**  
**取得流程的修訂資訊**  
下列 `get-flow-template-revisions` 範例取得流程 (工作流程) 的修訂資訊。  

```
aws iotthingsgraph get-flow-template-revisions \
    --id urn:tdm:us-west-2/123456789012/default:Workflow:MyFlow
```
輸出：  

```
{
    "summaries": [
        {
            "id": "urn:tdm:us-west-2/123456789012/default:Workflow:MyFlow",
            "revisionNumber": 1,
            "createdAt": 1559247540.292
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[使用流程](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-workflows.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [GetFlowTemplateRevisions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/get-flow-template-revisions.html)。

### `get-flow-template`
<a name="iotthingsgraph_GetFlowTemplate_cli_2_topic"></a>

以下程式碼範例顯示如何使用 `get-flow-template`。

**AWS CLI**  
**取得流程定義**  
下列 `get-flow-template` 範例取得流程的定義 (工作流程)。  

```
aws iotthingsgraph get-flow-template \
    --id "urn:tdm:us-west-2/123456789012/default:Workflow:MyFlow"
```
輸出：  

```
{
    "description": {
        "summary": {
            "id": "urn:tdm:us-west-2/123456789012/default:Workflow:MyFlow",
            "revisionNumber": 1,
            "createdAt": 1559247540.292
        },
        "definition": {
            "language": "GRAPHQL",
            "text": "{\nquery MyFlow($camera: string!, $screen: string!) @workflowType(id: \"urn:tdm:us-west-2/123456789012/default:Workflow:MyFlow\") @annotation(type: \"tgc:FlowEvent\", id: \"sledged790c1b2bcd949e09da0c9bfc077f79d\", x: 1586, y: 653) @triggers(definition: \"{MotionSensor(description: \\\"\\\") @position(x: 1045, y: 635.6666564941406) {\\n  condition(expr: \\\"devices[name == \\\\\\\"motionSensor\\\\\\\"].events[name == \\\\\\\"StateChanged\\\\\\\"].lastEvent\\\")\\n  action(expr: \\\"\\\")\\n}}\") {\n  variables {\n    cameraResult @property(id: \"urn:tdm:aws/examples:property:CameraStateProperty\")\n  }\n  steps {\n    step(name: \"Camera\", outEvent: [\"sledged790c1b2bcd949e09da0c9bfc077f79d\"]) @position(x: 1377, y: 638.6666564941406) {\n      DeviceActivity(deviceModel: \"urn:tdm:aws/examples:deviceModel:Camera\", out: \"cameraResult\", deviceId: \"${camera}\") {\n        capture\n      }\n    }\n    step(name: \"Screen\", inEvent: [\"sledged790c1b2bcd949e09da0c9bfc077f79d\"]) @position(x: 1675.6666870117188, y: 637.9999847412109) {\n      DeviceActivity(deviceModel: \"urn:tdm:aws/examples:deviceModel:Screen\", deviceId: \"${screen}\") {\n        display(imageUrl: \"${cameraResult.lastClickedImage}\")\n      }\n    }\n  }\n}\n}"
        },
        "validatedNamespaceVersion": 5
    }
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[使用流程](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-workflows.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [GetFlowTemplate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/get-flow-template.html)。

### `get-namespace-deletion-status`
<a name="iotthingsgraph_GetNamespaceDeletionStatus_cli_2_topic"></a>

以下程式碼範例顯示如何使用 `get-namespace-deletion-status`。

**AWS CLI**  
**取得命名空間刪除任務的狀態**  
下列 `get-namespace-deletion-status` 範例會取得命名空間刪除任務的狀態。  

```
aws iotthingsgraph get-namespace-deletion-status
```
輸出：  

```
{
   "namespaceArn": "arn:aws:iotthingsgraph:us-west-2:123456789012",
   "namespaceName": "us-west-2/123456789012/default"
   "status": "SUCCEEDED "
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[命名空間](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-whatis-namespace.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [GetNamespaceDeletionStatus](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/get-namespace-deletion-status.html)。

### `get-system-instance`
<a name="iotthingsgraph_GetSystemInstance_cli_2_topic"></a>

以下程式碼範例顯示如何使用 `get-system-instance`。

**AWS CLI**  
**取得系統執行個體**  
下列 `get-system-instance` 範例會取得系統執行個體的定義。  

```
aws iotthingsgraph get-system-instance \
    --id "urn:tdm:us-west-2/123456789012/default:Deployment:Room218"
```
輸出：  

```
{
    "description": {
        "summary": {
            "id": "urn:tdm:us-west-2/123456789012/default:Deployment:Room218",
            "arn": "arn:aws:iotthingsgraph:us-west-2:123456789012:Deployment/default/Room218",
            "status": "NOT_DEPLOYED",
            "target": "CLOUD",
            "createdAt": 1559249315.208,
            "updatedAt": 1559249315.208
        },
        "definition": {
            "language": "GRAPHQL",
            "text": "{\r\nquery Room218 @deployment(id: \"urn:tdm:us-west-2/123456789012/default:Deployment:Room218\", systemId: \"urn:tdm:us-west-2/123456789012/default:System:SecurityFlow\") {\r\n    motionSensor(deviceId: \"MotionSensorName\")\r\n    screen(deviceId: \"ScreenName\")\r\n    camera(deviceId: \"CameraName\") \r\n    triggers {MotionEventTrigger(description: \"a trigger\") {  \r\n    condition(expr: \"devices[name == 'motionSensor'].events[name == 'StateChanged'].lastEvent\") \r\n    action(expr: \"ThingsGraph.startFlow('SecurityFlow', bindings[name == 'camera'].deviceId, bindings[name == 'screen'].deviceId)\")\r\n    }\r\n   }\r\n  }\r\n  }"
        },
        "metricsConfiguration": {
            "cloudMetricEnabled": false
        },
        "validatedNamespaceVersion": 5,
        "flowActionsRoleArn": "arn:aws:iam::123456789012:role/ThingsGraphRole"
    }
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[使用系統和流程組態](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-sysdeploy.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [GetSystemInstance](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/get-system-instance.html)。

### `get-system-template-revisions`
<a name="iotthingsgraph_GetSystemTemplateRevisions_cli_2_topic"></a>

以下程式碼範例顯示如何使用 `get-system-template-revisions`。

**AWS CLI**  
**取得系統的修訂資訊**  
下列 `get-system-template-revisions` 範例會取得系統的修訂資訊。  

```
aws iotthingsgraph get-system-template-revisions \
    --id "urn:tdm:us-west-2/123456789012/default:System:MySystem"
```
輸出：  

```
{
    "summaries": [
        {
            "id": "urn:tdm:us-west-2/123456789012/default:System:MySystem",
            "arn": "arn:aws:iotthingsgraph:us-west-2:123456789012:System/default/MySystem",
            "revisionNumber": 1,
            "createdAt": 1559247540.656
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[使用系統和流程組態](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-sysdeploy.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [GetSystemTemplateRevisions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/get-system-template-revisions.html)。

### `get-system-template`
<a name="iotthingsgraph_GetSystemTemplate_cli_2_topic"></a>

以下程式碼範例顯示如何使用 `get-system-template`。

**AWS CLI**  
**取得系統**  
下列 `get-system-template` 範例會取得系統的定義。  

```
aws iotthingsgraph get-system-template \
    --id "urn:tdm:us-west-2/123456789012/default:System:MySystem"
```
輸出：  

```
{
    "description": {
        "summary": {
            "id": "urn:tdm:us-west-2/123456789012/default:System:MySystem",
            "arn": "arn:aws:iotthingsgraph:us-west-2:123456789012:System/default/MyFlow",
            "revisionNumber": 1,
            "createdAt": 1559247540.656
        },
        "definition": {
            "language": "GRAPHQL",
            "text": "{\ntype MySystem @systemType(id: \"urn:tdm:us-west-2/123456789012/default:System:MySystem\", description: \"\") {\n  camera: Camera @thing(id: \"urn:tdm:aws/examples:deviceModel:Camera\")\n  screen: Screen @thing(id: \"urn:tdm:aws/examples:deviceModel:Screen\")\n  motionSensor: MotionSensor @thing(id: \"urn:tdm:aws/examples:deviceModel:MotionSensor\")\n  MyFlow: MyFlow @workflow(id: \"urn:tdm:us-west-2/123456789012/default:Workflow:MyFlow\")\n}\n}"
        },
        "validatedNamespaceVersion": 5
    }
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[使用系統和流程組態](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-sysdeploy.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [GetSystemTemplate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/get-system-template.html)。

### `get-upload-status`
<a name="iotthingsgraph_GetUploadStatus_cli_2_topic"></a>

以下程式碼範例顯示如何使用 `get-upload-status`。

**AWS CLI**  
**取得實體上傳的狀態**  
下列 `get-upload-status` 範例會取得實體上傳操作的狀態。`MyUploadId` 的值是 `upload-entity-definitions` 操作傳回的 ID 值。  

```
aws iotthingsgraph get-upload-status \
    --upload-id "MyUploadId"
```
輸出：  

```
{
    "namespaceName": "us-west-2/123456789012/default",
    "namespaceVersion": 5,
    "uploadId": "f6294f1e-b109-4bbe-9073-f451a2dda2da",
    "uploadStatus": "SUCCEEDED"
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[建立實體模型](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-modelmanagement.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [GetUploadStatus](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/get-upload-status.html)。

### `list-flow-execution-messages`
<a name="iotthingsgraph_ListFlowExecutionMessages_cli_2_topic"></a>

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

**AWS CLI**  
**取得流程執行中事件的相關資訊**  
下列 `list-flow-execution-messages` 範例會取得流程執行中事件的相關資訊。  

```
aws iotthingsgraph list-flow-execution-messages \
    --flow-execution-id "urn:tdm:us-west-2/123456789012/default:Workflow:SecurityFlow_2019-05-11T19:39:55.317Z_MotionSensor_69b151ad-a611-42f5-ac21-fe537f9868ad"
```
輸出：  

```
{
    "messages": [
        {
         "eventType": "EXECUTION_STARTED",
         "messageId": "f6294f1e-b109-4bbe-9073-f451a2dda2da",
         "payload": "Flow execution started",
         "timestamp": 1559247540.656
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[使用流程](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-workflows.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [ListFlowExecutionMessages](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/list-flow-execution-messages.html)。

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

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

**AWS CLI**  
**列出資源的所有標籤**  
下列`list-tags-for-resource`範例列出 an AWS IoT Things Graph 資源的所有標籤。  

```
aws iotthingsgraph list-tags-for-resource \
    --resource-arn "arn:aws:iotthingsgraph:us-west-2:123456789012:Deployment/default/Room218"
```
輸出：  

```
{
   "tags": [
      {
         "key": "Type",
         "value": "Residential"
      }
   ]
}
```
如需詳細資訊，請參閱 [AWS IoT Things Graph 使用者指南中的標記您的 IoT Things Graph 資源](https://docs.aws.amazon.com/thingsgraph/latest/ug/tagging-tg.html)。 *AWS IoT *  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [ListTagsForResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/list-tags-for-resource.html)。

### `search-entities`
<a name="iotthingsgraph_SearchEntities_cli_2_topic"></a>

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

**AWS CLI**  
**搜尋實體**  
下列 `search-entities` 範例會搜尋類型為 `EVENT` 的所有實體。  

```
aws iotthingsgraph search-entities \
    --entity-types "EVENT"
```
輸出：  

```
{
    "descriptions": [
        {
            "id": "urn:tdm:aws/examples:Event:MotionSensorEvent",
            "type": "EVENT",
            "definition": {
                "language": "GRAPHQL",
                "text": "##\n# Description of events emitted by motion sensor.\n##\ntype MotionSensorEvent @eventType(id: \"urn:tdm:aws/examples:event:MotionSensorEvent\",\n            payload: \"urn:tdm:aws/examples:property:MotionSensorStateProperty\") {ignore:void}"
            }
        },
        {
            "id": "urn:tdm:us-west-2/123456789012/default:Event:CameraClickedEventV2",
            "type": "EVENT",
            "definition": {
                "language": "GRAPHQL",
                "text": "type CameraClickedEventV2 @eventType(id: \"urn:tdm:us-west-2/123456789012/default:event:CameraClickedEventV2\",\r\npayload: \"urn:tdm:aws:Property:Boolean\"){ignore:void}"
            }
        },
        {
            "id": "urn:tdm:us-west-2/123456789012/default:Event:MotionSensorEventV2",
            "type": "EVENT",
            "definition": {
                "language": "GRAPHQL",
                "text": "# Event emitted by the motion sensor.\r\ntype MotionSensorEventV2 @eventType(id: \"urn:tdm:us-west-2/123456789012/default:event:MotionSensorEventV2\",\r\npayload: \"urn:tdm:us-west-2/123456789012/default:property:MotionSensorStateProperty2\") {ignore:void}"
            }
        }
    ],
    "nextToken": "urn:tdm:us-west-2/123456789012/default:Event:MotionSensorEventV2"
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[AWS IoT Things Graph 資料模型參考](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-models.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [SearchEntities](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/search-entities.html)。

### `search-flow-executions`
<a name="iotthingsgraph_SearchFlowExecutions_cli_2_topic"></a>

以下程式碼範例顯示如何使用 `search-flow-executions`。

**AWS CLI**  
**搜尋流程執行**  
下列 `search-flow-executions` 範例會搜尋指定系統執行個體中流程的所有執行。  

```
aws iotthingsgraph search-flow-executions \
    --system-instance-id "urn:tdm:us-west-2/123456789012/default:Deployment:Room218"
```
輸出：  

```
{
   "summaries": [
      {
         "createdAt": 1559247540.656,
         "flowExecutionId": "f6294f1e-b109-4bbe-9073-f451a2dda2da",
         "flowTemplateId": "urn:tdm:us-west-2/123456789012/default:Workflow:MyFlow",
         "status": "RUNNING ",
         "systemInstanceId": "urn:tdm:us-west-2/123456789012/default:System:MySystem",
         "updatedAt": 1559247540.656
      }
   ]
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[使用系統和流程組態](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-sysdeploy.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [SearchFlowExecutions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/search-flow-executions.html)。

### `search-flow-templates`
<a name="iotthingsgraph_SearchFlowTemplates_cli_2_topic"></a>

以下程式碼範例顯示如何使用 `search-flow-templates`。

**AWS CLI**  
**搜尋流程 (或工作流程)**  
下列 `search-flow-templates` 範例會搜尋內含攝影機裝置模型的所有流程 (工作流程)。  

```
aws iotthingsgraph search-flow-templates \
    --filters name="DEVICE_MODEL_ID",value="urn:tdm:aws/examples:DeviceModel:Camera"
```
輸出：  

```
{
    "summaries": [
        {
            "id": "urn:tdm:us-west-2/123456789012/default:Workflow:MyFlow",
            "revisionNumber": 1,
            "createdAt": 1559247540.292
        },
        {
            "id": "urn:tdm:us-west-2/123456789012/default:Workflow:SecurityFlow",
            "revisionNumber": 3,
            "createdAt": 1548283099.27
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[使用流程](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-workflows.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [SearchFlowTemplates](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/search-flow-templates.html)。

### `search-system-instances`
<a name="iotthingsgraph_SearchSystemInstances_cli_2_topic"></a>

以下程式碼範例顯示如何使用 `search-system-instances`。

**AWS CLI**  
**搜尋系統執行個體**  
下列 `search-system-instances` 範例會搜尋內含指定系統的所有系統執行個體。  

```
aws iotthingsgraph search-system-instances \
    --filters name="SYSTEM_TEMPLATE_ID",value="urn:tdm:us-west-2/123456789012/default:System:SecurityFlow"
```
輸出：  

```
{
    "summaries": [
        {
            "id": "urn:tdm:us-west-2/123456789012/default:Deployment:DeploymentForSample",
            "arn": "arn:aws:iotthingsgraph:us-west-2:123456789012:Deployment/default/DeploymentForSample",
            "status": "NOT_DEPLOYED",
            "target": "GREENGRASS",
            "greengrassGroupName": "ThingsGraphGrnGr",
            "createdAt": 1555716314.707,
            "updatedAt": 1555716314.707
        },
        {
            "id": "urn:tdm:us-west-2/123456789012/default:Deployment:MockDeployment",
            "arn": "arn:aws:iotthingsgraph:us-west-2:123456789012:Deployment/default/MockDeployment",
            "status": "DELETED_IN_TARGET",
            "target": "GREENGRASS",
            "greengrassGroupName": "ThingsGraphGrnGr",
            "createdAt": 1549416462.049,
            "updatedAt": 1549416722.361,
            "greengrassGroupId": "01d04b07-2a51-467f-9d03-0c90b3cdcaaf",
            "greengrassGroupVersionId": "7365aed7-2d3e-4d13-aad8-75443d45eb05"
        },
        {
            "id": "urn:tdm:us-west-2/123456789012/default:Deployment:MockDeployment2",
            "arn": "arn:aws:iotthingsgraph:us-west-2:123456789012:Deployment/default/MockDeployment2",
            "status": "DEPLOYED_IN_TARGET",
            "target": "GREENGRASS",
            "greengrassGroupName": "ThingsGraphGrnGr",
            "createdAt": 1549572385.774,
            "updatedAt": 1549572418.408,
            "greengrassGroupId": "01d04b07-2a51-467f-9d03-0c90b3cdcaaf",
            "greengrassGroupVersionId": "bfa70ab3-2bf7-409c-a4d4-bc8328ae5b86"
        },
        {
            "id": "urn:tdm:us-west-2/123456789012/default:Deployment:Room215",
            "arn": "arn:aws:iotthingsgraph:us-west-2:123456789012:Deployment/default/Room215",
            "status": "NOT_DEPLOYED",
            "target": "GREENGRASS",
            "greengrassGroupName": "ThingsGraphGG",
            "createdAt": 1547056918.413,
            "updatedAt": 1547056918.413
        },
        {
            "id": "urn:tdm:us-west-2/123456789012/default:Deployment:Room218",
            "arn": "arn:aws:iotthingsgraph:us-west-2:123456789012:Deployment/default/Room218",
            "status": "NOT_DEPLOYED",
            "target": "CLOUD",
            "createdAt": 1559249315.208,
            "updatedAt": 1559249315.208
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[使用系統和流程組態](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-sysdeploy.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [SearchSystemInstances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/search-system-instances.html)。

### `search-system-templates`
<a name="iotthingsgraph_SearchSystemTemplates_cli_2_topic"></a>

以下程式碼範例顯示如何使用 `search-system-templates`。

**AWS CLI**  
**搜尋系統**  
下列 `search-system-templates` 範例會搜尋內含指定流程的所有系統。  

```
aws iotthingsgraph search-system-templates \
    --filters name="FLOW_TEMPLATE_ID",value="urn:tdm:us-west-2/123456789012/default:Workflow:SecurityFlow"
```
輸出：  

```
{
    "summaries": [
        {
            "id": "urn:tdm:us-west-2/123456789012/default:System:SecurityFlow",
            "arn": "arn:aws:iotthingsgraph:us-west-2:123456789012:System/default/SecurityFlow",
            "revisionNumber": 1,
            "createdAt": 1548283099.433
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[使用流程](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-workflows.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [SearchSystemTemplates](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/search-system-templates.html)。

### `search-things`
<a name="iotthingsgraph_SearchThings_cli_2_topic"></a>

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

**AWS CLI**  
**搜尋與裝置和裝置模型相關聯的物件**  
下列 `search-things` 範例會搜尋與 HCSR501MotionSensor 裝置相關聯的所有物件。  

```
aws iotthingsgraph search-things \
    --entity-id "urn:tdm:aws/examples:Device:HCSR501MotionSensor"
```
輸出：  

```
{
    "things": [
        {
            "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MotionSensor1",
            "thingName": "MotionSensor1"
        },
        {
            "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/TG_MS",
            "thingName": "TG_MS"
        }
    ]
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[建立和上傳模型](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-models-gs.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [SearchThings](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/search-things.html)。

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

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

**AWS CLI**  
**建立資源的標籤**  
下列 `tag-resource` 範例會為指定的資源建立標籤。  

```
aws iotthingsgraph tag-resource \
    --resource-arn "arn:aws:iotthingsgraph:us-west-2:123456789012:Deployment/default/Room218" \
    --tags key="Type",value="Residential"
```
此命令不會產生輸出。  
如需詳細資訊，請參閱 [AWS IoT Things Graph 使用者指南中的標記您的 IoT Things Graph 資源](https://docs.aws.amazon.com/thingsgraph/latest/ug/tagging-tg.html)。 *AWS IoT *  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [TagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/tag-resource.html)。

### `undeploy-system-instance`
<a name="iotthingsgraph_UndeploySystemInstance_cli_2_topic"></a>

以下程式碼範例顯示如何使用 `undeploy-system-instance`。

**AWS CLI**  
**將系統執行個體從其目標取消部署**  
下列 `undeploy-system-instance` 範例會將系統執行個體從其目標中移除。  

```
aws iotthingsgraph undeploy-system-instance \
    --id "urn:tdm:us-west-2/123456789012/default:Deployment:Room215"
```
輸出：  

```
{
    "summary": {
        "id": "urn:tdm:us-west-2/123456789012/default:Deployment:Room215",
        "arn": "arn:aws:iotthingsgraph:us-west-2:123456789012:Deployment/default/Room215",
        "status": "PENDING_DELETE",
        "target": "GREENGRASS",
        "greengrassGroupName": "ThingsGraphGrnGr",
        "createdAt": 1553189694.255,
        "updatedAt": 1559344549.601,
        "greengrassGroupId": "01d04b07-2a51-467f-9d03-0c90b3cdcaaf",
        "greengrassGroupVersionId": "731b371d-d644-4b67-ac64-3934e99b75d7"
    }
}
```
如需詳細資訊，請參閱 [AWS IoT Things Graph 使用者指南中的 IoT Things Graph 實體、流程、系統和部署的生命週期管理](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-lifecycle.html)。 *AWS IoT *  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [UndeploySystemInstance](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/undeploy-system-instance.html)。

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

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

**AWS CLI**  
**移除資源的標籤**  
下列 `untag-resource` 範例會移除指定資源的標籤。  

```
aws iotthingsgraph untag-resource \
    --resource-arn "arn:aws:iotthingsgraph:us-west-2:123456789012:Deployment/default/Room218" \
    --tag-keys "Type"
```
此命令不會產生輸出。  
如需詳細資訊，請參閱 [AWS IoT Things Graph 使用者指南中的標記您的 IoT Things Graph 資源](https://docs.aws.amazon.com/thingsgraph/latest/ug/tagging-tg.html)。 *AWS IoT *  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [UntagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/untag-resource.html)。

### `update-flow-template`
<a name="iotthingsgraph_UpdateFlowTemplate_cli_2_topic"></a>

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

**AWS CLI**  
**更新流程**  
下列 `update-flow-template` 範例會更新流程 (工作流程)。`MyFlowDefinition` 的值是建立流程模型的 GraphQL。  

```
aws iotthingsgraph update-flow-template \
    --id "urn:tdm:us-west-2/123456789012/default:Workflow:MyFlow" \
    --definition language=GRAPHQL,text="MyFlowDefinition"
```
輸出：  

```
{
    "summary": {
        "createdAt": 1559248067.545,
        "id": "urn:tdm:us-west-2/123456789012/default:Workflow:MyFlow",
        "revisionNumber": 2
    }
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[使用流程](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-workflows.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [UpdateFlowTemplate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/update-flow-template.html)。

### `update-system-template`
<a name="iotthingsgraph_UpdateSystemTemplate_cli_2_topic"></a>

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

**AWS CLI**  
**更新系統**  
下列 `update-system-template` 範例會更新系統。`MySystemDefinition` 的值是建立系統模型的 GraphQL。  

```
aws iotthingsgraph update-system-template \
    --id "urn:tdm:us-west-2/123456789012/default:System:MySystem" \
    --definition language=GRAPHQL,text="MySystemDefinition"
```
輸出：  

```
{
    "summary": {
        "createdAt": 1559249776.254,
        "id": "urn:tdm:us-west-2/123456789012/default:System:MySystem",
        "arn": "arn:aws:iotthingsgraph:us-west-2:123456789012:System/default/MySystem",
        "revisionNumber": 2
    }
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[建立系統](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-sysdeploy-systems.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [UpdateSystemTemplate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/update-system-template.html)。

### `upload-entity-definitions`
<a name="iotthingsgraph_UploadEntityDefinitions_cli_2_topic"></a>

以下程式碼範例顯示如何使用 `upload-entity-definitions`。

**AWS CLI**  
**上傳實體定義**  
下列 `upload-entity-definitions` 範例會將實體定義上傳至命名空間。`MyEntityDefinitions` 的值是建立實體模型的 GraphQL。  

```
aws iotthingsgraph upload-entity-definitions \
    --document language=GRAPHQL,text="MyEntityDefinitions"
```
輸出：  

```
{
    "uploadId": "f6294f1e-b109-4bbe-9073-f451a2dda2da"
}
```
如需詳細資訊，請參閱《AWS IoT Things Graph 使用者指南》**中的[建立實體模型](https://docs.aws.amazon.com/thingsgraph/latest/ug/iot-tg-modelmanagement.html)。  
+  如需 API 詳細資訊，請參閱《AWS CLI 命令參考》**中的 [UploadEntityDefinitions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/iotthingsgraph/upload-entity-definitions.html)。