use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status.DELETE_FAILED in project cloudbreak by hortonworks.
the class CleanupWaitUtil method checkEnvironmentDeleteFailedStatus.
/**
* Checking the environment is in DELETE_FAILED state.
*
* Returns with:
* TRUE: DELETE_FAILED state is available.
* FALSE: DELETE_FAILED state is not available.
*
* @param environmentClient com.sequenceiq.environment.client.EnvironmentClient
* @param environmentName Provided environment name
* @return TRUE or FALSE based on existing DELETE_FAILED status
*/
private boolean checkEnvironmentDeleteFailedStatus(EnvironmentClient environmentClient, String environmentName) {
try {
EnvironmentStatus environmentStatus = environmentClient.environmentV1Endpoint().list().getResponses().stream().filter(response -> response.getName().equalsIgnoreCase(environmentName)).findFirst().map(EnvironmentBaseResponse::getEnvironmentStatus).orElse(EnvironmentStatus.ARCHIVED);
LOG.info("{} environment actual state is: {}", environmentName, environmentStatus);
return environmentStatus.equals(EnvironmentStatus.DELETE_FAILED);
} catch (Exception e) {
LOG.warn("Exception has been occurred while checking {} environment's DELETE_FAILED state: {}", environmentName, e.getMessage(), e);
return false;
}
}
Aggregations