in src/main/java/software/amazon/encryption/s3/internal/InstructionFileConfig.java [97:120]
public InstructionFileConfig build() {
if ((_s3AsyncClient != null || _s3Client != null) && _disableInstructionFile) {
throw new S3EncryptionClientException("Instruction Files have been disabled but a client has been passed!");
}
if (_disableInstructionFile) {
// We know both clients are null, so carry on.
this._clientType = InstructionFileClientType.DISABLED;
return new InstructionFileConfig(this);
}
if (_s3Client != null && _s3AsyncClient != null) {
throw new S3EncryptionClientException("Only one instruction file client may be set.");
}
if (_s3Client != null) {
_clientType = InstructionFileClientType.SYNCHRONOUS;
} else if (_s3AsyncClient != null){
_clientType = InstructionFileClientType.ASYNC;
} else {
throw new S3EncryptionClientException(
"At least one instruction file client must be set or Instruction Files MUST be disabled."
);
}
return new InstructionFileConfig(this);
}