| 1 | import type * as signer from "@distilled.cloud/aws/signer"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { SigningProfile } from "./SigningProfile.ts"; |
| 5 | |
| 6 | /** |
| 7 | * Runtime binding for `signer:StartSigningJob`. |
| 8 | * |
| 9 | * Starts an asynchronous code-signing job with the bound |
| 10 | * {@link SigningProfile} — Signer reads the (versioned) source object from |
| 11 | * S3, signs it with the profile's platform and material, and writes the |
| 12 | * signed artifact to the destination bucket. The profile name is injected |
| 13 | * from the binding; the caller's credentials are used for the S3 access, so |
| 14 | * also bind `S3.GetObject` on the source bucket and `S3.PutObject` on the |
| 15 | * destination. Returns the `jobId` for use with `DescribeSigningJob` / |
| 16 | * `RevokeSignature`. Provide the implementation with |
| 17 | * `Effect.provide(AWS.Signer.StartSigningJobHttp)`. |
| 18 | * ### Signing Code |
| 19 | * **Example:** Sign an S3 Object |
| 20 | * ```typescript |
| 21 | * // init — bind the operation to the profile |
| 22 | * const startSigningJob = yield* AWS.Signer.StartSigningJob(profile); |
| 23 | * |
| 24 | * // runtime |
| 25 | * const { jobId } = yield* startSigningJob({ |
| 26 | * source: { s3: { bucketName: "src", key: "code.zip", version: versionId } }, |
| 27 | * destination: { s3: { bucketName: "dst", prefix: "signed/" } }, |
| 28 | * }); |
| 29 | * ``` |
| 30 | * |
| 31 | * @binding |
| 32 | */ |
| 33 | export interface StartSigningJob extends Binding.Service< |
| 34 | StartSigningJob, |
| 35 | "AWS.Signer.StartSigningJob", |
| 36 | ( |
| 37 | profile: SigningProfile, |
| 38 | ) => Effect.Effect< |
| 39 | ( |
| 40 | request: Omit<signer.StartSigningJobRequest, "profileName">, |
| 41 | ) => Effect.Effect< |
| 42 | signer.StartSigningJobResponse, |
| 43 | signer.StartSigningJobError |
| 44 | > |
| 45 | > |
| 46 | > {} |
| 47 | export const StartSigningJob = Binding.Service<StartSigningJob>( |
| 48 | "AWS.Signer.StartSigningJob", |
| 49 | ); |