This repository was archived by the owner on May 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathServerState.java
More file actions
77 lines (60 loc) · 1.91 KB
/
ServerState.java
File metadata and controls
77 lines (60 loc) · 1.91 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
/*
* Upcloud api
* The UpCloud API consists of operations used to control resources on UpCloud. The API is a web service interface. HTTPS is used to connect to the API. The API follows the principles of a RESTful web service wherever possible. The base URL for all API operations is https://api.upcloud.com/. All API operations require authentication.
*
* OpenAPI spec version: 1.2.0
*
*/
package com.upcloud.client.models;
import java.util.Objects;
import io.swagger.annotations.ApiModel;
import com.google.gson.annotations.SerializedName;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* The server state indicates the server's current status.
*/
@JsonAdapter(ServerState.Adapter.class)
public enum ServerState {
STARTED("started"),
STOPPED("stopped"),
MAINTENANCE("maintenance"),
ERROR("error");
private String value;
ServerState(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static ServerState fromValue(String text) {
for (ServerState b : ServerState.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<ServerState> {
@Override
public void write(final JsonWriter jsonWriter, final ServerState enumeration) throws IOException {
if (enumeration != null) {
jsonWriter.value(enumeration.getValue());
} else {
jsonWriter.nullValue();
}
}
@Override
public ServerState read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return ServerState.fromValue(String.valueOf(value));
}
}
}