| 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 CreateLicense}. |
| 7 | */ |
| 8 | export interface CreateLicenseRequest |
| 9 | extends licensemanager.CreateLicenseRequest {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `license-manager:CreateLicense` — issue a |
| 13 | * seller-issued license from the calling application. The core of an ISV |
| 14 | * ordering/fulfillment backend: when a customer purchases, the backend |
| 15 | * mints a license with the product SKU, entitlements, validity window, |
| 16 | * and consumption configuration, then distributes it via grants or |
| 17 | * activation tokens. |
| 18 | * |
| 19 | * Provide the implementation with |
| 20 | * `Effect.provide(AWS.LicenseManager.CreateLicenseHttp)`. |
| 21 | * ### Issuing Licenses |
| 22 | * **Example:** Issue a License on Purchase |
| 23 | * ```typescript |
| 24 | * // init — account-level binding takes no resource |
| 25 | * const createLicense = yield* AWS.LicenseManager.CreateLicense(); |
| 26 | * |
| 27 | * // runtime |
| 28 | * const { LicenseArn, Version } = yield* createLicense({ |
| 29 | * LicenseName: "my-product-license", |
| 30 | * ProductName: "My Product", |
| 31 | * ProductSKU: "my-product-sku", |
| 32 | * Issuer: { Name: "my-company" }, |
| 33 | * HomeRegion: region, |
| 34 | * Validity: { Begin: new Date().toISOString() }, |
| 35 | * Entitlements: [ |
| 36 | * { Name: "seats", MaxCount: 10, Unit: "Count", AllowCheckIn: true }, |
| 37 | * ], |
| 38 | * Beneficiary: customerAccountId, |
| 39 | * ConsumptionConfiguration: { |
| 40 | * ProvisionalConfiguration: { MaxTimeToLiveInMinutes: 60 }, |
| 41 | * }, |
| 42 | * ClientToken: crypto.randomUUID(), |
| 43 | * }); |
| 44 | * ``` |
| 45 | * |
| 46 | * @binding |
| 47 | */ |
| 48 | export interface CreateLicense extends Binding.Service< |
| 49 | CreateLicense, |
| 50 | "AWS.LicenseManager.CreateLicense", |
| 51 | () => Effect.Effect< |
| 52 | ( |
| 53 | request: CreateLicenseRequest, |
| 54 | ) => Effect.Effect< |
| 55 | licensemanager.CreateLicenseResponse, |
| 56 | licensemanager.CreateLicenseError |
| 57 | > |
| 58 | > |
| 59 | > {} |
| 60 | export const CreateLicense = Binding.Service<CreateLicense>( |
| 61 | "AWS.LicenseManager.CreateLicense", |
| 62 | ); |