| 1 | import type * as RE2 from "@distilled.cloud/aws/resource-explorer-2"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { View } from "./View.ts"; |
| 5 | |
| 6 | export interface ListResourcesRequest extends Omit< |
| 7 | RE2.ListResourcesInput, |
| 8 | "ViewArn" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `resource-explorer-2:ListResources`. |
| 13 | * |
| 14 | * Enumerates the resources visible through the bound {@link View} using a |
| 15 | * structured filter (instead of `Search`'s free-form query string) — the |
| 16 | * building block of inventory automation: page through every resource the |
| 17 | * view exposes and act on each one. The view's ARN is injected from the |
| 18 | * binding. Provide the implementation with |
| 19 | * `Effect.provide(AWS.ResourceExplorer.ListResourcesHttp)`. |
| 20 | * ### Listing Resources |
| 21 | * **Example:** List Resources Through a View |
| 22 | * ```typescript |
| 23 | * // init — bind the operation to the view |
| 24 | * const listResources = yield* AWS.ResourceExplorer.ListResources(view); |
| 25 | * |
| 26 | * // runtime |
| 27 | * const page = yield* listResources({ |
| 28 | * Filters: { FilterString: "service:s3" }, |
| 29 | * MaxResults: 100, |
| 30 | * }); |
| 31 | * for (const resource of page.Resources ?? []) { |
| 32 | * yield* Effect.log(`${resource.ResourceType}: ${resource.Arn}`); |
| 33 | * } |
| 34 | * ``` |
| 35 | * |
| 36 | * @binding |
| 37 | */ |
| 38 | export interface ListResources extends Binding.Service< |
| 39 | ListResources, |
| 40 | "AWS.ResourceExplorer.ListResources", |
| 41 | <V extends View>( |
| 42 | view: V, |
| 43 | ) => Effect.Effect< |
| 44 | ( |
| 45 | request?: ListResourcesRequest, |
| 46 | ) => Effect.Effect<RE2.ListResourcesOutput, RE2.ListResourcesError> |
| 47 | > |
| 48 | > {} |
| 49 | export const ListResources = Binding.Service<ListResources>( |
| 50 | "AWS.ResourceExplorer.ListResources", |
| 51 | ); |