Search in sources :

Example 21 with InstanceGroupV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request in project cloudbreak by hortonworks.

the class StackRequestManifesterTest method setupInstanceVolumeEncryptionTestWhenGcpAndEncryptionKeyAndTwoInstanceGroups.

@Test
void setupInstanceVolumeEncryptionTestWhenGcpAndEncryptionKeyAndTwoInstanceGroups() {
    DetailedEnvironmentResponse envResponse = new DetailedEnvironmentResponse();
    envResponse.setGcp(GcpEnvironmentParameters.builder().withResourceEncryptionParameters(GcpResourceEncryptionParameters.builder().withEncryptionKey(ENCRYPTION_KEY).build()).build());
    envResponse.setCloudPlatform(CloudPlatform.GCP.name());
    InstanceGroupV4Request instanceGroupV4Request1 = createInstanceGroupV4Request();
    InstanceTemplateV4Request instanceTemplateV4Request1 = instanceGroupV4Request1.getTemplate();
    InstanceGroupV4Request instanceGroupV4Request2 = createInstanceGroupV4Request();
    InstanceTemplateV4Request instanceTemplateV4Request2 = instanceGroupV4Request2.getTemplate();
    instanceTemplateV4Request2.createGcp().setEncryption(createGcpEncryptionV4Parameters(EncryptionType.CUSTOM, ENCRYPTION_KEY));
    when(stackV4Request.getInstanceGroups()).thenReturn(List.of(instanceGroupV4Request1, instanceGroupV4Request2));
    underTest.setupInstanceVolumeEncryption(stackV4Request, envResponse);
    verifyGcpEncryption(instanceTemplateV4Request1, EncryptionType.CUSTOM, ENCRYPTION_KEY);
    verifyGcpEncryption(instanceTemplateV4Request2, EncryptionType.CUSTOM, ENCRYPTION_KEY);
}
Also used : InstanceTemplateV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.template.InstanceTemplateV4Request) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) InstanceGroupV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 22 with InstanceGroupV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request in project cloudbreak by hortonworks.

the class StackRequestManifesterTest method setupInstanceVolumeEncryptionTestWhenAzureAndEncryptionAtHostAndNoInstanceTemplateParameters.

@Test
void setupInstanceVolumeEncryptionTestWhenAzureAndEncryptionAtHostAndNoInstanceTemplateParameters() {
    DetailedEnvironmentResponse envResponse = new DetailedEnvironmentResponse();
    envResponse.setAccountId(ACCOUNT_ID);
    envResponse.setCloudPlatform(CloudPlatform.AZURE.name());
    when(entitlementService.isAzureEncryptionAtHostEnabled(ACCOUNT_ID)).thenReturn(Boolean.TRUE);
    InstanceGroupV4Request instanceGroupV4Request = createInstanceGroupV4Request();
    when(stackV4Request.getInstanceGroups()).thenReturn(List.of(instanceGroupV4Request));
    underTest.setupInstanceVolumeEncryption(stackV4Request, envResponse);
    verifyAzureEncryptionForEncryptionAtHost(instanceGroupV4Request.getTemplate(), Boolean.TRUE);
}
Also used : DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) InstanceGroupV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 23 with InstanceGroupV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request in project cloudbreak by hortonworks.

the class StackRequestManifesterTest method setupInstanceVolumeEncryptionTestWhenAzureAndDiskEncryptionSetIdAndNoInstanceTemplateParameters.

@Test
void setupInstanceVolumeEncryptionTestWhenAzureAndDiskEncryptionSetIdAndNoInstanceTemplateParameters() {
    DetailedEnvironmentResponse envResponse = new DetailedEnvironmentResponse();
    envResponse.setCloudPlatform(CloudPlatform.AZURE.name());
    envResponse.setAzure(AzureEnvironmentParameters.builder().withResourceEncryptionParameters(AzureResourceEncryptionParameters.builder().withDiskEncryptionSetId(DISK_ENCRYPTION_SET_ID).withEncryptionKeyUrl(ENCRYPTION_KEY).build()).build());
    InstanceGroupV4Request instanceGroupV4Request = createInstanceGroupV4Request();
    when(stackV4Request.getInstanceGroups()).thenReturn(List.of(instanceGroupV4Request));
    underTest.setupInstanceVolumeEncryption(stackV4Request, envResponse);
    verifyAzureEncryption(instanceGroupV4Request.getTemplate(), EncryptionType.CUSTOM, DISK_ENCRYPTION_SET_ID, ENCRYPTION_KEY);
}
Also used : DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) InstanceGroupV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 24 with InstanceGroupV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request in project cloudbreak by hortonworks.

the class StackRequestManifesterTest method setupInstanceVolumeEncryptionTestWhenGcpAndEncryptionKeyAndNoInstanceTemplateParameters.

@Test
void setupInstanceVolumeEncryptionTestWhenGcpAndEncryptionKeyAndNoInstanceTemplateParameters() {
    DetailedEnvironmentResponse envResponse = new DetailedEnvironmentResponse();
    envResponse.setCloudPlatform(CloudPlatform.GCP.name());
    envResponse.setGcp(GcpEnvironmentParameters.builder().withResourceEncryptionParameters(GcpResourceEncryptionParameters.builder().withEncryptionKey(ENCRYPTION_KEY).build()).build());
    InstanceGroupV4Request instanceGroupV4Request = createInstanceGroupV4Request();
    when(stackV4Request.getInstanceGroups()).thenReturn(List.of(instanceGroupV4Request));
    underTest.setupInstanceVolumeEncryption(stackV4Request, envResponse);
    verifyGcpEncryption(instanceGroupV4Request.getTemplate(), EncryptionType.CUSTOM, ENCRYPTION_KEY);
}
Also used : DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) InstanceGroupV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 25 with InstanceGroupV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request 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);
}
Also used : InstanceTemplateV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.template.InstanceTemplateV4Request) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) InstanceGroupV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

InstanceGroupV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request)51 Test (org.junit.jupiter.api.Test)28 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)27 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)22 InstanceTemplateV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.template.InstanceTemplateV4Request)18 ArrayList (java.util.ArrayList)8 StackV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)5 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)5 InstanceGroupNetworkV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.network.InstanceGroupNetworkV4Request)4 SecurityGroupV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.securitygroup.SecurityGroupV4Request)4 InstanceGroupV1Request (com.sequenceiq.distrox.api.v1.distrox.model.instancegroup.InstanceGroupV1Request)4 MethodSource (org.junit.jupiter.params.provider.MethodSource)4 AwsInstanceTemplateV4Parameters (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AwsInstanceTemplateV4Parameters)2 NetworkV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.network.NetworkV4Request)2 SecurityRuleV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.util.requests.SecurityRuleV4Request)2 InstanceGroup (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup)2 InstanceGroupType (com.sequenceiq.common.api.type.InstanceGroupType)2 List (java.util.List)2 Test (org.junit.Test)2 Strings (com.google.common.base.Strings)1