aboutsummaryrefslogtreecommitdiffstats
path: root/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/wire/GetHostResponse.java
blob: 99489b345d42d90b2078de25ff3bb2656cb96d24 (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
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.orchestrator.restapi.wire;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Objects;

/*
 * @author andreer
 */
public class GetHostResponse {

    public static final String FIELD_NAME_HOSTNAME = "hostname";
    public static final String FIELD_NAME_STATE = "state";

    private final String hostname;
    private final String state;

    @JsonCreator
    public GetHostResponse(
            @JsonProperty(FIELD_NAME_HOSTNAME) final String hostname,
            @JsonProperty(FIELD_NAME_STATE) final String state) {
        this.hostname = hostname;
        this.state = state;
    }

    @JsonProperty(FIELD_NAME_HOSTNAME)
    public String hostname() {
        return hostname;
    }

    @JsonProperty(FIELD_NAME_STATE)
    public String state() {
        return state;
    }

    @Override
    public boolean equals(final Object o) {
        if (!(o instanceof GetHostResponse)) {
            return false;
        }

        final GetHostResponse other = (GetHostResponse) o;
        if (!Objects.equals(this.hostname, other.hostname)) return false;
        if (!Objects.equals(this.state, other.state)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return Objects.hash(hostname, state);
    }
}