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

main
ts 46 lines 1.51 KB
Raw
1 import * as sqs from "@distilled.cloud/aws/sqs";
2 import * as Binding from "alchemy/Binding";
3 import * as Effect from "effect/Effect";
4 import type { Queue } from "./Queue.ts";
5
6 export interface GetQueueAttributesRequest extends Omit<
7 sqs.GetQueueAttributesRequest,
8 "QueueUrl"
9 > {}
10
11 /**
12 * Runtime binding for `sqs:GetQueueAttributes`.
13 *
14 * Bind this operation to a {@link Queue} inside a function runtime to read
15 * live queue attributes — e.g. `ApproximateNumberOfMessages` for queue-depth
16 * monitoring or backpressure decisions. The binding grants the host function
17 * `sqs:GetQueueAttributes` on the queue. Provide the
18 * `GetQueueAttributesHttp` layer on the Function to implement the binding.
19 * ### Reading Queue Attributes
20 * **Example:** Monitor Queue Depth
21 * ```typescript
22 * // init (provide SQS.GetQueueAttributesHttp on the Function)
23 * const getQueueAttributes = yield* SQS.GetQueueAttributes(queue);
24 *
25 * // runtime
26 * const result = yield* getQueueAttributes({
27 * AttributeNames: ["ApproximateNumberOfMessages"],
28 * });
29 * const depth = Number(result.Attributes?.ApproximateNumberOfMessages ?? 0);
30 * ```
31 *
32 * @binding
33 */
34 export interface GetQueueAttributes extends Binding.Service<
35 GetQueueAttributes,
36 "AWS.SQS.GetQueueAttributes",
37 (
38 queue: Queue,
39 ) => Effect.Effect<
40 (
41 request?: GetQueueAttributesRequest,
42 ) => Effect.Effect<sqs.GetQueueAttributesResult, sqs.GetQueueAttributesError>
43 >
44 > {}
45
46 export const GetQueueAttributes = Binding.Service<GetQueueAttributes>("AWS.SQS.GetQueueAttributes");