def create_export()

in pyqldbsamples/export_journal.py [0:0]


def create_export(ledger_name, start_time, end_time, s3_bucket_name, s3_prefix, encryption_configuration, role_arn):
    """
    Request QLDB to export the contents of the journal for the given time period and S3 configuration. Before calling
    this function the S3 bucket should be created,
    see :py:meth:`pyqldbsamples.export_journal.create_s3_bucket_if_not_exists`

    :type ledger_name: str
    :param ledger_name: Name of the ledger.

    :type start_time: :py:class:`datetime.datetime`
    :param start_time: Time from when the journal contents should be exported.

    :type end_time: :py:class:`datetime.datetime`
    :param end_time: Time until which the journal contents should be exported.

    :type s3_bucket_name: str
    :param s3_bucket_name: S3 bucket to write the data to.

    :type s3_prefix: str
    :param s3_prefix: S3 prefix to be prefixed to the files written.

    :type encryption_configuration: dict
    :param encryption_configuration: Encryption configuration for S3.

    :type role_arn: str
    :param role_arn: The IAM role ARN to be used when exporting the journal.

    :rtype: dict
    :return: The result of the request.
    """
    logger.info("Let's create a journal export for ledger with name: {}.".format(ledger_name))
    try:
        result = qldb_client.export_journal_to_s3(Name=ledger_name, InclusiveStartTime=start_time,
                                                  ExclusiveEndTime=end_time,
                                                  S3ExportConfiguration={'Bucket': s3_bucket_name, 'Prefix': s3_prefix,
                                                                         'EncryptionConfiguration':
                                                                             encryption_configuration},
                                                  RoleArn=role_arn)
        logger.info("Requested QLDB to export contents of the journal.")
        return result
    except qldb_client.exceptions.InvalidParameterException as ipe:
        logger.error("The eventually consistent behavior of the IAM service may cause this export to fail its first"
                     " attempts, please retry.")
        raise ipe