1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.linecorp.centraldogma.server.internal.api;
18
19 import static com.google.common.base.MoreObjects.firstNonNull;
20 import static java.util.Objects.requireNonNull;
21
22 import java.util.Objects;
23
24 import javax.annotation.Nullable;
25
26 import com.fasterxml.jackson.annotation.JsonCreator;
27 import com.fasterxml.jackson.annotation.JsonProperty;
28 import com.google.common.base.MoreObjects;
29
30 import com.linecorp.centraldogma.server.management.ServerStatus;
31
32 public final class UpdateServerStatusRequest {
33 private final ServerStatus serverStatus;
34 private final Scope scope;
35
36 @JsonCreator
37 public UpdateServerStatusRequest(@JsonProperty("serverStatus") ServerStatus serverStatus,
38 @JsonProperty("scope") @Nullable Scope scope) {
39 this.serverStatus = requireNonNull(serverStatus, "serverStatus");
40 this.scope = firstNonNull(scope, Scope.ALL);
41 }
42
43 @JsonProperty("serverStatus")
44 public ServerStatus serverStatus() {
45 return serverStatus;
46 }
47
48 @JsonProperty("scope")
49 public Scope scope() {
50 return scope;
51 }
52
53 @Override
54 public boolean equals(Object o) {
55 if (this == o) {
56 return true;
57 }
58 if (!(o instanceof UpdateServerStatusRequest)) {
59 return false;
60 }
61 final UpdateServerStatusRequest that = (UpdateServerStatusRequest) o;
62 return serverStatus == that.serverStatus && scope == that.scope;
63 }
64
65 @Override
66 public int hashCode() {
67 return Objects.hash(serverStatus, scope);
68 }
69
70 @Override
71 public String toString() {
72 return MoreObjects.toStringHelper(this)
73 .add("serverStatus", serverStatus)
74 .add("scope", scope)
75 .toString();
76 }
77
78 public enum Scope {
79 LOCAL, ALL
80 }
81 }