updateArchive method

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

Updates the specified archive.

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

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 kmsKeyIdentifier : The identifier of the KMS customer managed key for EventBridge to use, if you choose to use a customer managed key to encrypt this archive. The identifier can be the key Amazon Resource Name (ARN), KeyId, key alias, or key alias ARN.

If you do not specify a customer managed key identifier, EventBridge uses an Amazon Web Services owned key to encrypt the archive.

For more information, see Identify and view keys in the Key Management Service Developer Guide.

For more information, see Encrypting archives in the Amazon EventBridge User Guide.

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

Implementation

Future<UpdateArchiveResponse> updateArchive({
  required String archiveName,
  String? description,
  String? eventPattern,
  String? kmsKeyIdentifier,
  int? retentionDays,
}) async {
  _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 (kmsKeyIdentifier != null) 'KmsKeyIdentifier': kmsKeyIdentifier,
      if (retentionDays != null) 'RetentionDays': retentionDays,
    },
  );

  return UpdateArchiveResponse.fromJson(jsonResponse.body);
}