createArchive method
Creates an archive of events with the specified settings. When you create an archive, incoming events might not immediately start being sent to the archive. Allow a short period of time for changes to take effect. If you do not specify a pattern to filter events sent to the archive, all events are sent to the archive except replayed events. Replayed events are not sent to an archive.
For more information, see Encrypting archives in the Amazon EventBridge User Guide.
May throw ConcurrentModificationException.
May throw InternalException.
May throw InvalidEventPatternException.
May throw LimitExceededException.
May throw ResourceAlreadyExistsException.
May throw ResourceNotFoundException.
Parameter archiveName :
The name for the archive to create.
Parameter eventSourceArn :
The ARN of the event bus that sends events to the archive.
Parameter description :
A description for the archive.
Parameter eventPattern :
An 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 for. Default value is 0. If set to 0,
events are retained indefinitely
Implementation
Future<CreateArchiveResponse> createArchive({
required String archiveName,
required String eventSourceArn,
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.CreateArchive'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ArchiveName': archiveName,
'EventSourceArn': eventSourceArn,
if (description != null) 'Description': description,
if (eventPattern != null) 'EventPattern': eventPattern,
if (kmsKeyIdentifier != null) 'KmsKeyIdentifier': kmsKeyIdentifier,
if (retentionDays != null) 'RetentionDays': retentionDays,
},
);
return CreateArchiveResponse.fromJson(jsonResponse.body);
}