diff options
author | Martin Polden <mpolden@mpolden.no> | 2018-03-14 15:06:20 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2018-03-14 15:06:20 +0100 |
commit | 9bd947289f3f67e0df1a44f8bd55ac110b904c69 (patch) | |
tree | 493bfe08ccc605c3e787fecf3eb8e7026b774833 | |
parent | d0b2ffd151865421b4479d60bd52e211aa09c809 (diff) |
Remove deprecated suspend API
4 files changed, 2 insertions, 95 deletions
diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/configserver/orchestrator/OrchestratorImplTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/configserver/orchestrator/OrchestratorImplTest.java index c64e650a70c..e4c46c504be 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/configserver/orchestrator/OrchestratorImplTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/configserver/orchestrator/OrchestratorImplTest.java @@ -3,7 +3,6 @@ package com.yahoo.vespa.hosted.node.admin.configserver.orchestrator; import com.yahoo.vespa.hosted.node.admin.configserver.ConfigServerApiImpl; import com.yahoo.vespa.hosted.node.admin.configserver.HttpException; -import com.yahoo.vespa.orchestrator.restapi.wire.BatchHostSuspendRequest; import com.yahoo.vespa.orchestrator.restapi.wire.BatchOperationResult; import com.yahoo.vespa.orchestrator.restapi.wire.HostStateChangeDenialReason; import com.yahoo.vespa.orchestrator.restapi.wire.UpdateHostResponse; @@ -149,8 +148,8 @@ public class OrchestratorImplTest { String exceptionMessage = "Exception: Something crashed!"; when(configServerApi.put( - OrchestratorImpl.ORCHESTRATOR_PATH_PREFIX_HOST_SUSPENSION_API, - Optional.of(new BatchHostSuspendRequest(parentHostName, hostNames)), + "/orchestrator/v1/suspensions/hosts/host1.test.yahoo.com?hostname=a1.host1.test.yahoo.com&hostname=a2.host1.test.yahoo.com", + Optional.empty(), BatchOperationResult.class )).thenThrow(new RuntimeException(exceptionMessage)); diff --git a/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/HostSuspensionApi.java b/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/HostSuspensionApi.java index a9846134eff..603d6a1adac 100644 --- a/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/HostSuspensionApi.java +++ b/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/HostSuspensionApi.java @@ -1,7 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.orchestrator.restapi; -import com.yahoo.vespa.orchestrator.restapi.wire.BatchHostSuspendRequest; import com.yahoo.vespa.orchestrator.restapi.wire.BatchOperationResult; import javax.ws.rs.Consumes; @@ -32,12 +31,6 @@ public interface HostSuspensionApi { * batch-requests for suspension of hosts succeed. */ @PUT - @Produces(MediaType.APPLICATION_JSON) - @Consumes(MediaType.APPLICATION_JSON) - @Deprecated // TODO: Remove after 2018-04-01 - BatchOperationResult suspendAll(BatchHostSuspendRequest request); - - @PUT @Path("/{hostname}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) diff --git a/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/wire/BatchHostSuspendRequest.java b/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/wire/BatchHostSuspendRequest.java deleted file mode 100644 index 3dc28f53217..00000000000 --- a/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/wire/BatchHostSuspendRequest.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2017 Yahoo Holdings. 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 boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - BatchHostSuspendRequest that = (BatchHostSuspendRequest) o; - - if (parentHostname != null ? !parentHostname.equals(that.parentHostname) : that.parentHostname != null) - return false; - return hostnames != null ? hostnames.equals(that.hostnames) : that.hostnames == null; - - } - - @Override - public int hashCode() { - int result = parentHostname != null ? parentHostname.hashCode() : 0; - result = 31 * result + (hostnames != null ? hostnames.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "BatchHostSuspendRequest{" + - "parentHostname=" + parentHostname + - ", hostnames=" + hostnames + - '}'; - } -} diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostSuspensionResource.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostSuspensionResource.java index c1e312ddee6..6fa1e06520e 100644 --- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostSuspensionResource.java +++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostSuspensionResource.java @@ -9,7 +9,6 @@ import com.yahoo.vespa.orchestrator.BatchInternalErrorException; import com.yahoo.vespa.orchestrator.Orchestrator; import com.yahoo.vespa.orchestrator.policy.BatchHostStateChangeDeniedException; import com.yahoo.vespa.orchestrator.restapi.HostSuspensionApi; -import com.yahoo.vespa.orchestrator.restapi.wire.BatchHostSuspendRequest; import com.yahoo.vespa.orchestrator.restapi.wire.BatchOperationResult; import javax.inject.Inject; @@ -37,23 +36,6 @@ public class HostSuspensionResource implements HostSuspensionApi { } @Override - public BatchOperationResult suspendAll(BatchHostSuspendRequest request) throws WebApplicationException { - String parentHostnameString = request.getParentHostname(); - if (parentHostnameString == null || parentHostnameString.isEmpty()) { - String message = "parentHostname missing or empty in request: " + request; - log.log(LogLevel.DEBUG, message); - throw createWebApplicationException(message, Response.Status.BAD_REQUEST); - } - List<String> hostnamesAsStrings = request.getHostnames(); - if (hostnamesAsStrings == null) { - String message = "hostnames missing in request: " + request; - log.log(LogLevel.DEBUG, message); - throw createWebApplicationException(message, Response.Status.BAD_REQUEST); - } - return suspendAll(parentHostnameString, hostnamesAsStrings); - } - - @Override public BatchOperationResult suspendAll(String parentHostnameString, List<String> hostnamesAsStrings) { HostName parentHostname = new HostName(parentHostnameString); List<HostName> hostnames = hostnamesAsStrings.stream().map(HostName::new).collect(Collectors.toList()); |