createAnomalySubscription method

Future<CreateAnomalySubscriptionResponse> createAnomalySubscription({
  1. required AnomalySubscription anomalySubscription,
})

Adds a subscription to a cost anomaly detection monitor. You can use each subscription to define subscribers with email or SNS notifications. Email subscribers can set a dollar threshold and a time frequency for receiving notifications.

May throw UnknownMonitorException. May throw LimitExceededException.

Parameter anomalySubscription : The cost anomaly subscription object that you want to create.

Implementation

Future<CreateAnomalySubscriptionResponse> createAnomalySubscription({
  required AnomalySubscription anomalySubscription,
}) async {
  ArgumentError.checkNotNull(anomalySubscription, 'anomalySubscription');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSInsightsIndexService.CreateAnomalySubscription'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AnomalySubscription': anomalySubscription,
    },
  );

  return CreateAnomalySubscriptionResponse.fromJson(jsonResponse.body);
}