From 8bffff4620b7a7325a828e2c383e6f7b892b412c Mon Sep 17 00:00:00 2001 From: Tim Gatzemeier Date: Mon, 16 Mar 2020 18:48:29 +0100 Subject: [PATCH] set actions enabled in template on describe images this is to avoid errors with terraform relates to https://github.com/localstack/localstack/issues/2161 --- moto/cloudwatch/models.py | 4 ++++ moto/cloudwatch/responses.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/moto/cloudwatch/models.py b/moto/cloudwatch/models.py index 716a29633..bdba09930 100644 --- a/moto/cloudwatch/models.py +++ b/moto/cloudwatch/models.py @@ -67,6 +67,7 @@ class FakeAlarm(BaseModel): ok_actions, insufficient_data_actions, unit, + actions_enabled, ): self.name = name self.namespace = namespace @@ -80,6 +81,7 @@ class FakeAlarm(BaseModel): self.dimensions = [ Dimension(dimension["name"], dimension["value"]) for dimension in dimensions ] + self.actions_enabled = actions_enabled self.alarm_actions = alarm_actions self.ok_actions = ok_actions self.insufficient_data_actions = insufficient_data_actions @@ -215,6 +217,7 @@ class CloudWatchBackend(BaseBackend): ok_actions, insufficient_data_actions, unit, + actions_enabled, ): alarm = FakeAlarm( name, @@ -231,6 +234,7 @@ class CloudWatchBackend(BaseBackend): ok_actions, insufficient_data_actions, unit, + actions_enabled, ) self.alarms[name] = alarm return alarm diff --git a/moto/cloudwatch/responses.py b/moto/cloudwatch/responses.py index 7872e71fd..dbc9d8c5a 100644 --- a/moto/cloudwatch/responses.py +++ b/moto/cloudwatch/responses.py @@ -28,6 +28,7 @@ class CloudWatchResponse(BaseResponse): dimensions = self._get_list_prefix("Dimensions.member") alarm_actions = self._get_multi_param("AlarmActions.member") ok_actions = self._get_multi_param("OKActions.member") + actions_enabled = self._get_multi_param("ActionsEnabled") insufficient_data_actions = self._get_multi_param( "InsufficientDataActions.member" ) @@ -47,6 +48,7 @@ class CloudWatchResponse(BaseResponse): ok_actions, insufficient_data_actions, unit, + actions_enabled, ) template = self.response_template(PUT_METRIC_ALARM_TEMPLATE) return template.render(alarm=alarm)