| 1 | import type * as licensemanager from "@distilled.cloud/aws/license-manager"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | /** |
| 6 | * Request for {@link CheckoutLicense}. |
| 7 | */ |
| 8 | export interface CheckoutLicenseRequest |
| 9 | extends licensemanager.CheckoutLicenseRequest {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `license-manager:CheckoutLicense` — check out |
| 13 | * entitlements from a seller-issued license for the calling application. |
| 14 | * The returned `LicenseConsumptionToken` is used to check in or extend the |
| 15 | * consumption; `PROVISIONAL` checkouts expire and must be extended with |
| 16 | * {@link ExtendLicenseConsumption}. |
| 17 | * |
| 18 | * Provide the implementation with |
| 19 | * `Effect.provide(AWS.LicenseManager.CheckoutLicenseHttp)`. |
| 20 | * ### License Checkout Data Plane |
| 21 | * **Example:** Check Out an Entitlement |
| 22 | * ```typescript |
| 23 | * // init — account-level binding takes no resource |
| 24 | * const checkoutLicense = yield* AWS.LicenseManager.CheckoutLicense(); |
| 25 | * |
| 26 | * // runtime |
| 27 | * const checkout = yield* checkoutLicense({ |
| 28 | * ProductSKU: "my-product-sku", |
| 29 | * CheckoutType: "PROVISIONAL", |
| 30 | * KeyFingerprint: keyFingerprint, |
| 31 | * Entitlements: [{ Name: "seats", Value: "1", Unit: "Count" }], |
| 32 | * ClientToken: crypto.randomUUID(), |
| 33 | * }); |
| 34 | * const token = checkout.LicenseConsumptionToken; |
| 35 | * // on the Function effect: |
| 36 | * // .pipe(Effect.provide(AWS.LicenseManager.CheckoutLicenseHttp)) |
| 37 | * ``` |
| 38 | * |
| 39 | * @binding |
| 40 | */ |
| 41 | export interface CheckoutLicense extends Binding.Service< |
| 42 | CheckoutLicense, |
| 43 | "AWS.LicenseManager.CheckoutLicense", |
| 44 | () => Effect.Effect< |
| 45 | ( |
| 46 | request: CheckoutLicenseRequest, |
| 47 | ) => Effect.Effect< |
| 48 | licensemanager.CheckoutLicenseResponse, |
| 49 | licensemanager.CheckoutLicenseError |
| 50 | > |
| 51 | > |
| 52 | > {} |
| 53 | export const CheckoutLicense = Binding.Service<CheckoutLicense>( |
| 54 | "AWS.LicenseManager.CheckoutLicense", |
| 55 | ); |