Class: AWSCDK::EC2::MultipartUserData
- Inherits:
-
UserData
- Object
- UserData
- AWSCDK::EC2::MultipartUserData
- Defined in:
- ec2/multipart_user_data.rb
Overview
Mime multipart user data.
This class represents MIME multipart user data, as described in. Specifying Multiple User Data Blocks Using a MIME Multi Part Archive
Class Method Summary collapse
Instance Method Summary collapse
-
#add_commands(*commands) ⇒ void
Add one or more commands to the user data.
-
#add_execute_file_command(params) ⇒ void
Adds commands to execute a file.
-
#add_on_exit_commands(*commands) ⇒ void
Add one or more commands to the user data that will run when the script exits.
-
#add_part(part) ⇒ void
Adds a part to the list of parts.
-
#add_s3_download_command(params) ⇒ String
Adds commands to download a file from S3.
-
#add_signal_on_exit_command(resource) ⇒ void
Adds a command which will send a cfn-signal when the user data script ends.
-
#add_user_data_part(user_data, content_type = nil, make_default = nil) ⇒ void
Adds a multipart part based on a UserData object.
-
#initialize(opts = nil) ⇒ MultipartUserData
constructor
A new instance of MultipartUserData.
-
#render ⇒ String
Render the UserData for use in a construct.
Constructor Details
#initialize(opts = nil) ⇒ MultipartUserData
Returns a new instance of MultipartUserData.
12 13 14 15 16 |
# File 'ec2/multipart_user_data.rb', line 12 def initialize(opts = nil) opts = opts.is_a?(Hash) ? ::AWSCDK::EC2::MultipartUserDataOptions.new(**opts.transform_keys(&:to_sym)) : opts Jsii::Type.check_type(opts, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLk11bHRpcGFydFVzZXJEYXRhT3B0aW9ucyJ9")), "opts") unless opts.nil? Jsii::Object.instance_method(:initialize).bind(self).call(opts) end |
Class Method Details
.jsii_overridable_methods ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'ec2/multipart_user_data.rb', line 18 def self.jsii_overridable_methods { :add_commands => { kind: :method, name: "addCommands", is_optional: false }, :add_execute_file_command => { kind: :method, name: "addExecuteFileCommand", is_optional: false }, :add_on_exit_commands => { kind: :method, name: "addOnExitCommands", is_optional: false }, :add_s3_download_command => { kind: :method, name: "addS3DownloadCommand", is_optional: false }, :add_signal_on_exit_command => { kind: :method, name: "addSignalOnExitCommand", is_optional: false }, :render => { kind: :method, name: "render", is_optional: false }, :add_part => { kind: :method, name: "addPart", is_optional: false }, :add_user_data_part => { kind: :method, name: "addUserDataPart", is_optional: false }, } end |
Instance Method Details
#add_commands(*commands) ⇒ void
This method returns an undefined value.
Add one or more commands to the user data.
35 36 37 38 39 40 |
# File 'ec2/multipart_user_data.rb', line 35 def add_commands(*commands) commands.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "commands[#{index}]") end jsii_call_method("addCommands", [*commands]) end |
#add_execute_file_command(params) ⇒ void
This method returns an undefined value.
Adds commands to execute a file.
46 47 48 49 50 |
# File 'ec2/multipart_user_data.rb', line 46 def add_execute_file_command(params) params = params.is_a?(Hash) ? ::AWSCDK::EC2::ExecuteFileOptions.new(**params.transform_keys(&:to_sym)) : params Jsii::Type.check_type(params, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLkV4ZWN1dGVGaWxlT3B0aW9ucyJ9")), "params") jsii_call_method("addExecuteFileCommand", [params]) end |
#add_on_exit_commands(*commands) ⇒ void
This method returns an undefined value.
Add one or more commands to the user data that will run when the script exits.
56 57 58 59 60 61 |
# File 'ec2/multipart_user_data.rb', line 56 def add_on_exit_commands(*commands) commands.each_with_index do |item, index| Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "commands[#{index}]") end jsii_call_method("addOnExitCommands", [*commands]) end |
#add_part(part) ⇒ void
This method returns an undefined value.
Adds a part to the list of parts.
93 94 95 96 |
# File 'ec2/multipart_user_data.rb', line 93 def add_part(part) Jsii::Type.check_type(part, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLk11bHRpcGFydEJvZHkifQ==")), "part") jsii_call_method("addPart", [part]) end |
#add_s3_download_command(params) ⇒ String
Adds commands to download a file from S3.
67 68 69 70 71 |
# File 'ec2/multipart_user_data.rb', line 67 def add_s3_download_command(params) params = params.is_a?(Hash) ? ::AWSCDK::EC2::S3DownloadOptions.new(**params.transform_keys(&:to_sym)) : params Jsii::Type.check_type(params, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlMzRG93bmxvYWRPcHRpb25zIn0=")), "params") jsii_call_method("addS3DownloadCommand", [params]) end |
#add_signal_on_exit_command(resource) ⇒ void
This method returns an undefined value.
Adds a command which will send a cfn-signal when the user data script ends.
77 78 79 80 |
# File 'ec2/multipart_user_data.rb', line 77 def add_signal_on_exit_command(resource) Jsii::Type.check_type(resource, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZXNvdXJjZSJ9")), "resource") jsii_call_method("addSignalOnExitCommand", [resource]) end |
#add_user_data_part(user_data, content_type = nil, make_default = nil) ⇒ void
This method returns an undefined value.
Adds a multipart part based on a UserData object.
If make_default 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 make_default is false, then this is the same as calling:
multi_part = nil # AWSCDK::EC2::MultipartUserData
user_data = nil # AWSCDK::EC2::UserData
content_type = nil
multi_part.add_part(AWSCDK::EC2::MultipartBody.from_user_data(user_data, content_type))
An undefined make_default defaults to either:
trueif no default UserData has been set yet; orfalseif there is no default UserData set.
124 125 126 127 128 129 |
# File 'ec2/multipart_user_data.rb', line 124 def add_user_data_part(user_data, content_type = nil, make_default = 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::Type.check_type(make_default, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "makeDefault") unless make_default.nil? jsii_call_method("addUserDataPart", [user_data, content_type, make_default]) end |
#render ⇒ String
Render the UserData for use in a construct.
85 86 87 |
# File 'ec2/multipart_user_data.rb', line 85 def render() jsii_call_method("render", []) end |