| 1 | import type * as datazone from "@distilled.cloud/aws/datazone"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Domain } from "./Domain.ts"; |
| 5 | |
| 6 | export interface SearchRequest extends Omit< |
| 7 | datazone.SearchInput, |
| 8 | "domainIdentifier" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `datazone:Search`. |
| 13 | * |
| 14 | * Searches the bound domain's inventory — assets, glossaries, and data products visible to the calling project. The domain id is injected from the binding. |
| 15 | * Provide the implementation with |
| 16 | * `Effect.provide(AWS.DataZone.SearchHttp)`. |
| 17 | * ### Searching the Catalog |
| 18 | * **Example:** Search Assets by Text |
| 19 | * ```typescript |
| 20 | * // init — bind the operation to the domain |
| 21 | * const search = yield* AWS.DataZone.Search(domain); |
| 22 | * |
| 23 | * // runtime |
| 24 | * const result = yield* search({ searchScope: "ASSET", searchText: "orders" }); |
| 25 | * const names = result.items?.map((i) => i.assetItem?.name); |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface Search extends Binding.Service< |
| 31 | Search, |
| 32 | "AWS.DataZone.Search", |
| 33 | ( |
| 34 | domain: Domain, |
| 35 | ) => Effect.Effect< |
| 36 | ( |
| 37 | request: SearchRequest, |
| 38 | ) => Effect.Effect<datazone.SearchOutput, datazone.SearchError> |
| 39 | > |
| 40 | > {} |
| 41 | export const Search = Binding.Service<Search>("AWS.DataZone.Search"); |