-
Notifications
You must be signed in to change notification settings - Fork 663
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 API definitions to 'api' module, pt 8 (#2833)
SOLR-16825 added a new gradle module, 'api', which holds v2 API definitions as interfaces. This allows us to generate an OAS (and other artifacts) as a part of the solrj build. But these artifacts only cover the v2 APIs present in the 'api' module. This commit moves v2 API defining annotations to new interfaces in the 'api' module for several "schema", "replication", and "logging" APIs as well as 'create-alias'. This APIs are all now reflected in our OAS and generated artifacts.
- Loading branch information
1 parent
e04dfd3
commit 968aac2
Showing
44 changed files
with
1,236 additions
and
580 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
solr/api/src/java/org/apache/solr/client/api/endpoint/CreateAliasApi.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.endpoint; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import jakarta.ws.rs.POST; | ||
import jakarta.ws.rs.Path; | ||
import org.apache.solr.client.api.model.CreateAliasRequestBody; | ||
import org.apache.solr.client.api.model.SolrJerseyResponse; | ||
|
||
@Path("/aliases") | ||
public interface CreateAliasApi { | ||
@POST | ||
@Operation( | ||
summary = "Create a traditional or 'routed' alias", | ||
tags = {"aliases"}) | ||
SolrJerseyResponse createAlias(CreateAliasRequestBody 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
61 changes: 61 additions & 0 deletions
61
solr/api/src/java/org/apache/solr/client/api/endpoint/NodeLoggingApis.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,61 @@ | ||
/* | ||
* 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.PUT; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.QueryParam; | ||
import java.util.List; | ||
import org.apache.solr.client.api.model.ListLevelsResponse; | ||
import org.apache.solr.client.api.model.LogLevelChange; | ||
import org.apache.solr.client.api.model.LogMessagesResponse; | ||
import org.apache.solr.client.api.model.LoggingResponse; | ||
import org.apache.solr.client.api.model.SetThresholdRequestBody; | ||
|
||
@Path("/node/logging") | ||
public interface NodeLoggingApis { | ||
|
||
@GET | ||
@Path("/levels") | ||
@Operation( | ||
summary = "List all log-levels for the target node.", | ||
tags = {"logging"}) | ||
ListLevelsResponse listAllLoggersAndLevels(); | ||
|
||
@PUT | ||
@Path("/levels") | ||
@Operation( | ||
summary = "Set one or more logger levels on the target node.", | ||
tags = {"logging"}) | ||
LoggingResponse modifyLocalLogLevel(List<LogLevelChange> requestBody); | ||
|
||
@GET | ||
@Path("/messages") | ||
@Operation( | ||
summary = "Fetch recent log messages on the targeted node.", | ||
tags = {"logging"}) | ||
LogMessagesResponse fetchLocalLogMessages(@QueryParam("since") Long boundingTimeMillis); | ||
|
||
@PUT | ||
@Path("/messages/threshold") | ||
@Operation( | ||
summary = "Set a threshold level for the targeted node's log message watcher.", | ||
tags = {"logging"}) | ||
LoggingResponse setMessageThreshold(SetThresholdRequestBody requestBody); | ||
} |
50 changes: 50 additions & 0 deletions
50
solr/api/src/java/org/apache/solr/client/api/endpoint/ReplicationApis.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,50 @@ | ||
/* | ||
* 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 java.io.IOException; | ||
import org.apache.solr.client.api.model.FileListResponse; | ||
import org.apache.solr.client.api.model.IndexVersionResponse; | ||
import org.apache.solr.client.api.util.CoreApiParameters; | ||
|
||
@Path("/cores/{coreName}/replication") | ||
public interface ReplicationApis { | ||
|
||
@GET | ||
@CoreApiParameters | ||
@Path("/indexversion") | ||
@Operation( | ||
summary = "Return the index version of the specified core.", | ||
tags = {"replication"}) | ||
IndexVersionResponse fetchIndexVersion() throws IOException; | ||
|
||
@GET | ||
@CoreApiParameters | ||
@Path("/files") | ||
@Operation( | ||
summary = "Return the list of index file that make up the specified core.", | ||
tags = {"replication"}) | ||
FileListResponse fetchFileList( | ||
@Parameter(description = "The generation number of the index", required = true) | ||
@QueryParam("generation") | ||
long gen); | ||
} |
27 changes: 27 additions & 0 deletions
27
solr/api/src/java/org/apache/solr/client/api/model/CategoryRoutedAliasProperties.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; | ||
|
||
public class CategoryRoutedAliasProperties extends RoutedAliasProperties { | ||
@JsonProperty("maxCardinality") | ||
public Long maxCardinality; | ||
|
||
@JsonProperty("mustMatch") | ||
public String mustMatch; | ||
} |
42 changes: 42 additions & 0 deletions
42
solr/api/src/java/org/apache/solr/client/api/model/CreateAliasRequestBody.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,42 @@ | ||
/* | ||
* 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.List; | ||
|
||
public class CreateAliasRequestBody { | ||
@JsonProperty(required = true) | ||
public String name; | ||
|
||
@JsonProperty("collections") | ||
public List<String> collections; | ||
|
||
@JsonProperty("async") | ||
public String async; | ||
|
||
@JsonProperty("routers") | ||
public List<RoutedAliasProperties> routers; | ||
|
||
@Schema( | ||
description = | ||
"Parameters to be used for any collections created by this alias. Only used for 'routed' aliases", | ||
name = "collCreationParameters") | ||
@JsonProperty("create-collection") | ||
public CreateCollectionRequestBody collCreationParameters; | ||
} |
38 changes: 38 additions & 0 deletions
38
solr/api/src/java/org/apache/solr/client/api/model/FileListResponse.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,38 @@ | ||
/* | ||
* 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 java.util.List; | ||
|
||
/** Response body for the `GET /api/cores/coreName/replication/files` API */ | ||
public class FileListResponse extends SolrJerseyResponse { | ||
@JsonProperty("filelist") | ||
public List<FileMetaData> fileList; | ||
|
||
@JsonProperty("confFiles") | ||
public List<FileMetaData> confFiles; | ||
|
||
@JsonProperty("status") | ||
public String status; | ||
|
||
@JsonProperty("message") | ||
public String message; | ||
|
||
@JsonProperty("exception") | ||
public Exception exception; | ||
} |
42 changes: 42 additions & 0 deletions
42
solr/api/src/java/org/apache/solr/client/api/model/FileMetaData.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,42 @@ | ||
/* | ||
* 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; | ||
|
||
public class FileMetaData { | ||
|
||
@JsonProperty("size") | ||
public long size; | ||
|
||
@JsonProperty("name") | ||
public String name; | ||
|
||
@JsonProperty("checksum") | ||
public long checksum; | ||
|
||
@JsonProperty("alias") | ||
public String alias; | ||
|
||
public FileMetaData() {} | ||
|
||
public FileMetaData(long size, String name, long checksum) { | ||
this.size = size; | ||
this.name = name; | ||
this.checksum = checksum; | ||
} | ||
} |
Oops, something went wrong.