| 1 | import type * as acmpca from "@distilled.cloud/aws/acm-pca"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { CertificateAuthority } from "./CertificateAuthority.ts"; |
| 5 | |
| 6 | export interface ImportCertificateAuthorityCertificateRequest extends Omit< |
| 7 | acmpca.ImportCertificateAuthorityCertificateRequest, |
| 8 | "CertificateAuthorityArn" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `acm-pca:ImportCertificateAuthorityCertificate`. |
| 13 | * |
| 14 | * Bind a {@link CertificateAuthority} inside a function runtime to install |
| 15 | * the CA's signed certificate — the final step of the activation flow |
| 16 | * (fetch CSR via {@link GetCertificateAuthorityCsr}, sign it, import). This |
| 17 | * enables workflows where the CA's CSR is signed by an on-premises or |
| 18 | * external parent CA at runtime. Provide |
| 19 | * `ACMPCA.ImportCertificateAuthorityCertificateHttp` on the Function effect |
| 20 | * to implement the binding. |
| 21 | * |
| 22 | * ### CA Activation |
| 23 | * **Example:** Install a Signed CA Certificate |
| 24 | * ```typescript |
| 25 | * // init |
| 26 | * const importCaCertificate = |
| 27 | * yield* ACMPCA.ImportCertificateAuthorityCertificate(ca); |
| 28 | * |
| 29 | * // runtime |
| 30 | * yield* importCaCertificate({ |
| 31 | * Certificate: new TextEncoder().encode(signedCertPem), |
| 32 | * CertificateChain: new TextEncoder().encode(chainPem), |
| 33 | * }); |
| 34 | * ``` |
| 35 | * |
| 36 | * @binding |
| 37 | */ |
| 38 | export interface ImportCertificateAuthorityCertificate extends Binding.Service< |
| 39 | ImportCertificateAuthorityCertificate, |
| 40 | "AWS.ACMPCA.ImportCertificateAuthorityCertificate", |
| 41 | ( |
| 42 | certificateAuthority: CertificateAuthority, |
| 43 | ) => Effect.Effect< |
| 44 | ( |
| 45 | request: ImportCertificateAuthorityCertificateRequest, |
| 46 | ) => Effect.Effect< |
| 47 | acmpca.ImportCertificateAuthorityCertificateResponse, |
| 48 | acmpca.ImportCertificateAuthorityCertificateError |
| 49 | > |
| 50 | > |
| 51 | > {} |
| 52 | |
| 53 | export const ImportCertificateAuthorityCertificate = |
| 54 | Binding.Service<ImportCertificateAuthorityCertificate>( |
| 55 | "AWS.ACMPCA.ImportCertificateAuthorityCertificate", |
| 56 | ); |