| 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:GetComponent`. |
| 8 | * |
| 9 | * Fetches the bound {@link ComponentVersion}'s recipe (JSON or YAML, as raw |
| 10 | * bytes) so a function can inspect or mirror the component definition. The |
| 11 | * component version ARN is injected from the binding. Provide the |
| 12 | * implementation with `Effect.provide(AWS.GreengrassV2.GetComponentHttp)`. |
| 13 | * ### Reading Components |
| 14 | * **Example:** Fetch A Component's Recipe |
| 15 | * ```typescript |
| 16 | * // init — bind the operation to the component version |
| 17 | * const getComponent = yield* AWS.GreengrassV2.GetComponent(component); |
| 18 | * |
| 19 | * // runtime |
| 20 | * const { recipe } = yield* getComponent({ recipeOutputFormat: "JSON" }); |
| 21 | * const text = new TextDecoder().decode(recipe); |
| 22 | * ``` |
| 23 | * |
| 24 | * @binding |
| 25 | */ |
| 26 | export interface GetComponent extends Binding.Service< |
| 27 | GetComponent, |
| 28 | "AWS.GreengrassV2.GetComponent", |
| 29 | ( |
| 30 | component: ComponentVersion, |
| 31 | ) => Effect.Effect< |
| 32 | ( |
| 33 | request?: Omit<greengrassv2.GetComponentRequest, "arn">, |
| 34 | ) => Effect.Effect< |
| 35 | greengrassv2.GetComponentResponse, |
| 36 | greengrassv2.GetComponentError |
| 37 | > |
| 38 | > |
| 39 | > {} |
| 40 | export const GetComponent = Binding.Service<GetComponent>( |
| 41 | "AWS.GreengrassV2.GetComponent", |
| 42 | ); |