Skip to content
v2.274.0

CfnFunctionProps Struct ​

Properties for defining a CfnFunction.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_cloudfront as cloudfront } from 'aws-cdk-lib';
const cfnFunctionProps: cloudfront.CfnFunctionProps = {
  functionCode: 'functionCode',
  functionConfig: {
    comment: 'comment',
    runtime: 'runtime',

    // the properties below are optional
    keyValueStoreAssociations: [{
      keyValueStoreArn: 'keyValueStoreArn',
    }],
  },
  name: 'name',

  // the properties below are optional
  autoPublish: false,
  functionMetadata: {
    functionArn: 'functionArn',
  },
  tags: [{
    key: 'key',
    value: 'value',
  }],
};

Properties ​

autoPublishoptionalboolean | IResolvableauto_publishoptionaltyping.Union[bool, IResolvable]autoPublishoptionalBooleanAutoPublishoptionalboolAutoPublishoptionalinterface{}#
A flag that determines whether to automatically publish the function to the `LIVE` stage when it’s created.

To automatically publish to the LIVE stage, set this property to true .

functionCodestringfunction_codestrfunctionCodeStringFunctionCodestringFunctionCode*stringrequired#
The function code.
notes

For more information about writing a CloudFront function, see Writing function code for CloudFront Functions in the Amazon CloudFront Developer Guide .

functionConfigIResolvable | CfnFunction.FunctionConfigPropertyfunction_configtyping.Union[IResolvable, FunctionConfigProperty]functionConfigIResolvableFunctionConfigIResolvableFunctionConfiginterface{}required#
Contains configuration information about a CloudFront function.
functionMetadataoptionalIResolvable | CfnFunction.FunctionMetadataPropertyfunction_metadataoptionaltyping.Union[IResolvable, FunctionMetadataProperty]functionMetadataoptionalIResolvableFunctionMetadataoptionalIResolvableFunctionMetadataoptionalinterface{}#
Contains metadata about a CloudFront function.
namestringnamestrnameStringNamestringName*stringrequired#
A name to identify the function.
tagsoptionalCfnTag[]tagsoptionaltyping.List[CfnTag]tagsoptionalList<CfnTag>TagsoptionalCfnTag[]Tagsoptional*[]CfnTag#
A complex type that contains zero or more ``Tag`` elements.