use of com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureEnvironmentParameters in project cloudbreak by hortonworks.
the class EnvironmentApiConverterTest method createAzureRequest.
private AzureEnvironmentParameters createAzureRequest() {
AzureEnvironmentParameters azureEnvironmentParameters = new AzureEnvironmentParameters();
azureEnvironmentParameters.setResourceGroup(AzureResourceGroup.builder().withName("mySingleResourceGroupName").withResourceGroupUsage(ResourceGroupUsage.MULTIPLE).build());
azureEnvironmentParameters.setResourceEncryptionParameters(AzureResourceEncryptionParameters.builder().withEncryptionKeyUrl(KEY_URL).withEncryptionKeyResourceGroupName(KEY_URL_RESOURCE_GROUP).build());
return azureEnvironmentParameters;
}
use of com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureEnvironmentParameters 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.environment.api.v1.environment.model.request.azure.AzureEnvironmentParameters in project cloudbreak by hortonworks.
the class EnvironmentResponseConverter method azureEnvParamsToAzureEnvironmentParams.
private AzureEnvironmentParameters azureEnvParamsToAzureEnvironmentParams(ParametersDto parameters) {
AzureResourceGroupDto resourceGroupDto = Optional.ofNullable(parameters.getAzureParametersDto()).map(AzureParametersDto::getAzureResourceGroupDto).filter(rgDto -> Objects.nonNull(rgDto.getResourceGroupUsagePattern())).filter(rgDto -> Objects.nonNull(rgDto.getResourceGroupCreation())).orElse(null);
AzureResourceEncryptionParametersDto resourceEncryptionParametersDto = Optional.ofNullable(parameters.getAzureParametersDto()).map(AzureParametersDto::getAzureResourceEncryptionParametersDto).orElse(null);
return AzureEnvironmentParameters.builder().withAzureResourceGroup(getIfNotNull(resourceGroupDto, this::azureParametersToAzureResourceGroup)).withResourceEncryptionParameters(getIfNotNull(resourceEncryptionParametersDto, this::azureParametersToAzureResourceEncryptionParameters)).build();
}
use of com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureEnvironmentParameters in project cloudbreak by hortonworks.
the class InstanceTemplateParameterConverterTest method createDetailedEnvironmentResponseForAzureEncryption.
private DetailedEnvironmentResponse createDetailedEnvironmentResponseForAzureEncryption(boolean withAzure, boolean withResourceEncryption, String diskEncryptionSetId, String encryptionKeyUrl) {
DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
if (withAzure) {
AzureEnvironmentParameters parameters = new AzureEnvironmentParameters();
environment.setAzure(parameters);
if (withResourceEncryption) {
AzureResourceEncryptionParameters encryption = new AzureResourceEncryptionParameters();
parameters.setResourceEncryptionParameters(encryption);
encryption.setEncryptionKeyUrl(encryptionKeyUrl);
encryption.setDiskEncryptionSetId(diskEncryptionSetId);
}
}
return environment;
}
use of com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureEnvironmentParameters in project cloudbreak by hortonworks.
the class AzureCloudProvider method withResourceEncryption.
@Override
public EnvironmentTestDto withResourceEncryption(EnvironmentTestDto environmentTestDto) {
if (environmentTestDto.getAzure() == null) {
environmentTestDto.setAzure(AzureEnvironmentParameters.builder().build());
}
AzureEnvironmentParameters azureEnvironmentParameters = environmentTestDto.getAzure();
azureEnvironmentParameters.setResourceEncryptionParameters(AzureResourceEncryptionParameters.builder().withEncryptionKeyResourceGroupName(getEncryptionResourceGroupName()).withEncryptionKeyUrl(getEncryptionKeyUrl()).build());
environmentTestDto.setAzure(azureEnvironmentParameters);
return environmentTestDto;
}
Aggregations