Class: AWSCDK::EC2::InitCommandOptions
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::EC2::InitCommandOptions
- Defined in:
- ec2/init_command_options.rb
Overview
Options for InitCommand.
Instance Attribute Summary collapse
-
#cwd ⇒ String?
readonly
The working directory.
-
#env ⇒ Hash{String => String}?
readonly
Sets environment variables for the command.
-
#ignore_errors ⇒ Boolean?
readonly
Continue running if this command fails.
-
#key ⇒ String?
readonly
Identifier key for this command.
-
#service_restart_handles ⇒ Array<AWSCDK::EC2::InitServiceRestartHandle>?
readonly
Restart the given service(s) after this command has run.
-
#test_cmd ⇒ String?
readonly
Command to determine whether this command should be run.
-
#wait_after_completion ⇒ AWSCDK::EC2::InitCommandWaitDuration?
readonly
The duration to wait after a command has finished in case the command causes a reboot.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cwd: nil, env: nil, ignore_errors: nil, key: nil, service_restart_handles: nil, test_cmd: nil, wait_after_completion: nil) ⇒ InitCommandOptions
constructor
A new instance of InitCommandOptions.
- #to_jsii ⇒ Object
Constructor Details
#initialize(cwd: nil, env: nil, ignore_errors: nil, key: nil, service_restart_handles: nil, test_cmd: nil, wait_after_completion: nil) ⇒ InitCommandOptions
Returns a new instance of InitCommandOptions.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'ec2/init_command_options.rb', line 14 def initialize(cwd: nil, env: nil, ignore_errors: nil, key: nil, service_restart_handles: nil, test_cmd: nil, wait_after_completion: nil) @cwd = cwd Jsii::Type.check_type(@cwd, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "cwd") unless @cwd.nil? @env = env Jsii::Type.check_type(@env, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "env") unless @env.nil? @ignore_errors = ignore_errors Jsii::Type.check_type(@ignore_errors, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "ignoreErrors") unless @ignore_errors.nil? @key = key Jsii::Type.check_type(@key, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "key") unless @key.nil? @service_restart_handles = service_restart_handles Jsii::Type.check_type(@service_restart_handles, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lYzIuSW5pdFNlcnZpY2VSZXN0YXJ0SGFuZGxlIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "serviceRestartHandles") unless @service_restart_handles.nil? @test_cmd = test_cmd Jsii::Type.check_type(@test_cmd, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "testCmd") unless @test_cmd.nil? @wait_after_completion = wait_after_completion Jsii::Type.check_type(@wait_after_completion, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkluaXRDb21tYW5kV2FpdER1cmF0aW9uIn0=")), "waitAfterCompletion") unless @wait_after_completion.nil? end |
Instance Attribute Details
#cwd ⇒ String? (readonly)
Default: - Use default working directory
The working directory.
35 36 37 |
# File 'ec2/init_command_options.rb', line 35 def cwd @cwd end |
#env ⇒ Hash{String => String}? (readonly)
Default: - Use current environment
Sets environment variables for the command.
This property overwrites, rather than appends, the existing environment.
42 43 44 |
# File 'ec2/init_command_options.rb', line 42 def env @env end |
#ignore_errors ⇒ Boolean? (readonly)
Default: false
Continue running if this command fails.
47 48 49 |
# File 'ec2/init_command_options.rb', line 47 def ignore_errors @ignore_errors end |
#key ⇒ String? (readonly)
Default: - Automatically generated based on index
Identifier key for this command.
Commands are executed in lexicographical order of their key names.
54 55 56 |
# File 'ec2/init_command_options.rb', line 54 def key @key end |
#service_restart_handles ⇒ Array<AWSCDK::EC2::InitServiceRestartHandle>? (readonly)
Default: - Do not restart any service
Restart the given service(s) after this command has run.
59 60 61 |
# File 'ec2/init_command_options.rb', line 59 def service_restart_handles @service_restart_handles end |
#test_cmd ⇒ String? (readonly)
Default: - Always run the command
Command to determine whether this command should be run.
If the test passes (exits with error code of 0), the command is run.
66 67 68 |
# File 'ec2/init_command_options.rb', line 66 def test_cmd @test_cmd end |
#wait_after_completion ⇒ AWSCDK::EC2::InitCommandWaitDuration? (readonly)
Default: - 60 seconds
The duration to wait after a command has finished in case the command causes a reboot.
Set this value to InitCommandWaitDuration.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.
76 77 78 |
# File 'ec2/init_command_options.rb', line 76 def wait_after_completion @wait_after_completion end |
Class Method Details
.jsii_properties ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 |
# File 'ec2/init_command_options.rb', line 78 def self.jsii_properties { :cwd => "cwd", :env => "env", :ignore_errors => "ignoreErrors", :key => "key", :service_restart_handles => "serviceRestartHandles", :test_cmd => "testCmd", :wait_after_completion => "waitAfterCompletion", } end |
Instance Method Details
#to_jsii ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'ec2/init_command_options.rb', line 90 def to_jsii result = {} result.merge!({ "cwd" => @cwd, "env" => @env, "ignoreErrors" => @ignore_errors, "key" => @key, "serviceRestartHandles" => @service_restart_handles, "testCmd" => @test_cmd, "waitAfterCompletion" => @wait_after_completion, }) result.compact end |