use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.
the class StackRequestManifesterTest method setupInstanceVolumeEncryptionTestWhenAzureAndEncryptionAtHostAndNoEncryptionParameters.
@Test
void setupInstanceVolumeEncryptionTestWhenAzureAndEncryptionAtHostAndNoEncryptionParameters() {
DetailedEnvironmentResponse envResponse = new DetailedEnvironmentResponse();
envResponse.setAccountId(ACCOUNT_ID);
envResponse.setCloudPlatform(CloudPlatform.AZURE.name());
when(entitlementService.isAzureEncryptionAtHostEnabled(ACCOUNT_ID)).thenReturn(Boolean.TRUE);
InstanceGroupV4Request instanceGroupV4Request = createInstanceGroupV4Request();
InstanceTemplateV4Request instanceTemplateV4Request = instanceGroupV4Request.getTemplate();
instanceTemplateV4Request.createAzure();
when(stackV4Request.getInstanceGroups()).thenReturn(List.of(instanceGroupV4Request));
underTest.setupInstanceVolumeEncryption(stackV4Request, envResponse);
verifyAzureEncryptionForEncryptionAtHost(instanceGroupV4Request.getTemplate(), Boolean.TRUE);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.
the class StackRequestManifesterTest method setupInstanceVolumeEncryptionTestWhenAwsAndNoEncryptionParameters.
@Test
void setupInstanceVolumeEncryptionTestWhenAwsAndNoEncryptionParameters() {
DetailedEnvironmentResponse envResponse = new DetailedEnvironmentResponse();
envResponse.setCloudPlatform(CloudPlatform.AWS.name());
InstanceGroupV4Request instanceGroupV4Request = createInstanceGroupV4Request();
InstanceTemplateV4Request instanceTemplateV4Request = instanceGroupV4Request.getTemplate();
instanceTemplateV4Request.createAws();
when(stackV4Request.getInstanceGroups()).thenReturn(List.of(instanceGroupV4Request));
underTest.setupInstanceVolumeEncryption(stackV4Request, envResponse);
verifyAwsEncryption(instanceTemplateV4Request, EncryptionType.DEFAULT);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.
the class SdxService method overrideDefaultTemplateValues.
private void overrideDefaultTemplateValues(StackV4Request defaultTemplate, List<SdxInstanceGroupRequest> customInstanceGroups, String accountId) {
if (isCustomInstanceTypeSelected(customInstanceGroups) && !entitlementService.isDatalakeSelectInstanceTypeEnabled(accountId)) {
throw new BadRequestException("Datalake instance type selection is not enabled! " + "Contact Cloudera support to enable CDP_DATALAKE_SELECT_INSTANCE_TYPE entitlement for the account.");
}
if (CollectionUtils.isNotEmpty(customInstanceGroups)) {
LOGGER.debug("Override default template with custom instance groups from request.");
customInstanceGroups.forEach(customInstanceGroup -> {
InstanceGroupV4Request templateInstanceGroup = defaultTemplate.getInstanceGroups().stream().filter(templateGroup -> templateGroup.getName() != null && templateGroup.getName().equals(customInstanceGroup.getName())).findAny().orElseThrow(() -> new BadRequestException("Custom instance group is missing from default template: " + customInstanceGroup.getName()));
overrideInstanceType(templateInstanceGroup, customInstanceGroup.getInstanceType());
});
}
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.
the class SdxService method updateAzureLoadBalancerSkuIfPresent.
private void updateAzureLoadBalancerSkuIfPresent(StackV4Request stackRequest, SdxClusterRequest sdxClusterRequest) {
Optional.ofNullable(sdxClusterRequest.getAzure()).map(SdxAzureBase::getLoadBalancerSku).ifPresent(sku -> {
AzureStackV4Parameters azureParameters = stackRequest.createAzure();
azureParameters.setLoadBalancerSku(sku);
stackRequest.setAzure(azureParameters);
});
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request in project cloudbreak by hortonworks.
the class SdxService method prepareDefaultSecurityConfigs.
protected StackV4Request prepareDefaultSecurityConfigs(StackV4Request internalRequest, StackV4Request stackV4Request, CloudPlatform cloudPlatform) {
if (internalRequest == null && !List.of("MOCK", "YARN").contains(cloudPlatform.name())) {
stackV4Request.getInstanceGroups().forEach(instance -> {
SecurityGroupV4Request groupRequest = new SecurityGroupV4Request();
if (InstanceGroupType.CORE.equals(instance.getType())) {
groupRequest.setSecurityRules(rulesWithPorts("22"));
} else if (InstanceGroupType.GATEWAY.equals(instance.getType())) {
groupRequest.setSecurityRules(rulesWithPorts("443", "22"));
} else {
throw new IllegalStateException("Unknown instance group type " + instance.getType());
}
instance.setSecurityGroup(groupRequest);
});
}
return stackV4Request;
}
Aggregations