Search in sources :

Example 1 with DatabaseStackConfig

use of com.sequenceiq.cloudbreak.service.externaldatabase.model.DatabaseStackConfig in project cloudbreak by hortonworks.

the class ExternalDatabaseService method getDatabaseServerStackRequest.

private DatabaseServerV4StackRequest getDatabaseServerStackRequest(CloudPlatform cloudPlatform, DatabaseAvailabilityType externalDatabase) {
    DatabaseStackConfig databaseStackConfig = dbConfigs.get(cloudPlatform);
    if (databaseStackConfig == null) {
        throw new BadRequestException("Database config for cloud platform " + cloudPlatform + " not found");
    }
    DatabaseServerV4StackRequest request = new DatabaseServerV4StackRequest();
    request.setInstanceType(databaseStackConfig.getInstanceType());
    request.setDatabaseVendor(databaseStackConfig.getVendor());
    request.setStorageSize(databaseStackConfig.getVolumeSize());
    DatabaseServerParameter serverParameter = DatabaseServerParameter.builder().withHighlyAvailable(DatabaseAvailabilityType.HA == externalDatabase).build();
    parameterDecoratorMap.get(cloudPlatform).setParameters(request, serverParameter);
    return request;
}
Also used : DatabaseStackConfig(com.sequenceiq.cloudbreak.service.externaldatabase.model.DatabaseStackConfig) DatabaseServerV4StackRequest(com.sequenceiq.redbeams.api.endpoint.v4.stacks.DatabaseServerV4StackRequest) BadRequestException(javax.ws.rs.BadRequestException) DatabaseServerParameter(com.sequenceiq.cloudbreak.service.externaldatabase.model.DatabaseServerParameter)

Example 2 with DatabaseStackConfig

use of com.sequenceiq.cloudbreak.service.externaldatabase.model.DatabaseStackConfig in project cloudbreak by hortonworks.

the class ExternalDatabaseService method getDatabaseServerStackRequest.

private DatabaseServerV4StackRequest getDatabaseServerStackRequest(CloudPlatform cloudPlatform, DatabaseAvailabilityType externalDatabase, String databaseEngineVersion) {
    DatabaseStackConfig databaseStackConfig = dbConfigs.get(cloudPlatform);
    if (databaseStackConfig == null) {
        throw new BadRequestException("Database config for cloud platform " + cloudPlatform + " not found");
    }
    DatabaseServerV4StackRequest request = new DatabaseServerV4StackRequest();
    request.setInstanceType(databaseStackConfig.getInstanceType());
    request.setDatabaseVendor(databaseStackConfig.getVendor());
    request.setStorageSize(databaseStackConfig.getVolumeSize());
    DatabaseServerParameter serverParameter = DatabaseServerParameter.builder().withHighlyAvailable(DatabaseAvailabilityType.HA == externalDatabase).withEngineVersion(databaseEngineVersion).build();
    parameterDecoratorMap.get(cloudPlatform).setParameters(request, serverParameter);
    return request;
}
Also used : DatabaseStackConfig(com.sequenceiq.cloudbreak.service.externaldatabase.model.DatabaseStackConfig) DatabaseServerV4StackRequest(com.sequenceiq.redbeams.api.endpoint.v4.stacks.DatabaseServerV4StackRequest) BadRequestException(javax.ws.rs.BadRequestException) DatabaseServerParameter(com.sequenceiq.cloudbreak.service.externaldatabase.model.DatabaseServerParameter)

Example 3 with DatabaseStackConfig

use of com.sequenceiq.cloudbreak.service.externaldatabase.model.DatabaseStackConfig in project cloudbreak by hortonworks.

the class ExternalDatabaseServiceTest method setUp.

@BeforeEach
void setUp() {
    underTest = new ExternalDatabaseService(redbeamsClient, clusterRepository, dbConfigs, parameterDecoratorMap, databaseObtainerService);
    environmentResponse = new DetailedEnvironmentResponse();
    environmentResponse.setCloudPlatform(CLOUD_PLATFORM.name());
    environmentResponse.setCrn(ENV_CRN);
    dbConfigs.put(CLOUD_PLATFORM, new DatabaseStackConfig("instance", "vendor", 1234));
    lenient().when(parameterDecoratorMap.get(CLOUD_PLATFORM)).thenReturn(dbServerParameterDecorator);
}
Also used : DatabaseStackConfig(com.sequenceiq.cloudbreak.service.externaldatabase.model.DatabaseStackConfig) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

DatabaseStackConfig (com.sequenceiq.cloudbreak.service.externaldatabase.model.DatabaseStackConfig)3 DatabaseServerParameter (com.sequenceiq.cloudbreak.service.externaldatabase.model.DatabaseServerParameter)2 DatabaseServerV4StackRequest (com.sequenceiq.redbeams.api.endpoint.v4.stacks.DatabaseServerV4StackRequest)2 BadRequestException (javax.ws.rs.BadRequestException)2 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1