use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AzureEncryptionV4Parameters in project cloudbreak by hortonworks.
the class InstanceTemplateParameterConverter method initAzureEncryptionFromEnvironment.
private void initAzureEncryptionFromEnvironment(AzureInstanceTemplateV4Parameters response, DetailedEnvironmentResponse environment) {
String encryptionKeyUrl = Optional.of(environment).map(DetailedEnvironmentResponse::getAzure).map(AzureEnvironmentParameters::getResourceEncryptionParameters).map(AzureResourceEncryptionParameters::getEncryptionKeyUrl).orElse(null);
String diskEncryptionSetId = Optional.of(environment).map(DetailedEnvironmentResponse::getAzure).map(AzureEnvironmentParameters::getResourceEncryptionParameters).map(AzureResourceEncryptionParameters::getDiskEncryptionSetId).orElse(null);
if (encryptionKeyUrl != null && diskEncryptionSetId != null) {
LOGGER.info("Applying SSE with CMK for Azure managed disks as per environment.");
AzureEncryptionV4Parameters encryption = new AzureEncryptionV4Parameters();
encryption.setKey(encryptionKeyUrl);
encryption.setType(EncryptionType.CUSTOM);
encryption.setDiskEncryptionSetId(diskEncryptionSetId);
response.setEncryption(encryption);
} else {
LOGGER.info("Environment has not requested for SSE with CMK for Azure managed disks.");
}
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AzureEncryptionV4Parameters in project cloudbreak by hortonworks.
the class StackRequestManifesterTest method verifyAzureEncryptionForEncryptionAtHost.
private void verifyAzureEncryptionForEncryptionAtHost(InstanceTemplateV4Request instanceTemplateV4Request, Boolean expectedIsEncryptionAtHost) {
AzureInstanceTemplateV4Parameters azure = instanceTemplateV4Request.getAzure();
assertThat(azure).isNotNull();
AzureEncryptionV4Parameters encryption = azure.getEncryption();
assertThat(encryption).isNotNull();
assertThat(encryption.isEncryptionAtHostEnabled()).isEqualTo(expectedIsEncryptionAtHost);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AzureEncryptionV4Parameters in project cloudbreak by hortonworks.
the class StackRequestManifesterTest method verifyAzureEncryption.
private void verifyAzureEncryption(InstanceTemplateV4Request instanceTemplateV4Request, EncryptionType expectedEncryptionType, String expectedDiskEncryptionSetId, String expectedEncryptionKeyUrl) {
AzureInstanceTemplateV4Parameters azure = instanceTemplateV4Request.getAzure();
assertThat(azure).isNotNull();
AzureEncryptionV4Parameters encryption = azure.getEncryption();
assertThat(encryption).isNotNull();
assertThat(encryption.getType()).isEqualTo(expectedEncryptionType);
assertThat(encryption.getKey()).isEqualTo(expectedEncryptionKeyUrl);
assertThat(encryption.getDiskEncryptionSetId()).isEqualTo(expectedDiskEncryptionSetId);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AzureEncryptionV4Parameters in project cloudbreak by hortonworks.
the class StackRequestManifester method setupInstanceVolumeEncryptionForAzure.
@VisibleForTesting
void setupInstanceVolumeEncryptionForAzure(StackV4Request stackRequest, DetailedEnvironmentResponse environmentResponse) {
Optional<String> encryptionKeyUrl = Optional.of(environmentResponse).map(DetailedEnvironmentResponse::getAzure).map(AzureEnvironmentParameters::getResourceEncryptionParameters).map(AzureResourceEncryptionParameters::getEncryptionKeyUrl);
Optional<String> diskEncryptionSetId = Optional.of(environmentResponse).map(DetailedEnvironmentResponse::getAzure).map(AzureEnvironmentParameters::getResourceEncryptionParameters).map(AzureResourceEncryptionParameters::getDiskEncryptionSetId);
stackRequest.getInstanceGroups().forEach(ig -> {
AzureInstanceTemplateV4Parameters azure = ig.getTemplate().createAzure();
AzureEncryptionV4Parameters encryption = azure.getEncryption();
if (encryption == null) {
encryption = new AzureEncryptionV4Parameters();
azure.setEncryption(encryption);
}
if (encryptionKeyUrl.isPresent() && diskEncryptionSetId.isPresent()) {
azure.getEncryption().setKey(encryptionKeyUrl.get());
azure.getEncryption().setType(EncryptionType.CUSTOM);
azure.getEncryption().setDiskEncryptionSetId(diskEncryptionSetId.get());
}
if (entitlementService.isAzureEncryptionAtHostEnabled(environmentResponse.getAccountId())) {
azure.getEncryption().setEncryptionAtHostEnabled(Boolean.TRUE);
}
});
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AzureEncryptionV4Parameters in project cloudbreak by hortonworks.
the class StackRequestManifesterTest method createAzureEncryptionV4Parameters.
private AzureEncryptionV4Parameters createAzureEncryptionV4Parameters(EncryptionType encryptionType, String encryptionKey) {
AzureEncryptionV4Parameters azureEncryptionV4Parameters = new AzureEncryptionV4Parameters();
azureEncryptionV4Parameters.setType(encryptionType);
azureEncryptionV4Parameters.setKey(encryptionKey);
return azureEncryptionV4Parameters;
}
Aggregations