public EncryptConfig getConfig()

in c3r-cli/src/main/java/com/amazonaws/c3r/cli/EncryptMode.java [236:263]


    public EncryptConfig getConfig() {
        final String tempDir = (optionalArgs.tempDir != null) ? optionalArgs.tempDir : FileUtil.TEMP_DIR;
        final SecretKey keyMaterial = KeyUtil.sharedSecretKeyFromString(System.getenv(KeyUtil.KEY_ENV_VAR));
        final TableSchema tableSchema;
        try {
            tableSchema = GsonUtil.fromJson(FileUtil.readBytes(requiredArgs.getSchema()), TableSchema.class);
        } catch (Exception e) {
            throw new C3rRuntimeException("Failed to parse the table schema file: " + requiredArgs.getSchema()
                    + ". Please see the stack trace for where the parsing failed.", e);
        }
        if (tableSchema == null) {
            throw new C3rIllegalArgumentException("The table schema file was empty: " + requiredArgs.getSchema());
        }

        return EncryptConfig.builder()
                .sourceFile(requiredArgs.getInput())
                .fileFormat(optionalArgs.fileFormat)
                .targetFile(optionalArgs.output)
                .tempDir(tempDir)
                .overwrite(optionalArgs.overwrite)
                .csvInputNullValue(optionalArgs.csvInputNullValue)
                .csvOutputNullValue(optionalArgs.csvOutputNullValue)
                .secretKey(keyMaterial)
                .salt(requiredArgs.getId().toString())
                .settings(getClientSettings())
                .tableSchema(tableSchema)
                .build();
    }