Class: AWSCDK::Lambda::CodeConfig

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
lambda/code_config.rb

Overview

Result of binding Code into a Function.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(image: nil, inline_code: nil, s3_location: nil, source_kms_key_arn: nil) ⇒ CodeConfig

Returns a new instance of CodeConfig.

Parameters:

  • image (AWSCDK::Lambda::CodeImageConfig, nil) (defaults to: nil)

    Docker image configuration (mutually exclusive with s3Location and inlineCode).

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

    Inline code (mutually exclusive with s3Location and image).

  • s3_location (AWSCDK::S3::Location, nil) (defaults to: nil)

    The location of the code in S3 (mutually exclusive with inlineCode and image).

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

    The ARN of the KMS key used to encrypt the handler code.



11
12
13
14
15
16
17
18
19
20
# File 'lambda/code_config.rb', line 11

def initialize(image: nil, inline_code: nil, s3_location: nil, source_kms_key_arn: nil)
  @image = image.is_a?(Hash) ? ::AWSCDK::Lambda::CodeImageConfig.new(**image.transform_keys(&:to_sym)) : image
  Jsii::Type.check_type(@image, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLkNvZGVJbWFnZUNvbmZpZyJ9")), "image") unless @image.nil?
  @inline_code = inline_code
  Jsii::Type.check_type(@inline_code, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "inlineCode") unless @inline_code.nil?
  @s3_location = s3_location.is_a?(Hash) ? ::AWSCDK::S3::Location.new(**s3_location.transform_keys(&:to_sym)) : s3_location
  Jsii::Type.check_type(@s3_location, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuTG9jYXRpb24ifQ==")), "s3Location") unless @s3_location.nil?
  @source_kms_key_arn = source_kms_key_arn
  Jsii::Type.check_type(@source_kms_key_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "sourceKMSKeyArn") unless @source_kms_key_arn.nil?
end

Instance Attribute Details

#imageAWSCDK::Lambda::CodeImageConfig? (readonly)

Note:

Default: - code is not an ECR container image

Docker image configuration (mutually exclusive with s3Location and inlineCode).



26
27
28
# File 'lambda/code_config.rb', line 26

def image
  @image
end

#inline_codeString? (readonly)

Note:

Default: - code is not inline code

Inline code (mutually exclusive with s3Location and image).

Returns:

  • (String, nil)


31
32
33
# File 'lambda/code_config.rb', line 31

def inline_code
  @inline_code
end

#s3_locationAWSCDK::S3::Location? (readonly)

Note:

Default: - code is not an s3 location

The location of the code in S3 (mutually exclusive with inlineCode and image).

Returns:



36
37
38
# File 'lambda/code_config.rb', line 36

def s3_location
  @s3_location
end

#source_kms_key_arnString? (readonly)

Note:

Default: - the default server-side encryption with Amazon S3 managed keys(SSE-S3) key will be used.

The ARN of the KMS key used to encrypt the handler code.

Returns:

  • (String, nil)


41
42
43
# File 'lambda/code_config.rb', line 41

def source_kms_key_arn
  @source_kms_key_arn
end

Class Method Details

.jsii_propertiesObject



43
44
45
46
47
48
49
50
# File 'lambda/code_config.rb', line 43

def self.jsii_properties
  {
    :image => "image",
    :inline_code => "inlineCode",
    :s3_location => "s3Location",
    :source_kms_key_arn => "sourceKMSKeyArn",
  }
end

Instance Method Details

#to_jsiiObject



52
53
54
55
56
57
58
59
60
61
# File 'lambda/code_config.rb', line 52

def to_jsii
  result = {}
  result.merge!({
    "image" => @image,
    "inlineCode" => @inline_code,
    "s3Location" => @s3_location,
    "sourceKMSKeyArn" => @source_kms_key_arn,
  })
  result.compact
end