updateAnomalySubscription method

Future<UpdateAnomalySubscriptionResponse> updateAnomalySubscription({
  1. required String subscriptionArn,
  2. AnomalySubscriptionFrequency? frequency,
  3. List<String>? monitorArnList,
  4. List<Subscriber>? subscribers,
  5. String? subscriptionName,
  6. double? threshold,
})

Updates an existing cost anomaly monitor subscription.

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 at which subscribers will receive notifications.

Parameter monitorArnList : A list of cost anomaly monitor ARNs.

Parameter subscribers : The update to the subscriber list.

Parameter subscriptionName : The subscription's new name.

Parameter threshold : The update to the threshold value for receiving notifications.

Implementation

Future<UpdateAnomalySubscriptionResponse> updateAnomalySubscription({
  required String subscriptionArn,
  AnomalySubscriptionFrequency? frequency,
  List<String>? monitorArnList,
  List<Subscriber>? subscribers,
  String? subscriptionName,
  double? threshold,
}) async {
  ArgumentError.checkNotNull(subscriptionArn, 'subscriptionArn');
  _s.validateStringLength(
    'subscriptionArn',
    subscriptionArn,
    0,
    1024,
    isRequired: true,
  );
  _s.validateStringLength(
    'subscriptionName',
    subscriptionName,
    0,
    1024,
  );
  _s.validateNumRange(
    'threshold',
    threshold,
    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.toValue(),
      if (monitorArnList != null) 'MonitorArnList': monitorArnList,
      if (subscribers != null) 'Subscribers': subscribers,
      if (subscriptionName != null) 'SubscriptionName': subscriptionName,
      if (threshold != null) 'Threshold': threshold,
    },
  );

  return UpdateAnomalySubscriptionResponse.fromJson(jsonResponse.body);
}