forked from opensearch-project/opensearch-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate the ml namespace (opensearch-project#1158)
* Generate ml.register_model_group Signed-off-by: Thomas Farr <[email protected]> * Start neural search sample Signed-off-by: Thomas Farr <[email protected]> * Re-generate ShardStatistics Signed-off-by: Thomas Farr <[email protected]> * Re-generate ShardFailure Signed-off-by: Thomas Farr <[email protected]> * Re-generate Result Signed-off-by: Thomas Farr <[email protected]> * Re-generate WriteResponseBase Signed-off-by: Thomas Farr <[email protected]> * Generate ml.delete_model_group Signed-off-by: Thomas Farr <[email protected]> * Generate ml.register_model Signed-off-by: Thomas Farr <[email protected]> * Exclude legacy license from ml namespace Signed-off-by: Thomas Farr <[email protected]> * Generate ml.get_task Signed-off-by: Thomas Farr <[email protected]> * Generate ml.delete_task Signed-off-by: Thomas Farr <[email protected]> * Generate ml.delete_model Signed-off-by: Thomas Farr <[email protected]> * Generate ml.deploy_model Signed-off-by: Thomas Farr <[email protected]> * Generate ml.undeploy_model Signed-off-by: Thomas Farr <[email protected]> * Complete neural search sample Signed-off-by: Thomas Farr <[email protected]> * Generate ml.get_model Signed-off-by: Thomas Farr <[email protected]> * Add changelog entry Signed-off-by: Thomas Farr <[email protected]> * note Signed-off-by: Thomas Farr <[email protected]> * Fix tests Signed-off-by: Thomas Farr <[email protected]> --------- Signed-off-by: Thomas Farr <[email protected]> (cherry picked from commit c6e61e1)
- Loading branch information
Showing
16 changed files
with
213 additions
and
87 deletions.
There are no files selected for viewing
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
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
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
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
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
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
java-codegen/src/main/java/org/opensearch/client/codegen/model/OperationGroupMatcher.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 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.client.codegen.model; | ||
|
||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
import javax.annotation.Nonnull; | ||
|
||
@FunctionalInterface | ||
public interface OperationGroupMatcher { | ||
boolean matches(OperationGroup group); | ||
|
||
static OperationGroupMatcher all() { | ||
return group -> true; | ||
} | ||
|
||
static OperationGroupMatcher none() { | ||
return group -> false; | ||
} | ||
|
||
static OperationGroupMatcher not(OperationGroupMatcher matcher) { | ||
return group -> !matcher.matches(group); | ||
} | ||
|
||
static OperationGroupMatcher or(OperationGroupMatcher... matchers) { | ||
return group -> { | ||
for (OperationGroupMatcher matcher : matchers) { | ||
if (matcher.matches(group)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
}; | ||
} | ||
|
||
static OperationGroupMatcher and(OperationGroupMatcher... matchers) { | ||
return group -> { | ||
for (OperationGroupMatcher matcher : matchers) { | ||
if (!matcher.matches(group)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}; | ||
} | ||
|
||
static OperationGroupMatcher named(String... names) { | ||
var set = new HashSet<>(Arrays.asList(names)); | ||
return group -> set.contains(group.getName()); | ||
} | ||
|
||
static OperationGroupMatcher namespace(@Nonnull String namespace) { | ||
return group -> namespace.equals(group.getNamespace().orElse("")); | ||
} | ||
} |
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
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
Oops, something went wrong.