1import type * as RE2 from "@distilled.cloud/aws/resource-explorer-2";
2import type * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { View } from "./View.ts";
5
6export 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 */
29export 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> {}
38export const Search = Binding.Service<Search>("AWS.ResourceExplorer.Search");