| 1 | import type * as schemas from "@distilled.cloud/aws/schemas"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Schema } from "./Schema.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `schemas:PutCodeBinding`. |
| 8 | * |
| 9 | * Kicks off code-binding generation for the bound {@link Schema} in a target |
| 10 | * language (`Java8`, `Python36`, `TypeScript3`, or `Go1`). Generation is |
| 11 | * asynchronous — poll {@link DescribeCodeBinding} until the status is |
| 12 | * `CREATE_COMPLETE`, then download the package with |
| 13 | * {@link GetCodeBindingSource}. The registry and schema names are injected |
| 14 | * from the binding. Provide the implementation with |
| 15 | * `Effect.provide(AWS.Schemas.PutCodeBindingHttp)`. |
| 16 | * ### Code Bindings |
| 17 | * **Example:** Generate Python Bindings |
| 18 | * ```typescript |
| 19 | * // init — bind the operation to the schema |
| 20 | * const putCodeBinding = yield* AWS.Schemas.PutCodeBinding(schema); |
| 21 | * |
| 22 | * // runtime |
| 23 | * const { Status } = yield* putCodeBinding({ Language: "Python36" }); |
| 24 | * // Status is "CREATE_IN_PROGRESS" until generation finishes |
| 25 | * ``` |
| 26 | * |
| 27 | * @binding |
| 28 | */ |
| 29 | export interface PutCodeBinding extends Binding.Service< |
| 30 | PutCodeBinding, |
| 31 | "AWS.Schemas.PutCodeBinding", |
| 32 | (schema: Schema) => Effect.Effect< |
| 33 | (request: { |
| 34 | /** The target language: `Java8`, `Python36`, `TypeScript3`, or `Go1`. */ |
| 35 | Language: string; |
| 36 | /** The version of the schema to generate bindings for. Defaults to the latest. */ |
| 37 | SchemaVersion?: string; |
| 38 | }) => Effect.Effect< |
| 39 | schemas.PutCodeBindingResponse, |
| 40 | schemas.PutCodeBindingError |
| 41 | > |
| 42 | > |
| 43 | > {} |
| 44 | export const PutCodeBinding = Binding.Service<PutCodeBinding>( |
| 45 | "AWS.Schemas.PutCodeBinding", |
| 46 | ); |