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 pathStorageState.java
More file actions
79 lines (61 loc) · 2.49 KB
/
StorageState.java
File metadata and controls
79 lines (61 loc) · 2.49 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
77
78
/*
* 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 storage state indicates the storage's current status. * `online` - The storage resource is ready for use. The storage can be attached or detached. * `maintenance` - Maintenance work is currently performed on the storage. The storage may have been newly created or it is being updated by some API operation. * `cloning` - The storage resource is currently the clone source for another storage. * `backuping` - The storage resource is currently being backed up to another storage. * `error` - The storage has encountered an error and is currently inaccessible.
*/
@JsonAdapter(StorageState.Adapter.class)
public enum StorageState {
ONLINE("online"),
MAINTENANCE("maintenance"),
CLONING("cloning"),
BACKUPING("backuping"),
ERROR("error");
private String value;
StorageState(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static StorageState fromValue(String text) {
for (StorageState b : StorageState.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<StorageState> {
@Override
public void write(final JsonWriter jsonWriter, final StorageState enumeration) throws IOException {
if (enumeration != null) {
jsonWriter.value(enumeration.getValue());
} else {
jsonWriter.nullValue();
}
}
@Override
public StorageState read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return StorageState.fromValue(String.valueOf(value));
}
}
}