public static void main()

in src/main/java/software/amazon/qldb/tutorial/ExportJournal.java [151:183]


    public static void main(final String... args) throws Exception {
        String s3BucketName;
        String kmsArn = null;
        String roleArn = null;

        if (args.length >= 1) {
            s3BucketName = args[0];
            if (args.length >= 2) {
                roleArn = args[1];
            }
            // KMS Key ARN is an optional argument.
            // If not provided, SSE-S3 is used for exporting to S3 bucket.
            if (args.length == 3) {
                kmsArn = args[2];
            }
        } else {
            String accountId = AWSSecurityTokenServiceClientBuilder.defaultClient()
                .getCallerIdentity(new GetCallerIdentityRequest()).getAccount();
            s3BucketName = Constants.JOURNAL_EXPORT_S3_BUCKET_NAME_PREFIX + "-" + accountId;
        }

        S3EncryptionConfiguration s3EncryptionConfiguration;
        if (kmsArn == null) {
            s3EncryptionConfiguration =
                    new S3EncryptionConfiguration().withObjectEncryptionType(S3ObjectEncryptionType.SSE_S3);
        } else {
            s3EncryptionConfiguration =
                    new S3EncryptionConfiguration().withObjectEncryptionType(S3ObjectEncryptionType.SSE_KMS)
                            .withKmsKeyArn(kmsArn);
        }
        createJournalExportAndAwaitCompletion(Constants.LEDGER_NAME, s3BucketName, Constants.LEDGER_NAME + "/",
                roleArn, s3EncryptionConfiguration, DEFAULT_EXPORT_TIMEOUT_MS);
    }