sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ LicenseManager/ CheckoutBorrowLicense.ts

import type * as licensemanager from "@distilled.cloud/aws/license-manager";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";

/**
 * Request for {@link CheckoutBorrowLicense}.
 */
export interface CheckoutBorrowLicenseRequest extends licensemanager.CheckoutBorrowLicenseRequest {}

/**
 * Runtime binding for `license-manager:CheckoutBorrowLicense` — check out
 * an offline-capable (borrow) entitlement from a seller-issued license
 * that allows borrowing. The signed token proves the entitlement while the
 * consumer is disconnected.
 *
 * Provide the implementation with
 * `Effect.provide(AWS.LicenseManager.CheckoutBorrowLicenseHttp)`.
 * ### License Checkout Data Plane
 * **Example:** Borrow an Entitlement for Offline Use
 * ```typescript
 * // init
 * const checkoutBorrow = yield* AWS.LicenseManager.CheckoutBorrowLicense();
 *
 * // runtime
 * const borrowed = yield* checkoutBorrow({
 *   LicenseArn: licenseArn,
 *   Entitlements: [{ Name: "seats", Value: "1", Unit: "Count" }],
 *   DigitalSignatureMethod: "JWT_PS384",
 *   ClientToken: crypto.randomUUID(),
 * });
 * ```
 *
 * @binding
 */
export interface CheckoutBorrowLicense extends Binding.Service<
  CheckoutBorrowLicense,
  "AWS.LicenseManager.CheckoutBorrowLicense",
  () => Effect.Effect<
    (
      request: CheckoutBorrowLicenseRequest,
    ) => Effect.Effect<
      licensemanager.CheckoutBorrowLicenseResponse,
      licensemanager.CheckoutBorrowLicenseError
    >
  >
> {}
export const CheckoutBorrowLicense = Binding.Service<CheckoutBorrowLicense>(
  "AWS.LicenseManager.CheckoutBorrowLicense",
);