| 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 SearchRequest extends Omit<RE2.SearchInput, "ViewArn"> {} |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `resource-explorer-2:Search`. |
| 10 | * |
| 11 | * Bind this operation to a `View` inside a function runtime to get a |
| 12 | * callable that automatically injects the view's ARN. Results are the |
| 13 | * intersection of the `QueryString` and the view's filter. Provide the |
| 14 | * implementation with `Effect.provide(AWS.ResourceExplorer.SearchHttp)`. |
| 15 | * ### Searching Resources |
| 16 | * **Example:** Search for S3 buckets |
| 17 | * ```typescript |
| 18 | * const search = yield* AWS.ResourceExplorer.Search(view); |
| 19 | * |
| 20 | * const results = yield* search({ |
| 21 | * QueryString: "service:s3", |
| 22 | * MaxResults: 50, |
| 23 | * }); |
| 24 | * // results.Resources, results.Count?.TotalResources |
| 25 | * ``` |
| 26 | * |
| 27 | * @binding |
| 28 | */ |
| 29 | export interface Search extends Binding.Service< |
| 30 | Search, |
| 31 | "AWS.ResourceExplorer.Search", |
| 32 | <V extends View>( |
| 33 | view: V, |
| 34 | ) => Effect.Effect< |
| 35 | (request: SearchRequest) => Effect.Effect<RE2.SearchOutput, RE2.SearchError> |
| 36 | > |
| 37 | > {} |
| 38 | export const Search = Binding.Service<Search>("AWS.ResourceExplorer.Search"); |