Search in sources :

Example 1 with AzureEnvironmentParameters

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;
}
Also used : AzureEnvironmentParameters(com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureEnvironmentParameters)

Example 2 with 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.");
    }
}
Also used : AzureEncryptionV4Parameters(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AzureEncryptionV4Parameters) AzureEnvironmentParameters(com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureEnvironmentParameters)

Example 3 with AzureEnvironmentParameters

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();
}
Also used : GcpEnvironmentParameters(com.sequenceiq.environment.api.v1.environment.model.request.gcp.GcpEnvironmentParameters) AzureResourceGroupDto(com.sequenceiq.environment.parameter.dto.AzureResourceGroupDto) NullUtil.getIfNotNull(com.sequenceiq.cloudbreak.util.NullUtil.getIfNotNull) GcpResourceEncryptionParametersDto(com.sequenceiq.environment.parameter.dto.GcpResourceEncryptionParametersDto) ResourceGroupUsage(com.sequenceiq.environment.api.v1.environment.model.request.azure.ResourceGroupUsage) EnvironmentNetworkResponse(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentNetworkResponse) LoggerFactory(org.slf4j.LoggerFactory) AzureResourceEncryptionParameters(com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureResourceEncryptionParameters) AuthenticationDto(com.sequenceiq.environment.environment.dto.AuthenticationDto) EnvironmentDto(com.sequenceiq.environment.environment.dto.EnvironmentDto) AzureEnvironmentParameters(com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureEnvironmentParameters) GcpResourceEncryptionParameters(com.sequenceiq.environment.api.v1.environment.model.request.gcp.GcpResourceEncryptionParameters) SecurityAccessResponse(com.sequenceiq.environment.api.v1.environment.model.response.SecurityAccessResponse) AwsEnvironmentParameters(com.sequenceiq.environment.api.v1.environment.model.request.aws.AwsEnvironmentParameters) AwsDiskEncryptionParameters(com.sequenceiq.environment.api.v1.environment.model.request.aws.AwsDiskEncryptionParameters) CredentialViewConverter(com.sequenceiq.environment.credential.v1.converter.CredentialViewConverter) ResourceGroupUsagePattern(com.sequenceiq.environment.parameter.dto.ResourceGroupUsagePattern) SimpleEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.SimpleEnvironmentResponse) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) YarnEnvironmentParameters(com.sequenceiq.environment.api.v1.environment.model.request.yarn.YarnEnvironmentParameters) ProxyConfigToProxyResponseConverter(com.sequenceiq.environment.proxy.v1.converter.ProxyConfigToProxyResponseConverter) Tunnel(com.sequenceiq.common.api.type.Tunnel) CredentialToCredentialV1ResponseConverter(com.sequenceiq.environment.credential.v1.converter.CredentialToCredentialV1ResponseConverter) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) AwsDiskEncryptionParametersDto(com.sequenceiq.environment.parameter.dto.AwsDiskEncryptionParametersDto) ParametersDto(com.sequenceiq.environment.parameter.dto.ParametersDto) SecurityGroupSeparator.getSecurityGroupIds(com.sequenceiq.cloudbreak.util.SecurityGroupSeparator.getSecurityGroupIds) AzureResourceGroup(com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureResourceGroup) TagResponse(com.sequenceiq.environment.api.v1.environment.model.response.TagResponse) NullUtil(com.sequenceiq.cloudbreak.util.NullUtil) SecurityAccessDto(com.sequenceiq.environment.environment.dto.SecurityAccessDto) AzureParametersDto(com.sequenceiq.environment.parameter.dto.AzureParametersDto) LocationResponse(com.sequenceiq.environment.api.v1.environment.model.response.LocationResponse) Objects(java.util.Objects) Component(org.springframework.stereotype.Component) EnvironmentAuthenticationResponse(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentAuthenticationResponse) S3GuardRequestParameters(com.sequenceiq.environment.api.v1.environment.model.request.aws.S3GuardRequestParameters) NetworkDto(com.sequenceiq.environment.network.dto.NetworkDto) LocationDto(com.sequenceiq.environment.environment.dto.LocationDto) AwsParametersDto(com.sequenceiq.environment.parameter.dto.AwsParametersDto) EnvironmentTags(com.sequenceiq.environment.environment.domain.EnvironmentTags) Optional(java.util.Optional) EnvironmentViewDto(com.sequenceiq.environment.environment.dto.EnvironmentViewDto) AzureResourceEncryptionParametersDto(com.sequenceiq.environment.parameter.dto.AzureResourceEncryptionParametersDto) EnvironmentDeletionType(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentDeletionType) GcpParametersDto(com.sequenceiq.environment.parameter.dto.GcpParametersDto) AzureResourceEncryptionParametersDto(com.sequenceiq.environment.parameter.dto.AzureResourceEncryptionParametersDto) AzureResourceGroupDto(com.sequenceiq.environment.parameter.dto.AzureResourceGroupDto)

Example 4 with AzureEnvironmentParameters

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;
}
Also used : DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) AzureResourceEncryptionParameters(com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureResourceEncryptionParameters) AzureEnvironmentParameters(com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureEnvironmentParameters)

Example 5 with AzureEnvironmentParameters

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;
}
Also used : AzureEnvironmentParameters(com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureEnvironmentParameters)

Aggregations

AzureEnvironmentParameters (com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureEnvironmentParameters)6 AzureResourceEncryptionParameters (com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureResourceEncryptionParameters)3 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)3 AzureEncryptionV4Parameters (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AzureEncryptionV4Parameters)2 ResourceGroupUsage (com.sequenceiq.environment.api.v1.environment.model.request.azure.ResourceGroupUsage)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 AzureInstanceTemplateV4Parameters (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AzureInstanceTemplateV4Parameters)1 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)1 NullUtil (com.sequenceiq.cloudbreak.util.NullUtil)1 NullUtil.getIfNotNull (com.sequenceiq.cloudbreak.util.NullUtil.getIfNotNull)1 SecurityGroupSeparator.getSecurityGroupIds (com.sequenceiq.cloudbreak.util.SecurityGroupSeparator.getSecurityGroupIds)1 Tunnel (com.sequenceiq.common.api.type.Tunnel)1 AwsDiskEncryptionParameters (com.sequenceiq.environment.api.v1.environment.model.request.aws.AwsDiskEncryptionParameters)1 AwsEnvironmentParameters (com.sequenceiq.environment.api.v1.environment.model.request.aws.AwsEnvironmentParameters)1 S3GuardRequestParameters (com.sequenceiq.environment.api.v1.environment.model.request.aws.S3GuardRequestParameters)1 AzureResourceGroup (com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureResourceGroup)1 GcpEnvironmentParameters (com.sequenceiq.environment.api.v1.environment.model.request.gcp.GcpEnvironmentParameters)1 GcpResourceEncryptionParameters (com.sequenceiq.environment.api.v1.environment.model.request.gcp.GcpResourceEncryptionParameters)1 YarnEnvironmentParameters (com.sequenceiq.environment.api.v1.environment.model.request.yarn.YarnEnvironmentParameters)1 EnvironmentAuthenticationResponse (com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentAuthenticationResponse)1