AWS IoT TwinMaker データコネクター - AWS IoT TwinMaker

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

AWS IoT TwinMaker データコネクター

コネクタは、送信されたクエリを解決し、結果またはエラーを返すために、基になるデータストアにアクセスする必要があります。

利用可能なコネクタ、そのリクエストインターフェース、レスポンスインターフェースについては、以下のトピックを参照してください。

コネクタインターフェースで使用されるプロパティの詳細については、GetPropertyValueHistoryAPI アクションを参照してください。

注記

一部のコネクタでは、リクエストインターフェースとレスポンスインターフェースの両方に、開始時刻と終了時刻のプロパティ用に2つのタイムスタンプフィールドがあります。startDateTimeendDateTimeのどちらもエポック秒を表すのに長い数字を使用していますが、これはもうサポートされていません。後方互換性を維持するため、このフィールドにはタイムスタンプ値を送信しますが、APIのタイムスタンプ形式と一致するstartTimeフィールドとendTimeフィールドを使用することをお勧めします。

スキーマ イニシャライザ コネクタ

コンポーネントタイプまたはエンティティライフサイクルでスキーマ イニシャライザを使用して、基になるデータソースからコンポーネントタイプまたはコンポーネントプロパティを取得できます。スキーマ イニシャライザは、APIアクションを明示的に呼び出してpropertiesをセットアップしなくても、コンポーネントタイプまたはコンポーネントプロパティを自動的にインポートします。

SchemaInitializer リクエストインターフェース

