diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2019-11-07 11:47:10 +0100 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2019-11-07 11:47:10 +0100 |
commit | aeb44288a43930f740cea49b022377124de75f72 (patch) | |
tree | d2f3a853651ebbbfea899102984af1f8278d27ab /controller-api | |
parent | 6be85f2ca51c86b34b7d6ec831603531c4683ca6 (diff) |
Add Jax-rs and Jackson bindings for /system-flags/v1
Diffstat (limited to 'controller-api')
4 files changed, 83 insertions, 0 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/wire/SystemFlagsV1Api.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/wire/SystemFlagsV1Api.java new file mode 100644 index 00000000000..2b7119a5a13 --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/wire/SystemFlagsV1Api.java @@ -0,0 +1,25 @@ +// Copyright 2019 Oath Inc. 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 javax.ws.rs.Consumes; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import java.io.InputStream; + +/** + * @author bjorncs + */ +@Path("/system-flags/v1") +public interface SystemFlagsV1Api { + + @PUT + @Produces(MediaType.APPLICATION_JSON) + @Consumes("application/zip") + @Path("/deploy") + WireSystemFlagsDeployResult deploy(@QueryParam("dryRun") @DefaultValue("false") boolean dryRun, InputStream inputStream); + +} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/wire/WireErrorResponse.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/wire/WireErrorResponse.java new file mode 100644 index 00000000000..996f0ac6cdd --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/wire/WireErrorResponse.java @@ -0,0 +1,18 @@ +// Copyright 2019 Oath Inc. 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; + +/** + * @author bjorncs + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class WireErrorResponse { + @JsonProperty("message") + public String message; + @JsonProperty("error-code") + public String errorCode; +} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/wire/WireSystemFlagsDeployResult.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/wire/WireSystemFlagsDeployResult.java new file mode 100644 index 00000000000..bd54fd15d15 --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/wire/WireSystemFlagsDeployResult.java @@ -0,0 +1,32 @@ +// Copyright 2019 Oath Inc. 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; + +/** + * + * + * @author bjorncs + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +public class WireSystemFlagsDeployResult { + @JsonProperty("changes") public List<WireFlagDataChange> changes; + + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_NULL) + public static class WireFlagDataChange { + @JsonProperty("flag-id") public String flagId; + @JsonProperty("targets") public List<String> targets; + @JsonProperty("operation") public String operation; + @JsonProperty("data") public WireFlagData data; + @JsonProperty("previous-data") public WireFlagData previousData; + } +} + + diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/wire/package-info.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/wire/package-info.java new file mode 100644 index 00000000000..305cf91014b --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/systemflags/v1/wire/package-info.java @@ -0,0 +1,8 @@ +// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +/** + * @author bjorncs + */ +@ExportPackage +package com.yahoo.vespa.hosted.controller.api.systemflags.v1.wire; + +import com.yahoo.osgi.annotation.ExportPackage;
\ No newline at end of file |