async function createExport()

in src/ExportJournal.ts [85:118]


async function createExport(
    ledgerName: string,
    startTime: Date,
    endTime: Date,
    s3BucketName: string,
    s3Prefix: string,
    encryptionConfig: S3EncryptionConfiguration,
    roleArn: string,
    qldbClient: QLDB
): Promise<ExportJournalToS3Response> {
    log(`Let's create a journal export for ledger with name: ${ledgerName}`);
    const request: ExportJournalToS3Request = {
        Name: ledgerName,
        InclusiveStartTime: startTime,
        ExclusiveEndTime: endTime,
        S3ExportConfiguration: {
            Bucket: s3BucketName,
            Prefix: s3Prefix,
            EncryptionConfiguration: encryptionConfig
        },
        RoleArn: roleArn
    };
    const result: ExportJournalToS3Response = await qldbClient.exportJournalToS3(request).promise().catch((err: AWSError ) => {
        if (isInvalidParameterException(err)) {
            error(
                "The eventually consistent behavior of the IAM service may cause this export to fail its first " +
                "attempts, please retry."
            );
        }
        throw err;
    });
    log("Requested QLDB to export contents of the journal.");
    return result;
}