Hedronite · Go Lesson · Polyglot-Dev / Go · Thu 2026-09-10
DescribeAlarms inventory in Go — aws-sdk-go-v2 paginator
Same silent-alarm WARN. Different SDK.
Paginate
DescribeAlarms.
WARN
No actions.
Both
Metric + composite.
Match Ops WARN semantics.
Same silent-alarm WARN. Different SDK.
§I — Frame
Use aws-sdk-go-v2 cloudwatch.NewDescribeAlarmsPaginator to list metric and composite alarms, count actions, print WARN when actions are empty. Config chain same as 09-05/09-07 companions.
§II — Sketch
cfg, err := config.LoadDefaultConfig(ctx)
client := cloudwatch.NewFromConfig(cfg)
pager := cloudwatch.NewDescribeAlarmsPaginator(client, &cloudwatch.DescribeAlarmsInput{
AlarmTypes: []types.AlarmType{types.AlarmTypeMetricAlarm, types.AlarmTypeCompositeAlarm},
})
for pager.HasMorePages() {
out, err := pager.NextPage(ctx)
// inspect MetricAlarms and CompositeAlarms; WARN if no actions
}
§III — Boundaries
- Do not DeleteAlarms from the inventory tool.
- Region is part of identity; empty page is not org-wide truth.
- Composite alarms use a different action field layout; handle both.
§IV — Closing
Match Ops WARN semantics so Maghrib can fold Go items into the Dev quiz.
Related
- Ops
- Dev
- Cert