Class: AWSCDK::CloudFront::EdgeLambda

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
cloud_front/edge_lambda.rb

Overview

Represents a Lambda function version and event type when using Lambda@Edge.

The type of the AddBehaviorOptions.edgeLambdas property.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_type:, function_version:, include_body: nil) ⇒ EdgeLambda

Returns a new instance of EdgeLambda.

Parameters:

  • event_type (AWSCDK::CloudFront::LambdaEdgeEventType)

    The type of event in response to which should the function be invoked.

  • function_version (AWSCDK::Lambda::IVersion)

    The version of the Lambda function that will be invoked.

  • include_body (Boolean, nil) (defaults to: nil)

    Allows a Lambda function to have read access to the body content.



12
13
14
15
16
17
18
19
# File 'cloud_front/edge_lambda.rb', line 12

def initialize(event_type:, function_version:, include_body: nil)
  @event_type = event_type
  Jsii::Type.check_type(@event_type, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5MYW1iZGFFZGdlRXZlbnRUeXBlIn0=")), "eventType")
  @function_version = function_version
  Jsii::Type.check_type(@function_version, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfbGFtYmRhLklWZXJzaW9uIn0=")), "functionVersion")
  @include_body = include_body
  Jsii::Type.check_type(@include_body, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "includeBody") unless @include_body.nil?
end

Instance Attribute Details

#event_typeAWSCDK::CloudFront::LambdaEdgeEventType (readonly)

The type of event in response to which should the function be invoked.



24
25
26
# File 'cloud_front/edge_lambda.rb', line 24

def event_type
  @event_type
end

#function_versionAWSCDK::Lambda::IVersion (readonly)

The version of the Lambda function that will be invoked.

Note: it's not possible to use the '$LATEST' function version for Lambda@Edge!



30
31
32
# File 'cloud_front/edge_lambda.rb', line 30

def function_version
  @function_version
end

#include_bodyBoolean? (readonly)

Note:

Default: false

Allows a Lambda function to have read access to the body content.

Only valid for "request" event types (ORIGIN_REQUEST or VIEWER_REQUEST). See https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-include-body-access.html

Returns:

  • (Boolean, nil)


38
39
40
# File 'cloud_front/edge_lambda.rb', line 38

def include_body
  @include_body
end

Class Method Details

.jsii_propertiesObject



40
41
42
43
44
45
46
# File 'cloud_front/edge_lambda.rb', line 40

def self.jsii_properties
  {
    :event_type => "eventType",
    :function_version => "functionVersion",
    :include_body => "includeBody",
  }
end

Instance Method Details

#to_jsiiObject



48
49
50
51
52
53
54
55
56
# File 'cloud_front/edge_lambda.rb', line 48

def to_jsii
  result = {}
  result.merge!({
    "eventType" => @event_type,
    "functionVersion" => @function_version,
    "includeBody" => @include_body,
  })
  result.compact
end