@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 40 lines 1.39 KB
Raw
1 import type { Alarm } from "./Alarm.ts";
2 import type { AlarmMuteRule } from "./AlarmMuteRule.ts";
3 import { sortByLogicalId } from "./common.ts";
4 import type { CompositeAlarm } from "./CompositeAlarm.ts";
5 import type { Dashboard } from "./Dashboard.ts";
6 import type { InsightRule } from "./InsightRule.ts";
7 import type { MetricStream } from "./MetricStream.ts";
8
9 export type AlarmResource = Alarm | CompositeAlarm;
10
11 export type InsightRuleResource = InsightRule;
12
13 export type TaggableResource =
14 | AlarmResource
15 | Dashboard
16 | MetricStream
17 | InsightRule
18 | AlarmMuteRule;
19
20 export const sortAlarmResources = (alarms: [AlarmResource, ...AlarmResource[]]) =>
21 sortByLogicalId(alarms) as [AlarmResource, ...AlarmResource[]];
22
23 export const sortInsightRuleResources = (rules: [InsightRuleResource, ...InsightRuleResource[]]) =>
24 sortByLogicalId(rules) as [InsightRuleResource, ...InsightRuleResource[]];
25
26 export const getTaggableResourceArn = (resource: TaggableResource) => {
27 switch (resource.Type) {
28 case "AWS.CloudWatch.Alarm":
29 case "AWS.CloudWatch.CompositeAlarm":
30 return resource.alarmArn;
31 case "AWS.CloudWatch.Dashboard":
32 return resource.dashboardArn;
33 case "AWS.CloudWatch.MetricStream":
34 return resource.metricStreamArn;
35 case "AWS.CloudWatch.InsightRule":
36 return resource.ruleArn;
37 case "AWS.CloudWatch.AlarmMuteRule":
38 return resource.alarmMuteRuleArn;
39 }
40 };