updateArchive method

Future<UpdateArchiveResponse> updateArchive({
  1. required String archiveName,
  2. String? description,
  3. String? eventPattern,
  4. int? retentionDays,
})

Updates the specified archive.

May throw ConcurrentModificationException. May throw ResourceNotFoundException. May throw InternalException. May throw LimitExceededException. May throw InvalidEventPatternException.

Parameter archiveName : The name of the archive to update.

Parameter description : The description for the archive.

Parameter eventPattern : The event pattern to use to filter events sent to the archive.

Parameter retentionDays : The number of days to retain events in the archive.

Implementation

Future<UpdateArchiveResponse> updateArchive({
  required String archiveName,
  String? description,
  String? eventPattern,
  int? retentionDays,
}) async {
  ArgumentError.checkNotNull(archiveName, 'archiveName');
  _s.validateStringLength(
    'archiveName',
    archiveName,
    1,
    48,
    isRequired: true,
  );
  _s.validateStringLength(
    'description',
    description,
    0,
    512,
  );
  _s.validateNumRange(
    'retentionDays',
    retentionDays,
    0,
    1152921504606846976,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSEvents.UpdateArchive'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ArchiveName': archiveName,
      if (description != null) 'Description': description,
      if (eventPattern != null) 'EventPattern': eventPattern,
      if (retentionDays != null) 'RetentionDays': retentionDays,
    },
  );

  return UpdateArchiveResponse.fromJson(jsonResponse.body);
}