Search in sources :

Example 1 with AzureDatabaseServerV4Parameters

use of com.sequenceiq.redbeams.api.endpoint.v4.stacks.azure.AzureDatabaseServerV4Parameters in project cloudbreak by hortonworks.

the class AzureDatabaseServerParameterDecorator method setParameters.

@Override
public void setParameters(DatabaseServerV4StackRequest request, DatabaseServerParameter serverParameter) {
    AzureDatabaseServerV4Parameters parameters = new AzureDatabaseServerV4Parameters();
    if (serverParameter.isHighlyAvailable()) {
        parameters.setBackupRetentionDays(retentionPeriodHa);
        parameters.setGeoRedundantBackup(geoRedundantBackupHa);
    } else {
        parameters.setBackupRetentionDays(retentionPeriodNonHa);
        parameters.setGeoRedundantBackup(geoRedundantBackupNonHa);
    }
    parameters.setBackupRetentionDays(retentionPeriodHa);
    parameters.setGeoRedundantBackup(geoRedundantBackupHa);
    parameters.setDbVersion(serverParameter.getEngineVersion());
    request.setAzure(parameters);
}
Also used : AzureDatabaseServerV4Parameters(com.sequenceiq.redbeams.api.endpoint.v4.stacks.azure.AzureDatabaseServerV4Parameters)

Example 2 with AzureDatabaseServerV4Parameters

use of com.sequenceiq.redbeams.api.endpoint.v4.stacks.azure.AzureDatabaseServerV4Parameters in project cloudbreak by hortonworks.

the class AzureDatabaseServerParameterSetterTest method testNonHAServer.

@Test
public void testNonHAServer() {
    underTest.setParameters(request, SdxDatabaseAvailabilityType.NON_HA, null);
    verify(request).setAzure(captor.capture());
    AzureDatabaseServerV4Parameters azureDatabaseServerV4Parameters = captor.getValue();
    assertEquals(false, azureDatabaseServerV4Parameters.getGeoRedundantBackup());
    assertEquals(7, azureDatabaseServerV4Parameters.getBackupRetentionDays());
}
Also used : AzureDatabaseServerV4Parameters(com.sequenceiq.redbeams.api.endpoint.v4.stacks.azure.AzureDatabaseServerV4Parameters) Test(org.junit.jupiter.api.Test)

Example 3 with AzureDatabaseServerV4Parameters

use of com.sequenceiq.redbeams.api.endpoint.v4.stacks.azure.AzureDatabaseServerV4Parameters in project cloudbreak by hortonworks.

the class AzureDatabaseServerParameterSetterTest method testHAServer.

@Test
public void testHAServer() {
    underTest.setParameters(request, SdxDatabaseAvailabilityType.HA, null);
    verify(request).setAzure(captor.capture());
    AzureDatabaseServerV4Parameters azureDatabaseServerV4Parameters = captor.getValue();
    assertEquals(true, azureDatabaseServerV4Parameters.getGeoRedundantBackup());
    assertEquals(30, azureDatabaseServerV4Parameters.getBackupRetentionDays());
}
Also used : AzureDatabaseServerV4Parameters(com.sequenceiq.redbeams.api.endpoint.v4.stacks.azure.AzureDatabaseServerV4Parameters) Test(org.junit.jupiter.api.Test)

Example 4 with AzureDatabaseServerV4Parameters

use of com.sequenceiq.redbeams.api.endpoint.v4.stacks.azure.AzureDatabaseServerV4Parameters in project cloudbreak by hortonworks.

the class AzureDatabaseServerParameterSetterTest method testEngineVersion.

@Test
public void testEngineVersion() {
    underTest.setParameters(request, SdxDatabaseAvailabilityType.NON_HA, "13");
    verify(request).setAzure(captor.capture());
    AzureDatabaseServerV4Parameters azureDatabaseServerV4Parameters = captor.getValue();
    assertEquals(false, azureDatabaseServerV4Parameters.getGeoRedundantBackup());
    assertEquals(7, azureDatabaseServerV4Parameters.getBackupRetentionDays());
    assertEquals("13", azureDatabaseServerV4Parameters.getDbVersion());
}
Also used : AzureDatabaseServerV4Parameters(com.sequenceiq.redbeams.api.endpoint.v4.stacks.azure.AzureDatabaseServerV4Parameters) Test(org.junit.jupiter.api.Test)

Example 5 with AzureDatabaseServerV4Parameters

use of com.sequenceiq.redbeams.api.endpoint.v4.stacks.azure.AzureDatabaseServerV4Parameters in project cloudbreak by hortonworks.

the class AzureDatabaseServerParameterSetter method setParameters.

@Override
public void setParameters(DatabaseServerV4StackRequest request, SdxDatabaseAvailabilityType availabilityType, String databaseEngineVersion) {
    AzureDatabaseServerV4Parameters parameters = new AzureDatabaseServerV4Parameters();
    if (SdxDatabaseAvailabilityType.HA.equals(availabilityType)) {
        parameters.setBackupRetentionDays(backupRetentionPeriodHa);
        parameters.setGeoRedundantBackup(geoRedundantBackupHa);
    } else if (SdxDatabaseAvailabilityType.NON_HA.equals(availabilityType)) {
        parameters.setBackupRetentionDays(backupRetentionPeriodNonHa);
        parameters.setGeoRedundantBackup(geoRedundantBackupNonHa);
    } else {
        throw new IllegalArgumentException(availabilityType + " database availability type is not supported on Azure.");
    }
    if (StringUtils.isNotEmpty(databaseEngineVersion)) {
        parameters.setDbVersion(databaseEngineVersion);
    }
    request.setAzure(parameters);
}
Also used : AzureDatabaseServerV4Parameters(com.sequenceiq.redbeams.api.endpoint.v4.stacks.azure.AzureDatabaseServerV4Parameters)

Aggregations

AzureDatabaseServerV4Parameters (com.sequenceiq.redbeams.api.endpoint.v4.stacks.azure.AzureDatabaseServerV4Parameters)5 Test (org.junit.jupiter.api.Test)3