putRetentionPolicy method

Future<void> putRetentionPolicy({
  1. required String logGroupName,
  2. required int retentionInDays,
})

Sets the retention of the specified log group. A retention policy allows you to configure the number of days for which to retain log events in the specified log group.

May throw InvalidParameterException. May throw ResourceNotFoundException. May throw OperationAbortedException. May throw ServiceUnavailableException.

Parameter logGroupName : The name of the log group.

Implementation

Future<void> putRetentionPolicy({
  required String logGroupName,
  required int retentionInDays,
}) async {
  ArgumentError.checkNotNull(logGroupName, 'logGroupName');
  _s.validateStringLength(
    'logGroupName',
    logGroupName,
    1,
    512,
    isRequired: true,
  );
  ArgumentError.checkNotNull(retentionInDays, 'retentionInDays');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Logs_20140328.PutRetentionPolicy'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'logGroupName': logGroupName,
      'retentionInDays': retentionInDays,
    },
  );
}