public static final class ScriptMetaData.Builder
extends java.lang.Object
ClusterState
. Scripts can be added or deleted, then built
to generate a new Map
of scripts that will be used to update
the current ClusterState
.Constructor and Description |
---|
Builder(ScriptMetaData previous) |
Modifier and Type | Method and Description |
---|---|
ScriptMetaData |
build() |
ScriptMetaData.Builder |
deleteScript(java.lang.String id,
java.lang.String lang)
Delete a script from the existing stored scripts.
|
ScriptMetaData.Builder |
storeScript(java.lang.String id,
StoredScriptSource source)
Add a new script to the existing stored scripts.
|
public Builder(ScriptMetaData previous)
previous
- The current ScriptMetaData
or null
if there
is no existing ScriptMetaData
.public ScriptMetaData.Builder storeScript(java.lang.String id, StoredScriptSource source)
Take for example script 'A' with lang 'L0' and data 'D0'. If we add script 'A' to the
empty set, the scripts Map
will be ["A" -- D0, "A#L0" -- D0]. If a script
'A' with lang 'L1' and data 'D1' is then added, the scripts Map
will be
["A" -- D1, "A#L1" -- D1, "A#L0" -- D0].
id
- The user-specified id to use for the look up.source
- The user-specified stored script data held in StoredScriptSource
.public ScriptMetaData.Builder deleteScript(java.lang.String id, java.lang.String lang)
null
. The script will be removed from the deprecated
namespace on any delete either using using the specified lang parameter or the language
found from looking up the script in the new namespace.
Take for example a scripts Map
with {"A" -- D1, "A#L1" -- D1, "A#L0" -- D0}.
If a script is removed specified by an id 'A' and lang null
then the scripts
Map
will be {"A#L0" -- D0}. To remove the final script, the deprecated
namespace must be used, so an id 'A' and lang 'L0' would need to be specified.
id
- The user-specified id to use for the look up.lang
- The user-specified language to use for the look up if using the deprecated
namespace, otherwise null
.public ScriptMetaData build()
ScriptMetaData
with the updated Map
of scripts.