@Generated(value="jsii-pacmak/1.63.2 (build a8a8833)",
date="2022-08-09T19:16:37.482Z")
public class InitServiceRestartHandle
extends software.amazon.jsii.JsiiObject
Pass an instance of this object to the InitFile
, InitCommand
,
InitSource
and InitPackage
objects, and finally to an InitService
itself to cause the actions (files, commands, sources, and packages)
to trigger a restart of the service.
For example, the following will run a custom command to install Nginx, and trigger the nginx service to be restarted after the command has run.
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()));
Example:
Bucket myBucket; InitServiceRestartHandle handle = new InitServiceRestartHandle(); CloudFormationInit.fromElements(InitFile.fromString("/etc/nginx/nginx.conf", "...", InitFileOptions.builder().serviceRestartHandles(List.of(handle)).build()), InitSource.fromS3Object("/var/www/html", myBucket, "html.zip", InitSourceOptions.builder().serviceRestartHandles(List.of(handle)).build()), InitService.enable("nginx", InitServiceOptions.builder() .serviceRestartHandle(handle) .build()));
Modifier | Constructor and Description |
---|---|
|
InitServiceRestartHandle() |
protected |
InitServiceRestartHandle(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
InitServiceRestartHandle(software.amazon.jsii.JsiiObjectRef objRef) |
protected InitServiceRestartHandle(software.amazon.jsii.JsiiObjectRef objRef)
protected InitServiceRestartHandle(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public InitServiceRestartHandle()