Class: AWSCDK::EC2::MultipartBody

Inherits:
Jsii::Object
  • Object
show all
Defined in:
ec2/multipart_body.rb

Overview

The base class for all classes which can be used as MultipartUserData.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMultipartBody

Returns a new instance of MultipartBody.



8
9
10
# File 'ec2/multipart_body.rb', line 8

def initialize
  Jsii::Object.instance_method(:initialize).bind(self).call
end

Class Method Details

.CLOUD_BOOTHOOKString

Content type for boot hooks.

Returns:

  • (String)


47
48
49
# File 'ec2/multipart_body.rb', line 47

def self.CLOUD_BOOTHOOK()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_ec2.MultipartBody", "CLOUD_BOOTHOOK")
end

.from_raw_body(opts) ⇒ AWSCDK::EC2::MultipartBody

Constructs the raw MultipartBody using specified body, content type and transfer encoding.

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.

Parameters:

Returns:

  • (AWSCDK::EC2::MultipartBody)


25
26
27
28
29
# File 'ec2/multipart_body.rb', line 25

def self.from_raw_body(opts)
  opts = opts.is_a?(Hash) ? ::AWSCDK::EC2::MultipartBodyOptions.new(**opts.transform_keys(&:to_sym)) : opts
  Jsii::Type.check_type(opts, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLk11bHRpcGFydEJvZHlPcHRpb25zIn0=")), "opts")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ec2.MultipartBody", "fromRawBody", [opts])
end

.from_user_data(user_data, content_type = nil) ⇒ AWSCDK::EC2::MultipartBody

Constructs the new MultipartBody wrapping existing UserData. Modification to UserData are reflected in subsequent renders of the part.

For more information about content types see MultipartBodyOptions.contentType.

Parameters:

  • user_data (AWSCDK::EC2::UserData)

    user data to wrap into body part.

  • content_type (String, nil) (defaults to: nil)

    optional content type, if default one should not be used.

Returns:

  • (AWSCDK::EC2::MultipartBody)


38
39
40
41
42
# File 'ec2/multipart_body.rb', line 38

def self.from_user_data(user_data, content_type = nil)
  Jsii::Type.check_type(user_data, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlVzZXJEYXRhIn0=")), "userData")
  Jsii::Type.check_type(content_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "contentType") unless content_type.nil?
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_ec2.MultipartBody", "fromUserData", [user_data, content_type])
end

.jsii_overridable_methodsObject



12
13
14
15
16
# File 'ec2/multipart_body.rb', line 12

def self.jsii_overridable_methods
  {
    :render_body_part => { kind: :method, name: "renderBodyPart", is_optional: false },
  }
end

.SHELL_SCRIPTString

Content type for shell scripts.

Returns:

  • (String)


54
55
56
# File 'ec2/multipart_body.rb', line 54

def self.SHELL_SCRIPT()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_ec2.MultipartBody", "SHELL_SCRIPT")
end

Instance Method Details

#render_body_partArray<String>

Render body part as the string.

Subclasses should not add leading nor trailing new line characters (\r \n)

Returns:

  • (Array<String>)


63
64
65
# File 'ec2/multipart_body.rb', line 63

def render_body_part()
  jsii_call_method("renderBodyPart", [])
end