java.lang.Object
org.elasticsearch.cli.Command
org.elasticsearch.common.cli.EnvironmentAwareCommand
org.elasticsearch.common.cli.KeyStoreAwareCommand
- All Implemented Interfaces:
Closeable,AutoCloseable
An
EnvironmentAwareCommand that needs to access the elasticsearch keystore, possibly
decrypting it if it is password protected.-
Field Summary
Fields inherited from class org.elasticsearch.cli.Command
description, parser -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voiddecryptKeyStore(KeyStoreWrapper keyStore, Terminal terminal) Decrypt thekeyStore, prompting the user to enter the password in theTerminalif it is password protectedabstract voidexecute(Terminal terminal, joptsimple.OptionSet options, Environment env, ProcessInfo processInfo) Execute the command with the initializedEnvironment.protected static SecureStringreadPassword(Terminal terminal, boolean withVerification) Reads the keystore password from theTerminal, prompting for verification where applicable and returns it as aSecureString.Methods inherited from class org.elasticsearch.common.cli.EnvironmentAwareCommand
createEnv, execute, getBuildTypeMethods inherited from class org.elasticsearch.cli.Command
close, exit, main, mainWithoutErrorHandling, parseOptions, printAdditionalHelp, printUserException
-
Constructor Details
-
KeyStoreAwareCommand
-
-
Method Details
-
readPassword
protected static SecureString readPassword(Terminal terminal, boolean withVerification) throws UserException Reads the keystore password from theTerminal, prompting for verification where applicable and returns it as aSecureString.- Parameters:
terminal- the terminal to use for user inputswithVerification- whether the user should be prompted for password verification- Returns:
- a SecureString with the password the user entered
- Throws:
UserException- If the user is prompted for verification and enters a different password
-
decryptKeyStore
protected static void decryptKeyStore(KeyStoreWrapper keyStore, Terminal terminal) throws UserException, IOException Decrypt thekeyStore, prompting the user to enter the password in theTerminalif it is password protected- Throws:
UserExceptionIOException
-
execute
public abstract void execute(Terminal terminal, joptsimple.OptionSet options, Environment env, ProcessInfo processInfo) throws Exception Description copied from class:EnvironmentAwareCommandExecute the command with the initializedEnvironment.- Specified by:
executein classEnvironmentAwareCommand- Throws:
Exception
-