use of com.sequenceiq.flow.api.model.operation.OperationCondition in project cloudbreak by hortonworks.
the class OperationService method handleProvisionOperation.
private OperationView handleProvisionOperation(String resourceCrn, OperationResource operationResource, OperationFlowsView operationFlowsView, boolean detailed) {
OperationView stackOperationView;
stackOperationView = operationDetailsPopulator.createOperationView(operationFlowsView, operationResource, List.of(CloudConfigValidationFlowConfig.class, KerberosConfigValidationFlowConfig.class, ExternalDatabaseCreationFlowConfig.class, StackCreationFlowConfig.class, ClusterCreationFlowConfig.class));
if (detailed && !OperationResource.DATALAKE.equals(operationResource)) {
Stack stack = stackOperations.getStackByCrn(resourceCrn);
DatabaseAvailabilityType databaseAvailabilityType = stack.getExternalDatabaseCreationType();
Map<OperationResource, OperationCondition> conditionMap = new HashMap<>();
Map<OperationResource, OperationView> subOperations = new HashMap<>();
if (!DatabaseAvailabilityType.NONE.equals(databaseAvailabilityType)) {
conditionMap.put(OperationResource.REMOTEDB, OperationCondition.REQUIRED);
subOperations.put(OperationResource.REMOTEDB, databaseService.getRemoteDatabaseOperationProgress(stack, detailed).orElse(null));
} else {
conditionMap.put(OperationResource.REMOTEDB, OperationCondition.NONE);
}
stackOperationView.setSubOperationConditions(conditionMap);
stackOperationView.setSubOperations(subOperations);
}
return stackOperationView;
}
use of com.sequenceiq.flow.api.model.operation.OperationCondition in project cloudbreak by hortonworks.
the class OperationService method handleProvisionOperation.
private void handleProvisionOperation(String resourceCrn, OperationView sdxOperationView, boolean detailed) {
String userCrn = ThreadBasedUserCrnProvider.getUserCrn();
SdxCluster sdxCluster = sdxService.getByCrn(userCrn, resourceCrn);
boolean createDb = sdxCluster.isCreateDatabase();
Map<OperationResource, OperationView> subOperations = new HashMap<>();
Map<OperationResource, OperationCondition> conditionMap = new HashMap<>();
conditionMap.put(OperationResource.DATALAKE, OperationCondition.REQUIRED);
if (createDb) {
conditionMap.put(OperationResource.REMOTEDB, OperationCondition.REQUIRED);
try {
OperationView rdbOperationView = databaseService.getOperationProgressStatus(sdxCluster.getDatabaseCrn(), detailed);
if (OperationType.PROVISION.equals(rdbOperationView.getOperationType())) {
subOperations.put(OperationResource.REMOTEDB, rdbOperationView);
}
} catch (Exception e) {
LOGGER.warn("Error during fetching provision progress from remote database API. Skip filling remote database response.", e);
}
} else {
conditionMap.put(OperationResource.REMOTEDB, OperationCondition.NONE);
}
sdxOperationView.setSubOperationConditions(conditionMap);
try {
OperationView stackOperationProgressView = operationV4Endpoint.getOperationProgressByResourceCrn(resourceCrn, detailed);
if (OperationType.PROVISION.equals(stackOperationProgressView.getOperationType())) {
subOperations.put(OperationResource.DATALAKE, stackOperationProgressView);
}
} catch (Exception e) {
LOGGER.warn("Error during fetching provision progress from stack API. Skip filling stack progress response.", e);
}
sdxOperationView.setSubOperations(subOperations);
}
Aggregations