aboutsummaryrefslogtreecommitdiffstats
path: root/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/bindings/NodeRepositoryNode.java
blob: 35ca757ebbe488a058a4b5f11c17507096c0dcfa (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.configserver.noderepository.bindings;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JsonNode;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author freva
 */
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class NodeRepositoryNode {

    @JsonProperty("state")
    public String state;
    @JsonProperty("hostname")
    public String hostname;
    @JsonProperty("ipAddresses")
    public Set<String> ipAddresses;
    @JsonProperty("additionalIpAddresses")
    public Set<String> additionalIpAddresses;
    @JsonProperty("id")
    public String id;
    @JsonProperty("cloudAccount")
    public String cloudAccount;
    @JsonProperty("flavor")
    public String flavor;
    @JsonProperty("resources")
    public NodeResources resources;
    @JsonProperty("realResources")
    public NodeResources realResources;
    @JsonProperty("membership")
    public Membership membership;
    @JsonProperty("owner")
    public Owner owner;
    @JsonProperty("restartGeneration")
    public Long restartGeneration;
    @JsonProperty("rebootGeneration")
    public Long rebootGeneration;
    @JsonProperty("currentRestartGeneration")
    public Long currentRestartGeneration;
    @JsonProperty("currentRebootGeneration")
    public Long currentRebootGeneration;
    @JsonProperty("vespaVersion")
    public String vespaVersion;
    @JsonProperty("wantedVespaVersion")
    public String wantedVespaVersion;
    @JsonProperty("currentOsVersion")
    public String currentOsVersion;
    @JsonProperty("wantedOsVersion")
    public String wantedOsVersion;
    @JsonProperty("currentFirmwareCheck")
    public Long currentFirmwareCheck;
    @JsonProperty("wantedFirmwareCheck")
    public Long wantedFirmwareCheck;
    @JsonProperty("modelName")
    public String modelName;
    @JsonProperty("failCount")
    public Integer failCount;
    @JsonProperty("environment")
    public String environment;
    @JsonProperty("reservedTo")
    public String reservedTo;
    @JsonProperty("type")
    public String type;
    @JsonProperty("wantedDockerImage")
    public String wantedDockerImage;
    @JsonProperty("currentDockerImage")
    public String currentDockerImage;
    @JsonProperty("parentHostname")
    public String parentHostname;
    @JsonProperty("wantToRetire")
    public Boolean wantToRetire;
    @JsonProperty("wantToDeprovision")
    public Boolean wantToDeprovision;
    @JsonProperty("wantToRebuild")
    public Boolean wantToRebuild;
    @JsonProperty("orchestratorStatus")
    public String orchestratorStatus;
    @JsonProperty("archiveUri")
    public String archiveUri;
    @JsonProperty("exclusiveTo")
    public String exclusiveTo;
    @JsonProperty("history")
    public List<Event> history;
    @JsonProperty("trustStore")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    public List<TrustStoreItem> trustStore;
    @JsonProperty("wireguard")
    public WireguardKeyWithTimestamp wireguardKeyWithTimestamp;

    // TODO wg: remove separate key and timestamp when all nodes use new keyWithTimestamp
    @JsonProperty("wireguardPubkey")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    public String wireguardPubkey;
    @JsonProperty("wireguardKeyTimestamp")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    public Long wireguardKeyTimestamp;

    @JsonProperty("reports")
    public Map<String, JsonNode> reports = null;

    @Override
    public String toString() {
        return "NodeRepositoryNode{" +
               "state='" + state + '\'' +
               ", hostname='" + hostname + '\'' +
               ", ipAddresses=" + ipAddresses +
               ", additionalIpAddresses=" + additionalIpAddresses +
               ", id='" + id + '\'' +
               ", flavor='" + flavor + '\'' +
               ", resources=" + resources +
               ", realResources=" + realResources +
               ", membership=" + membership +
               ", owner=" + owner +
               ", restartGeneration=" + restartGeneration +
               ", rebootGeneration=" + rebootGeneration +
               ", currentRestartGeneration=" + currentRestartGeneration +
               ", currentRebootGeneration=" + currentRebootGeneration +
               ", vespaVersion='" + vespaVersion + '\'' +
               ", wantedVespaVersion='" + wantedVespaVersion + '\'' +
               ", currentOsVersion='" + currentOsVersion + '\'' +
               ", wantedOsVersion='" + wantedOsVersion + '\'' +
               ", currentFirmwareCheck=" + currentFirmwareCheck +
               ", wantedFirmwareCheck=" + wantedFirmwareCheck +
               ", modelName='" + modelName + '\'' +
               ", failCount=" + failCount +
               ", environment='" + environment + '\'' +
               ", reservedTo='" + reservedTo + '\'' +
               ", type='" + type + '\'' +
               ", wantedDockerImage='" + wantedDockerImage + '\'' +
               ", currentDockerImage='" + currentDockerImage + '\'' +
               ", parentHostname='" + parentHostname + '\'' +
               ", wantToRetire=" + wantToRetire +
               ", wantToDeprovision=" + wantToDeprovision +
               ", wantToRebuild=" + wantToRebuild +
               ", orchestratorStatus='" + orchestratorStatus + '\'' +
               ", archiveUri='" + archiveUri + '\'' +
               ", exclusiveTo='" + exclusiveTo + '\'' +
               ", history=" + history +
               ", trustStore=" + trustStore +
               ", wireguard=" + wireguardKeyTimestamp +
               ", reports=" + reports +
               '}';
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class WireguardKeyWithTimestamp {
        @JsonProperty("key")
        public String key;
        @JsonProperty("timestamp")
        public long timestamp;

        public WireguardKeyWithTimestamp(@JsonProperty("key") String key, @JsonProperty("timestamp") long timestamp) {
            this.key = key;
            this.timestamp = timestamp;
        }
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class Owner {
        @JsonProperty("tenant")
        public String tenant;
        @JsonProperty("application")
        public String application;
        @JsonProperty("instance")
        public String instance;

        public String toString() {
            return "Owner {" +
                    " tenant = " + tenant +
                    " application = " + application +
                    " instance = " + instance +
                    " }";
        }
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class Membership {
        @JsonProperty("clustertype")
        public String clusterType;
        @JsonProperty("clusterid")
        public String clusterId;
        @JsonProperty("group")
        public String group;
        @JsonProperty("index")
        public int index;
        @JsonProperty("retired")
        public boolean retired;

        @Override
        public String toString() {
            return "Membership {" +
                    " clusterType = " + clusterType +
                    " clusterId = " + clusterId +
                    " group = " + group +
                    " index = " + index +
                    " retired = " + retired +
                    " }";
        }
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class NodeResources {
        @JsonProperty
        public Double vcpu;
        @JsonProperty
        public Double memoryGb;
        @JsonProperty
        public Double diskGb;
        @JsonProperty
        public Double bandwidthGbps;
        @JsonProperty
        public String diskSpeed;
        @JsonProperty
        public String storageType;
        @JsonProperty
        public String architecture;
        @JsonProperty
        public Integer gpuCount;
        @JsonProperty
        public Double gpuMemoryGb;

        @Override
        public String toString() {
            return "NodeResources{" +
                   "vcpu=" + vcpu +
                   ", memoryGb=" + memoryGb +
                   ", diskGb=" + diskGb +
                   ", bandwidthGbps=" + bandwidthGbps +
                   ", diskSpeed='" + diskSpeed + '\'' +
                   ", storageType='" + storageType + '\'' +
                   ", architecture='" + architecture + '\'' +
                   ", gpuCount=" + gpuCount +
                   ", gpuMemoryGb=" + gpuMemoryGb +
                   '}';
        }
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class Event {
        @JsonProperty
        public String event;
        @JsonProperty
        public String agent;
        @JsonProperty
        public Long at;

        @Override
        public String toString() {
            return "Event{" +
                    "agent=" + agent +
                    ", event=" + event +
                    ", at=" + at +
                    '}';
        }
    }
    @JsonIgnoreProperties(ignoreUnknown = true)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class TrustStoreItem {
        @JsonProperty ("fingerprint")
        public String fingerprint;
        @JsonProperty ("expiry")
        public long expiry;

        public TrustStoreItem(@JsonProperty("fingerprint") String fingerprint, @JsonProperty("expiry") long expiry) {
            this.fingerprint = fingerprint;
            this.expiry = expiry;
        }
    }
}