updateAnomalySubscription method
Updates an existing cost anomaly subscription. Specify the fields that you want to update. Omitted fields are unchanged.
May throw LimitExceededException.
May throw UnknownMonitorException.
May throw UnknownSubscriptionException.
Parameter subscriptionArn :
A cost anomaly subscription Amazon Resource Name (ARN).
Parameter frequency :
The update to the frequency value that subscribers receive notifications.
Parameter monitorArnList :
A list of cost anomaly monitor ARNs.
Parameter subscribers :
The update to the subscriber list.
Parameter subscriptionName :
The new name of the subscription.
Parameter threshold :
(deprecated)
The update to the threshold value for receiving notifications.
This field has been deprecated. To update a threshold, use ThresholdExpression. Continued use of Threshold will be treated as shorthand syntax for a ThresholdExpression.
You can specify either Threshold or ThresholdExpression, but not both.
Parameter thresholdExpression :
The update to the Expression
object used to specify the anomalies that you want to generate alerts for.
This supports dimensions and nested expressions. The supported dimensions
are ANOMALY_TOTAL_IMPACT_ABSOLUTE and
ANOMALY_TOTAL_IMPACT_PERCENTAGE, corresponding to an
anomaly’s TotalImpact and TotalImpactPercentage, respectively (see Impact
for more details). The supported nested expression types are
AND and OR. The match option
GREATER_THAN_OR_EQUAL is required. Values must be numbers
between 0 and 10,000,000,000 in string format.
You can specify either Threshold or ThresholdExpression, but not both.
The following are examples of valid ThresholdExpressions:
-
Absolute threshold:
{ "Dimensions": { "Key": "ANOMALY_TOTAL_IMPACT_ABSOLUTE", "MatchOptions": \[ "GREATER_THAN_OR_EQUAL" \], "Values": \[ "100" \] } } -
Percentage threshold:
{ "Dimensions": { "Key": "ANOMALY_TOTAL_IMPACT_PERCENTAGE", "MatchOptions": \[ "GREATER_THAN_OR_EQUAL" \], "Values": \[ "100" \] } } -
ANDtwo thresholds together:{ "And": \[ { "Dimensions": { "Key": "ANOMALY_TOTAL_IMPACT_ABSOLUTE", "MatchOptions": \[ "GREATER_THAN_OR_EQUAL" \], "Values": \[ "100" \] } }, { "Dimensions": { "Key": "ANOMALY_TOTAL_IMPACT_PERCENTAGE", "MatchOptions": \[ "GREATER_THAN_OR_EQUAL" \], "Values": \[ "100" \] } } \] } -
ORtwo thresholds together:{ "Or": \[ { "Dimensions": { "Key": "ANOMALY_TOTAL_IMPACT_ABSOLUTE", "MatchOptions": \[ "GREATER_THAN_OR_EQUAL" \], "Values": \[ "100" \] } }, { "Dimensions": { "Key": "ANOMALY_TOTAL_IMPACT_PERCENTAGE", "MatchOptions": \[ "GREATER_THAN_OR_EQUAL" \], "Values": \[ "100" \] } } \] }
Implementation
Future<UpdateAnomalySubscriptionResponse> updateAnomalySubscription({
required String subscriptionArn,
AnomalySubscriptionFrequency? frequency,
List<String>? monitorArnList,
List<Subscriber>? subscribers,
String? subscriptionName,
double? threshold,
Expression? thresholdExpression,
}) async {
_s.validateNumRange(
'threshold',
threshold,
0.0,
1152921504606846976,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSInsightsIndexService.UpdateAnomalySubscription'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'SubscriptionArn': subscriptionArn,
if (frequency != null) 'Frequency': frequency.value,
if (monitorArnList != null) 'MonitorArnList': monitorArnList,
if (subscribers != null) 'Subscribers': subscribers,
if (subscriptionName != null) 'SubscriptionName': subscriptionName,
if (threshold != null) 'Threshold': threshold,
if (thresholdExpression != null)
'ThresholdExpression': thresholdExpression,
},
);
return UpdateAnomalySubscriptionResponse.fromJson(jsonResponse.body);
}