Search in sources :

Example 6 with AzureEnvironmentParameters

use of com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureEnvironmentParameters in project cloudbreak by hortonworks.

the class AzureCloudProvider method withResourceGroup.

@Override
public EnvironmentTestDto withResourceGroup(EnvironmentTestDto environmentTestDto, String resourceGroupUsageString, String resourceGroupName) {
    ResourceGroupUsage resourceGroupUsage = ResourceGroupUsage.valueOf(resourceGroupUsageString);
    if (environmentTestDto.getAzure() == null) {
        environmentTestDto.setAzure(AzureEnvironmentParameters.builder().build());
    }
    AzureEnvironmentParameters azureEnvironmentParameters = environmentTestDto.getAzure();
    azureEnvironmentParameters.setResourceGroup(AzureResourceGroup.builder().withResourceGroupUsage(resourceGroupUsage).withName(resourceGroupName).build());
    environmentTestDto.setAzure(azureEnvironmentParameters);
    return environmentTestDto;
}
Also used : ResourceGroupUsage(com.sequenceiq.environment.api.v1.environment.model.request.azure.ResourceGroupUsage) AzureEnvironmentParameters(com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureEnvironmentParameters)

Example 7 with AzureEnvironmentParameters

use of com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureEnvironmentParameters 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);
        }
    });
}
Also used : AzureInstanceTemplateV4Parameters(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AzureInstanceTemplateV4Parameters) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) AzureEncryptionV4Parameters(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AzureEncryptionV4Parameters) AzureResourceEncryptionParameters(com.sequenceiq.environment.api.v1.environment.model.request.azure.AzureResourceEncryptionParameters) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

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