Skip to content
5 changes: 5 additions & 0 deletions changelog/unreleased/migrate-v2-apis-to-jax-rs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
title: Migrate NodeHealthAPI, NodeThreadsAPI, and ClusterAPI V2 endpoints from @EndPoint to JAX-RS
type: changed
authors:
- name: copilot-swe-agent[bot]
113 changes: 113 additions & 0 deletions solr/api/src/java/org/apache/solr/client/api/endpoint/ClusterApis.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.client.api.endpoint;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import org.apache.solr.client.api.model.AddRoleRequestBody;
import org.apache.solr.client.api.model.RateLimiterPayload;
import org.apache.solr.client.api.model.SolrJerseyResponse;

/** V2 API definitions for cluster-level operations in a Solr cluster. */
@Path("/cluster")
public interface ClusterApis {

@GET
@Operation(
summary = "Retrieve the cluster status.",
tags = {"cluster"})
SolrJerseyResponse getClusterStatus() throws Exception;

@GET
@Path("/nodes")
@Operation(
summary = "Retrieve the list of live nodes in the cluster.",
tags = {"cluster"})
SolrJerseyResponse getNodes() throws Exception;

@GET
@Path("/overseer")
@Operation(
summary = "Retrieve the status of the cluster overseer.",
tags = {"cluster"})
SolrJerseyResponse getOverseerStatus() throws Exception;

@GET
@Path("/command-status/{requestId}")
@Operation(
summary = "Retrieve the status of an async command.",
tags = {"cluster"})
SolrJerseyResponse getCommandStatus(
@Parameter(description = "The async request ID to look up.", required = true)
@PathParam("requestId")
String requestId)
throws Exception;

@DELETE
@Path("/command-status/{requestId}")
@Operation(
summary = "Delete the status of a completed async command.",
tags = {"cluster"})
SolrJerseyResponse deleteCommandStatus(
@Parameter(description = "The async request ID to delete.", required = true)
@PathParam("requestId")
String requestId)
throws Exception;

@DELETE
@Path("/command-status")
@Operation(
summary = "Flush the status of all completed async commands.",
tags = {"cluster"})
SolrJerseyResponse flushCommandStatus() throws Exception;

@POST
@Path("/roles")
@Operation(
summary = "Add an overseer role to a node.",
tags = {"cluster"})
SolrJerseyResponse addRole(
@RequestBody(description = "The node and role to assign.", required = true)
AddRoleRequestBody requestBody)
throws Exception;

@DELETE
@Path("/roles")
@Operation(
summary = "Remove an overseer role from a node.",
tags = {"cluster"})
SolrJerseyResponse removeRole(
@RequestBody(description = "The node and role to remove.", required = true)
AddRoleRequestBody requestBody)
throws Exception;

@POST
@Path("/ratelimiters")
@Operation(
summary = "Set rate limiter configuration for the cluster.",
tags = {"cluster"})
SolrJerseyResponse setRateLimiters(
@RequestBody(description = "Rate limiter configuration.", required = true)
RateLimiterPayload requestBody)
throws Exception;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.client.api.endpoint;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import org.apache.solr.client.api.model.SolrJerseyResponse;

/** V2 API definitions for reading node roles in a Solr cluster. */
@Path("/cluster/node-roles")
public interface ClusterNodeRolesApis {

@GET
@Operation(
summary = "Retrieve all node roles in the cluster.",
tags = {"cluster"})
SolrJerseyResponse getAllNodeRoles() throws Exception;

@GET
@Path("/supported")
@Operation(
summary = "Retrieve all supported node roles and their modes.",
tags = {"cluster"})
SolrJerseyResponse getSupportedRoles() throws Exception;

@GET
@Path("/role/{role}")
@Operation(
summary = "Retrieve all nodes assigned to a specific role.",
tags = {"cluster"})
SolrJerseyResponse getNodesForRole(
@Parameter(description = "The role to query.", required = true) @PathParam("role")
String role)
throws Exception;

@GET
@Path("/role/{role}/{mode}")
@Operation(
summary = "Retrieve nodes assigned to a specific role and mode.",
tags = {"cluster"})
SolrJerseyResponse getNodesForRoleAndMode(
@Parameter(description = "The role to query.", required = true) @PathParam("role")
String role,
@Parameter(description = "The mode to query.", required = true) @PathParam("mode")
String mode)
throws Exception;

@GET
@Path("/node/{node}")
@Operation(
summary = "Retrieve all roles assigned to a specific node.",
tags = {"cluster"})
SolrJerseyResponse getRolesForNode(
@Parameter(description = "The node name to query.", required = true) @PathParam("node")
String node)
throws Exception;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.client.api.endpoint;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import org.apache.solr.client.api.model.MigrateDocsRequestBody;
import org.apache.solr.client.api.model.SolrJerseyResponse;

/** V2 API definition for migrating documents from one collection to another. */
@Path("/collections/{collectionName}/migrate")
public interface MigrateDocsApi {
@POST
@Operation(
summary = "Migrate documents to another collection",
tags = {"collections"})
SolrJerseyResponse migrateDocs(
@PathParam("collectionName") String collectionName,
@RequestBody(description = "Properties for the migrate-docs operation")
MigrateDocsRequestBody requestBody)
throws Exception;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.client.api.endpoint;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import org.apache.solr.client.api.model.ModifyCollectionRequestBody;
import org.apache.solr.client.api.model.SolrJerseyResponse;

/** V2 API definition for modifying a collection's configuration. */
@Path("/collections/{collectionName}/modify")
public interface ModifyCollectionApi {
@POST
@Operation(
summary = "Modify a collection's configuration",
tags = {"collections"})
SolrJerseyResponse modifyCollection(
@PathParam("collectionName") String collectionName,
@RequestBody(description = "Properties to modify on the collection")
ModifyCollectionRequestBody requestBody)
throws Exception;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.client.api.endpoint;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import org.apache.solr.client.api.model.MoveReplicaRequestBody;
import org.apache.solr.client.api.model.SolrJerseyResponse;

/** V2 API definition for moving a collection replica to a different node. */
@Path("/collections/{collectionName}/move-replica")
public interface MoveReplicaApi {
@POST
@Operation(
summary = "Move a replica to a different node",
tags = {"replicas"})
SolrJerseyResponse moveReplica(
@PathParam("collectionName") String collectionName,
@RequestBody(description = "Properties for the move-replica operation")
MoveReplicaRequestBody requestBody)
throws Exception;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.client.api.endpoint;

import io.swagger.v3.oas.annotations.Operation;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;
import org.apache.solr.client.api.model.NodeHealthResponse;

/** V2 API definition for checking the health of the receiving Solr node. */
@Path("/node/health")
public interface NodeHealthApi {

@GET
@Operation(
summary = "Check the health of the receiving Solr node.",
tags = {"node"})
NodeHealthResponse getHealth(
@QueryParam("requireHealthyCores") Boolean requireHealthyCores,
@QueryParam("maxGenerationLag") Integer maxGenerationLag)
throws Exception;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.client.api.endpoint;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;
import org.apache.solr.client.api.model.NodePropertiesResponse;

/** V2 API definition for listing system properties on a node. */
@Path("/node/properties")
public interface NodePropertiesApi {
@GET
@Operation(
summary = "List system properties for the node",
tags = {"node"})
NodePropertiesResponse getProperties(
@Parameter(description = "The name of a specific property to retrieve") @QueryParam("name")
String name)
throws Exception;
}
Loading