Search in sources :

Example 21 with Status

use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status 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;
    }
}
Also used : Logger(org.slf4j.Logger) LoggerFactory(org.slf4j.LoggerFactory) Status(com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status) CloudbreakClient(com.sequenceiq.cloudbreak.client.CloudbreakClient) Collectors(java.util.stream.Collectors) StackViewV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Response) EnvironmentBaseResponse(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentBaseResponse) WaitResult(com.sequenceiq.it.cloudbreak.util.WaitResult) Value(org.springframework.beans.factory.annotation.Value) SdxClient(com.sequenceiq.sdx.client.SdxClient) Component(org.springframework.stereotype.Component) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) EnvironmentClient(com.sequenceiq.environment.client.EnvironmentClient) Map(java.util.Map) EnvironmentStatus(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentStatus) SdxClusterStatusResponse(com.sequenceiq.sdx.api.model.SdxClusterStatusResponse) Collections(java.util.Collections) EnvironmentStatus(com.sequenceiq.environment.api.v1.environment.model.response.EnvironmentStatus)

Example 22 with Status

use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status in project cloudbreak by hortonworks.

the class StopExternalDatabaseHandlerTest method buildStack.

private Stack buildStack(DatabaseAvailabilityType databaseAvailabilityType) {
    StackStatus status = new StackStatus();
    status.setStatus(Status.AVAILABLE);
    Cluster cluster = new Cluster();
    Stack stack = new Stack();
    stack.setStackStatus(status);
    stack.setId(STACK_ID);
    stack.setName(STACK_NAME);
    stack.setExternalDatabaseCreationType(databaseAvailabilityType);
    stack.setEnvironmentCrn("envCrn");
    stack.setCluster(cluster);
    return stack;
}
Also used : StackStatus(com.sequenceiq.cloudbreak.domain.stack.StackStatus) DetailedStackStatus(com.sequenceiq.cloudbreak.api.endpoint.v4.common.DetailedStackStatus) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Example 23 with Status

use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status in project cloudbreak by hortonworks.

the class TerminateExternalDatabaseHandlerTest method buildStack.

private Stack buildStack(DatabaseAvailabilityType databaseAvailabilityType) {
    StackStatus status = new StackStatus();
    status.setStatus(Status.AVAILABLE);
    Cluster cluster = new Cluster();
    Stack stack = new Stack();
    stack.setStackStatus(status);
    stack.setId(STACK_ID);
    stack.setName(STACK_NAME);
    stack.setExternalDatabaseCreationType(databaseAvailabilityType);
    stack.setEnvironmentCrn("envCrn");
    stack.setCluster(cluster);
    return stack;
}
Also used : StackStatus(com.sequenceiq.cloudbreak.domain.stack.StackStatus) DetailedStackStatus(com.sequenceiq.cloudbreak.api.endpoint.v4.common.DetailedStackStatus) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Example 24 with Status

use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status in project cloudbreak by hortonworks.

the class SdxClusterStatusCheckerJob method isUnreachable.

private boolean isUnreachable(StackStatusV4Response stack) {
    Status stackStatus = stack.getStatus();
    Status clusterStatus = stack.getClusterStatus();
    return stackStatus == Status.UNREACHABLE || (stackStatus == Status.AVAILABLE && clusterStatus == Status.UNREACHABLE);
}
Also used : Status(com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status)

Example 25 with Status

use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status in project cloudbreak by hortonworks.

the class CloudbreakPollerTest method statusResponse.

private StackStatusV4Response statusResponse(Status stackStatus, Status clusterStatus) {
    StackStatusV4Response statusV4Response = new StackStatusV4Response();
    statusV4Response.setStatus(stackStatus);
    statusV4Response.setClusterStatus(clusterStatus);
    return statusV4Response;
}
Also used : StackStatusV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackStatusV4Response)

Aggregations

DetailedStackStatus (com.sequenceiq.cloudbreak.api.endpoint.v4.common.DetailedStackStatus)23 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)22 Status (com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status)18 StackStatus (com.sequenceiq.cloudbreak.domain.stack.StackStatus)12 StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)10 Logger (org.slf4j.Logger)10 LoggerFactory (org.slf4j.LoggerFactory)10 StackStatusV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackStatusV4Response)9 InstanceStatus (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus)7 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)7 Map (java.util.Map)7 Collectors (java.util.stream.Collectors)7 CloudVmInstanceStatus (com.sequenceiq.cloudbreak.cloud.model.CloudVmInstanceStatus)6 Collection (java.util.Collection)6 List (java.util.List)6 Set (java.util.Set)6 Inject (javax.inject.Inject)6 PollerStoppedException (com.dyngr.exception.PollerStoppedException)5 ClusterV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.ClusterV4Response)5 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)5