@Test void createDefaultTemplateTestNoVolumeEncryptionWhenAwsAndNotEntitled() { when(entitlementService.freeIpaDlEbsEncryptionEnabled(INTERNAL_ACTOR_CRN, ACCOUNT_ID)).thenReturn(false); Template result = underTest.createDefaultTemplate(CloudPlatform.AWS, ACCOUNT_ID); assertThat(result).isNotNull(); assertThat(result.getAttributes()).isNull(); }
public Template createDefaultTemplate(CloudPlatform cloudPlatform, String accountId) { Template template = new Template(); template.setName(missingResourceNameGenerator.generateName(APIResourceType.TEMPLATE)); template.setStatus(ResourceStatus.DEFAULT); template.setRootVolumeSize(defaultRootVolumeSizeProvider.getForPlatform(cloudPlatform.name())); template.setVolumeCount(0); template.setVolumeSize(0); template.setInstanceType(defaultInstanceTypeProvider.getForPlatform(cloudPlatform.name())); template.setAccountId(accountId); if (cloudPlatform == CloudPlatform.AWS && entitlementService.freeIpaDlEbsEncryptionEnabled(INTERNAL_ACTOR_CRN, accountId)) { template.setAttributes(new Json(Map.<String, Object>ofEntries( entry(AwsInstanceTemplate.EBS_ENCRYPTION_ENABLED, Boolean.TRUE), entry(AwsInstanceTemplate.FAST_EBS_ENCRYPTION_ENABLED, entitlementService.fastEbsEncryptionEnabled(INTERNAL_ACTOR_CRN, accountId)), entry(InstanceTemplate.VOLUME_ENCRYPTION_KEY_TYPE, EncryptionType.DEFAULT.name())))); } return template; }
DefaultInstanceGroupProvider { public Template createDefaultTemplate(CloudPlatform cloudPlatform, String accountId) { Template template = new Template(); template.setName(missingResourceNameGenerator.generateName(APIResourceType.TEMPLATE)); template.setStatus(ResourceStatus.DEFAULT); template.setRootVolumeSize(defaultRootVolumeSizeProvider.getForPlatform(cloudPlatform.name())); template.setVolumeCount(0); template.setVolumeSize(0); template.setInstanceType(defaultInstanceTypeProvider.getForPlatform(cloudPlatform.name())); template.setAccountId(accountId); if (cloudPlatform == CloudPlatform.AWS && entitlementService.freeIpaDlEbsEncryptionEnabled(INTERNAL_ACTOR_CRN, accountId)) { template.setAttributes(new Json(Map.<String, Object>ofEntries( entry(AwsInstanceTemplate.EBS_ENCRYPTION_ENABLED, Boolean.TRUE), entry(AwsInstanceTemplate.FAST_EBS_ENCRYPTION_ENABLED, entitlementService.fastEbsEncryptionEnabled(INTERNAL_ACTOR_CRN, accountId)), entry(InstanceTemplate.VOLUME_ENCRYPTION_KEY_TYPE, EncryptionType.DEFAULT.name())))); } return template; } }
DefaultInstanceGroupProvider { public Template createDefaultTemplate(CloudPlatform cloudPlatform, String accountId) { Template template = new Template(); template.setName(missingResourceNameGenerator.generateName(APIResourceType.TEMPLATE)); template.setStatus(ResourceStatus.DEFAULT); template.setRootVolumeSize(defaultRootVolumeSizeProvider.getForPlatform(cloudPlatform.name())); template.setVolumeCount(0); template.setVolumeSize(0); template.setInstanceType(defaultInstanceTypeProvider.getForPlatform(cloudPlatform.name())); template.setAccountId(accountId); if (cloudPlatform == CloudPlatform.AWS && entitlementService.freeIpaDlEbsEncryptionEnabled(INTERNAL_ACTOR_CRN, accountId)) { template.setAttributes(new Json(Map.<String, Object>ofEntries( entry(AwsInstanceTemplate.EBS_ENCRYPTION_ENABLED, Boolean.TRUE), entry(AwsInstanceTemplate.FAST_EBS_ENCRYPTION_ENABLED, entitlementService.fastEbsEncryptionEnabled(INTERNAL_ACTOR_CRN, accountId)), entry(InstanceTemplate.VOLUME_ENCRYPTION_KEY_TYPE, EncryptionType.DEFAULT.name())))); } return template; }  }
DefaultInstanceGroupProvider { public Template createDefaultTemplate(CloudPlatform cloudPlatform, String accountId) { Template template = new Template(); template.setName(missingResourceNameGenerator.generateName(APIResourceType.TEMPLATE)); template.setStatus(ResourceStatus.DEFAULT); template.setRootVolumeSize(defaultRootVolumeSizeProvider.getForPlatform(cloudPlatform.name())); template.setVolumeCount(0); template.setVolumeSize(0); template.setInstanceType(defaultInstanceTypeProvider.getForPlatform(cloudPlatform.name())); template.setAccountId(accountId); if (cloudPlatform == CloudPlatform.AWS && entitlementService.freeIpaDlEbsEncryptionEnabled(INTERNAL_ACTOR_CRN, accountId)) { template.setAttributes(new Json(Map.<String, Object>ofEntries( entry(AwsInstanceTemplate.EBS_ENCRYPTION_ENABLED, Boolean.TRUE), entry(AwsInstanceTemplate.FAST_EBS_ENCRYPTION_ENABLED, entitlementService.fastEbsEncryptionEnabled(INTERNAL_ACTOR_CRN, accountId)), entry(InstanceTemplate.VOLUME_ENCRYPTION_KEY_TYPE, EncryptionType.DEFAULT.name())))); } return template; }  Template createDefaultTemplate(CloudPlatform cloudPlatform, String accountId); Json createAttributes(CloudPlatform cloudPlatform, String stackName, String instanceGroupName); }
DefaultInstanceGroupProvider { public Template createDefaultTemplate(CloudPlatform cloudPlatform, String accountId) { Template template = new Template(); template.setName(missingResourceNameGenerator.generateName(APIResourceType.TEMPLATE)); template.setStatus(ResourceStatus.DEFAULT); template.setRootVolumeSize(defaultRootVolumeSizeProvider.getForPlatform(cloudPlatform.name())); template.setVolumeCount(0); template.setVolumeSize(0); template.setInstanceType(defaultInstanceTypeProvider.getForPlatform(cloudPlatform.name())); template.setAccountId(accountId); if (cloudPlatform == CloudPlatform.AWS && entitlementService.freeIpaDlEbsEncryptionEnabled(INTERNAL_ACTOR_CRN, accountId)) { template.setAttributes(new Json(Map.<String, Object>ofEntries( entry(AwsInstanceTemplate.EBS_ENCRYPTION_ENABLED, Boolean.TRUE), entry(AwsInstanceTemplate.FAST_EBS_ENCRYPTION_ENABLED, entitlementService.fastEbsEncryptionEnabled(INTERNAL_ACTOR_CRN, accountId)), entry(InstanceTemplate.VOLUME_ENCRYPTION_KEY_TYPE, EncryptionType.DEFAULT.name())))); } return template; }  Template createDefaultTemplate(CloudPlatform cloudPlatform, String accountId); Json createAttributes(CloudPlatform cloudPlatform, String stackName, String instanceGroupName);  }