aboutsummaryrefslogtreecommitdiffstats
path: root/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/wire/WireSystemFlagsDeployResult.java
blob: 9218706b3121adcf5f622381a47f653043a5e056 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.systemflags.v1.wire;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.yahoo.vespa.flags.json.wire.WireFlagData;

import java.util.List;

/**
 * Note: This class is only annotated for serialization, deserialization is not supported.
 *
 * @author bjorncs
 */
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class WireSystemFlagsDeployResult {
    @JsonProperty("changes") public List<WireFlagDataChange> changes;
    @JsonProperty("errors") public List<WireOperationFailure> errors;
    @JsonProperty("warnings") public List<WireWarning> warnings;

    @JsonIgnoreProperties(ignoreUnknown = true)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class WireFlagDataChange {
        @JsonProperty("flag-id") public String flagId;
        @JsonProperty("owners") @JsonInclude(JsonInclude.Include.NON_EMPTY) public List<String> owners;
        @JsonProperty("targets") public List<String> targets;
        @JsonProperty("operation") public String operation;
        @JsonProperty("data") public WireFlagData data;
        @JsonProperty("previous-data") public WireFlagData previousData;
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class WireOperationFailure {
        @JsonProperty("flag-id") public String flagId;
        @JsonProperty("owners") @JsonInclude(JsonInclude.Include.NON_EMPTY) public List<String> owners;
        @JsonProperty("message") public String message;
        @JsonProperty("targets") public List<String> targets;
        @JsonProperty("operation") public String operation;
        @JsonProperty("data") public WireFlagData data;
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    @JsonInclude(JsonInclude.Include.NON_NULL)
    public static class WireWarning {
        @JsonProperty("flag-id") public String flagId;
        @JsonProperty("owners") @JsonInclude(JsonInclude.Include.NON_EMPTY) public List<String> owners;
        @JsonProperty("message") public String message;
        @JsonProperty("targets") public List<String> targets;
    }

    public boolean hasErrors() { return errors != null && !errors.isEmpty(); }
}