aboutsummaryrefslogtreecommitdiffstats
path: root/service-monitor/src/main/java/com/yahoo/vespa/service/health/HealthResponse.java
blob: 9ab4d094dd5b9d3e82cae77e56ddd51b2b8db976 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.service.health;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.yahoo.text.JSON;

/**
 * Response entity from /state/v1/health
 *
 * @author hakon
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class HealthResponse {
    @JsonProperty("status")
    public Status status = new Status();

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class Status {
        public static final String DEFAULT_STATUS = "down";

        @JsonProperty("code")
        public String code = DEFAULT_STATUS;

        @Override
        public String toString() {
            return "{ \"code\": \"" + JSON.escape(code) + "\" }";
        }
    }

    @Override
    public String toString() {
        return "{ \"status\": " + status.toString() + " }";
    }
}