Class: AWSCDK::EC2::InitServiceOptions
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::EC2::InitServiceOptions
- Defined in:
- ec2/init_service_options.rb
Overview
Options for an InitService.
Instance Attribute Summary collapse
-
#enabled ⇒ Boolean?
readonly
Enable or disable this service.
-
#ensure_running ⇒ Boolean?
readonly
Make sure this service is running or not running after cfn-init finishes.
-
#service_manager ⇒ AWSCDK::EC2::ServiceManager?
readonly
What service manager to use.
-
#service_restart_handle ⇒ AWSCDK::EC2::InitServiceRestartHandle?
readonly
Restart service when the actions registered into the restartHandle have been performed.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(enabled: nil, ensure_running: nil, service_manager: nil, service_restart_handle: nil) ⇒ InitServiceOptions
constructor
A new instance of InitServiceOptions.
- #to_jsii ⇒ Object
Constructor Details
#initialize(enabled: nil, ensure_running: nil, service_manager: nil, service_restart_handle: nil) ⇒ InitServiceOptions
Returns a new instance of InitServiceOptions.
11 12 13 14 15 16 17 18 19 20 |
# File 'ec2/init_service_options.rb', line 11 def initialize(enabled: nil, ensure_running: nil, service_manager: nil, service_restart_handle: nil) @enabled = enabled Jsii::Type.check_type(@enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enabled") unless @enabled.nil? @ensure_running = ensure_running Jsii::Type.check_type(@ensure_running, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "ensureRunning") unless @ensure_running.nil? @service_manager = service_manager Jsii::Type.check_type(@service_manager, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlNlcnZpY2VNYW5hZ2VyIn0=")), "serviceManager") unless @service_manager.nil? @service_restart_handle = service_restart_handle Jsii::Type.check_type(@service_restart_handle, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkluaXRTZXJ2aWNlUmVzdGFydEhhbmRsZSJ9")), "serviceRestartHandle") unless @service_restart_handle.nil? end |
Instance Attribute Details
#enabled ⇒ Boolean? (readonly)
Default: - true if used in InitService.enable(), no change to service state if used in InitService.fromOptions().
Enable or disable this service.
Set to true to ensure that the service will be started automatically upon boot.
Set to false to ensure that the service will not be started automatically upon boot.
30 31 32 |
# File 'ec2/init_service_options.rb', line 30 def enabled @enabled end |
#ensure_running ⇒ Boolean? (readonly)
Default: - same value as enabled.
Make sure this service is running or not running after cfn-init finishes.
Set to true to ensure that the service is running after cfn-init finishes.
Set to false to ensure that the service is not running after cfn-init finishes.
39 40 41 |
# File 'ec2/init_service_options.rb', line 39 def ensure_running @ensure_running end |
#service_manager ⇒ AWSCDK::EC2::ServiceManager? (readonly)
Default: ServiceManager.SYSVINIT for Linux images, ServiceManager.WINDOWS for Windows images
What service manager to use.
This needs to match the actual service manager on your Operating System. For example, Amazon Linux 1 uses SysVinit, but Amazon Linux 2 uses Systemd.
47 48 49 |
# File 'ec2/init_service_options.rb', line 47 def service_manager @service_manager end |
#service_restart_handle ⇒ AWSCDK::EC2::InitServiceRestartHandle? (readonly)
Default: - No files trigger restart
Restart service when the actions registered into the restartHandle have been performed.
Register actions into the restartHandle by passing it to InitFile, InitCommand,
InitPackage and InitSource objects.
55 56 57 |
# File 'ec2/init_service_options.rb', line 55 def service_restart_handle @service_restart_handle end |
Class Method Details
.jsii_properties ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'ec2/init_service_options.rb', line 57 def self.jsii_properties { :enabled => "enabled", :ensure_running => "ensureRunning", :service_manager => "serviceManager", :service_restart_handle => "serviceRestartHandle", } end |
Instance Method Details
#to_jsii ⇒ Object
66 67 68 69 70 71 72 73 74 75 |
# File 'ec2/init_service_options.rb', line 66 def to_jsii result = {} result.merge!({ "enabled" => @enabled, "ensureRunning" => @ensure_running, "serviceManager" => @service_manager, "serviceRestartHandle" => @service_restart_handle, }) result.compact end |