sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ ResourceGroups/ SearchResources.ts

import type * as resourcegroups from "@distilled.cloud/aws/resource-groups";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";

/**
 * Runtime binding for `resource-groups:SearchResources`.
 *
 * Runs an ad-hoc resource query (the same `TAG_FILTERS_1_0` /
 * `CLOUDFORMATION_STACK_1_0` syntax a query-based group is defined with)
 * and returns the matching resource ARNs — a group-less preview of what a
 * query would capture. Account-level: the query is chosen per request, so
 * the grant is on `*` (including the Tagging API / CloudFormation
 * read-through permissions the search fans out to). Provide the
 * implementation with `Effect.provide(AWS.ResourceGroups.SearchResourcesHttp)`.
 * ### Searching Resources
 * **Example:** Find Resources By Tag
 * ```typescript
 * // init
 * const searchResources = yield* AWS.ResourceGroups.SearchResources();
 *
 * // runtime
 * const { ResourceIdentifiers } = yield* searchResources({
 *   ResourceQuery: {
 *     Type: "TAG_FILTERS_1_0",
 *     Query: JSON.stringify({
 *       ResourceTypeFilters: ["AWS::AllSupported"],
 *       TagFilters: [{ Key: "env", Values: ["prod"] }],
 *     }),
 *   },
 * });
 * ```
 *
 * @binding
 */
export interface SearchResources extends Binding.Service<
  SearchResources,
  "AWS.ResourceGroups.SearchResources",
  () => Effect.Effect<
    (
      request: resourcegroups.SearchResourcesInput,
    ) => Effect.Effect<resourcegroups.SearchResourcesOutput, resourcegroups.SearchResourcesError>
  >
> {}
export const SearchResources = Binding.Service<SearchResources>(
  "AWS.ResourceGroups.SearchResources",
);