@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:38.484Z") @Stability(value=Stable) public class MultipartUserData extends UserData
This class represents MIME multipart user data, as described in. Specifying Multiple User Data Blocks Using a MIME Multi Part Archive
Example:
// Example automatically generated from non-compiling source. May contain errors.
UserData bootHookConf = UserData.forLinux();
bootHookConf.addCommands("cloud-init-per once docker_options echo 'OPTIONS=\"${OPTIONS} --storage-opt dm.basesize=40G\"' >> /etc/sysconfig/docker");
UserData setupCommands = UserData.forLinux();
setupCommands.addCommands("sudo yum install awscli && echo Packages installed らと > /var/tmp/setup");
MultipartUserData multipartUserData = new MultipartUserData();
// The docker has to be configured at early stage, so content type is overridden to boothook
multipartUserData.addPart(MultipartBody.fromUserData(bootHookConf, "text/cloud-boothook; charset=\"us-ascii\""));
// Execute the rest of setup
multipartUserData.addPart(MultipartBody.fromUserData(setupCommands));
LaunchTemplate.Builder.create(this, "")
.userData(multipartUserData)
.blockDevices(List.of())
.build();
| Modifier and Type | Class and Description |
|---|---|
static class |
MultipartUserData.Builder
A fluent builder for
MultipartUserData. |
| Modifier | Constructor and Description |
|---|---|
|
MultipartUserData() |
protected |
MultipartUserData(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
MultipartUserData(software.amazon.jsii.JsiiObjectRef objRef) |
|
MultipartUserData(MultipartUserDataOptions opts) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCommands(String... commands)
Add one or more commands to the user data.
|
void |
addExecuteFileCommand(ExecuteFileOptions params)
Adds commands to execute a file.
|
void |
addOnExitCommands(String... commands)
Add one or more commands to the user data that will run when the script exits.
|
void |
addPart(MultipartBody part)
Adds a part to the list of parts.
|
String |
addS3DownloadCommand(S3DownloadOptions params)
Adds commands to download a file from S3.
|
void |
addSignalOnExitCommand(Resource resource)
Adds a command which will send a cfn-signal when the user data script ends.
|
void |
addUserDataPart(UserData userData)
Adds a multipart part based on a UserData object.
|
void |
addUserDataPart(UserData userData,
String contentType)
Adds a multipart part based on a UserData object.
|
void |
addUserDataPart(UserData userData,
String contentType,
Boolean makeDefault)
Adds a multipart part based on a UserData object.
|
String |
render()
Render the UserData for use in a construct.
|
custom, forLinux, forLinux, forOperatingSystem, forWindowsjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected MultipartUserData(software.amazon.jsii.JsiiObjectRef objRef)
protected MultipartUserData(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public MultipartUserData(@Nullable
MultipartUserDataOptions opts)
opts - @Stability(value=Stable) public MultipartUserData()
@Stability(value=Stable)
public void addCommands(@NotNull
String... commands)
addCommands in class UserDatacommands - This parameter is required.@Stability(value=Stable)
public void addExecuteFileCommand(@NotNull
ExecuteFileOptions params)
addExecuteFileCommand in class UserDataparams - This parameter is required.@Stability(value=Stable)
public void addOnExitCommands(@NotNull
String... commands)
addOnExitCommands in class UserDatacommands - This parameter is required.@Stability(value=Stable)
public void addPart(@NotNull
MultipartBody part)
part - This parameter is required.@Stability(value=Stable) @NotNull public String addS3DownloadCommand(@NotNull S3DownloadOptions params)
addS3DownloadCommand in class UserDataparams - This parameter is required.@Stability(value=Stable)
public void addSignalOnExitCommand(@NotNull
Resource resource)
addSignalOnExitCommand in class UserDataresource - This parameter is required.@Stability(value=Stable)
public void addUserDataPart(@NotNull
UserData userData,
@Nullable
String contentType,
@Nullable
Boolean makeDefault)
If makeDefault is true, then the UserData added by this method
will also be the target of calls to the add*Command methods on
this MultipartUserData object.
If makeDefault is false, then this is the same as calling:
// Example automatically generated from non-compiling source. May contain errors. MultipartUserData multiPart; UserData userData; String contentType; multiPart.addPart(MultipartBody.fromUserData(userData, contentType));
An undefined makeDefault defaults to either:
true if no default UserData has been set yet; orfalse if there is no default UserData set.userData - This parameter is required.contentType - makeDefault - @Stability(value=Stable)
public void addUserDataPart(@NotNull
UserData userData,
@Nullable
String contentType)
If makeDefault is true, then the UserData added by this method
will also be the target of calls to the add*Command methods on
this MultipartUserData object.
If makeDefault is false, then this is the same as calling:
// Example automatically generated from non-compiling source. May contain errors. MultipartUserData multiPart; UserData userData; String contentType; multiPart.addPart(MultipartBody.fromUserData(userData, contentType));
An undefined makeDefault defaults to either:
true if no default UserData has been set yet; orfalse if there is no default UserData set.userData - This parameter is required.contentType - @Stability(value=Stable)
public void addUserDataPart(@NotNull
UserData userData)
If makeDefault is true, then the UserData added by this method
will also be the target of calls to the add*Command methods on
this MultipartUserData object.
If makeDefault is false, then this is the same as calling:
// Example automatically generated from non-compiling source. May contain errors. MultipartUserData multiPart; UserData userData; String contentType; multiPart.addPart(MultipartBody.fromUserData(userData, contentType));
An undefined makeDefault defaults to either:
true if no default UserData has been set yet; orfalse if there is no default UserData set.userData - This parameter is required.Copyright © 2022. All rights reserved.