| 1 | import type * as cloudfront from "@distilled.cloud/aws/cloudfront"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Distribution } from "./Distribution.ts"; |
| 5 | |
| 6 | export interface GetInvalidationRequest extends Omit< |
| 7 | cloudfront.GetInvalidationRequest, |
| 8 | "DistributionId" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `cloudfront:GetInvalidation`. |
| 13 | * |
| 14 | * Reads the status of a cache invalidation on the bound distribution — |
| 15 | * pairs with {@link CreateInvalidation} to poll a purge to `Completed`. |
| 16 | * Provide the implementation with |
| 17 | * `Effect.provide(AWS.CloudFront.GetInvalidationHttp)`. |
| 18 | * ### Inspecting Invalidations |
| 19 | * **Example:** Poll an Invalidation's Status |
| 20 | * ```typescript |
| 21 | * // init — bind the operation to the distribution |
| 22 | * const getInvalidation = yield* CloudFront.GetInvalidation(distribution); |
| 23 | * |
| 24 | * // runtime |
| 25 | * const res = yield* getInvalidation({ Id: invalidationId }); |
| 26 | * console.log(res.Invalidation?.Status); // "InProgress" | "Completed" |
| 27 | * ``` |
| 28 | * |
| 29 | * @binding |
| 30 | */ |
| 31 | export interface GetInvalidation extends Binding.Service< |
| 32 | GetInvalidation, |
| 33 | "AWS.CloudFront.GetInvalidation", |
| 34 | ( |
| 35 | distribution: Distribution, |
| 36 | ) => Effect.Effect< |
| 37 | ( |
| 38 | request: GetInvalidationRequest, |
| 39 | ) => Effect.Effect< |
| 40 | cloudfront.GetInvalidationResult, |
| 41 | cloudfront.GetInvalidationError |
| 42 | > |
| 43 | > |
| 44 | > {} |
| 45 | |
| 46 | export const GetInvalidation = Binding.Service<GetInvalidation>( |
| 47 | "AWS.CloudFront.GetInvalidation", |
| 48 | ); |