updateAnomalyMonitor method

Future<UpdateAnomalyMonitorResponse> updateAnomalyMonitor({
  1. required String monitorArn,
  2. String? monitorName,
})

Updates an existing cost anomaly monitor. The changes made are applied going forward, and does not change anomalies detected in the past.

May throw LimitExceededException. May throw UnknownMonitorException.

Parameter monitorArn : Cost anomaly monitor Amazon Resource Names (ARNs).

Parameter monitorName : The new name for the cost anomaly monitor.

Implementation

Future<UpdateAnomalyMonitorResponse> updateAnomalyMonitor({
  required String monitorArn,
  String? monitorName,
}) async {
  ArgumentError.checkNotNull(monitorArn, 'monitorArn');
  _s.validateStringLength(
    'monitorArn',
    monitorArn,
    0,
    1024,
    isRequired: true,
  );
  _s.validateStringLength(
    'monitorName',
    monitorName,
    0,
    1024,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSInsightsIndexService.UpdateAnomalyMonitor'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'MonitorArn': monitorArn,
      if (monitorName != null) 'MonitorName': monitorName,
    },
  );

  return UpdateAnomalyMonitorResponse.fromJson(jsonResponse.body);
}