Search in sources :

Example 21 with InstanceTemplateRequest

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceTemplateRequest in project cloudbreak by hortonworks.

the class InstanceTemplateRequestToTemplateConverterTest method shouldSetEncryptionKeyAndEncryptionMethodPropertyWhenCustomAwsEncryptionKeyPresent.

@Test
void shouldSetEncryptionKeyAndEncryptionMethodPropertyWhenCustomAwsEncryptionKeyPresent() {
    InstanceTemplateRequest source = new InstanceTemplateRequest();
    source.setInstanceType(INSTANCE_TYPE);
    Template result = underTest.convert(source, CloudPlatform.AWS, ACCOUNT_ID, null, null, "dummyAwsEncryptionKeyArn");
    Json attributes = result.getAttributes();
    assertThat(attributes).isNotNull();
    assertThat(attributes.<Object>getValue(GcpInstanceTemplate.VOLUME_ENCRYPTION_KEY_ID)).isEqualTo("dummyAwsEncryptionKeyArn");
    assertThat(attributes.<Object>getValue(InstanceTemplate.VOLUME_ENCRYPTION_KEY_TYPE)).isEqualTo(EncryptionType.CUSTOM.name());
}
Also used : InstanceTemplateRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceTemplateRequest) Json(com.sequenceiq.cloudbreak.common.json.Json) AzureInstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.instance.AzureInstanceTemplate) Template(com.sequenceiq.freeipa.entity.Template) AwsInstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.instance.AwsInstanceTemplate) GcpInstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.instance.GcpInstanceTemplate) InstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate) Test(org.junit.jupiter.api.Test)

Example 22 with InstanceTemplateRequest

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceTemplateRequest in project cloudbreak by hortonworks.

the class InstanceTemplateRequestToTemplateConverterTest method shouldSetSpotPercentagePropertyWhenProvided.

@Test
void shouldSetSpotPercentagePropertyWhenProvided() {
    InstanceTemplateRequest source = new InstanceTemplateRequest();
    source.setInstanceType(INSTANCE_TYPE);
    source.setAws(createAwsInstanceTemplateParameters(SPOT_PERCENTAGE, SPOT_MAX_PRICE));
    Template result = underTest.convert(source, CLOUD_PLATFORM, ACCOUNT_ID, null, null, null);
    Json attributes = result.getAttributes();
    assertThat(attributes).isNotNull();
    assertThat(attributes.<Object>getValue(AwsInstanceTemplate.EC2_SPOT_PERCENTAGE)).isEqualTo(SPOT_PERCENTAGE);
    assertThat(attributes.<Object>getValue(AwsInstanceTemplate.EC2_SPOT_MAX_PRICE)).isEqualTo(SPOT_MAX_PRICE);
}
Also used : InstanceTemplateRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceTemplateRequest) Json(com.sequenceiq.cloudbreak.common.json.Json) AzureInstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.instance.AzureInstanceTemplate) Template(com.sequenceiq.freeipa.entity.Template) AwsInstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.instance.AwsInstanceTemplate) GcpInstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.instance.GcpInstanceTemplate) InstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate) Test(org.junit.jupiter.api.Test)

Example 23 with InstanceTemplateRequest

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceTemplateRequest in project cloudbreak by hortonworks.

the class InstanceTemplateRequestToTemplateConverterTest method shouldNotSetVolumeEncryptionWhenAzure.

@Test
void shouldNotSetVolumeEncryptionWhenAzure() {
    InstanceTemplateRequest source = new InstanceTemplateRequest();
    source.setInstanceType(INSTANCE_TYPE);
    Template result = underTest.convert(source, CloudPlatform.AZURE, ACCOUNT_ID, null, null, null);
    Json attributes = result.getAttributes();
    assertThat(attributes).isNotNull();
    assertThat(attributes.<Object>getValue(AwsInstanceTemplate.EBS_ENCRYPTION_ENABLED)).isNull();
    assertThat(attributes.<Object>getValue(InstanceTemplate.VOLUME_ENCRYPTION_KEY_TYPE)).isNull();
}
Also used : InstanceTemplateRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceTemplateRequest) Json(com.sequenceiq.cloudbreak.common.json.Json) AzureInstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.instance.AzureInstanceTemplate) Template(com.sequenceiq.freeipa.entity.Template) AwsInstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.instance.AwsInstanceTemplate) GcpInstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.instance.GcpInstanceTemplate) InstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate) Test(org.junit.jupiter.api.Test)

Example 24 with InstanceTemplateRequest

use of com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceTemplateRequest in project cloudbreak by hortonworks.

the class InstanceTemplateRequestToTemplateConverterTest method shouldSetAccoundIdWhenProvided.

@Test
void shouldSetAccoundIdWhenProvided() {
    InstanceTemplateRequest source = new InstanceTemplateRequest();
    source.setInstanceType(INSTANCE_TYPE);
    Template result = underTest.convert(source, CLOUD_PLATFORM, ACCOUNT_ID, null, null, null);
    assertThat(result.getAccountId()).isEqualTo(ACCOUNT_ID);
}
Also used : InstanceTemplateRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceTemplateRequest) AzureInstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.instance.AzureInstanceTemplate) Template(com.sequenceiq.freeipa.entity.Template) AwsInstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.instance.AwsInstanceTemplate) GcpInstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.instance.GcpInstanceTemplate) InstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate) Test(org.junit.jupiter.api.Test)

Aggregations

InstanceTemplateRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceTemplateRequest)24 AwsInstanceTemplate (com.sequenceiq.cloudbreak.cloud.model.instance.AwsInstanceTemplate)21 Template (com.sequenceiq.freeipa.entity.Template)21 Test (org.junit.jupiter.api.Test)21 AzureInstanceTemplate (com.sequenceiq.cloudbreak.cloud.model.instance.AzureInstanceTemplate)19 Json (com.sequenceiq.cloudbreak.common.json.Json)15 InstanceTemplate (com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate)14 GcpInstanceTemplate (com.sequenceiq.cloudbreak.cloud.model.instance.GcpInstanceTemplate)14 FreeIpaServerRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.FreeIpaServerRequest)7 InstanceGroupRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupRequest)7 NetworkRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.NetworkRequest)7 InstanceGroup (com.sequenceiq.freeipa.entity.InstanceGroup)7 Stack (com.sequenceiq.freeipa.entity.Stack)7 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)5 VolumeRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.VolumeRequest)3 AwsInstanceTemplateParameters (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.aws.AwsInstanceTemplateParameters)3 AwsInstanceTemplateSpotParameters (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.aws.AwsInstanceTemplateSpotParameters)3 CreateFreeIpaRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.create.CreateFreeIpaRequest)3 StackTags (com.sequenceiq.cloudbreak.cloud.model.StackTags)2 BackupRequest (com.sequenceiq.common.api.backup.request.BackupRequest)2