com.sap.cloud.mt.subscription.HanaEncryptionTool Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of multi-tenant-subscription Show documentation
Show all versions of multi-tenant-subscription Show documentation
Spring Boot Enablement Parent
package com.sap.cloud.mt.subscription;
import com.sap.cloud.mt.subscription.exceptions.InternalError;
import com.sap.xsa.core.instancemanager.client.InstanceCreationOptions;
import java.util.HashMap;
import java.util.Map;
public class HanaEncryptionTool {
private HanaEncryptionTool() {
}
public static void addEncryptionParameter(InstanceCreationOptions instanceCreationOptions, DbEncryptionMode encryptionMode,
String globalAccountId,
String subAccountId,
String applicationName) throws InternalError {
if (encryptionMode == null) {
return;
}
if (instanceCreationOptions == null) {
throw new InternalError("Instance create options is initial");
}
Map parameters = instanceCreationOptions.getProvisioningParameters();
if (parameters == null) {
parameters = new HashMap<>();
}
Map dataEncryption = new HashMap<>();
dataEncryption.put("mode", encryptionMode.getValue());
parameters.put("dataEncryption", dataEncryption);
Map subscriptionContext = new HashMap<>();
subscriptionContext.put("globalAccountID", globalAccountId);
subscriptionContext.put("subAccountID", subAccountId);
subscriptionContext.put("applicationName", applicationName);
parameters.put("subscriptionContext", subscriptionContext);
instanceCreationOptions.withProvisioningParameters(parameters);
}
public enum DbEncryptionMode {
DEDICATED_KEY("DEDICATED_KEY"), MANAGED_KEY("MANAGED_KEY");
private final String value;
DbEncryptionMode(String value) {
this.value = value;
}
public String getValue() {
return value;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy