sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ ACMPCA/ GetCertificateAuthorityCertificate.ts

import type * as acmpca from "@distilled.cloud/aws/acm-pca";
import * as Binding from "alchemy/Binding";
import type * as Effect from "effect/Effect";
import type { CertificateAuthority } from "./CertificateAuthority.ts";

/**
 * Runtime binding for `acm-pca:GetCertificateAuthorityCertificate`.
 *
 * Bind a {@link CertificateAuthority} inside a function runtime to retrieve
 * the CA's own certificate and chain (PEM) — e.g. to build a trust store
 * for mutual-TLS verification of certificates the CA issued. Provide
 * `ACMPCA.GetCertificateAuthorityCertificateHttp` on the Function effect to
 * implement the binding.
 *
 * ### Reading the CA Certificate
 * **Example:** Build a Trust Store
 * ```typescript
 * // init
 * const getCaCertificate =
 *   yield* ACMPCA.GetCertificateAuthorityCertificate(ca);
 *
 * // runtime
 * const { Certificate, CertificateChain } = yield* getCaCertificate();
 * ```
 *
 * @binding
 */
export interface GetCertificateAuthorityCertificate extends Binding.Service<
  GetCertificateAuthorityCertificate,
  "AWS.ACMPCA.GetCertificateAuthorityCertificate",
  (
    certificateAuthority: CertificateAuthority,
  ) => Effect.Effect<
    () => Effect.Effect<
      acmpca.GetCertificateAuthorityCertificateResponse,
      acmpca.GetCertificateAuthorityCertificateError
    >
  >
> {}

export const GetCertificateAuthorityCertificate =
  Binding.Service<GetCertificateAuthorityCertificate>(
    "AWS.ACMPCA.GetCertificateAuthorityCertificate",
  );