Class InitCommand

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.ec2.InitElement
software.amazon.awscdk.services.ec2.InitCommand
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:39.365Z") @Stability(Stable) public class InitCommand extends InitElement
Command to execute on the instance.

Example:

 InitServiceRestartHandle handle = new InitServiceRestartHandle();
 CloudFormationInit.fromElements(InitCommand.shellCommand("/usr/bin/custom-nginx-install.sh", InitCommandOptions.builder().serviceRestartHandles(List.of(handle)).build()), InitService.enable("nginx", InitServiceOptions.builder().serviceRestartHandle(handle).build()));
 
  • Nested Class Summary

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    InitCommand(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    InitCommand(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Run a command from an argv array.
    Run a command from an argv array.
    Returns the init element type for this element.
    shellCommand(String shellCommand)
    Run a shell command.
    shellCommand(String shellCommand, InitCommandOptions options)
    Run a shell command.

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • InitCommand

      protected InitCommand(software.amazon.jsii.JsiiObjectRef objRef)
    • InitCommand

      protected InitCommand(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
  • Method Details

    • argvCommand

      @Stability(Stable) @NotNull public static InitCommand argvCommand(@NotNull List<String> argv, @Nullable InitCommandOptions options)
      Run a command from an argv array.

      You do not need to escape space characters or enclose command parameters in quotes.

      Parameters:
      argv - This parameter is required.
      options -
    • argvCommand

      @Stability(Stable) @NotNull public static InitCommand argvCommand(@NotNull List<String> argv)
      Run a command from an argv array.

      You do not need to escape space characters or enclose command parameters in quotes.

      Parameters:
      argv - This parameter is required.
    • shellCommand

      @Stability(Stable) @NotNull public static InitCommand shellCommand(@NotNull String shellCommand, @Nullable InitCommandOptions options)
      Run a shell command.

      Remember that some characters like &, |, ;, > etc. have special meaning in a shell and need to be preceded by a \ if you want to treat them as part of a filename.

      Parameters:
      shellCommand - This parameter is required.
      options -
    • shellCommand

      @Stability(Stable) @NotNull public static InitCommand shellCommand(@NotNull String shellCommand)
      Run a shell command.

      Remember that some characters like &, |, ;, > etc. have special meaning in a shell and need to be preceded by a \ if you want to treat them as part of a filename.

      Parameters:
      shellCommand - This parameter is required.
    • getElementType

      @Stability(Stable) @NotNull public String getElementType()
      Returns the init element type for this element.
      Specified by:
      getElementType in class InitElement