@Generated(value="jsii-pacmak/1.58.0 (build f8ba112)", date="2022-05-20T22:19:59.459Z") public abstract class InitFile extends InitElement
Example:
Vpc vpc; InstanceType instanceType; IMachineImage machineImage; AutoScalingGroup.Builder.create(this, "ASG") .vpc(vpc) .instanceType(instanceType) .machineImage(machineImage) // ... .init(CloudFormationInit.fromElements(InitFile.fromString("/etc/my_instance", "This got written during instance startup"))) .signals(Signals.waitForAll(SignalsOptions.builder() .timeout(Duration.minutes(10)) .build())) .build();
Modifier | Constructor and Description |
---|---|
protected |
InitFile(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
InitFile(software.amazon.jsii.JsiiObjectRef objRef) |
protected |
InitFile(java.lang.String fileName,
InitFileOptions options) |
Modifier and Type | Method and Description |
---|---|
static InitFile |
fromAsset(java.lang.String targetFileName,
java.lang.String path)
Create an asset from the given file.
|
static InitFile |
fromAsset(java.lang.String targetFileName,
java.lang.String path,
InitFileAssetOptions options)
Create an asset from the given file.
|
static InitFile |
fromExistingAsset(java.lang.String targetFileName,
Asset asset)
Use a file from an asset at instance startup time.
|
static InitFile |
fromExistingAsset(java.lang.String targetFileName,
Asset asset,
InitFileOptions options)
Use a file from an asset at instance startup time.
|
static InitFile |
fromFileInline(java.lang.String targetFileName,
java.lang.String sourceFileName)
Read a file from disk and use its contents.
|
static InitFile |
fromFileInline(java.lang.String targetFileName,
java.lang.String sourceFileName,
InitFileOptions options)
Read a file from disk and use its contents.
|
static InitFile |
fromObject(java.lang.String fileName,
java.util.Map<java.lang.String,? extends java.lang.Object> obj)
Use a JSON-compatible object as the file content, write it to a JSON file.
|
static InitFile |
fromObject(java.lang.String fileName,
java.util.Map<java.lang.String,? extends java.lang.Object> obj,
InitFileOptions options)
Use a JSON-compatible object as the file content, write it to a JSON file.
|
static InitFile |
fromS3Object(java.lang.String fileName,
IBucket bucket,
java.lang.String key)
Download a file from an S3 bucket at instance startup time.
|
static InitFile |
fromS3Object(java.lang.String fileName,
IBucket bucket,
java.lang.String key,
InitFileOptions options)
Download a file from an S3 bucket at instance startup time.
|
static InitFile |
fromString(java.lang.String fileName,
java.lang.String content)
Use a literal string as the file content.
|
static InitFile |
fromString(java.lang.String fileName,
java.lang.String content,
InitFileOptions options)
Use a literal string as the file content.
|
static InitFile |
fromUrl(java.lang.String fileName,
java.lang.String url)
Download from a URL at instance startup time.
|
static InitFile |
fromUrl(java.lang.String fileName,
java.lang.String url,
InitFileOptions options)
Download from a URL at instance startup time.
|
java.lang.String |
getElementType()
Returns the init element type for this element.
|
static InitFile |
symlink(java.lang.String fileName,
java.lang.String target)
Write a symlink with the given symlink target.
|
static InitFile |
symlink(java.lang.String fileName,
java.lang.String target,
InitFileOptions options)
Write a symlink with the given symlink target.
|
protected InitFile(software.amazon.jsii.JsiiObjectRef objRef)
protected InitFile(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
protected InitFile(java.lang.String fileName, InitFileOptions options)
fileName
- This parameter is required.options
- This parameter is required.public static InitFile fromAsset(java.lang.String targetFileName, java.lang.String path, InitFileAssetOptions options)
This is appropriate for files that are too large to embed into the template.
targetFileName
- This parameter is required.path
- This parameter is required.options
- public static InitFile fromAsset(java.lang.String targetFileName, java.lang.String path)
This is appropriate for files that are too large to embed into the template.
targetFileName
- This parameter is required.path
- This parameter is required.public static InitFile fromExistingAsset(java.lang.String targetFileName, Asset asset, InitFileOptions options)
targetFileName
- This parameter is required.asset
- This parameter is required.options
- public static InitFile fromExistingAsset(java.lang.String targetFileName, Asset asset)
targetFileName
- This parameter is required.asset
- This parameter is required.public static InitFile fromFileInline(java.lang.String targetFileName, java.lang.String sourceFileName, InitFileOptions options)
The file will be embedded in the template, so care should be taken to not exceed the template size.
If options.base64encoded is set to true, this will base64-encode the file's contents.
targetFileName
- This parameter is required.sourceFileName
- This parameter is required.options
- public static InitFile fromFileInline(java.lang.String targetFileName, java.lang.String sourceFileName)
The file will be embedded in the template, so care should be taken to not exceed the template size.
If options.base64encoded is set to true, this will base64-encode the file's contents.
targetFileName
- This parameter is required.sourceFileName
- This parameter is required.public static InitFile fromObject(java.lang.String fileName, java.util.Map<java.lang.String,? extends java.lang.Object> obj, InitFileOptions options)
May contain tokens.
fileName
- This parameter is required.obj
- This parameter is required.options
- public static InitFile fromObject(java.lang.String fileName, java.util.Map<java.lang.String,? extends java.lang.Object> obj)
May contain tokens.
fileName
- This parameter is required.obj
- This parameter is required.public static InitFile fromS3Object(java.lang.String fileName, IBucket bucket, java.lang.String key, InitFileOptions options)
fileName
- This parameter is required.bucket
- This parameter is required.key
- This parameter is required.options
- public static InitFile fromS3Object(java.lang.String fileName, IBucket bucket, java.lang.String key)
fileName
- This parameter is required.bucket
- This parameter is required.key
- This parameter is required.public static InitFile fromString(java.lang.String fileName, java.lang.String content, InitFileOptions options)
fileName
- This parameter is required.content
- This parameter is required.options
- public static InitFile fromString(java.lang.String fileName, java.lang.String content)
fileName
- This parameter is required.content
- This parameter is required.public static InitFile fromUrl(java.lang.String fileName, java.lang.String url, InitFileOptions options)
fileName
- This parameter is required.url
- This parameter is required.options
- public static InitFile fromUrl(java.lang.String fileName, java.lang.String url)
fileName
- This parameter is required.url
- This parameter is required.public static InitFile symlink(java.lang.String fileName, java.lang.String target, InitFileOptions options)
fileName
- This parameter is required.target
- This parameter is required.options
- public static InitFile symlink(java.lang.String fileName, java.lang.String target)
fileName
- This parameter is required.target
- This parameter is required.public java.lang.String getElementType()
getElementType
in class InitElement