use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.template.InstanceTemplateV4Response in project cloudbreak by hortonworks.
the class MockStackResponseGenerator method awsTemplate.
public static InstanceTemplateV4Response awsTemplate() {
InstanceTemplateV4Response awsTemplate = new InstanceTemplateV4Response();
awsTemplate.setCloudPlatform(CloudPlatform.AWS);
return awsTemplate;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.template.InstanceTemplateV4Response in project cloudbreak by hortonworks.
the class TemplateToInstanceTemplateV4ResponseConverterTest method testAwsEncryptionConvert.
@Test
public void testAwsEncryptionConvert() {
String encyptionKey = "aKey";
Template template = new Template();
Map<String, String> attributes = Maps.newHashMap();
attributes.put(InstanceTemplate.VOLUME_ENCRYPTION_KEY_ID, encyptionKey);
attributes.put(InstanceTemplate.VOLUME_ENCRYPTION_KEY_TYPE, "CUSTOM");
attributes.put("cloudPlatform", "AWS");
template.setAttributes(new Json(attributes));
template.setVolumeTemplates(Sets.newHashSet());
template.setCloudPlatform("AWS");
InstanceTemplateV4Response response = underTest.convert(template);
assertEquals(response.getAws().getEncryption().getType(), EncryptionType.CUSTOM);
assertEquals(response.getAws().getEncryption().getKey(), encyptionKey);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.template.InstanceTemplateV4Response in project cloudbreak by hortonworks.
the class TemplateToInstanceTemplateV4ResponseConverter method convert.
public InstanceTemplateV4Response convert(Template source) {
InstanceTemplateV4Response response = new InstanceTemplateV4Response();
response.setId(source.getId());
response.setRootVolume(rootVolume(source));
response.setAttachedVolumes(source.getVolumeTemplates().stream().filter(volume -> volume.getUsageType() == VolumeUsageType.GENERAL).map(volume -> templateToVolumeV4ResponseConverter.convert(volume)).collect(Collectors.toSet()));
response.setDatabaseVolume(databaseVolume(source));
response.setInstanceType(source.getInstanceType());
Json attributes = source.getAttributes();
if (attributes != null) {
Map<String, Object> parameters = attributes.getMap();
ofNullable(source.getSecretAttributes()).ifPresent(attr -> parameters.putAll(new Json(attr).getMap()));
providerParameterCalculator.parse(parameters, response);
}
response.setCloudPlatform(CloudPlatform.valueOf(source.cloudPlatform()));
return response;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.template.InstanceTemplateV4Response in project cloudbreak by hortonworks.
the class MockStackResponseGenerator method instanceGroup.
public static InstanceGroupV4Response instanceGroup(String hostGroupName, InstanceTemplateV4Response template, Set<InstanceMetaDataV4Response> instanceMetaDataV4Responses) {
InstanceGroupV4Response instanceGroup = new InstanceGroupV4Response();
instanceGroup.setTemplate(template);
instanceGroup.setName(hostGroupName);
instanceGroup.setMetadata(instanceMetaDataV4Responses);
return instanceGroup;
}
Aggregations