1import type * as sitewise from "@distilled.cloud/aws/iotsitewise";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Asset } from "./Asset.ts";
5
6/**
7 * Request for {@link DescribeAsset}. The bound asset's id is injected
8 * automatically.
9 */
10export interface DescribeAssetRequest extends Omit<
11 sitewise.DescribeAssetRequest,
12 "assetId"
13> {}
14
15/**
16 * Runtime binding for `iotsitewise:DescribeAsset` — read the bound asset's
17 * full description (including its properties with their service-assigned
18 * ids and names) from a deployed Lambda or Task. Use it to resolve a
19 * property's id by name before reading or ingesting values.
20 *
21 * ### Describing the Bound Asset
22 * Provide the `DescribeAssetHttp` implementation layer on the Function
23 * effect, bind the asset in the init phase, then call the returned client
24 * at runtime.
25 *
26 * **Example:** Resolve a Property Id by Name
27 * ```typescript
28 * // init
29 * const describeAsset = yield* AWS.IoTSiteWise.DescribeAsset(asset);
30 *
31 * // runtime
32 * const described = yield* describeAsset();
33 * const propertyId = described.assetProperties.find(
34 * (p) => p.name === "Temperature",
35 * )?.id;
36 * // on the Function effect:
37 * // .pipe(Effect.provide(AWS.IoTSiteWise.DescribeAssetHttp))
38 * ```
39 *
40 * @binding
41 */
42export interface DescribeAsset extends Binding.Service<
43 DescribeAsset,
44 "AWS.IoTSiteWise.DescribeAsset",
45 (
46 asset: Asset,
47 ) => Effect.Effect<
48 (
49 request?: DescribeAssetRequest,
50 ) => Effect.Effect<
51 sitewise.DescribeAssetResponse,
52 sitewise.DescribeAssetError
53 >
54 >
55> {}
56export const DescribeAsset = Binding.Service<DescribeAsset>(
57 "AWS.IoTSiteWise.DescribeAsset",
58);