Class MultipartBody
The base class for all classes which can be used as MultipartUserData
.
Inheritance
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public abstract class MultipartBody : DeputyBase
Syntax (vb)
Public MustInherit Class MultipartBody
Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
var multipartUserData = new MultipartUserData();
var commandsUserData = UserData.ForLinux();
multipartUserData.AddUserDataPart(commandsUserData, MultipartBody.SHELL_SCRIPT, true);
// Adding commands to the multipartUserData adds them to commandsUserData, and vice-versa.
multipartUserData.AddCommands("touch /root/multi.txt");
commandsUserData.AddCommands("touch /root/userdata.txt");
Synopsis
Constructors
MultipartBody() | |
MultipartBody(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
MultipartBody(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
CLOUD_BOOTHOOK | Content type for boot hooks. |
SHELL_SCRIPT | Content type for shell scripts. |
Methods
FromRawBody(IMultipartBodyOptions) | Constructs the raw |
FromUserData(UserData, String) | Constructs the new |
RenderBodyPart() | Render body part as the string. |
Constructors
MultipartBody()
protected MultipartBody()
MultipartBody(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected MultipartBody(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
MultipartBody(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected MultipartBody(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
CLOUD_BOOTHOOK
Content type for boot hooks.
public static string CLOUD_BOOTHOOK { get; }
Property Value
System.String
SHELL_SCRIPT
Content type for shell scripts.
public static string SHELL_SCRIPT { get; }
Property Value
System.String
Methods
FromRawBody(IMultipartBodyOptions)
Constructs the raw MultipartBody
using specified body, content type and transfer encoding.
public static MultipartBody FromRawBody(IMultipartBodyOptions opts)
Parameters
Returns
Remarks
When transfer encoding is specified (typically as Base64), it's caller responsibility to convert body to
Base64 either by wrapping with Fn.base64
or by converting it by other converters.
FromUserData(UserData, String)
Constructs the new MultipartBody
wrapping existing UserData
. Modification to UserData
are reflected in subsequent renders of the part.
public static MultipartBody FromUserData(UserData userData, string contentType = null)
Parameters
- userData UserData
user data to wrap into body part.
- contentType System.String
optional content type, if default one should not be used.
Returns
Remarks
For more information about content types see MultipartBodyOptions.contentType
.
RenderBodyPart()
Render body part as the string.
public abstract string[] RenderBodyPart()
Returns
System.String[]
Remarks
Subclasses should not add leading nor trailing new line characters (\r \n)