summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2021-04-23 15:47:14 +0200
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2021-04-23 15:47:14 +0200
commit93e34a71a2b04a9e4297c1b653b92b16dae51e8f (patch)
tree45c0af05dc1dcb7804abce639bd2c802132040ec
parentde8de80a94622b299fae019398c1071a7624ffe0 (diff)
Remove old Jaxrs resource definitions from orchestrator-restapi
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/orchestrator/OrchestratorImpl.java6
-rw-r--r--orchestrator-restapi/pom.xml12
-rw-r--r--orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/ApplicationSuspensionApi.java91
-rw-r--r--orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/HostApi.java82
-rw-r--r--orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/HostSuspensionApi.java35
-rw-r--r--orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/package-info.java7
6 files changed, 2 insertions, 231 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/orchestrator/OrchestratorImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/orchestrator/OrchestratorImpl.java
index 20c0604b5dc..a3cc7042c47 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/orchestrator/OrchestratorImpl.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/orchestrator/OrchestratorImpl.java
@@ -5,8 +5,6 @@ import com.yahoo.vespa.hosted.node.admin.configserver.ConfigServerApi;
import com.yahoo.vespa.hosted.node.admin.configserver.ConnectionException;
import com.yahoo.vespa.hosted.node.admin.configserver.HttpException;
import com.yahoo.vespa.hosted.node.admin.nodeadmin.ConvergenceException;
-import com.yahoo.vespa.orchestrator.restapi.HostApi;
-import com.yahoo.vespa.orchestrator.restapi.HostSuspensionApi;
import com.yahoo.vespa.orchestrator.restapi.wire.BatchOperationResult;
import com.yahoo.vespa.orchestrator.restapi.wire.UpdateHostResponse;
@@ -32,9 +30,9 @@ public class OrchestratorImpl implements Orchestrator {
// TODO: Find a way to avoid duplicating this (present in orchestrator's services.xml also).
private static final String ORCHESTRATOR_PATH_PREFIX = "/orchestrator";
static final String ORCHESTRATOR_PATH_PREFIX_HOST_API
- = ORCHESTRATOR_PATH_PREFIX + HostApi.PATH_PREFIX;
+ = ORCHESTRATOR_PATH_PREFIX + "/v1/hosts";
static final String ORCHESTRATOR_PATH_PREFIX_HOST_SUSPENSION_API
- = ORCHESTRATOR_PATH_PREFIX + HostSuspensionApi.PATH_PREFIX;
+ = ORCHESTRATOR_PATH_PREFIX + "/v1/suspensions/hosts";
private final ConfigServerApi configServerApi;
diff --git a/orchestrator-restapi/pom.xml b/orchestrator-restapi/pom.xml
index 2d4ceb069df..37552b7aa0b 100644
--- a/orchestrator-restapi/pom.xml
+++ b/orchestrator-restapi/pom.xml
@@ -23,18 +23,6 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>javax.ws.rs-api</artifactId>
- <version>2.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.yahoo.vespa</groupId>
- <artifactId>jaxrs_utils</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson2.version}</version>
diff --git a/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/ApplicationSuspensionApi.java b/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/ApplicationSuspensionApi.java
deleted file mode 100644
index e44f6fa0df7..00000000000
--- a/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/ApplicationSuspensionApi.java
+++ /dev/null
@@ -1,91 +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;
-
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import java.util.Set;
-
-/**
- * Definition of Orchestrator's REST API for suspensions of applications aka application instances.
- *
- * Implementing classes must not put any JAX-RS annotation on the overridden methods. Doing so will cause all
- * method annotations in this interface to be ignored by the JAX-RS container (see section 3.6 of JSR-339).
- *
- * @author smorgrav
- */
-@Path("/orchestrator" + ApplicationSuspensionApi.PATH_PREFIX)
-public interface ApplicationSuspensionApi {
- /**
- * Path prefix for this api. Resources implementing this API should use this with a @Path annotation.
- */
- String PATH_PREFIX = "/v1/suspensions/applications";
-
- /**
- * Lists all applications that is currently suspended.
- *
- * HTTP Behavior:
- * Always 200
- *
- * @return A list of application ids of suspended applications
- */
- @GET
- @Produces(MediaType.APPLICATION_JSON)
- Set<String> getApplications();
-
- /**
- * Shows the Orchestrator status for an application instance
- *
- * HTTP Behavior:
- * 204 if the application is suspended
- * 400 if the applicationId is invalid
- * 404 if the application is not suspended
- *
- * @param applicationIdString the fully qualified application id.
- */
- @GET
- @Path("/{application}")
- @Produces(MediaType.APPLICATION_JSON)
- void getApplication(@PathParam("application") String applicationIdString);
-
- /**
- * Ask for permission to temporarily suspend all services for an application instance.
- *
- * On success all content nodes for this application instance have been set in maintenance mode.
- *
- * Once the application is ready to resume normal operations, it must finish with resume() (see below).
- *
- * If the application has already been granted permission to suspend all services, requesting
- * suspension again is idempotent and will succeed.
- *
- * HTTP Behavior:
- * 204 is the suspend operation was successful
- * 400 if the applicationId is invalid
- * 409 if the suspend was denied
- *
- * @param applicationIdString the fully qualified application id.
- */
- @POST
- void suspend(String applicationIdString);
-
- /**
- * Resume normal operations for all services for an application
- * instance that has previously been allowed suspension.
- *
- * If the host is already registered as running normal operations, then resume() is idempotent
- * and will succeed.
- *
- * HTTP Behavior:
- * Returns 204 is the resume operation was successful (or the application was not suspended)
- * Returns 400 if the applicationId is invalid
- *
- * @param applicationIdString the fully qualified application id.
- */
- @DELETE
- @Path("/{application}")
- void resume(@PathParam("application") String applicationIdString);
-}
diff --git a/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/HostApi.java b/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/HostApi.java
deleted file mode 100644
index 1c4d138acef..00000000000
--- a/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/HostApi.java
+++ /dev/null
@@ -1,82 +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;
-
-import com.yahoo.vespa.jaxrs.annotation.PATCH;
-import com.yahoo.vespa.orchestrator.restapi.wire.GetHostResponse;
-import com.yahoo.vespa.orchestrator.restapi.wire.PatchHostRequest;
-import com.yahoo.vespa.orchestrator.restapi.wire.PatchHostResponse;
-import com.yahoo.vespa.orchestrator.restapi.wire.UpdateHostResponse;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-/**
- * Definition of Orchestrator's REST API for hosts.
- *
- * Implementing classes must not put any JAX-RS annotation on the overridden methods. Doing so will cause all
- * method annotations in this interface to be ignored by the JAX-RS container (see section 3.6 of JSR-339).
- *
- * @author bakksjo
- */
-public interface HostApi {
- /**
- * Path prefix for this api. Resources implementing this API should use this with a @Path annotation.
- */
- String PATH_PREFIX = "/v1/hosts";
-
- /**
- * Shows the Orchestrator state of a host.
- *
- * @param hostNameString the fully qualified host name
- */
- @GET
- @Path("/{hostname}")
- @Produces(MediaType.APPLICATION_JSON)
- GetHostResponse getHost(@PathParam("hostname") String hostNameString);
-
- /**
- * Tweak internal Orchestrator state for host.
- */
- @PATCH
- @Path("/{hostname}")
- @Consumes(MediaType.APPLICATION_JSON)
- @Produces(MediaType.APPLICATION_JSON)
- PatchHostResponse patch(@PathParam("hostname") String hostNameString, PatchHostRequest request);
-
- /**
- * Ask for permission to temporarily suspend all services on a host.
- *
- * On success, none, some, or all services on the host may already have been effectively suspended,
- * e.g. as of Feb 2015, a content node would already be set in the maintenance state.
- *
- * Once the host is ready to resume normal operations, it must finish with resume() (see below).
- *
- * If the host has already been granted permission to suspend all services, requesting
- * suspension again is idempotent and will succeed.
- *
- * @param hostNameString the fully qualified host name.
- */
- @PUT
- @Path("/{hostname}/suspended")
- @Produces(MediaType.APPLICATION_JSON)
- UpdateHostResponse suspend(@PathParam("hostname") String hostNameString);
-
- /**
- * Resume normal operations for all services on a host that has previously been allowed suspension.
- *
- * If the host is already registered as running normal operations, then resume() is idempotent
- * and will succeed.
- *
- * @param hostNameString the fully qualified host name.
- */
- @DELETE
- @Path("/{hostname}/suspended")
- @Produces(MediaType.APPLICATION_JSON)
- UpdateHostResponse resume(@PathParam("hostname") String hostNameString);
-}
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
deleted file mode 100644
index 9535096af4f..00000000000
--- a/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/HostSuspensionApi.java
+++ /dev/null
@@ -1,35 +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;
-
-import com.yahoo.vespa.orchestrator.restapi.wire.BatchOperationResult;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-import java.util.List;
-
-/**
- * @author hakonhall
- */
-public interface HostSuspensionApi {
- /**
- * Path prefix for this api. Resources implementing this API should use this with a @Path annotation.
- */
- String PATH_PREFIX = "/v1/suspensions/hosts";
-
- /**
- * Ask for permission to temporarily suspend all services on a set of hosts (nodes).
- *
- * See HostApi::suspend for semantics of suspending a node.
- */
- @PUT
- @Path("/{hostname}")
- @Produces(MediaType.APPLICATION_JSON)
- @Consumes(MediaType.APPLICATION_JSON)
- BatchOperationResult suspendAll(@PathParam("hostname") String parentHostname,
- @QueryParam("hostname") List<String> hostnames);
-}
diff --git a/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/package-info.java b/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/package-info.java
deleted file mode 100644
index 72da3faa44f..00000000000
--- a/orchestrator-restapi/src/main/java/com/yahoo/vespa/orchestrator/restapi/package-info.java
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-@ExportPackage
-@PublicApi
-package com.yahoo.vespa.orchestrator.restapi;
-
-import com.yahoo.api.annotations.PublicApi;
-import com.yahoo.osgi.annotation.ExportPackage; \ No newline at end of file