| 1 | import type * as acm from "@distilled.cloud/aws/acm"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | /** |
| 6 | * The full import request. `PrivateKey` is sensitive — pass it as |
| 7 | * `Redacted.make(bytes)` so it never leaks into logs or traces. Pass |
| 8 | * `CertificateArn` to re-import (rotate) an existing imported certificate; |
| 9 | * omit it to import a new one. |
| 10 | */ |
| 11 | export interface ImportCertificateRequest |
| 12 | extends acm.ImportCertificateRequest {} |
| 13 | |
| 14 | /** |
| 15 | * Runtime binding for `acm:ImportCertificate`. |
| 16 | * |
| 17 | * An account-level operation (no certificate argument) that imports an |
| 18 | * externally issued certificate into ACM in `us-east-1` — the classic |
| 19 | * rotation flow where a function obtains a renewed certificate from an |
| 20 | * outside CA and re-imports it over the existing ACM entry by passing its |
| 21 | * `CertificateArn`. Provide the implementation with |
| 22 | * `Effect.provide(AWS.ACM.ImportCertificateHttp)`. |
| 23 | * ### Importing Certificates |
| 24 | * **Example:** Rotate an Externally Issued Certificate |
| 25 | * ```typescript |
| 26 | * // init — account-level binding takes no resource |
| 27 | * const importCertificate = yield* AWS.ACM.ImportCertificate(); |
| 28 | * |
| 29 | * // runtime — re-import a renewed certificate over the existing ARN |
| 30 | * const encoder = new TextEncoder(); |
| 31 | * const result = yield* importCertificate({ |
| 32 | * CertificateArn: existingArn, |
| 33 | * Certificate: encoder.encode(certificatePem), |
| 34 | * PrivateKey: Redacted.make(encoder.encode(privateKeyPem)), |
| 35 | * CertificateChain: encoder.encode(chainPem), |
| 36 | * }); |
| 37 | * ``` |
| 38 | * |
| 39 | * @binding |
| 40 | */ |
| 41 | export interface ImportCertificate extends Binding.Service< |
| 42 | ImportCertificate, |
| 43 | "AWS.ACM.ImportCertificate", |
| 44 | () => Effect.Effect< |
| 45 | ( |
| 46 | request: ImportCertificateRequest, |
| 47 | ) => Effect.Effect< |
| 48 | acm.ImportCertificateResponse, |
| 49 | acm.ImportCertificateError |
| 50 | > |
| 51 | > |
| 52 | > {} |
| 53 | |
| 54 | export const ImportCertificate = Binding.Service<ImportCertificate>( |
| 55 | "AWS.ACM.ImportCertificate", |
| 56 | ); |