@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.71 KB
Raw
1 import * as cloudwatch from "@distilled.cloud/aws/cloudwatch";
2 import * as Binding from "alchemy/Binding";
3 import * as Effect from "effect/Effect";
4 import type { AlarmResource } from "./binding-common.ts";
5
6 export interface DescribeAlarmsRequest extends Omit<cloudwatch.DescribeAlarmsInput, "AlarmNames"> {}
7
8 type AlarmResources = [AlarmResource, ...AlarmResource[]];
9
10 /**
11 * Runtime binding for `cloudwatch:DescribeAlarms` — read the current state
12 * and configuration of the bound alarms. Bind it to one or more
13 * {@link Alarm} / {@link CompositeAlarm} resources; the alarm names are
14 * injected automatically.
15 *
16 * Provide `CloudWatch.DescribeAlarmsHttp` on the hosting Lambda Function to
17 * satisfy the requirement.
18 * ### Reading Alarm State
19 * **Example:** Read the State of a Bound Alarm
20 * ```typescript
21 * const alarm = yield* CloudWatch.Alarm("HighErrors", {
22 * MetricName: "Errors",
23 * Namespace: "AWS/Lambda",
24 * Statistic: "Sum",
25 * Period: 60,
26 * EvaluationPeriods: 1,
27 * Threshold: 1,
28 * ComparisonOperator: "GreaterThanOrEqualToThreshold",
29 * });
30 *
31 * // init — grants cloudwatch:DescribeAlarms on the alarm
32 * const describeAlarms = yield* AWS.CloudWatch.DescribeAlarms(alarm);
33 *
34 * // runtime
35 * const result = yield* describeAlarms();
36 * const state = result.MetricAlarms?.[0]?.StateValue; // "OK" | "ALARM" | ...
37 * ```
38 *
39 * @binding
40 */
41 export interface DescribeAlarms extends Binding.Service<
42 DescribeAlarms,
43 "AWS.CloudWatch.DescribeAlarms",
44 (
45 ...alarms: AlarmResources
46 ) => Effect.Effect<
47 (request?: DescribeAlarmsRequest) => Effect.Effect<cloudwatch.DescribeAlarmsOutput, any>
48 >
49 > {}
50
51 export const DescribeAlarms = Binding.Service<DescribeAlarms>("AWS.CloudWatch.DescribeAlarms");