{-# LANGUAGE FlexibleContexts, RecordWildCards #-}moduleAWS.CloudWatch.Alarm(describeAlarms,describeAlarmsForMetric,putMetricAlarm,deleteAlarms,describeAlarmHistory,enableAlarmActions,disableAlarmActions,setAlarmState)whereimportControl.ApplicativeimportData.ConduitimportData.Text(Text)importData.Time(UTCTime)importData.XML.Types(Event)importAWS.CloudWatch.InternalimportAWS.CloudWatch.TypesimportAWS.Lib.Parser(getT,getT_,members,text)importAWS.Lib.QueryimportAWS.Util(toText,boolToText,timeToText)describeAlarms::(MonadBaseControlIOm,MonadResourcem)=>MaybeText-- ^ The action name prefix.->AlarmNameSpec-- ^ The alarm name prefix or a list of alarm names to retrieve information for.->MaybeInt-- ^ The maximum number of alarm descriptions to retrieve.->MaybeText-- ^ The token returned by a previous call to indicate that there is more data available.->MaybeStateValue-- ^ The state value to be used in matching alarms.->CloudWatchm([MetricAlarm],MaybeText)-- ^ A list of information for the specified alarms and NextToken.describeAlarmsprefixspecmaxRecordsnextTokenstate=cloudWatchQuery"DescribeAlarms"params$(,)<$>members"MetricAlarms"sinkMetricAlarm<*>getT"NextToken"whereparams=["ActionPrefix"|=?prefix,specParamspec,"MaxRecords"|=?toText<$>maxRecords,"NextToken"|=?nextToken,"StateValue"|=?stringifyStateValue<$>state]specParamAlarmSpecNothing=nothingParamspecParam(AlarmSpecNamePrefixp)="AlarmNamePrefix"|=pspecParam(AlarmSpecNamesns)="AlarmNames.member"|.#=nsstringifyStateValue::StateValue->TextstringifyStateValueStateValueOk="OK"stringifyStateValueStateValueAlarm="ALARM"stringifyStateValueStateValueInsufficientData="INSUFFICIENT_DATA"sinkMetricAlarm::MonadThrowm=>GLSinkEventmMetricAlarmsinkMetricAlarm=MetricAlarm<$>getT"AlarmDescription"<*>getT"StateUpdatedTimestamp"<*>members"InsufficientDataActions"text<*>getT"StateReasonData"<*>getT"AlarmArn"<*>getT"AlarmConfigurationUpdatedTimestamp"<*>getT"AlarmName"<*>getT"StateValue"<*>getT"Period"<*>members"OKActions"text<*>getT"ActionsEnabled"<*>getT"Namespace"<*>getT"Threshold"<*>getT"EvaluationPeriods"<*>getT"Statistic"<*>members"AlarmActions"text<*>getT"Unit"<*>getT"StateReason"<*>members"Dimensions"sinkDimension<*>getT"ComparisonOperator"<*>getT"MetricName"describeAlarmsForMetric::(MonadBaseControlIOm,MonadResourcem)=>[Dimension]-- ^ The list of dimensions associated with the metric.->Text-- ^ The name of the metric.->Text-- ^ The namespace of the metric.->Int-- ^ The period in seconds over which the statistic is applied.->Statistic-- ^ The statistic for the metric.->MaybeText-- ^ The unit for the metric.->CloudWatchm[MetricAlarm]describeAlarmsForMetricdimsnamensperiodstatunit=cloudWatchQuery"DescribeAlarmsForMetric"params$members"MetricAlarms"sinkMetricAlarmwhereparams=["Dimensions.member"|.#.mapfromDimensiondims,"MetricName"|=name,"Namespace"|=ns,"Period"|=toTextperiod,"Statistic"|=stringifyStatisticstat,"Unit"|=?unit]putMetricAlarm::(MonadBaseControlIOm,MonadResourcem)=>PutMetricAlarmRequest->CloudWatchm()putMetricAlarmPutMetricAlarmRequest{..}=cloudWatchQuery"PutMetricAlarm"params$getT_"PutMetricAlarmResult"whereparams=["ActionsEnabled"|=?boolToText<$>putMetricAlarmActionsEnabled,"AlarmActions.member"|.#=putMetricAlarmAlarmActions,"AlarmDescription"|=?putMetricAlarmAlarmDescription,"AlarmName"|=putMetricAlarmAlarmName,"ComparisonOperator"|=toTextputMetricAlarmComparisonOperator,"Dimensions.member"|.#.mapfromDimensionputMetricAlarmDimensions,"EvaluationPeriods"|=toTextputMetricAlarmEvaluationPeriods,"InsufficientDataActions.member"|.#=putMetricAlarmInsufficientDataActions,"MetricName"|=putMetricAlarmMetricName,"Namespace"|=putMetricAlarmNamespace,"OKActions.member"|.#=putMetricAlarmOKActions,"Period"|=toTextputMetricAlarmPeriod,"Statistic"|=stringifyStatisticputMetricAlarmStatistic,"Threshold"|=toTextputMetricAlarmThreshold,"Unit"|=?putMetricAlarmUnit]deleteAlarms::(MonadBaseControlIOm,MonadResourcem)=>[Text]-- ^ A list of alarms to be deleted.->CloudWatchm()deleteAlarmsnames=cloudWatchQuery"DeleteAlarms"["AlarmNames.member"|.#=names]$return()describeAlarmHistory::(MonadBaseControlIOm,MonadResourcem)=>MaybeText-- ^ The name of the alarm.->MaybeUTCTime-- ^ The ending date to retrieve alarm history.->MaybeHistoryType-- ^ The type of alarm histories to retrieve.->MaybeInt-- ^ The maximum number of alarm history records to retrieve.->MaybeText-- ^ The token returned by a previous call to indicate that there is more data available.->MaybeUTCTime-- ^ The starting date to retrieve alarm history.->CloudWatchm([AlarmHistory],MaybeText)describeAlarmHistoryalarmendDatetype_maxRecordsnextTokenstartDate=cloudWatchQuery"DescribeAlarmHistory"params$(,)<$>members"AlarmHistoryItems"sinkAlarmHistory<*>getT"NextToken"whereparams=["AlarmName"|=?alarm,"EndDate"|=?timeToText<$>endDate,"HistoryItemType"|=?stringifyHistoryType<$>type_,"MaxRecords"|=?toText<$>maxRecords,"NextToken"|=?nextToken,"StartDate"|=?timeToText<$>startDate]stringifyHistoryType::HistoryType->TextstringifyHistoryTypeHistoryTypeConfigurationUpdate="ConfigurationUpdate"stringifyHistoryTypeHistoryTypeStateUpdate="StateUpdate"stringifyHistoryTypeHistoryTypeAction="Action"sinkAlarmHistory::MonadThrowm=>GLSinkEventmAlarmHistorysinkAlarmHistory=AlarmHistory<$>getT"Timestamp"<*>getT"HistoryItemType"<*>getT"AlarmName"<*>getT"HistoryData"<*>getT"HistorySummary"enableAlarmActions::(MonadBaseControlIOm,MonadResourcem)=>[Text]-- ^ The names of the alarms to enable actions for.->CloudWatchm()enableAlarmActionsalarms=cloudWatchQuery"EnableAlarmActions"["AlarmNames.member"|.#=alarms]$return()disableAlarmActions::(MonadBaseControlIOm,MonadResourcem)=>[Text]-- ^ The names of the alarms to enable actions for.->CloudWatchm()disableAlarmActionsalarms=cloudWatchQuery"DisableAlarmActions"["AlarmNames.member"|.#=alarms]$return()setAlarmState::(MonadBaseControlIOm,MonadResourcem)=>Text-- ^ The name for the alarm.->Text-- ^ The reason that this alarm is set to this specific state (in human-readable text format) ->Text-- ^ The reason that this alarm is set to this specific state (in machine-readable JSON format)->StateValue-- ^ The value of the state.->CloudWatchm()setAlarmStatealarmreasondatstate=cloudWatchQuery"SetAlarmState"params$return()whereparams=["AlarmName"|=alarm,"StateReason"|=reason,"StateReasonData"|=dat,"StateValue"|=stringifyStateValuestate]