def to_alarm(v): ret = { 'actions_enabled': v['actions_enabled'], 'alarm_actions': json.loads(v['alarm_actions']), 'alarm_arn': v['alarm_arn'], 'alarm_configuration_updated_timestamp': utils.strtime_trunk(v['alarm_configuration_updated_timestamp']), 'alarm_description': v['alarm_description'], 'alarm_name': v['alarm_name'], 'comparison_operator': v['comparison_operator'], 'dimensions': utils.dict_to_aws(json.loads(v['dimensions'])), 'evaluation_periods': v['evaluation_periods'], 'insufficient_data_actions': json.loads(v['insufficient_data_actions']), 'metric_name': v['metric_name'], 'namespace': v['namespace'], 'OK_actions': json.loads(v['ok_actions']), 'period': v['period'], 'project_id': v['project_id'], 'state_reason': v['state_reason'], 'state_reason_data': v['state_reason_data'], 'state_updated_timestamp': utils.strtime_trunk(v['state_updated_timestamp']), 'state_value': v['state_value'], 'statistic': v['statistic'], 'threshold': v['threshold'], 'unit': v['unit'], } return ret
def to_alarm_history(v): ret = { 'alarm_name': v['alarm_name'], 'history_data': v['history_data'], 'history_item_type': v['history_item_type'], 'history_summary': v['history_summary'], 'timestamp': utils.strtime_trunk(v['timestamp']) } return ret