| 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 | import type { Certificate } from "./Certificate.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `acm:GetCertificate`. |
| 8 | * |
| 9 | * Bind this operation to a {@link Certificate} to get a callable that |
| 10 | * retrieves the issued certificate body and its certificate chain (both |
| 11 | * PEM-encoded). The certificate must be issued — a certificate that is still |
| 12 | * pending validation fails with the typed `RequestInProgressException`. |
| 13 | * Provide the implementation with `Effect.provide(AWS.ACM.GetCertificateHttp)`. |
| 14 | * ### Reading Certificates |
| 15 | * **Example:** Fetch the PEM Certificate Chain |
| 16 | * ```typescript |
| 17 | * // init — bind the operation to the certificate |
| 18 | * const getCertificate = yield* AWS.ACM.GetCertificate(certificate); |
| 19 | * |
| 20 | * // runtime |
| 21 | * const result = yield* getCertificate(); |
| 22 | * const pem = result.Certificate; |
| 23 | * const chain = result.CertificateChain; |
| 24 | * ``` |
| 25 | * |
| 26 | * **Example:** Handle a Certificate That Is Not Issued Yet |
| 27 | * ```typescript |
| 28 | * const pem = yield* getCertificate().pipe( |
| 29 | * Effect.map((result) => result.Certificate), |
| 30 | * Effect.catchTag("RequestInProgressException", () => |
| 31 | * Effect.succeed(undefined), |
| 32 | * ), |
| 33 | * ); |
| 34 | * ``` |
| 35 | * |
| 36 | * @binding |
| 37 | */ |
| 38 | export interface GetCertificate extends Binding.Service< |
| 39 | GetCertificate, |
| 40 | "AWS.ACM.GetCertificate", |
| 41 | ( |
| 42 | certificate: Certificate, |
| 43 | ) => Effect.Effect< |
| 44 | () => Effect.Effect<acm.GetCertificateResponse, acm.GetCertificateError> |
| 45 | > |
| 46 | > {} |
| 47 | |
| 48 | export const GetCertificate = Binding.Service<GetCertificate>( |
| 49 | "AWS.ACM.GetCertificate", |
| 50 | ); |