use of com.amazonaws.services.ec2.model.InstanceTypeInfo in project cloudbreak by hortonworks.
the class AwsPlatformResourcesTest method testEncryptionWhenEncryptionSupportedWithNotSupportedValuePresentedShouldReturnFalse.
@Test
public void testEncryptionWhenEncryptionSupportedWithNotSupportedValuePresentedShouldReturnFalse() {
InstanceTypeInfo instanceTypeInfo = new InstanceTypeInfo();
EbsInfo ebsInfo = new EbsInfo();
ebsInfo.setEncryptionSupport("nonsupported");
instanceTypeInfo.setEbsInfo(ebsInfo);
boolean encryptionSupported = underTest.getEncryptionSupported(instanceTypeInfo);
assertFalse(encryptionSupported);
}
use of com.amazonaws.services.ec2.model.InstanceTypeInfo in project cloudbreak by hortonworks.
the class AwsPlatformResourcesTest method testEncryptionWhenNoEbsInfoShouldReturnFalse.
@Test
public void testEncryptionWhenNoEbsInfoShouldReturnFalse() {
InstanceTypeInfo instanceTypeInfo = new InstanceTypeInfo();
boolean encryptionSupported = underTest.getEncryptionSupported(instanceTypeInfo);
assertFalse(encryptionSupported);
}
use of com.amazonaws.services.ec2.model.InstanceTypeInfo in project cloudbreak by hortonworks.
the class AwsPlatformResources method getVmTypesWithAwsCall.
private void getVmTypesWithAwsCall(Set<VmType> awsInstances, DescribeInstanceTypesResult describeInstanceTypesResult) {
for (InstanceTypeInfo instanceType : describeInstanceTypesResult.getInstanceTypes()) {
if (!instanceType.isBareMetal()) {
VmTypeMetaBuilder vmTypeMetaBuilder = VmTypeMetaBuilder.builder().withCpuAndMemory(instanceType.getVCpuInfo().getDefaultVCpus(), getMemory(instanceType)).withMagneticConfig(new VolumeParameterConfig(MAGNETIC, MINIMUM_MAGNETIC_SIZE, MAXIMUM_MAGNETIC_SIZE, ONE, TWENTY_FOUR)).withSsdConfig(new VolumeParameterConfig(SSD, MINIMUM_SSD_SIZE, MAXIMUM_SSD_SIZE, ONE, TWENTY_FOUR)).withSt1Config(new VolumeParameterConfig(ST1, MINIMUM_ST1_SIZE, MAXIMUM_ST1_SIZE, ONE, TWENTY_FOUR));
if (instanceType.getInstanceStorageSupported()) {
InstanceStorageInfo instanceStorageInfo = instanceType.getInstanceStorageInfo();
DiskInfo diskInfo = instanceStorageInfo.getDisks().get(0);
vmTypeMetaBuilder.withEphemeralConfig(new VolumeParameterConfig(EPHEMERAL, diskInfo.getSizeInGB().intValue(), diskInfo.getSizeInGB().intValue(), diskInfo.getCount(), diskInfo.getCount()));
}
if (getEncryptionSupported(instanceType)) {
vmTypeMetaBuilder.withVolumeEncryptionSupport(true);
}
VmType vmType = vmTypeWithMeta(instanceType.getInstanceType(), vmTypeMetaBuilder.create(), true);
awsInstances.add(vmType);
}
}
}
use of com.amazonaws.services.ec2.model.InstanceTypeInfo in project photon-model by vmware.
the class AWSInstanceTypeService method getInstanceTypes.
/**
* Return the instance types by loading them from AWS SDK {@link InstanceType}.
*/
private DeferredResult<Context> getInstanceTypes(Context context) {
AssertUtil.assertNotNull(context.endpointState, "Endpoint state was not retrieved.");
context.instanceTypes = new InstanceTypeList();
// Set tenant links as specified in the endpoint.
context.instanceTypes.tenantLinks = context.endpointState.tenantLinks;
context.instanceTypes.instanceTypes = // Use AWS SDK InstanceType enum as primary source of instance type data.
Arrays.stream(InstanceType.values()).map(instanceType -> {
InstanceTypeList.InstanceType result = new InstanceTypeList.InstanceType(instanceType.toString(), instanceType.toString());
InstanceTypeList.InstanceType instanceTypeInfo = this.instanceTypeInfo.get(instanceType.toString());
if (instanceTypeInfo != null) {
// We have additional information -> populate additional fields.
result.cpuCount = instanceTypeInfo.cpuCount;
result.memoryInMB = instanceTypeInfo.memoryInMB;
result.networkType = instanceTypeInfo.networkType;
result.storageType = instanceTypeInfo.storageType;
result.dataDiskMaxCount = instanceTypeInfo.dataDiskMaxCount;
result.dataDiskSizeInMB = instanceTypeInfo.dataDiskSizeInMB;
}
return result;
}).filter(instanceType -> !Integer.valueOf(-1).equals(instanceType.cpuCount)).collect(Collectors.toList());
return DeferredResult.completed(context);
}
use of com.amazonaws.services.ec2.model.InstanceTypeInfo in project cloudbreak by hortonworks.
the class AwsPlatformResourcesTest method testEncryptionWhenEncryptionSupportedWithSupportedValuePresentedShouldReturnTrue.
@Test
public void testEncryptionWhenEncryptionSupportedWithSupportedValuePresentedShouldReturnTrue() {
InstanceTypeInfo instanceTypeInfo = new InstanceTypeInfo();
EbsInfo ebsInfo = new EbsInfo();
ebsInfo.setEncryptionSupport("supported");
instanceTypeInfo.setEbsInfo(ebsInfo);
boolean encryptionSupported = underTest.getEncryptionSupported(instanceTypeInfo);
assertTrue(encryptionSupported);
}
Aggregations