@Test void setupInstanceVolumeEncryptionTestWhenAwsAndEntitledAndTwoInstanceGroupsAndEncryptionTypesNoneCustom() { when(entitlementService.freeIpaDlEbsEncryptionEnabled(INTERNAL_ACTOR_CRN, ACCOUNT_ID)).thenReturn(true); InstanceGroupV4Request instanceGroupV4Request1 = createInstanceGroupV4Request(); InstanceTemplateV4Request instanceTemplateV4Request1 = instanceGroupV4Request1.getTemplate(); instanceTemplateV4Request1.createAws().setEncryption(createAwsEncryptionV4Parameters(EncryptionType.NONE)); InstanceGroupV4Request instanceGroupV4Request2 = createInstanceGroupV4Request(); InstanceTemplateV4Request instanceTemplateV4Request2 = instanceGroupV4Request2.getTemplate(); instanceTemplateV4Request2.createAws().setEncryption(createAwsEncryptionV4Parameters(EncryptionType.CUSTOM, ENCRYPTION_KEY)); when(stackV4Request.getInstanceGroups()).thenReturn(List.of(instanceGroupV4Request1, instanceGroupV4Request2)); underTest.setupInstanceVolumeEncryption(stackV4Request, CLOUD_PLATFORM_AWS, ACCOUNT_ID); verifyEncryption(instanceTemplateV4Request1, EncryptionType.NONE); verifyEncryption(instanceTemplateV4Request2, EncryptionType.CUSTOM, ENCRYPTION_KEY); }
@VisibleForTesting void setupInstanceVolumeEncryption(StackV4Request stackRequest, String cloudPlatform, String accountId) { if (CloudPlatform.AWS.name().equals(cloudPlatform) && entitlementService.freeIpaDlEbsEncryptionEnabled(INTERNAL_ACTOR_CRN, accountId)) { stackRequest.getInstanceGroups().forEach(ig -> { AwsInstanceTemplateV4Parameters aws = ig.getTemplate().createAws(); AwsEncryptionV4Parameters encryption = aws.getEncryption(); if (encryption == null) { encryption = new AwsEncryptionV4Parameters(); aws.setEncryption(encryption); } if (encryption.getType() == null) { encryption.setType(EncryptionType.DEFAULT); } }); } }
StackRequestManifester { @VisibleForTesting void setupInstanceVolumeEncryption(StackV4Request stackRequest, String cloudPlatform, String accountId) { if (CloudPlatform.AWS.name().equals(cloudPlatform) && entitlementService.freeIpaDlEbsEncryptionEnabled(INTERNAL_ACTOR_CRN, accountId)) { stackRequest.getInstanceGroups().forEach(ig -> { AwsInstanceTemplateV4Parameters aws = ig.getTemplate().createAws(); AwsEncryptionV4Parameters encryption = aws.getEncryption(); if (encryption == null) { encryption = new AwsEncryptionV4Parameters(); aws.setEncryption(encryption); } if (encryption.getType() == null) { encryption.setType(EncryptionType.DEFAULT); } }); } } }
StackRequestManifester { @VisibleForTesting void setupInstanceVolumeEncryption(StackV4Request stackRequest, String cloudPlatform, String accountId) { if (CloudPlatform.AWS.name().equals(cloudPlatform) && entitlementService.freeIpaDlEbsEncryptionEnabled(INTERNAL_ACTOR_CRN, accountId)) { stackRequest.getInstanceGroups().forEach(ig -> { AwsInstanceTemplateV4Parameters aws = ig.getTemplate().createAws(); AwsEncryptionV4Parameters encryption = aws.getEncryption(); if (encryption == null) { encryption = new AwsEncryptionV4Parameters(); aws.setEncryption(encryption); } if (encryption.getType() == null) { encryption.setType(EncryptionType.DEFAULT); } }); } }  }
StackRequestManifester { @VisibleForTesting void setupInstanceVolumeEncryption(StackV4Request stackRequest, String cloudPlatform, String accountId) { if (CloudPlatform.AWS.name().equals(cloudPlatform) && entitlementService.freeIpaDlEbsEncryptionEnabled(INTERNAL_ACTOR_CRN, accountId)) { stackRequest.getInstanceGroups().forEach(ig -> { AwsInstanceTemplateV4Parameters aws = ig.getTemplate().createAws(); AwsEncryptionV4Parameters encryption = aws.getEncryption(); if (encryption == null) { encryption = new AwsEncryptionV4Parameters(); aws.setEncryption(encryption); } if (encryption.getType() == null) { encryption.setType(EncryptionType.DEFAULT); } }); } }  void configureStackForSdxCluster(SdxCluster sdxCluster, DetailedEnvironmentResponse environment); }
StackRequestManifester { @VisibleForTesting void setupInstanceVolumeEncryption(StackV4Request stackRequest, String cloudPlatform, String accountId) { if (CloudPlatform.AWS.name().equals(cloudPlatform) && entitlementService.freeIpaDlEbsEncryptionEnabled(INTERNAL_ACTOR_CRN, accountId)) { stackRequest.getInstanceGroups().forEach(ig -> { AwsInstanceTemplateV4Parameters aws = ig.getTemplate().createAws(); AwsEncryptionV4Parameters encryption = aws.getEncryption(); if (encryption == null) { encryption = new AwsEncryptionV4Parameters(); aws.setEncryption(encryption); } if (encryption.getType() == null) { encryption.setType(EncryptionType.DEFAULT); } }); } }  void configureStackForSdxCluster(SdxCluster sdxCluster, DetailedEnvironmentResponse environment);  }