summaryrefslogtreecommitdiffstats
path: root/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/wire/BatchHostSuspendRequest.java
blob: 8311967e1bbfb3d3fe3ad49d414dc7dca8939a28 (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
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.orchestrator.restapi.wire;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

import javax.annotation.concurrent.Immutable;
import java.util.Collections;
import java.util.List;

@Immutable
public class BatchHostSuspendRequest {
    public static final String PARENT_HOSTNAME_FIELD = "parentHostname";
    public static final String HOSTNAMES_FIELD = "hostnames";

    public final String parentHostname;
    public final List<String> hostnames;

    @JsonCreator
    public BatchHostSuspendRequest(
            @JsonProperty(PARENT_HOSTNAME_FIELD) String parentHostname,
            @JsonProperty(HOSTNAMES_FIELD) List<String> hostnames) {
        this.parentHostname = parentHostname;
        this.hostnames = Collections.unmodifiableList(hostnames);
    }

    /**
     * @return The hostname of the parent of the hostnames, if applicable, which can be used for debugging.
     */
    @JsonProperty(PARENT_HOSTNAME_FIELD)
    public String getParentHostname() {
        return parentHostname;
    }

    @JsonProperty(HOSTNAMES_FIELD)
    public List<String> getHostnames() {
        return hostnames;
    }

    @Override
    public String toString() {
        return "BatchHostSuspendRequest{" +
                "parentHostname=" + parentHostname +
                ", hostnames=" + hostnames +
                '}';
    }
}