| 1 | import type * as resourcegroups from "@distilled.cloud/aws/resource-groups"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | /** |
| 6 | * Runtime binding for `resource-groups:SearchResources`. |
| 7 | * |
| 8 | * Runs an ad-hoc resource query (the same `TAG_FILTERS_1_0` / |
| 9 | * `CLOUDFORMATION_STACK_1_0` syntax a query-based group is defined with) |
| 10 | * and returns the matching resource ARNs — a group-less preview of what a |
| 11 | * query would capture. Account-level: the query is chosen per request, so |
| 12 | * the grant is on `*` (including the Tagging API / CloudFormation |
| 13 | * read-through permissions the search fans out to). Provide the |
| 14 | * implementation with `Effect.provide(AWS.ResourceGroups.SearchResourcesHttp)`. |
| 15 | * ### Searching Resources |
| 16 | * **Example:** Find Resources By Tag |
| 17 | * ```typescript |
| 18 | * // init |
| 19 | * const searchResources = yield* AWS.ResourceGroups.SearchResources(); |
| 20 | * |
| 21 | * // runtime |
| 22 | * const { ResourceIdentifiers } = yield* searchResources({ |
| 23 | * ResourceQuery: { |
| 24 | * Type: "TAG_FILTERS_1_0", |
| 25 | * Query: JSON.stringify({ |
| 26 | * ResourceTypeFilters: ["AWS::AllSupported"], |
| 27 | * TagFilters: [{ Key: "env", Values: ["prod"] }], |
| 28 | * }), |
| 29 | * }, |
| 30 | * }); |
| 31 | * ``` |
| 32 | * |
| 33 | * @binding |
| 34 | */ |
| 35 | export interface SearchResources extends Binding.Service< |
| 36 | SearchResources, |
| 37 | "AWS.ResourceGroups.SearchResources", |
| 38 | () => Effect.Effect< |
| 39 | ( |
| 40 | request: resourcegroups.SearchResourcesInput, |
| 41 | ) => Effect.Effect< |
| 42 | resourcegroups.SearchResourcesOutput, |
| 43 | resourcegroups.SearchResourcesError |
| 44 | > |
| 45 | > |
| 46 | > {} |
| 47 | export const SearchResources = Binding.Service<SearchResources>( |
| 48 | "AWS.ResourceGroups.SearchResources", |
| 49 | ); |