in c3r-sdk-core/src/main/java/com/amazonaws/c3r/cleanrooms/CleanRoomsDao.java [137:187]
public ClientSettings getCollaborationDataEncryptionMetadata(final String collaborationId) {
final AwsRequestOverrideConfiguration overrideConfiguration = AwsRequestOverrideConfiguration.builder()
.addApiName(apiName)
.build();
final GetCollaborationRequest request = GetCollaborationRequest.builder()
.collaborationIdentifier(collaborationId)
.overrideConfiguration(overrideConfiguration)
.build();
final String baseError = "Unable to retrieve the collaboration configuration for CollaborationID: `" + collaborationId + "`.";
final String endError = "Please verify that the CollaborationID is correct and try again.";
final GetCollaborationResponse response;
try {
response = getClient().getCollaboration(request);
} catch (ResourceNotFoundException e) {
throw new C3rRuntimeException(baseError + " No collaboration found. " + endError, e);
} catch (AccessDeniedException e) {
throw new C3rRuntimeException(baseError + " Access denied. " + endError, e);
} catch (ThrottlingException e) {
throw new C3rRuntimeException(baseError + " Throttling. Please wait a moment before trying again.", e);
} catch (ValidationException e) {
throw new C3rRuntimeException(baseError + " CollaborationID could not be validated. " + endError, e);
} catch (SdkException e) {
throw new C3rRuntimeException(baseError + " Unknown error: " + e.getMessage(), e);
}
final DataEncryptionMetadata metadata = response.collaboration().dataEncryptionMetadata();
if (metadata == null) {
throw new C3rRuntimeException(
"The collaboration with CollaborationID `" + collaborationId + "` was not created for use with " +
"C3R! C3R must be enabled on the collaboration when it's created in order to continue.");
}
final var settings = ClientSettings.builder()
.allowJoinsOnColumnsWithDifferentNames(metadata.allowJoinsOnColumnsWithDifferentNames())
.allowCleartext(metadata.allowCleartext())
.allowDuplicates(metadata.allowDuplicates())
.preserveNulls(metadata.preserveNulls())
.build();
final Function<Boolean, String> boolToYesOrNo = (b) -> b ? "yes" : "no";
log.debug("Cryptographic computing parameters found for collaboration {}:", collaborationId);
log.debug(" * Allow cleartext columns = {}",
boolToYesOrNo.apply(settings.isAllowCleartext()));
log.debug(" * Allow duplicates = {}",
boolToYesOrNo.apply(settings.isAllowDuplicates()));
log.debug(" * Allow JOIN of columns with different names = {}",
boolToYesOrNo.apply(settings.isAllowJoinsOnColumnsWithDifferentNames()));
log.debug(" * Preserve NULL values = {}",
boolToYesOrNo.apply(settings.isPreserveNulls()));
return settings;
}