| 1 | import type * as greengrassv2 from "@distilled.cloud/aws/greengrassv2"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { ComponentVersion } from "./ComponentVersion.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `greengrass:DescribeComponent`. |
| 8 | * |
| 9 | * Reads the bound {@link ComponentVersion}'s cloud metadata — publisher, |
| 10 | * description, lifecycle `status` (`DEPLOYABLE`, `FAILED`, `DEPRECATED`), |
| 11 | * platforms, and tags — so a function can audit component health before |
| 12 | * rolling out a deployment. The component version ARN is injected from the |
| 13 | * binding. Provide the implementation with |
| 14 | * `Effect.provide(AWS.GreengrassV2.DescribeComponentHttp)`. |
| 15 | * ### Reading Components |
| 16 | * **Example:** Check A Component's State |
| 17 | * ```typescript |
| 18 | * // init — bind the operation to the component version |
| 19 | * const describeComponent = yield* AWS.GreengrassV2.DescribeComponent(component); |
| 20 | * |
| 21 | * // runtime |
| 22 | * const metadata = yield* describeComponent(); |
| 23 | * if (metadata.status?.componentState === "DEPRECATED") { |
| 24 | * yield* Effect.logWarning(`${metadata.componentName} is deprecated`); |
| 25 | * } |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface DescribeComponent extends Binding.Service< |
| 31 | DescribeComponent, |
| 32 | "AWS.GreengrassV2.DescribeComponent", |
| 33 | ( |
| 34 | component: ComponentVersion, |
| 35 | ) => Effect.Effect< |
| 36 | ( |
| 37 | request?: Omit<greengrassv2.DescribeComponentRequest, "arn">, |
| 38 | ) => Effect.Effect< |
| 39 | greengrassv2.DescribeComponentResponse, |
| 40 | greengrassv2.DescribeComponentError |
| 41 | > |
| 42 | > |
| 43 | > {} |
| 44 | export const DescribeComponent = Binding.Service<DescribeComponent>( |
| 45 | "AWS.GreengrassV2.DescribeComponent", |
| 46 | ); |