Skip to content
v2.278.0

CfnCachePolicyProps Struct ​

Properties for defining a CfnCachePolicy.

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 cfnCachePolicyProps: cloudfront.CfnCachePolicyProps = {
  cachePolicyConfig: {
    defaultTtl: 123,
    maxTtl: 123,
    minTtl: 123,
    name: 'name',
    parametersInCacheKeyAndForwardedToOrigin: {
      cookiesConfig: {
        cookieBehavior: 'cookieBehavior',

        // the properties below are optional
        cookies: ['cookies'],
      },
      enableAcceptEncodingGzip: false,
      headersConfig: {
        headerBehavior: 'headerBehavior',

        // the properties below are optional
        headers: ['headers'],
      },
      queryStringsConfig: {
        queryStringBehavior: 'queryStringBehavior',

        // the properties below are optional
        queryStrings: ['queryStrings'],
      },

      // the properties below are optional
      enableAcceptEncodingBrotli: false,
    },

    // the properties below are optional
    comment: 'comment',
  },
};
python
# 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_cache_policy_props = cloudfront.CfnCachePolicyProps(
    cache_policy_config=cloudfront.CfnCachePolicy.CachePolicyConfigProperty(
        default_ttl=123,
        max_ttl=123,
        min_ttl=123,
        name="name",
        parameters_in_cache_key_and_forwarded_to_origin=cloudfront.CfnCachePolicy.ParametersInCacheKeyAndForwardedToOriginProperty(
            cookies_config=cloudfront.CfnCachePolicy.CookiesConfigProperty(
                cookie_behavior="cookieBehavior",

                # the properties below are optional
                cookies=["cookies"]
            ),
            enable_accept_encoding_gzip=False,
            headers_config=cloudfront.CfnCachePolicy.HeadersConfigProperty(
                header_behavior="headerBehavior",

                # the properties below are optional
                headers=["headers"]
            ),
            query_strings_config=cloudfront.CfnCachePolicy.QueryStringsConfigProperty(
                query_string_behavior="queryStringBehavior",

                # the properties below are optional
                query_strings=["queryStrings"]
            ),

            # the properties below are optional
            enable_accept_encoding_brotli=False
        ),

        # the properties below are optional
        comment="comment"
    )
)
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.*;

CfnCachePolicyProps cfnCachePolicyProps = CfnCachePolicyProps.builder()
        .cachePolicyConfig(CachePolicyConfigProperty.builder()
                .defaultTtl(123)
                .maxTtl(123)
                .minTtl(123)
                .name("name")
                .parametersInCacheKeyAndForwardedToOrigin(ParametersInCacheKeyAndForwardedToOriginProperty.builder()
                        .cookiesConfig(CookiesConfigProperty.builder()
                                .cookieBehavior("cookieBehavior")

                                // the properties below are optional
                                .cookies(List.of("cookies"))
                                .build())
                        .enableAcceptEncodingGzip(false)
                        .headersConfig(HeadersConfigProperty.builder()
                                .headerBehavior("headerBehavior")

                                // the properties below are optional
                                .headers(List.of("headers"))
                                .build())
                        .queryStringsConfig(QueryStringsConfigProperty.builder()
                                .queryStringBehavior("queryStringBehavior")

                                // the properties below are optional
                                .queryStrings(List.of("queryStrings"))
                                .build())

                        // the properties below are optional
                        .enableAcceptEncodingBrotli(false)
                        .build())

                // the properties below are optional
                .comment("comment")
                .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 cfnCachePolicyProps = new CfnCachePolicyProps {
    CachePolicyConfig = new CachePolicyConfigProperty {
        DefaultTtl = 123,
        MaxTtl = 123,
        MinTtl = 123,
        Name = "name",
        ParametersInCacheKeyAndForwardedToOrigin = new ParametersInCacheKeyAndForwardedToOriginProperty {
            CookiesConfig = new CookiesConfigProperty {
                CookieBehavior = "cookieBehavior",

                // the properties below are optional
                Cookies = new [] { "cookies" }
            },
            EnableAcceptEncodingGzip = false,
            HeadersConfig = new HeadersConfigProperty {
                HeaderBehavior = "headerBehavior",

                // the properties below are optional
                Headers = new [] { "headers" }
            },
            QueryStringsConfig = new QueryStringsConfigProperty {
                QueryStringBehavior = "queryStringBehavior",

                // the properties below are optional
                QueryStrings = new [] { "queryStrings" }
            },

            // the properties below are optional
            EnableAcceptEncodingBrotli = false
        },

        // the properties below are optional
        Comment = "comment"
    }
};
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"

cfnCachePolicyProps := &CfnCachePolicyProps{
	CachePolicyConfig: &CachePolicyConfigProperty{
		DefaultTtl: jsii.Number(123),
		MaxTtl: jsii.Number(123),
		MinTtl: jsii.Number(123),
		Name: jsii.String("name"),
		ParametersInCacheKeyAndForwardedToOrigin: &ParametersInCacheKeyAndForwardedToOriginProperty{
			CookiesConfig: &CookiesConfigProperty{
				CookieBehavior: jsii.String("cookieBehavior"),

				// the properties below are optional
				Cookies: []*string{
					jsii.String("cookies"),
				},
			},
			EnableAcceptEncodingGzip: jsii.Boolean(false),
			HeadersConfig: &HeadersConfigProperty{
				HeaderBehavior: jsii.String("headerBehavior"),

				// the properties below are optional
				Headers: []*string{
					jsii.String("headers"),
				},
			},
			QueryStringsConfig: &QueryStringsConfigProperty{
				QueryStringBehavior: jsii.String("queryStringBehavior"),

				// the properties below are optional
				QueryStrings: []*string{
					jsii.String("queryStrings"),
				},
			},

			// the properties below are optional
			EnableAcceptEncodingBrotli: jsii.Boolean(false),
		},

		// the properties below are optional
		Comment: jsii.String("comment"),
	},
}

Properties ​

cachePolicyConfigIResolvable | CfnCachePolicy.CachePolicyConfigPropertycache_policy_configtyping.Union[IResolvable, CachePolicyConfigProperty]cachePolicyConfigIResolvableCachePolicyConfigIResolvableCachePolicyConfiginterface{} required #
The cache policy configuration.