{ "workspaceId": "string", "entityId": "string", "componentName": "string", "properties": { // property name as key, // value is of type PropertyRequest "string": "PropertyRequest" } }
注記

このリクエストインターフェースのプロパティマップはPropertyRequestです。詳細については、を参照してくださいPropertyRequest

SchemaInitializer レスポンスインターフェース

{ "properties": { // property name as key, // value is of type PropertyResponse "string": "PropertyResponse" } }
注記

このリクエストインターフェースのプロパティマップはPropertyResponseです。詳細については、を参照してくださいPropertyResponse

DataReaderByEntity

DataReaderByEntity は、1 つのコンポーネントのプロパティの時系列値を取得するために使用されるデータプレーンコネクタです。

このコネクタのプロパティタイプ、構文、形式については、GetPropertyValueHistoryAPI アクションを参照してください。

DataReaderByEntityリクエストインターフェース

{ "startDateTime": long, // In epoch sec, deprecated "startTime": "string", // ISO-8601 timestamp format "endDateTime": long, // In epoch sec, deprecated "endTime": "string", // ISO-8601 timestamp format "properties": { // A map of properties as in the get-entity API response // property name as key, // value is of type PropertyResponse "string": "PropertyResponse" }, "workspaceId": "string", "selectedProperties": List:"string", "propertyFilters": List:PropertyFilter, "entityId": "string", "componentName": "string", "componentTypeId": "string", "interpolation": InterpolationParameters, "nextToken": "string", "maxResults": int, "orderByTime": "string" }

DataReaderByEntityレスポンスインターフェース

{ "propertyValues": [ { "entityPropertyReference": EntityPropertyReference, // The same as EntityPropertyReference "values": [ { "timestamp": long, // Epoch sec, deprecated "time": "string", // ISO-8601 timestamp format "value": DataValue // The same as DataValue } ] } ], "nextToken": "string" }

DataReaderByComponentType

同じコンポーネントタイプに含まれる共通プロパティの時系列値を取得するには、 DataReaderByEntityデータプレーンコネクタを使用します。たとえば、コンポーネントタイプで時系列プロパティを定義していて、そのコンポーネントタイプを使用するコンポーネントが複数ある場合、特定の時間範囲内のすべてのコンポーネントでそれらのプロパティをクエリできます。一般的な使用例としては、複数のコンポーネントのアラームステータスをクエリしてエンティティをグローバルに把握したい場合です。

このコネクタのプロパティタイプ、構文、形式については、GetPropertyValueHistoryAPI アクションを参照してください。

DataReaderByComponentType リクエストインターフェース

{ "startDateTime": long, // In epoch sec, deprecated "startTime": "string", // ISO-8601 timestamp format "endDateTime": long, // In epoch sec, deprecated "endTime": "string", // ISO-8601 timestamp format "properties": { // A map of properties as in the get-entity API response // property name as key, // value is of type PropertyResponse "string": "PropertyResponse" }, "workspaceId": "string", "selectedProperties": List:"string", "propertyFilters": List:PropertyFilter, "componentTypeId": "string", "interpolation": InterpolationParameters, "nextToken": "string", "maxResults": int, "orderByTime": "string" }

DataReaderByComponentType レスポンスインターフェース

{ "propertyValues": [ { "entityPropertyReference": EntityPropertyReference, // The same as EntityPropertyReference "entityId": "string", "componentName": "string", "values": [ { "timestamp": long, // Epoch sec, deprecated "time": "string", // ISO-8601 timestamp format "value": DataValue // The same as DataValue } ] } ], "nextToken": "string" }

DataReader

DataReader DataReaderByEntity との両方に対応できるデータプレーンコネクタです DataReaderByComponentType。

このコネクタのプロパティタイプ、構文、形式については、GetPropertyValueHistoryAPI アクションを参照してください。

DataReader リクエストインターフェース

EntityIdおよびcomponentNameはオプションです。

{ "startDateTime": long, // In epoch sec, deprecated "startTime": "string", // ISO-8601 timestamp format "endDateTime": long, // In epoch sec, deprecated "endTime": "string", // ISO-8601 timestamp format "properties": { // A map of properties as in the get-entity API response // property name as key, // value is of type PropertyRequest "string": "PropertyRequest" }, "workspaceId": "string", "selectedProperties": List:"string", "propertyFilters": List:PropertyFilter, "entityId": "string", "componentName": "string", "componentTypeId": "string", "interpolation": InterpolationParameters, "nextToken": "string", "maxResults": int, "orderByTime": "string" }

DataReader レスポンスインターフェース

{ "propertyValues": [ { "entityPropertyReference": EntityPropertyReference, // The same as EntityPropertyReference "values": [ { "timestamp": long, // Epoch sec, deprecated "time": "string", // ISO-8601 timestamp format "value": DataValue // The same as DataValue } ] } ], "nextToken": "string" }

AttributePropertyValueReaderByEntity

AttributePropertyValueReaderByEntity は、1 つのエンティティの静的プロパティの値を取得するために使用できるデータプレーンコネクタです。

このコネクタのプロパティタイプ、構文、形式については、 GetPropertyValueAPI アクションを参照してください。

AttributePropertyValueReaderByEntity リクエストインターフェース

{ "properties": { // property name as key, // value is of type PropertyResponse "string": "PropertyResponse" } "workspaceId": "string", "entityId": "string", "componentName": "string", "selectedProperties": List:"string", }

AttributePropertyValueReaderByEntity レスポンスインターフェース

{ "propertyValues": { "string": { // property name as key "propertyReference": EntityPropertyReference, // The same as EntityPropertyReference "propertyValue": DataValue // The same as DataValue } }

DataWriter

DataWriter は、単一コンポーネントのプロパティの時系列データポイントを基になるデータストアに書き戻すために使用できるデータプレーンコネクタです。

このコネクタのプロパティタイプ、構文、形式については、BatchPutPropertyValuesAPI アクションを参照してください。

DataWriter リクエストインターフェース

{ "workspaceId": "string", "properties": { // entity id as key "String": { // property name as key, // value is of type PropertyResponse "string": PropertyResponse } }, "entries": [ { "entryId": "string", "entityPropertyReference": EntityPropertyReference, // The same as EntityPropertyReference "propertyValues": [ { "timestamp": long, // Epoch sec, deprecated "time": "string", // ISO-8601 timestamp format "value": DataValue // The same as DataValue } ] } ] }

DataWriter レスポンスインターフェース

{ "errorEntries": [ { "errors": List:BatchPutPropertyError // The value is a list of type BatchPutPropertyError } ] }

以下のJSONサンプルは、複数のコネクタのレスポンスおよびリクエスト構文の例です。

  • SchemaInitializer:

    以下の例は、コンポーネントタイプのライフサイクルにおけるスキーマイニシャライザーを示しています。

    リクエスト:

    { "workspaceId": "myWorkspace", "properties": { "modelId": { "definition": { "dataType": { "type": "STRING" }, "isExternalId": true, "isFinal": true, "isImported": false, "isInherited": false, "isRequiredInEntity": true, "isStoredExternally": false, "isTimeSeries": false, "defaultValue": { "stringValue": "myModelId" } }, "value": { "stringValue": "myModelId" } }, "tableName": { "definition": { "dataType": { "type": "STRING" }, "isExternalId": false, "isFinal": false, "isImported": false, "isInherited": false, "isRequiredInEntity": false, "isStoredExternally": false, "isTimeSeries": false, "defaultValue": { "stringValue": "myTableName" } }, "value": { "stringValue": "myTableName" } } } }

    レスポンス:

    { "properties": { "myProperty1": { "definition": { "dataType": { "type": "DOUBLE", "unitOfMeasure": "%" }, "configuration": { "myProperty1Id": "idValue" }, "isTimeSeries": true } }, "myProperty2": { "definition": { "dataType": { "type": "STRING" }, "isTimeSeries": false, "defaultValue": { "stringValue": "property2Value" } } } } }
  • エンティティ ライフサイクルのスキーマ イニシャライザー

    リクエスト:

    { "workspaceId": "myWorkspace", "entityId": "myEntity", "componentName": "myComponent", "properties": { "assetId": { "definition": { "dataType": { "type": "STRING" }, "isExternalId": true, "isFinal": true, "isImported": false, "isInherited": false, "isRequiredInEntity": true, "isStoredExternally": false, "isTimeSeries": false }, "value": { "stringValue": "myAssetId" } }, "tableName": { "definition": { "dataType": { "type": "STRING" }, "isExternalId": false, "isFinal": false, "isImported": false, "isInherited": false, "isRequiredInEntity": false, "isStoredExternally": false, "isTimeSeries": false }, "value": { "stringValue": "myTableName" } } } }

    レスポンス:

    { "properties": { "myProperty1": { "definition": { "dataType": { "type": "DOUBLE", "unitOfMeasure": "%" }, "configuration": { "myProperty1Id": "idValue" }, "isTimeSeries": true } }, "myProperty2": { "definition": { "dataType": { "type": "STRING" }, "isTimeSeries": false }, "value": { "stringValue": "property2Value" } } } }
  • DataReaderByEntity と DataReader:

    リクエスト:

    { "workspaceId": "myWorkspace", "entityId": "myEntity", "componentName": "myComponent", "selectedProperties": [ "Temperature", "Pressure" ], "startTime": "2022-04-07T04:04:42Z", "endTime": "2022-04-07T04:04:45Z", "maxResults": 4, "orderByTime": "ASCENDING", "properties": { "assetId": { "definition": { "dataType": { "type": "STRING" }, "isExternalId": true, "isFinal": true, "isImported": false, "isInherited": false, "isRequiredInEntity": true, "isStoredExternally": false, "isTimeSeries": false }, "value": { "stringValue": "myAssetId" } }, "Temperature": { "definition": { "configuration": { "temperatureId": "xyz123" }, "dataType": { "type": "DOUBLE", "unitOfMeasure": "DEGC" }, "isExternalId": false, "isFinal": false, "isImported": true, "isInherited": false, "isRequiredInEntity": false, "isStoredExternally": false, "isTimeSeries": true } }, "Pressure": { "definition": { "configuration": { "pressureId": "xyz456" }, "dataType": { "type": "DOUBLE", "unitOfMeasure": "MPA" }, "isExternalId": false, "isFinal": false, "isImported": true, "isInherited": false, "isRequiredInEntity": false, "isStoredExternally": false, "isTimeSeries": true } } } }

    レスポンス:

    { "propertyValues": [ { "entityPropertyReference": { "entityId": "myEntity", "componentName": "myComponent", "propertyName": "Temperature" }, "values": [ { "time": "2022-04-07T04:04:42Z", "value": { "doubleValue": 588.168 } }, { "time": "2022-04-07T04:04:43Z", "value": { "doubleValue": 592.4224 } } ] } ], "nextToken": "qwertyuiop" }
  • AttributePropertyValueReaderByEntity:

    リクエスト:

    { "workspaceId": "myWorkspace", "entityId": "myEntity", "componentName": "myComponent", "selectedProperties": [ "manufacturer", ], "properties": { "assetId": { "definition": { "dataType": { "type": "STRING" }, "isExternalId": true, "isFinal": true, "isImported": false, "isInherited": false, "isRequiredInEntity": true, "isStoredExternally": false, "isTimeSeries": false }, "value": { "stringValue": "myAssetId" } }, "manufacturer": { "definition": { "dataType": { "type": "STRING" }, "configuration": { "manufacturerPropId": "M001" }, "isExternalId": false, "isFinal": false, "isImported": false, "isInherited": false, "isRequiredInEntity": false, "isStoredExternally": true, "isTimeSeries": false } } } }

    レスポンス:

    { "propertyValues": { "manufacturer": { "propertyReference": { "propertyName": "manufacturer", "entityId": "myEntity", "componentName": "myComponent" }, "propertyValue": { "stringValue": "Amazon" } } } }
  • DataWriter:

    リクエスト:

    { "workspaceId": "myWorkspaceId", "properties": { "myEntity": { "Temperature": { "definition": { "configuration": { "temperatureId": "xyz123" }, "dataType": { "type": "DOUBLE", "unitOfMeasure": "DEGC" }, "isExternalId": false, "isFinal": false, "isImported": true, "isInherited": false, "isRequiredInEntity": false, "isStoredExternally": false, "isTimeSeries": true } } } }, "entries": [ { "entryId": "myEntity", "entityPropertyReference": { "entityId": "myEntity", "componentName": "myComponent", "propertyName": "Temperature" }, "propertyValues": [ { "timestamp": 1626201120, "value": { "doubleValue": 95.6958 } }, { "timestamp": 1626201132, "value": { "doubleValue": 80.6959 } } ] } ] }

    レスポンス:

    { "errorEntries": [ { "errors": [ { "errorCode": "409", "errorMessage": "Conflict value at same timestamp", "entry": { "entryId": "myEntity", "entityPropertyReference": { "entityId": "myEntity", "componentName": "myComponent", "propertyName": "Temperature" }, "propertyValues": [ "time": "2022-04-07T04:04:42Z", "value": { "doubleValue": 95.6958 } ] } } ] } ] }