-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Backport 2.x] [Extensions] Add ExtensionAwarePlugin extension point …
…to add custom settings for extensions (#7526) (#7756) * [Extensions] Add ExtensionAwarePlugin extension point to add custom settings for extensions (#7526) * WIP on extension settings Signed-off-by: Craig Perkins <[email protected]> * Use getExtensionSettings from the identity service Signed-off-by: Craig Perkins <[email protected]> * Add extension scoped settings and add area for additional settings Signed-off-by: Craig Perkins <[email protected]> * Run spotlessApply Signed-off-by: Craig Perkins <[email protected]> * Re-run CI Signed-off-by: Craig Perkins <[email protected]> * spotlessApply Signed-off-by: Craig Perkins <[email protected]> * Change contructor to take list of additionalSettings Signed-off-by: Craig Perkins <[email protected]> * One constructor Signed-off-by: Craig Perkins <[email protected]> * Remove isAuthenticated Signed-off-by: Craig Perkins <[email protected]> * Re-run CI Signed-off-by: Craig Perkins <[email protected]> * Re-run CI Signed-off-by: Craig Perkins <[email protected]> * Create ExtensionAwarePlugin extension point Signed-off-by: Craig Perkins <[email protected]> * Update CHANGELOG Signed-off-by: Craig Perkins <[email protected]> * Address code review feedback Signed-off-by: Craig Perkins <[email protected]> * Compute additionalSettingsKeys outside of loop Signed-off-by: Craig Perkins <[email protected]> * Address code review feedback Signed-off-by: Craig Perkins <[email protected]> * Add comment Signed-off-by: Craig Perkins <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]> (cherry picked from commit 277eb3d) * Fix conflicts Signed-off-by: Craig Perkins <[email protected]> * Switch versions Signed-off-by: Craig Perkins <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]>
- Loading branch information
Showing
10 changed files
with
305 additions
and
59 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
34 changes: 34 additions & 0 deletions
34
server/src/main/java/org/opensearch/extensions/ExtensionScopedSettings.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,34 @@ | ||
/* | ||
* 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.extensions; | ||
|
||
import org.opensearch.common.settings.AbstractScopedSettings; | ||
import org.opensearch.common.settings.Setting; | ||
import org.opensearch.common.settings.Setting.Property; | ||
import org.opensearch.common.settings.SettingUpgrader; | ||
import org.opensearch.common.settings.Settings; | ||
|
||
import java.util.Collections; | ||
import java.util.Set; | ||
|
||
/** | ||
* Encapsulates all valid extension level settings. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public final class ExtensionScopedSettings extends AbstractScopedSettings { | ||
|
||
public ExtensionScopedSettings(final Set<Setting<?>> settingsSet) { | ||
this(settingsSet, Collections.emptySet()); | ||
} | ||
|
||
public ExtensionScopedSettings(final Set<Setting<?>> settingsSet, final Set<SettingUpgrader<?>> settingUpgraders) { | ||
super(Settings.EMPTY, settingsSet, settingUpgraders, Property.ExtensionScope); | ||
} | ||
} |
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
29 changes: 29 additions & 0 deletions
29
server/src/main/java/org/opensearch/plugins/ExtensionAwarePlugin.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,29 @@ | ||
/* | ||
* 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.plugins; | ||
|
||
import org.opensearch.common.settings.Setting; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
/** | ||
* Plugin that provides extra settings for extensions | ||
* | ||
* @opensearch.experimental | ||
*/ | ||
public interface ExtensionAwarePlugin { | ||
|
||
/** | ||
* Returns a list of additional {@link Setting} definitions that this plugin adds for extensions | ||
*/ | ||
default List<Setting<?>> getExtensionSettings() { | ||
return Collections.emptyList(); | ||
} | ||
} |
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.