CachePolicyArgs

data class CachePolicyArgs(val comment: Output<String>? = null, val defaultTtl: Output<Int>? = null, val maxTtl: Output<Int>? = null, val minTtl: Output<Int>? = null, val name: Output<String>? = null, val parametersInCacheKeyAndForwardedToOrigin: Output<CachePolicyParametersInCacheKeyAndForwardedToOriginArgs>? = null) : ConvertibleToJava<CachePolicyArgs>

Example Usage

The following example below creates a CloudFront cache policy.

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudfront.CachePolicy;
import com.pulumi.aws.cloudfront.CachePolicyArgs;
import com.pulumi.aws.cloudfront.inputs.CachePolicyParametersInCacheKeyAndForwardedToOriginArgs;
import com.pulumi.aws.cloudfront.inputs.CachePolicyParametersInCacheKeyAndForwardedToOriginCookiesConfigArgs;
import com.pulumi.aws.cloudfront.inputs.CachePolicyParametersInCacheKeyAndForwardedToOriginCookiesConfigCookiesArgs;
import com.pulumi.aws.cloudfront.inputs.CachePolicyParametersInCacheKeyAndForwardedToOriginHeadersConfigArgs;
import com.pulumi.aws.cloudfront.inputs.CachePolicyParametersInCacheKeyAndForwardedToOriginHeadersConfigHeadersArgs;
import com.pulumi.aws.cloudfront.inputs.CachePolicyParametersInCacheKeyAndForwardedToOriginQueryStringsConfigArgs;
import com.pulumi.aws.cloudfront.inputs.CachePolicyParametersInCacheKeyAndForwardedToOriginQueryStringsConfigQueryStringsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new CachePolicy("example", CachePolicyArgs.builder()
.comment("test comment")
.defaultTtl(50)
.maxTtl(100)
.minTtl(1)
.parametersInCacheKeyAndForwardedToOrigin(CachePolicyParametersInCacheKeyAndForwardedToOriginArgs.builder()
.cookiesConfig(CachePolicyParametersInCacheKeyAndForwardedToOriginCookiesConfigArgs.builder()
.cookieBehavior("whitelist")
.cookies(CachePolicyParametersInCacheKeyAndForwardedToOriginCookiesConfigCookiesArgs.builder()
.items("example")
.build())
.build())
.headersConfig(CachePolicyParametersInCacheKeyAndForwardedToOriginHeadersConfigArgs.builder()
.headerBehavior("whitelist")
.headers(CachePolicyParametersInCacheKeyAndForwardedToOriginHeadersConfigHeadersArgs.builder()
.items("example")
.build())
.build())
.queryStringsConfig(CachePolicyParametersInCacheKeyAndForwardedToOriginQueryStringsConfigArgs.builder()
.queryStringBehavior("whitelist")
.queryStrings(CachePolicyParametersInCacheKeyAndForwardedToOriginQueryStringsConfigQueryStringsArgs.builder()
.items("example")
.build())
.build())
.build())
.build());
}
}

Import

Cloudfront Cache Policies can be imported using the id, e.g.,

$ pulumi import aws:cloudfront/cachePolicy:CachePolicy policy 658327ea-f89d-4fab-a63d-7e88639e58f6

Constructors

Link copied to clipboard
constructor(comment: Output<String>? = null, defaultTtl: Output<Int>? = null, maxTtl: Output<Int>? = null, minTtl: Output<Int>? = null, name: Output<String>? = null, parametersInCacheKeyAndForwardedToOrigin: Output<CachePolicyParametersInCacheKeyAndForwardedToOriginArgs>? = null)

Properties

Link copied to clipboard
val comment: Output<String>? = null

A comment to describe the cache policy.

Link copied to clipboard
val defaultTtl: Output<Int>? = null

The default amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.

Link copied to clipboard
val maxTtl: Output<Int>? = null

The maximum amount of time, in seconds, that objects stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.

Link copied to clipboard
val minTtl: Output<Int>? = null

The minimum amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.

Link copied to clipboard
val name: Output<String>? = null

A unique name to identify the cache policy.

Link copied to clipboard

The HTTP headers, cookies, and URL query strings to include in the cache key. See Parameters In Cache Key And Forwarded To Origin for more information.

Functions

Link copied to clipboard
open override fun toJava(): CachePolicyArgs