Search in sources :

Example 1 with AwsDatabaseServerV4Parameters

use of com.sequenceiq.redbeams.api.endpoint.v4.stacks.aws.AwsDatabaseServerV4Parameters in project cloudbreak by hortonworks.

the class AwsDatabaseServerParameterDecorator method setParameters.

@Override
public void setParameters(DatabaseServerV4StackRequest request, DatabaseServerParameter serverParameter) {
    AwsDatabaseServerV4Parameters parameters = new AwsDatabaseServerV4Parameters();
    parameters.setBackupRetentionPeriod(serverParameter.isHighlyAvailable() ? retentionPeriodHa : retentionPeriodNonHa);
    parameters.setMultiAZ(Boolean.toString(serverParameter.isHighlyAvailable()));
    parameters.setEngineVersion(serverParameter.getEngineVersion());
    request.setAws(parameters);
}
Also used : AwsDatabaseServerV4Parameters(com.sequenceiq.redbeams.api.endpoint.v4.stacks.aws.AwsDatabaseServerV4Parameters)

Example 2 with AwsDatabaseServerV4Parameters

use of com.sequenceiq.redbeams.api.endpoint.v4.stacks.aws.AwsDatabaseServerV4Parameters in project cloudbreak by hortonworks.

the class AwsDatabaseServerParameterSetterTest method testHAServer.

@Test
public void testHAServer() {
    underTest.setParameters(request, SdxDatabaseAvailabilityType.HA, null);
    verify(request).setAws(captor.capture());
    AwsDatabaseServerV4Parameters awsDatabaseServerV4Parameters = captor.getValue();
    assertEquals("true", awsDatabaseServerV4Parameters.getMultiAZ());
    assertEquals(30, awsDatabaseServerV4Parameters.getBackupRetentionPeriod());
}
Also used : AwsDatabaseServerV4Parameters(com.sequenceiq.redbeams.api.endpoint.v4.stacks.aws.AwsDatabaseServerV4Parameters) Test(org.junit.jupiter.api.Test)

Example 3 with AwsDatabaseServerV4Parameters

use of com.sequenceiq.redbeams.api.endpoint.v4.stacks.aws.AwsDatabaseServerV4Parameters in project cloudbreak by hortonworks.

the class AwsDatabaseServerParameterSetterTest method testEngineVersion.

@Test
public void testEngineVersion() {
    underTest.setParameters(request, SdxDatabaseAvailabilityType.NON_HA, "13");
    verify(request).setAws(captor.capture());
    AwsDatabaseServerV4Parameters awsDatabaseServerV4Parameters = captor.getValue();
    assertEquals("false", awsDatabaseServerV4Parameters.getMultiAZ());
    assertEquals(0, awsDatabaseServerV4Parameters.getBackupRetentionPeriod());
    assertEquals("13", awsDatabaseServerV4Parameters.getEngineVersion());
}
Also used : AwsDatabaseServerV4Parameters(com.sequenceiq.redbeams.api.endpoint.v4.stacks.aws.AwsDatabaseServerV4Parameters) Test(org.junit.jupiter.api.Test)

Example 4 with AwsDatabaseServerV4Parameters

use of com.sequenceiq.redbeams.api.endpoint.v4.stacks.aws.AwsDatabaseServerV4Parameters in project cloudbreak by hortonworks.

the class AwsDatabaseServerParameterSetterTest method testNonHAServer.

@Test
public void testNonHAServer() {
    underTest.setParameters(request, SdxDatabaseAvailabilityType.NON_HA, null);
    verify(request).setAws(captor.capture());
    AwsDatabaseServerV4Parameters awsDatabaseServerV4Parameters = captor.getValue();
    assertEquals("false", awsDatabaseServerV4Parameters.getMultiAZ());
    assertEquals(0, awsDatabaseServerV4Parameters.getBackupRetentionPeriod());
}
Also used : AwsDatabaseServerV4Parameters(com.sequenceiq.redbeams.api.endpoint.v4.stacks.aws.AwsDatabaseServerV4Parameters) Test(org.junit.jupiter.api.Test)

Example 5 with AwsDatabaseServerV4Parameters

use of com.sequenceiq.redbeams.api.endpoint.v4.stacks.aws.AwsDatabaseServerV4Parameters in project cloudbreak by hortonworks.

the class AwsDatabaseServerParameterSetter method setParameters.

@Override
public void setParameters(DatabaseServerV4StackRequest request, SdxDatabaseAvailabilityType availabilityType, String databaseEngineVersion) {
    AwsDatabaseServerV4Parameters parameters = new AwsDatabaseServerV4Parameters();
    if (SdxDatabaseAvailabilityType.HA.equals(availabilityType)) {
        parameters.setBackupRetentionPeriod(backupRetentionPeriodHa);
        parameters.setMultiAZ("true");
    } else if (SdxDatabaseAvailabilityType.NON_HA.equals(availabilityType)) {
        parameters.setBackupRetentionPeriod(backupRetentionPeriodNonHa);
        parameters.setMultiAZ("false");
    } else {
        throw new IllegalArgumentException(availabilityType + " database availability type is not supported on AWS.");
    }
    if (StringUtils.isNotEmpty(databaseEngineVersion)) {
        parameters.setEngineVersion(databaseEngineVersion);
    }
    request.setAws(parameters);
}
Also used : AwsDatabaseServerV4Parameters(com.sequenceiq.redbeams.api.endpoint.v4.stacks.aws.AwsDatabaseServerV4Parameters)

Aggregations

AwsDatabaseServerV4Parameters (com.sequenceiq.redbeams.api.endpoint.v4.stacks.aws.AwsDatabaseServerV4Parameters)6 Test (org.junit.jupiter.api.Test)3 Test (org.junit.Test)1