Search in sources :

Example 11 with DatabaseServerV4StackRequest

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

the class DatabaseService method getDatabaseServerRequest.

private DatabaseServerV4StackRequest getDatabaseServerRequest(CloudPlatform cloudPlatform, SdxCluster sdxCluster) {
    DatabaseConfig databaseConfig = dbConfigs.get(new DatabaseConfigKey(cloudPlatform, sdxCluster.getClusterShape()));
    if (databaseConfig == null) {
        throw new BadRequestException("Database config for cloud platform " + cloudPlatform + ", cluster shape " + sdxCluster.getClusterShape() + " not found");
    }
    DatabaseServerV4StackRequest req = new DatabaseServerV4StackRequest();
    req.setInstanceType(databaseConfig.getInstanceType());
    req.setDatabaseVendor(databaseConfig.getVendor());
    req.setStorageSize(databaseConfig.getVolumeSize());
    databaseServerParameterSetterMap.get(cloudPlatform).setParameters(req, sdxCluster.getDatabaseAvailabilityType(), sdxCluster.getDatabaseEngineVersion());
    return req;
}
Also used : DatabaseServerV4StackRequest(com.sequenceiq.redbeams.api.endpoint.v4.stacks.DatabaseServerV4StackRequest) BadRequestException(javax.ws.rs.BadRequestException)

Example 12 with DatabaseServerV4StackRequest

use of com.sequenceiq.redbeams.api.endpoint.v4.stacks.DatabaseServerV4StackRequest 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)

Example 13 with DatabaseServerV4StackRequest

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

the class GcpDatabaseServerParameterDecorator method setParameters.

@Override
public void setParameters(DatabaseServerV4StackRequest request, DatabaseServerParameter serverParameter) {
    GcpDatabaseServerV4Parameters parameters = new GcpDatabaseServerV4Parameters();
    parameters.setEngineVersion(serverParameter.getEngineVersion());
    request.setGcp(parameters);
}
Also used : GcpDatabaseServerV4Parameters(com.sequenceiq.redbeams.api.endpoint.v4.stacks.gcp.GcpDatabaseServerV4Parameters)

Example 14 with DatabaseServerV4StackRequest

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

the class AllocateDatabaseServerV4RequestTest method testGettersAndSetters.

@Test
public void testGettersAndSetters() {
    request.setName("myallocation");
    assertEquals("myallocation", request.getName());
    request.setEnvironmentCrn("myenv");
    request.setTags(new HashMap<>());
    assertEquals("myenv", request.getEnvironmentCrn());
    NetworkV4StackRequest network = new NetworkV4StackRequest();
    request.setNetwork(network);
    assertEquals(network, request.getNetwork());
    DatabaseServerV4StackRequest server = new DatabaseServerV4StackRequest();
    request.setDatabaseServer(server);
    assertEquals(server, request.getDatabaseServer());
}
Also used : NetworkV4StackRequest(com.sequenceiq.redbeams.api.endpoint.v4.stacks.NetworkV4StackRequest) DatabaseServerV4StackRequest(com.sequenceiq.redbeams.api.endpoint.v4.stacks.DatabaseServerV4StackRequest) Test(org.junit.Test)

Aggregations

DatabaseServerV4StackRequest (com.sequenceiq.redbeams.api.endpoint.v4.stacks.DatabaseServerV4StackRequest)8 DatabaseServerParameter (com.sequenceiq.cloudbreak.service.externaldatabase.model.DatabaseServerParameter)3 BadRequestException (javax.ws.rs.BadRequestException)3 DatabaseStackConfig (com.sequenceiq.cloudbreak.service.externaldatabase.model.DatabaseStackConfig)2 AllocateDatabaseServerV4Request (com.sequenceiq.redbeams.api.endpoint.v4.databaseserver.requests.AllocateDatabaseServerV4Request)2 NetworkV4StackRequest (com.sequenceiq.redbeams.api.endpoint.v4.stacks.NetworkV4StackRequest)2 AwsDatabaseServerV4Parameters (com.sequenceiq.redbeams.api.endpoint.v4.stacks.aws.AwsDatabaseServerV4Parameters)2 AzureDatabaseServerV4Parameters (com.sequenceiq.redbeams.api.endpoint.v4.stacks.azure.AzureDatabaseServerV4Parameters)2 GcpDatabaseServerV4Parameters (com.sequenceiq.redbeams.api.endpoint.v4.stacks.gcp.GcpDatabaseServerV4Parameters)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)1 SdxStatusEntity (com.sequenceiq.datalake.entity.SdxStatusEntity)1 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)1 SslConfigV4Request (com.sequenceiq.redbeams.api.endpoint.v4.databaseserver.requests.SslConfigV4Request)1 SecurityGroupV4StackRequest (com.sequenceiq.redbeams.api.endpoint.v4.stacks.SecurityGroupV4StackRequest)1 SslCertificateEntry (com.sequenceiq.redbeams.configuration.SslCertificateEntry)1 DBStack (com.sequenceiq.redbeams.domain.stack.DBStack)1 Test (org.junit.Test)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 MethodSource (org.junit.jupiter.params.provider.MethodSource)1