package awscloudfront import ( _init_ "github.com/aws/aws-cdk-go/awscdk/v2/jsii" _jsii_ "github.com/aws/jsii-runtime-go/runtime" ) // Determines whether any cookies in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin. // // Example: // // Creating a custom cache policy for a Distribution -- all parameters optional // var bucketOrigin s3Origin // // myCachePolicy := cloudfront.NewCachePolicy(this, jsii.String("myCachePolicy"), &CachePolicyProps{ // CachePolicyName: jsii.String("MyPolicy"), // Comment: jsii.String("A default policy"), // DefaultTtl: awscdk.Duration_Days(jsii.Number(2)), // MinTtl: awscdk.Duration_Minutes(jsii.Number(1)), // MaxTtl: awscdk.Duration_*Days(jsii.Number(10)), // CookieBehavior: cloudfront.CacheCookieBehavior_All(), // HeaderBehavior: cloudfront.CacheHeaderBehavior_AllowList(jsii.String("X-CustomHeader")), // QueryStringBehavior: cloudfront.CacheQueryStringBehavior_DenyList(jsii.String("username")), // EnableAcceptEncodingGzip: jsii.Boolean(true), // EnableAcceptEncodingBrotli: jsii.Boolean(true), // }) // cloudfront.NewDistribution(this, jsii.String("myDistCustomPolicy"), &DistributionProps{ // DefaultBehavior: &BehaviorOptions{ // Origin: bucketOrigin, // CachePolicy: myCachePolicy, // }, // }) // type CacheCookieBehavior interface { // The behavior of cookies: allow all, none, an allow list, or a deny list. Behavior() *string // The cookies to allow or deny, if the behavior is an allow or deny list. Cookies() *[]*string } // The jsii proxy struct for CacheCookieBehavior type jsiiProxy_CacheCookieBehavior struct { _ byte // padding } func (j *jsiiProxy_CacheCookieBehavior) Behavior() *string { var returns *string _jsii_.Get( j, "behavior", &returns, ) return returns } func (j *jsiiProxy_CacheCookieBehavior) Cookies() *[]*string { var returns *[]*string _jsii_.Get( j, "cookies", &returns, ) return returns } // All cookies in viewer requests are included in the cache key and are automatically included in requests that CloudFront sends to the origin. func CacheCookieBehavior_All() CacheCookieBehavior { _init_.Initialize() var returns CacheCookieBehavior _jsii_.StaticInvoke( "aws-cdk-lib.aws_cloudfront.CacheCookieBehavior", "all", nil, // no parameters &returns, ) return returns } // Only the provided `cookies` are included in the cache key and automatically included in requests that CloudFront sends to the origin. func CacheCookieBehavior_AllowList(cookies ...*string) CacheCookieBehavior { _init_.Initialize() args := []interface{}{} for _, a := range cookies { args = append(args, a) } var returns CacheCookieBehavior _jsii_.StaticInvoke( "aws-cdk-lib.aws_cloudfront.CacheCookieBehavior", "allowList", args, &returns, ) return returns } // All cookies except the provided `cookies` are included in the cache key and automatically included in requests that CloudFront sends to the origin. func CacheCookieBehavior_DenyList(cookies ...*string) CacheCookieBehavior { _init_.Initialize() args := []interface{}{} for _, a := range cookies { args = append(args, a) } var returns CacheCookieBehavior _jsii_.StaticInvoke( "aws-cdk-lib.aws_cloudfront.CacheCookieBehavior", "denyList", args, &returns, ) return returns } // Cookies in viewer requests are not included in the cache key and are not automatically included in requests that CloudFront sends to the origin. func CacheCookieBehavior_None() CacheCookieBehavior { _init_.Initialize() var returns CacheCookieBehavior _jsii_.StaticInvoke( "aws-cdk-lib.aws_cloudfront.CacheCookieBehavior", "none", nil, // no parameters &returns, ) return returns }