summaryrefslogtreecommitdiffstats
path: root/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/EndpointStatus.java
blob: d014a82bf621e33cdee3817bd32e4b6d5be24d5f (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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.application.v4.model;

/**
 * Represent the operational status of a service endpoint (where the endpoint itself
 * is identified by the container cluster id).
 *
 * The status of an endpoint may be assigned from the controller.
 *
 * @author smorgrav
 */
public class EndpointStatus {
    private final String agent;
    private final String reason;
    private final Status status;
    private final long epoch;

    public enum Status {
        in,
        out,
        unknown;
    }

    public EndpointStatus(Status status, String reason, String agent, long epoch) {
        this.status = status;
        this.reason = reason;
        this.agent = agent;
        this.epoch = epoch;
    }

    /**
     * @return The agent responsible setting this status
     */
    public String getAgent() {
        return agent;
    }

    /**
     * @return The reason for this status (e.g. 'incident INCXXX')
     */
    public String getReason() {
        return reason;
    }

    /**
     * @return The current status
     */
    public Status getStatus() {
        return status;
    }

    /**
     * @return The epoch for when this status became active
     */
    public long getEpoch() {
        return epoch;
    }
}