use of com.sequenceiq.environment.parameters.dao.domain.AzureParameters in project cloudbreak by hortonworks.
the class ResourceEncryptionInitializationHandler method initializeEncryptionResources.
private void initializeEncryptionResources(EnvironmentDto environmentDto, Environment environment) {
String environmentName = environment.getName();
LOGGER.info("Initializing encryption resources for environment \"{}\".", environmentName);
try {
CreatedDiskEncryptionSet createdDiskEncryptionSet = environmentEncryptionService.createEncryptionResources(environmentDto);
LOGGER.info("Created Disk Encryption Set resource for environment \"{}\": {}", environmentName, createdDiskEncryptionSet);
AzureParameters azureParameters = (AzureParameters) environment.getParameters();
azureParameters.setDiskEncryptionSetId(createdDiskEncryptionSet.getDiskEncryptionSetId());
environment.setStatus(EnvironmentStatus.ENVIRONMENT_ENCRYPTION_RESOURCES_INITIALIZED);
environment.setStatusReason(null);
environmentService.save(environment);
LOGGER.info("Finished initializing encryption resources for environment \"{}\".", environmentName);
} catch (Exception e) {
LOGGER.error(String.format("Failed to initialize encryption resources for environment \"%s\"", environmentName), e);
throw new CloudbreakServiceException("Error occurred while initializing encryption resources: " + e.getMessage(), e);
}
}
use of com.sequenceiq.environment.parameters.dao.domain.AzureParameters in project cloudbreak by hortonworks.
the class ParametersService method updateResourceGroupName.
public void updateResourceGroupName(Environment environment, String resourceGroupName) {
if (!CloudPlatform.AZURE.name().equals(environment.getCloudPlatform())) {
return;
}
Optional<BaseParameters> baseParametersOptional = baseParametersRepository.findByEnvironmentId(environment.getId());
if (baseParametersOptional.isEmpty()) {
return;
}
BaseParameters baseParameters = baseParametersOptional.get();
AzureParameters azureParameters = (AzureParameters) baseParameters;
azureParameters.setResourceGroupName(resourceGroupName);
baseParametersRepository.save(baseParameters);
}
use of com.sequenceiq.environment.parameters.dao.domain.AzureParameters in project cloudbreak by hortonworks.
the class AzureEnvironmentParametersConverter method postConvert.
@Override
protected void postConvert(BaseParameters baseParameters, Environment environment, ParametersDto parametersDto) {
super.postConvert(baseParameters, environment, parametersDto);
AzureParameters azureParameters = (AzureParameters) baseParameters;
Optional<AzureParametersDto> azureParametersDto = Optional.of(parametersDto).map(ParametersDto::getAzureParametersDto);
azureParameters.setResourceGroupName(azureParametersDto.map(AzureParametersDto::getAzureResourceGroupDto).map(AzureResourceGroupDto::getName).orElse(null));
azureParameters.setResourceGroupCreation(azureParametersDto.map(AzureParametersDto::getAzureResourceGroupDto).map(AzureResourceGroupDto::getResourceGroupCreation).orElse(null));
azureParameters.setResourceGroupUsagePattern(azureParametersDto.map(AzureParametersDto::getAzureResourceGroupDto).map(AzureResourceGroupDto::getResourceGroupUsagePattern).orElse(null));
azureParameters.setEncryptionKeyUrl(azureParametersDto.map(AzureParametersDto::getAzureResourceEncryptionParametersDto).map(AzureResourceEncryptionParametersDto::getEncryptionKeyUrl).orElse(null));
azureParameters.setEncryptionKeyResourceGroupName(azureParametersDto.map(AzureParametersDto::getAzureResourceEncryptionParametersDto).map(AzureResourceEncryptionParametersDto::getEncryptionKeyResourceGroupName).orElse(null));
}
Aggregations