blob: a49553cc3852631febf9e93283558aa035ddf16c (
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
59
60
61
62
63
64
|
// Copyright Vespa.ai. 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.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
/**
* A reason to reject a host state change request
*
* @author andreer
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class HostStateChangeDenialReason {
public static final String FIELD_NAME_CONSTRAINT = "constraint";
public static final String FIELD_NAME_MESSAGE = "message";
private final String constraintName;
private final String message;
@JsonCreator
public HostStateChangeDenialReason(
@JsonProperty(FIELD_NAME_CONSTRAINT) final String constraintName,
@JsonProperty(FIELD_NAME_MESSAGE) final String message) {
this.constraintName = constraintName;
this.message = message;
}
@JsonProperty(FIELD_NAME_CONSTRAINT)
public String constraintName() {
return constraintName;
}
@JsonProperty(FIELD_NAME_MESSAGE)
public String message() {
return message;
}
@Override
public boolean equals(final Object o) {
if (!(o instanceof HostStateChangeDenialReason)) {
return false;
}
final HostStateChangeDenialReason other = (HostStateChangeDenialReason) o;
if (!Objects.equals(this.constraintName, other.constraintName)) return false;
if (!Objects.equals(this.message, other.message)) return false;
return true;
}
@Override
public int hashCode() {
return Objects.hash(constraintName, message);
}
@Override
public String toString() {
return message + " [" + constraintName + "]";
}
}
|