| 1 | import * as sitewise from "@distilled.cloud/aws/iotsitewise"; |
| 2 | import * as Layer from "effect/Layer"; |
| 3 | import { |
| 4 | BatchPutAssetPropertyValue, |
| 5 | type BatchPutAssetPropertyValueRequest, |
| 6 | } from "./BatchPutAssetPropertyValue.ts"; |
| 7 | import { makeSiteWiseAssetHttpBinding } from "./BindingHttp.ts"; |
| 8 | |
| 9 | export const BatchPutAssetPropertyValueHttp = Layer.effect( |
| 10 | BatchPutAssetPropertyValue, |
| 11 | makeSiteWiseAssetHttpBinding({ |
| 12 | capability: "BatchPutAssetPropertyValue", |
| 13 | iamActions: ["iotsitewise:BatchPutAssetPropertyValue"], |
| 14 | operation: sitewise.batchPutAssetPropertyValue, |
| 15 | // Inject the bound asset's id into every entry that does not target a |
| 16 | // data stream by alias. |
| 17 | prepare: (request: BatchPutAssetPropertyValueRequest, assetId) => ({ |
| 18 | ...request, |
| 19 | entries: request.entries.map((entry) => |
| 20 | entry.propertyAlias === undefined ? { ...entry, assetId } : entry, |
| 21 | ), |
| 22 | }), |
| 23 | }), |
| 24 | ); |