1import type * as sqs from "@distilled.cloud/aws/sqs";
2import * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { Queue } from "./Queue.ts";
5
6/**
7 * Runtime binding for `sqs:PurgeQueue`.
8 *
9 * Bind this operation to a {@link Queue} inside a function runtime to delete
10 * every message in the queue in one call. The purge takes up to 60 seconds
11 * to complete, and only one purge per queue is allowed every 60 seconds
12 * (a second call fails with the typed `PurgeQueueInProgress` error). The
13 * binding grants the host function `sqs:PurgeQueue` on the queue. Provide
14 * the `PurgeQueueHttp` layer on the Function to implement the binding.
15 * ### Purging a Queue
16 * **Example:** Purge All Messages
17 * ```typescript
18 * // init (provide SQS.PurgeQueueHttp on the Function)
19 * const purgeQueue = yield* SQS.PurgeQueue(queue);
20 *
21 * // runtime: drop everything currently in the queue
22 * yield* purgeQueue();
23 * ```
24 *
25 * @binding
26 */
27export interface PurgeQueue extends Binding.Service<
28 PurgeQueue,
29 "AWS.SQS.PurgeQueue",
30 (
31 queue: Queue,
32 ) => Effect.Effect<
33 () => Effect.Effect<sqs.PurgeQueueResponse, sqs.PurgeQueueError>
34 >
35> {}
36
37export const PurgeQueue = Binding.Service<PurgeQueue>("AWS.SQS.PurgeQueue");