summaryrefslogtreecommitdiffstats
path: root/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/bindings/UpdateNodeAttributesRequestBody.java
blob: 28605bc3a8d9e42d7488c2800c0a03b7c1393f90 (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
// Copyright 2017 Yahoo Holdings. 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.JsonInclude;
import com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAttributes;

/**
 * Automagically handles (de)serialization based on 1:1 message fields and identifier names.
 * Instances of this class should serialize as:
 * <pre>
 *   {
 *     "currentRestartGeneration": 42
 *   }
 * </pre>
 *
 * @author bakksjo
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class UpdateNodeAttributesRequestBody {
    public Long currentRestartGeneration;
    public Long currentRebootGeneration;
    public String currentDockerImage;
    public String currentVespaVersion;
    public String hardwareDivergence;

    public UpdateNodeAttributesRequestBody(NodeAttributes nodeAttributes) {
        if (nodeAttributes.getDockerImage() != null) {
            this.currentDockerImage = nodeAttributes.getDockerImage().asString();
        }

        this.currentRestartGeneration = nodeAttributes.getRestartGeneration();
        this.currentVespaVersion = nodeAttributes.getVespaVersion();
        this.currentRebootGeneration = nodeAttributes.getRebootGeneration();
        this.hardwareDivergence = nodeAttributes.getHardwareDivergence();
    }
}