@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 51 lines 1.62 KB
Raw
1 import type * as acmpca from "@distilled.cloud/aws/acm-pca";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { CertificateAuthority } from "./CertificateAuthority.ts";
5
6 export interface IssueCertificateRequest extends Omit<
7 acmpca.IssueCertificateRequest,
8 "CertificateAuthorityArn"
9 > {}
10
11 /**
12 * Runtime binding for `acm-pca:IssueCertificate`.
13 *
14 * Bind a {@link CertificateAuthority} inside a function runtime to sign
15 * certificate signing requests (CSRs) with the CA's private key. Returns
16 * the ARN of the issued certificate — retrieve the PEM with the
17 * {@link GetCertificate} binding (issuance is asynchronous, so poll while
18 * `RequestInProgressException` is observed). Provide
19 * `ACMPCA.IssueCertificateHttp` on the Function effect to implement the
20 * binding.
21 *
22 * ### Issuing Certificates
23 * **Example:** Sign a CSR
24 * ```typescript
25 * // init
26 * const issueCertificate = yield* ACMPCA.IssueCertificate(ca);
27 *
28 * // runtime
29 * const issued = yield* issueCertificate({
30 * Csr: new TextEncoder().encode(csrPem),
31 * SigningAlgorithm: "SHA256WITHRSA",
32 * Validity: { Type: "DAYS", Value: 7 },
33 * });
34 * // issued.CertificateArn
35 * ```
36 *
37 * @binding
38 */
39 export interface IssueCertificate extends Binding.Service<
40 IssueCertificate,
41 "AWS.ACMPCA.IssueCertificate",
42 (
43 certificateAuthority: CertificateAuthority,
44 ) => Effect.Effect<
45 (
46 request: IssueCertificateRequest,
47 ) => Effect.Effect<acmpca.IssueCertificateResponse, acmpca.IssueCertificateError>
48 >
49 > {}
50
51 export const IssueCertificate = Binding.Service<IssueCertificate>("AWS.ACMPCA.IssueCertificate");