-
Notifications
You must be signed in to change notification settings - Fork 611
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SOLR-16825: Migrate v2 definitions to 'api' module, pt 5 (#1974)
This commit covers the collection-prop, core-snapshot, migrate-replicas, reload-core, and restore-core APIs. Extracting annotated interfaces for these APIs includes them in the SolrRequest- generation we now do in SolrJ
- Loading branch information
1 parent
8740b07
commit 16d57e9
Showing
31 changed files
with
687 additions
and
352 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
solr/api/src/java/org/apache/solr/client/api/endpoint/CollectionPropertyApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* 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 javax.ws.rs.DELETE; | ||
import javax.ws.rs.PUT; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.PathParam; | ||
import org.apache.solr.client.api.model.SolrJerseyResponse; | ||
import org.apache.solr.client.api.model.UpdateCollectionPropertyRequestBody; | ||
|
||
/** V2 API definitions for modifying collection-level properties. */ | ||
@Path("/collections/{collName}/properties/{propName}") | ||
public interface CollectionPropertyApi { | ||
@PUT | ||
@Operation( | ||
summary = "Create or update a collection property", | ||
tags = {"collection-properties"}) | ||
SolrJerseyResponse createOrUpdateCollectionProperty( | ||
@PathParam("collName") String collName, | ||
@PathParam("propName") String propName, | ||
UpdateCollectionPropertyRequestBody requestBody) | ||
throws Exception; | ||
|
||
@DELETE | ||
@Operation( | ||
summary = "Delete the specified collection property from the collection", | ||
tags = {"collection-properties"}) | ||
SolrJerseyResponse deleteCollectionProperty( | ||
@PathParam("collName") String collName, @PathParam("propName") String propName) | ||
throws Exception; | ||
} |
79 changes: 79 additions & 0 deletions
79
solr/api/src/java/org/apache/solr/client/api/endpoint/CoreSnapshotApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* 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 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.QueryParam; | ||
import org.apache.solr.client.api.model.CreateCoreSnapshotResponse; | ||
import org.apache.solr.client.api.model.DeleteSnapshotResponse; | ||
import org.apache.solr.client.api.model.ListCoreSnapshotsResponse; | ||
|
||
/** V2 API definitions for Creating, Listing, and Deleting Core Snapshots. */ | ||
@Path("/cores/{coreName}/snapshots") | ||
public interface CoreSnapshotApi { | ||
@POST | ||
@Path("/{snapshotName}") | ||
@Operation( | ||
summary = "Create a new snapshot of the specified core.", | ||
tags = {"core-snapshots"}) | ||
CreateCoreSnapshotResponse createSnapshot( | ||
@Parameter(description = "The name of the core to snapshot.", required = true) | ||
@PathParam("coreName") | ||
String coreName, | ||
@Parameter(description = "The name to associate with the core snapshot.", required = true) | ||
@PathParam("snapshotName") | ||
String snapshotName, | ||
@Parameter(description = "The id to associate with the async task.") @QueryParam("async") | ||
String taskId) | ||
throws Exception; | ||
|
||
@GET | ||
@Operation( | ||
summary = "List existing snapshots for the specified core.", | ||
tags = {"core-snapshots"}) | ||
ListCoreSnapshotsResponse listSnapshots( | ||
@Parameter( | ||
description = "The name of the core for which to retrieve snapshots.", | ||
required = true) | ||
@PathParam("coreName") | ||
String coreName) | ||
throws Exception; | ||
|
||
@DELETE | ||
@Path("/{snapshotName}") | ||
@Operation( | ||
summary = "Delete a single snapshot from the specified core.", | ||
tags = {"core-snapshots"}) | ||
DeleteSnapshotResponse deleteSnapshot( | ||
@Parameter( | ||
description = "The name of the core for which to delete a snapshot.", | ||
required = true) | ||
@PathParam("coreName") | ||
String coreName, | ||
@Parameter(description = "The name of the core snapshot to delete.", required = true) | ||
@PathParam("snapshotName") | ||
String snapshotName, | ||
@Parameter(description = "The id to associate with the async task.") @QueryParam("async") | ||
String taskId) | ||
throws Exception; | ||
} |
37 changes: 37 additions & 0 deletions
37
solr/api/src/java/org/apache/solr/client/api/endpoint/MigrateReplicasApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.parameters.RequestBody; | ||
import javax.ws.rs.POST; | ||
import javax.ws.rs.Path; | ||
import org.apache.solr.client.api.model.MigrateReplicasRequestBody; | ||
import org.apache.solr.client.api.model.SolrJerseyResponse; | ||
|
||
/** V2 API definition for migrating replicas from a set of nodes to another set of nodes. */ | ||
@Path("cluster/replicas/migrate") | ||
public interface MigrateReplicasApi { | ||
@POST | ||
@Operation( | ||
summary = "Migrate Replicas from a given set of nodes.", | ||
tags = {"cluster"}) | ||
SolrJerseyResponse migrateReplicas( | ||
@RequestBody(description = "Contains user provided parameters", required = true) | ||
MigrateReplicasRequestBody requestBody) | ||
throws Exception; | ||
} |
44 changes: 44 additions & 0 deletions
44
solr/api/src/java/org/apache/solr/client/api/endpoint/ReloadCoreApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* 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.media.Schema; | ||
import io.swagger.v3.oas.annotations.parameters.RequestBody; | ||
import javax.ws.rs.POST; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.PathParam; | ||
import org.apache.solr.client.api.model.ReloadCoreRequestBody; | ||
import org.apache.solr.client.api.model.SolrJerseyResponse; | ||
|
||
/** V2 API definition for reloading an individual core. */ | ||
@Path("/cores/{coreName}/reload") | ||
public interface ReloadCoreApi { | ||
|
||
@POST | ||
@Operation( | ||
summary = "Reload the specified core.", | ||
tags = {"cores"}) | ||
SolrJerseyResponse reloadCore( | ||
@Parameter(description = "The name of the core to reload.", required = true) | ||
@PathParam("coreName") | ||
String coreName, | ||
@Schema(description = "Additional parameters for reloading the core") @RequestBody | ||
ReloadCoreRequestBody reloadCoreRequestBody) | ||
throws Exception; | ||
} |
40 changes: 40 additions & 0 deletions
40
solr/api/src/java/org/apache/solr/client/api/endpoint/RestoreCoreApi.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* 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 javax.ws.rs.POST; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.PathParam; | ||
import org.apache.solr.client.api.model.RestoreCoreRequestBody; | ||
import org.apache.solr.client.api.model.SolrJerseyResponse; | ||
|
||
/** V2 API definition for restoring a previously taken backup to a core */ | ||
@Path("/cores/{coreName}/restore") | ||
public interface RestoreCoreApi { | ||
|
||
@POST | ||
@Operation( | ||
summary = "Restore a previously-taken backup to the specified core", | ||
tags = {"cores"}) | ||
SolrJerseyResponse restoreCore( | ||
@Parameter(description = "The name of the core to be restored") @PathParam("coreName") | ||
String coreName, | ||
RestoreCoreRequestBody requestBody) | ||
throws Exception; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
solr/api/src/java/org/apache/solr/client/api/model/CreateCoreSnapshotResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* 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.model; | ||
|
||
import static org.apache.solr.client.api.model.Constants.SNAPSHOT_NAME; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.Collection; | ||
|
||
public class CreateCoreSnapshotResponse extends SolrJerseyResponse { | ||
@Schema(description = "The name of the core.") | ||
@JsonProperty | ||
public String core; | ||
|
||
@Schema(name = "commitName", description = "The name of the created snapshot.") | ||
@JsonProperty(SNAPSHOT_NAME) | ||
public String commitName; | ||
|
||
@Schema(description = "The path to the directory containing the index files.") | ||
@JsonProperty | ||
public String indexDirPath; | ||
|
||
@Schema(description = "The generation value for the created snapshot.") | ||
@JsonProperty | ||
public Long generation; | ||
|
||
@Schema(description = "The list of index filenames contained within the created snapshot.") | ||
@JsonProperty | ||
public Collection<String> files; | ||
} |
32 changes: 32 additions & 0 deletions
32
solr/api/src/java/org/apache/solr/client/api/model/DeleteSnapshotResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* 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.model; | ||
|
||
import static org.apache.solr.client.api.model.Constants.SNAPSHOT_NAME; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
public class DeleteSnapshotResponse extends SolrJerseyResponse { | ||
@Schema(name = "coreName", description = "The name of the core.") | ||
@JsonProperty("core") | ||
public String coreName; | ||
|
||
@Schema(name = "commitName", description = "The name of the deleted snapshot.") | ||
@JsonProperty(SNAPSHOT_NAME) | ||
public String commitName; | ||
} |
27 changes: 27 additions & 0 deletions
27
solr/api/src/java/org/apache/solr/client/api/model/ListCoreSnapshotsResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* 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.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.Map; | ||
|
||
public class ListCoreSnapshotsResponse extends SolrJerseyResponse { | ||
@Schema(description = "The collection of snapshots found for the requested core.") | ||
@JsonProperty | ||
public Map<String, SnapshotInformation> snapshots; | ||
} |
Oops, something went wrong.