diff options
author | jonmv <venstad@gmail.com> | 2022-10-24 13:41:49 +0200 |
---|---|---|
committer | jonmv <venstad@gmail.com> | 2022-10-24 13:41:49 +0200 |
commit | 3e65928830d58b0a23ecab5dba4f42696ebdf5ef (patch) | |
tree | 90b171a1380c2a830f1d0ec7b9a30bb03da9e694 /controller-api | |
parent | 1afef7d4676c17d70087aeb36df228faf7073afd (diff) |
Avoid JSON class leaks, and removed unused data/code
Diffstat (limited to 'controller-api')
12 files changed, 50 insertions, 272 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/DeployResult.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/DeployResult.java deleted file mode 100644 index 50074329b49..00000000000 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/DeployResult.java +++ /dev/null @@ -1,43 +0,0 @@ -// 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.application.v4.model; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbindings.ConfigChangeActions; -import com.yahoo.vespa.hosted.controller.api.identifiers.RevisionId; - -import java.util.List; - -/** - * @author gjoranv - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class DeployResult { - - public final RevisionId revisionId; - public final Long applicationZipSize; - public final List<LogEntry> prepareMessages; - public final ConfigChangeActions configChangeActions; - - @JsonCreator - public DeployResult(@JsonProperty("revisionId") RevisionId revisionId, - @JsonProperty("applicationZipSize") Long applicationZipSize, - @JsonProperty("prepareMessages") List<LogEntry> prepareMessages, - @JsonProperty("configChangeActions") ConfigChangeActions configChangeActions) { - this.revisionId = revisionId; - this.applicationZipSize = applicationZipSize; - this.prepareMessages = prepareMessages; - this.configChangeActions = configChangeActions; - } - - @Override - public String toString() { - return "DeployResult{" + - "revisionId=" + revisionId.id() + - ", applicationZipSize=" + applicationZipSize + - ", prepareMessages=" + prepareMessages + - ", configChangeActions=" + configChangeActions + - '}'; - } -} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/configserverbindings/ConfigChangeActions.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/configserverbindings/ConfigChangeActions.java deleted file mode 100644 index fd740f19b69..00000000000 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/configserverbindings/ConfigChangeActions.java +++ /dev/null @@ -1,36 +0,0 @@ -// 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.application.v4.model.configserverbindings; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.List; - -/** - * @author bjorncs - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class ConfigChangeActions { - @JsonProperty("restart") public final List<RestartAction> restartActions; - @JsonProperty("refeed") public final List<RefeedAction> refeedActions; - @JsonProperty("reindex") public final List<ReindexAction> reindexActions; - - @JsonCreator - public ConfigChangeActions(@JsonProperty("restart") List<RestartAction> restartActions, - @JsonProperty("refeed") List<RefeedAction> refeedActions, - @JsonProperty("reindex") List<ReindexAction> reindexActions) { - this.restartActions = restartActions; - this.refeedActions = refeedActions; - this.reindexActions = reindexActions; - } - - @Override - public String toString() { - return "ConfigChangeActions{" + - "restartActions=" + restartActions + - ", refeedActions=" + refeedActions + - ", reindexActions=" + reindexActions + - '}'; - } -} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/configserverbindings/RefeedAction.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/configserverbindings/RefeedAction.java deleted file mode 100644 index bab6ecb0253..00000000000 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/configserverbindings/RefeedAction.java +++ /dev/null @@ -1,46 +0,0 @@ -// 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.application.v4.model.configserverbindings; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.List; - -/** - * @author bjorncs - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class RefeedAction { - - public final String name; - public final String documentType; - public final String clusterName; - public final List<ServiceInfo> services; - public final List<String> messages; - - @JsonCreator - public RefeedAction(@JsonProperty("name") String name, - @JsonProperty("documentType") String documentType, - @JsonProperty("clusterName") String clusterName, - @JsonProperty("services") List<ServiceInfo> services, - @JsonProperty("messages") List<String> messages) { - this.name = name; - this.documentType = documentType; - this.clusterName = clusterName; - this.services = services; - this.messages = messages; - } - - @Override - public String toString() { - return "RefeedAction{" + - "name='" + name + '\'' + - ", documentType='" + documentType + '\'' + - ", clusterName='" + clusterName + '\'' + - ", services=" + services + - ", messages=" + messages + - '}'; - } - -} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/configserverbindings/ReindexAction.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/configserverbindings/ReindexAction.java deleted file mode 100644 index 36909415888..00000000000 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/configserverbindings/ReindexAction.java +++ /dev/null @@ -1,46 +0,0 @@ -// 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.application.v4.model.configserverbindings; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.List; - -/** - * @author jonmv - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class ReindexAction { - - public final String name; - public final String documentType; - public final String clusterName; - public final List<ServiceInfo> services; - public final List<String> messages; - - @JsonCreator - public ReindexAction(@JsonProperty("name") String name, - @JsonProperty("documentType") String documentType, - @JsonProperty("clusterName") String clusterName, - @JsonProperty("services") List<ServiceInfo> services, - @JsonProperty("messages") List<String> messages) { - this.name = name; - this.documentType = documentType; - this.clusterName = clusterName; - this.services = services; - this.messages = messages; - } - - @Override - public String toString() { - return "ReindexAction{" + - "name='" + name + '\'' + - ", documentType='" + documentType + '\'' + - ", clusterName='" + clusterName + '\'' + - ", services=" + services + - ", messages=" + messages + - '}'; - } - -} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/configserverbindings/RestartAction.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/configserverbindings/RestartAction.java deleted file mode 100644 index 696e5c049f8..00000000000 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/configserverbindings/RestartAction.java +++ /dev/null @@ -1,44 +0,0 @@ -// 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.application.v4.model.configserverbindings; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.List; - -/** - * @author bjorncs - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class RestartAction { - public final String clusterName; - public final String clusterType; - public final String serviceType; - public final List<ServiceInfo> services; - public final List<String> messages; - - @JsonCreator - public RestartAction(@JsonProperty("clusterName") String clusterName, - @JsonProperty("clusterType") String clusterType, - @JsonProperty("serviceType") String serviceType, - @JsonProperty("services") List<ServiceInfo> services, - @JsonProperty("messages") List<String> messages) { - this.clusterName = clusterName; - this.clusterType = clusterType; - this.serviceType = serviceType; - this.services = services; - this.messages = messages; - } - - @Override - public String toString() { - return "RestartAction{" + - "clusterName='" + clusterName + '\'' + - ", clusterType='" + clusterType + '\'' + - ", serviceType='" + serviceType + '\'' + - ", services=" + services + - ", messages=" + messages + - '}'; - } -} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/configserverbindings/ServiceInfo.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/configserverbindings/ServiceInfo.java deleted file mode 100644 index bb7e63c2ec4..00000000000 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/configserverbindings/ServiceInfo.java +++ /dev/null @@ -1,38 +0,0 @@ -// 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.application.v4.model.configserverbindings; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * @author bjorncs - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class ServiceInfo { - public final String serviceName; - public final String serviceType; - public final String configId; - public final String hostName; - - @JsonCreator - public ServiceInfo(@JsonProperty("serviceName") String serviceName, - @JsonProperty("serviceType") String serviceType, - @JsonProperty("configId") String configId, - @JsonProperty("hostName")String hostName) { - this.serviceName = serviceName; - this.serviceType = serviceType; - this.configId = configId; - this.hostName = hostName; - } - - @Override - public String toString() { - return "ServiceInfo{" + - "serviceName='" + serviceName + '\'' + - ", serviceType='" + serviceType + '\'' + - ", configId='" + configId + '\'' + - ", hostName='" + hostName + '\'' + - '}'; - } -} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/configserverbindings/package-info.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/configserverbindings/package-info.java deleted file mode 100644 index 75fa8b2b2f1..00000000000 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/application/v4/model/configserverbindings/package-info.java +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -@ExportPackage -package com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbindings; - -import com.yahoo.osgi.annotation.ExportPackage; diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java index 97128d4c980..119e6794e6c 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ConfigServer.java @@ -33,7 +33,7 @@ import java.util.Optional; public interface ConfigServer { interface PreparedApplication { - PrepareResponse prepareResponse(); + DeploymentResult deploymentResult(); } PreparedApplication deploy(DeploymentData deployment); diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/DeploymentResult.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/DeploymentResult.java new file mode 100644 index 00000000000..4d49e2c3d19 --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/DeploymentResult.java @@ -0,0 +1,29 @@ +package com.yahoo.vespa.hosted.controller.api.integration.configserver; + +import java.util.List; +import java.util.logging.Level; + +import static java.util.Objects.requireNonNull; + +/** + * The result of a deployment, carried out against a {@link ConfigServer}. + * + * @author jonmv + */ +public record DeploymentResult(String message, List<LogEntry> log) { + + public DeploymentResult { + requireNonNull(message); + requireNonNull(log); + } + + public record LogEntry(long epochMillis, String message, Level level, boolean concernsPackage) { + + public LogEntry { + requireNonNull(message); + requireNonNull(level); + } + + } + +} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/PrepareResponse.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/PrepareResponse.java index 22716c9796f..606acd2cb50 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/PrepareResponse.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/PrepareResponse.java @@ -2,11 +2,7 @@ package com.yahoo.vespa.hosted.controller.api.integration.configserver; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.yahoo.vespa.hosted.controller.api.application.v4.model.configserverbindings.ConfigChangeActions; -import com.yahoo.vespa.hosted.controller.api.identifiers.TenantId; -import java.net.URI; import java.util.List; /** @@ -14,8 +10,8 @@ import java.util.List; */ @JsonIgnoreProperties(ignoreUnknown = true) public class PrepareResponse { - public TenantId tenant; + public String message; public List<Log> log; - public ConfigChangeActions configChangeActions; + } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/QuotaUsage.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/QuotaUsage.java index 2e4f3b96abe..86177376941 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/QuotaUsage.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/QuotaUsage.java @@ -1,14 +1,11 @@ // 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.integration.configserver; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - /** - * @author ogronnesby + * @author jonmv */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class QuotaUsage { - public static final QuotaUsage zero = new QuotaUsage() {{ this.rate = 0; }}; +public record QuotaUsage(double rate) { + + public static final QuotaUsage zero = new QuotaUsage(0); - public double rate; } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/QuotaUsageResponse.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/QuotaUsageResponse.java new file mode 100644 index 00000000000..9ec32f8a38a --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/QuotaUsageResponse.java @@ -0,0 +1,14 @@ +// 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.integration.configserver; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +/** + * @author ogronnesby + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class QuotaUsageResponse { + public static final QuotaUsageResponse zero = new QuotaUsageResponse() {{ this.rate = 0; }}; + + public double rate; +} |