Skip to content
v2.277.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',
  }],
};
python
from aws_cdk import CfnTag
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_cloudfront as cloudfront

cfn_function_props = cloudfront.CfnFunctionProps(
    function_code="functionCode",
    function_config=cloudfront.CfnFunction.FunctionConfigProperty(
        comment="comment",
        runtime="runtime",

        # the properties below are optional
        key_value_store_associations=[cloudfront.CfnFunction.KeyValueStoreAssociationProperty(
            key_value_store_arn="keyValueStoreArn"
        )]
    ),
    name="name",

    # the properties below are optional
    auto_publish=False,
    function_metadata=cloudfront.CfnFunction.FunctionMetadataProperty(
        function_arn="functionArn"
    ),
    tags=[CfnTag(
        key="key",
        value="value"
    )]
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.cloudfront.*;

CfnFunctionProps cfnFunctionProps = CfnFunctionProps.builder()
        .functionCode("functionCode")
        .functionConfig(FunctionConfigProperty.builder()
                .comment("comment")
                .runtime("runtime")

                // the properties below are optional
                .keyValueStoreAssociations(List.of(KeyValueStoreAssociationProperty.builder()
                        .keyValueStoreArn("keyValueStoreArn")
                        .build()))
                .build())
        .name("name")

        // the properties below are optional
        .autoPublish(false)
        .functionMetadata(FunctionMetadataProperty.builder()
                .functionArn("functionArn")
                .build())
        .tags(List.of(CfnTag.builder()
                .key("key")
                .value("value")
                .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.CloudFront;

var cfnFunctionProps = new CfnFunctionProps {
    FunctionCode = "functionCode",
    FunctionConfig = new FunctionConfigProperty {
        Comment = "comment",
        Runtime = "runtime",

        // the properties below are optional
        KeyValueStoreAssociations = new [] { new KeyValueStoreAssociationProperty {
            KeyValueStoreArn = "keyValueStoreArn"
        } }
    },
    Name = "name",

    // the properties below are optional
    AutoPublish = false,
    FunctionMetadata = new FunctionMetadataProperty {
        FunctionArn = "functionArn"
    },
    Tags = new [] { new CfnTag {
        Key = "key",
        Value = "value"
    } }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnFunctionProps := &CfnFunctionProps{
	FunctionCode: jsii.String("functionCode"),
	FunctionConfig: &FunctionConfigProperty{
		Comment: jsii.String("comment"),
		Runtime: jsii.String("runtime"),

		// the properties below are optional
		KeyValueStoreAssociations: []interface{}{
			&KeyValueStoreAssociationProperty{
				KeyValueStoreArn: jsii.String("keyValueStoreArn"),
			},
		},
	},
	Name: jsii.String("name"),

	// the properties below are optional
	AutoPublish: jsii.Boolean(false),
	FunctionMetadata: &FunctionMetadataProperty{
		FunctionArn: jsii.String("functionArn"),
	},
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("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*string required #
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*string required #
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.