Class InitService
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.ec2.InitElement
software.amazon.awscdk.services.ec2.InitService
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)",
date="2024-09-19T18:11:59.317Z")
@Stability(Stable)
public class InitService
extends InitElement
A services that be enabled, disabled or restarted when the instance is launched.
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()));
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
-
Constructor Summary
ModifierConstructorDescriptionprotected
InitService
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
InitService
(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionstatic InitService
Disable and stop the given service.static InitService
Enable and start the given service, optionally restarting it.static InitService
enable
(String serviceName, InitServiceOptions options) Enable and start the given service, optionally restarting it.Returns the init element type for this element.static InitFile
systemdConfigFile
(String serviceName, SystemdConfigFileOptions options) Install a systemd-compatible config file for the given service.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
-
InitService
protected InitService(software.amazon.jsii.JsiiObjectRef objRef) -
InitService
protected InitService(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
-
-
Method Details
-
disable
Disable and stop the given service.- Parameters:
serviceName
- This parameter is required.
-
enable
@Stability(Stable) @NotNull public static InitService enable(@NotNull String serviceName, @Nullable InitServiceOptions options) Enable and start the given service, optionally restarting it.- Parameters:
serviceName
- This parameter is required.options
-
-
enable
Enable and start the given service, optionally restarting it.- Parameters:
serviceName
- This parameter is required.
-
systemdConfigFile
@Stability(Stable) @NotNull public static InitFile systemdConfigFile(@NotNull String serviceName, @NotNull SystemdConfigFileOptions options) Install a systemd-compatible config file for the given service.This is a helper function to create a simple systemd configuration file that will allow running a service on the machine using
InitService.enable()
.Systemd allows many configuration options; this function does not pretend to expose all of them. If you need advanced configuration options, you can use
InitFile
to create exactly the configuration file you need at/etc/systemd/system/${serviceName}.service
.- Parameters:
serviceName
- This parameter is required.options
- This parameter is required.
-
getElementType
Returns the init element type for this element.- Specified by:
getElementType
in classInitElement
-