@@ -8,8 +8,10 @@ import type {
88 CloudWatchGetLogEventsResponse ,
99 CloudWatchGetMetricStatisticsResponse ,
1010 CloudWatchListMetricsResponse ,
11+ CloudWatchMuteAlarmResponse ,
1112 CloudWatchPutMetricDataResponse ,
1213 CloudWatchQueryLogsResponse ,
14+ CloudWatchUnmuteAlarmResponse ,
1315} from '@/tools/cloudwatch/types'
1416
1517export const CloudWatchBlock : BlockConfig <
@@ -21,6 +23,8 @@ export const CloudWatchBlock: BlockConfig<
2123 | CloudWatchListMetricsResponse
2224 | CloudWatchGetMetricStatisticsResponse
2325 | CloudWatchPutMetricDataResponse
26+ | CloudWatchMuteAlarmResponse
27+ | CloudWatchUnmuteAlarmResponse
2428> = {
2529 type : 'cloudwatch' ,
2630 name : 'CloudWatch' ,
@@ -47,6 +51,8 @@ export const CloudWatchBlock: BlockConfig<
4751 { label : 'Get Metric Statistics' , id : 'get_metric_statistics' } ,
4852 { label : 'Publish Metric' , id : 'put_metric_data' } ,
4953 { label : 'Describe Alarms' , id : 'describe_alarms' } ,
54+ { label : 'Mute Alarm' , id : 'mute_alarm' } ,
55+ { label : 'Unmute Alarm' , id : 'unmute_alarm' } ,
5056 ] ,
5157 value : ( ) => 'query_logs' ,
5258 } ,
@@ -360,6 +366,14 @@ Return ONLY the numeric timestamp - no explanations, no quotes, no extra text.`,
360366 value : ( ) => '' ,
361367 condition : { field : 'operation' , value : 'describe_alarms' } ,
362368 } ,
369+ {
370+ id : 'alarmNames' ,
371+ title : 'Alarm Names' ,
372+ type : 'short-input' ,
373+ placeholder : 'my-alarm-1, my-alarm-2' ,
374+ condition : { field : 'operation' , value : [ 'mute_alarm' , 'unmute_alarm' ] } ,
375+ required : { field : 'operation' , value : [ 'mute_alarm' , 'unmute_alarm' ] } ,
376+ } ,
363377 {
364378 id : 'limit' ,
365379 title : 'Limit' ,
@@ -389,6 +403,8 @@ Return ONLY the numeric timestamp - no explanations, no quotes, no extra text.`,
389403 'cloudwatch_get_metric_statistics' ,
390404 'cloudwatch_put_metric_data' ,
391405 'cloudwatch_describe_alarms' ,
406+ 'cloudwatch_mute_alarm' ,
407+ 'cloudwatch_unmute_alarm' ,
392408 ] ,
393409 config : {
394410 tool : ( params ) => {
@@ -409,6 +425,10 @@ Return ONLY the numeric timestamp - no explanations, no quotes, no extra text.`,
409425 return 'cloudwatch_put_metric_data'
410426 case 'describe_alarms' :
411427 return 'cloudwatch_describe_alarms'
428+ case 'mute_alarm' :
429+ return 'cloudwatch_mute_alarm'
430+ case 'unmute_alarm' :
431+ return 'cloudwatch_unmute_alarm'
412432 default :
413433 throw new Error ( `Invalid CloudWatch operation: ${ params . operation } ` )
414434 }
@@ -613,6 +633,33 @@ Return ONLY the numeric timestamp - no explanations, no quotes, no extra text.`,
613633 ...( parsedLimit !== undefined && { limit : parsedLimit } ) ,
614634 }
615635
636+ case 'mute_alarm' :
637+ case 'unmute_alarm' : {
638+ const alarmNames = rest . alarmNames
639+ if ( ! alarmNames ) {
640+ throw new Error ( 'Alarm names are required' )
641+ }
642+
643+ const names =
644+ typeof alarmNames === 'string'
645+ ? alarmNames
646+ . split ( ',' )
647+ . map ( ( n : string ) => n . trim ( ) )
648+ . filter ( Boolean )
649+ : alarmNames
650+
651+ if ( ! Array . isArray ( names ) || names . length === 0 ) {
652+ throw new Error ( 'At least one alarm name is required' )
653+ }
654+
655+ return {
656+ awsRegion,
657+ awsAccessKeyId,
658+ awsSecretAccessKey,
659+ alarmNames : names ,
660+ }
661+ }
662+
616663 default :
617664 throw new Error ( `Invalid CloudWatch operation: ${ operation } ` )
618665 }
@@ -653,6 +700,7 @@ Return ONLY the numeric timestamp - no explanations, no quotes, no extra text.`,
653700 description : 'Alarm state filter (OK, ALARM, INSUFFICIENT_DATA)' ,
654701 } ,
655702 alarmType : { type : 'string' , description : 'Alarm type filter (MetricAlarm, CompositeAlarm)' } ,
703+ alarmNames : { type : 'string' , description : 'Comma-separated alarm names to mute or unmute' } ,
656704 limit : { type : 'number' , description : 'Maximum number of results' } ,
657705 } ,
658706 outputs : {
@@ -696,9 +744,13 @@ Return ONLY the numeric timestamp - no explanations, no quotes, no extra text.`,
696744 type : 'array' ,
697745 description : 'CloudWatch alarms with state and configuration' ,
698746 } ,
747+ alarmNames : {
748+ type : 'array' ,
749+ description : 'Names of the alarms that were muted or unmuted' ,
750+ } ,
699751 success : {
700752 type : 'boolean' ,
701- description : 'Whether the published metric was successful ' ,
753+ description : 'Whether the operation completed successfully ' ,
702754 } ,
703755 namespace : {
704756 type : 'string' ,
0 commit comments