aboutsummaryrefslogtreecommitdiffstats
path: root/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/OrchestratorStatus.java
blob: f0a648827b6e6818613eb6a15ce69905ca0ba977 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.configserver.noderepository;

import java.util.stream.Stream;

public enum OrchestratorStatus {
    NO_REMARKS, ALLOWED_TO_BE_DOWN, PERMANENTLY_DOWN, UNKNOWN;

    public static OrchestratorStatus fromString(String statusString) {
        return Stream.of(values())
                .filter(status -> status.asString().equals(statusString))
                .findFirst()
                .orElse(UNKNOWN);
    }

    public String asString() {
        return name();
    }

    public boolean isSuspended() {
        return this != NO_REMARKS;
    }
}