Class InitCommandOptions.Builder
java.lang.Object
software.amazon.awscdk.services.ec2.InitCommandOptions.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<InitCommandOptions>
- Enclosing interface:
- InitCommandOptions
@Stability(Stable)
public static final class InitCommandOptions.Builder
extends Object
implements software.amazon.jsii.Builder<InitCommandOptions>
A builder for
InitCommandOptions-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the configured instance.Sets the value ofInitCommandOptions.getCwd()Sets the value ofInitCommandOptions.getEnv()ignoreErrors(Boolean ignoreErrors) Sets the value ofInitCommandOptions.getIgnoreErrors()Sets the value ofInitCommandOptions.getKey()serviceRestartHandles(List<? extends InitServiceRestartHandle> serviceRestartHandles) Sets the value ofInitCommandOptions.getServiceRestartHandles()Sets the value ofInitCommandOptions.getTestCmd()waitAfterCompletion(InitCommandWaitDuration waitAfterCompletion) Sets the value ofInitCommandOptions.getWaitAfterCompletion()
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
cwd
Sets the value ofInitCommandOptions.getCwd()- Parameters:
cwd- The working directory.- Returns:
this
-
env
Sets the value ofInitCommandOptions.getEnv()- Parameters:
env- Sets environment variables for the command. This property overwrites, rather than appends, the existing environment.- Returns:
this
-
ignoreErrors
Sets the value ofInitCommandOptions.getIgnoreErrors()- Parameters:
ignoreErrors- Continue running if this command fails.- Returns:
this
-
key
Sets the value ofInitCommandOptions.getKey()- Parameters:
key- Identifier key for this command. Commands are executed in lexicographical order of their key names.- Returns:
this
-
serviceRestartHandles
@Stability(Stable) public InitCommandOptions.Builder serviceRestartHandles(List<? extends InitServiceRestartHandle> serviceRestartHandles) Sets the value ofInitCommandOptions.getServiceRestartHandles()- Parameters:
serviceRestartHandles- Restart the given service(s) after this command has run.- Returns:
this
-
testCmd
Sets the value ofInitCommandOptions.getTestCmd()- Parameters:
testCmd- Command to determine whether this command should be run. If the test passes (exits with error code of 0), the command is run.- Returns:
this
-
waitAfterCompletion
@Stability(Stable) public InitCommandOptions.Builder waitAfterCompletion(InitCommandWaitDuration waitAfterCompletion) Sets the value ofInitCommandOptions.getWaitAfterCompletion()- Parameters:
waitAfterCompletion- The duration to wait after a command has finished in case the command causes a reboot. Set this value toInitCommandWaitDuration.none()if you do not want to wait for every command;InitCommandWaitDuration.forever()directs cfn-init to exit and resume only after the reboot is complete.For Windows systems only.
- Returns:
this
-
build
Builds the configured instance.- Specified by:
buildin interfacesoftware.amazon.jsii.Builder<InitCommandOptions>- Returns:
- a new instance of
InitCommandOptions - Throws:
NullPointerException- if any required attribute was not provided
-