Class: AWSCDK::CloudFront::CfnDistribution::LambdaFunctionAssociationProperty

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

Overview

A complex type that contains a Lambda@Edge function association.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_type: nil, include_body: nil, lambda_function_arn: nil) ⇒ LambdaFunctionAssociationProperty

Returns a new instance of LambdaFunctionAssociationProperty.

Parameters:

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

    Specifies the event type that triggers a Lambda@Edge function invocation. You can specify the following values:.

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

    A flag that allows a Lambda@Edge function to have read access to the body content.

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

    The ARN of the Lambda@Edge function.



2241
2242
2243
2244
2245
2246
2247
2248
# File 'cloud_front/cfn_distribution.rb', line 2241

def initialize(event_type: nil, include_body: nil, lambda_function_arn: nil)
  @event_type = event_type
  Jsii::Type.check_type(@event_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "eventType") unless @event_type.nil?
  @include_body = include_body
  Jsii::Type.check_type(@include_body, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "includeBody") unless @include_body.nil?
  @lambda_function_arn = lambda_function_arn
  Jsii::Type.check_type(@lambda_function_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "lambdaFunctionArn") unless @lambda_function_arn.nil?
end

Instance Attribute Details

#event_typeString? (readonly)

Specifies the event type that triggers a Lambda@Edge function invocation. You can specify the following values:.

  • viewer-request : The function executes when CloudFront receives a request from a viewer and before it checks to see whether the requested object is in the edge cache.
  • origin-request : The function executes only when CloudFront sends a request to your origin. When the requested object is in the edge cache, the function doesn't execute.
  • origin-response : The function executes after CloudFront receives a response from the origin and before it caches the object in the response. When the requested object is in the edge cache, the function doesn't execute.
  • viewer-response : The function executes before CloudFront returns the requested object to the viewer. The function executes regardless of whether the object was already in the edge cache.

If the origin returns an HTTP status code other than HTTP 200 (OK), the function doesn't execute.



2261
2262
2263
# File 'cloud_front/cfn_distribution.rb', line 2261

def event_type
  @event_type
end

#include_bodyBoolean, ... (readonly)

A flag that allows a Lambda@Edge function to have read access to the body content.

For more information, see Accessing the Request Body by Choosing the Include Body Option in the Amazon CloudFront Developer Guide.



2268
2269
2270
# File 'cloud_front/cfn_distribution.rb', line 2268

def include_body
  @include_body
end

#lambda_function_arnString? (readonly)

The ARN of the Lambda@Edge function.

You must specify the ARN of a function version; you can't specify an alias or $LATEST.



2275
2276
2277
# File 'cloud_front/cfn_distribution.rb', line 2275

def lambda_function_arn
  @lambda_function_arn
end

Class Method Details

.jsii_propertiesObject



2277
2278
2279
2280
2281
2282
2283
# File 'cloud_front/cfn_distribution.rb', line 2277

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

Instance Method Details

#to_jsiiObject



2285
2286
2287
2288
2289
2290
2291
2292
2293
# File 'cloud_front/cfn_distribution.rb', line 2285

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