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

Use the aws.cloudfront.CachePolicy resource to create a cache policy for CloudFront.

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

Using pulumi import, import CloudFront cache policies using the id of the cache policy. For example:

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

Constructors

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

Functions

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

Properties

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

Description for the cache policy.

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

Amount of time, in seconds, that objects are allowed to remain in the CloudFront cache before CloudFront sends a new request to the origin server to check if the object has been updated.

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

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

Minimum amount of time, in seconds, that objects should remain in the CloudFront cache before a new request is sent to the origin to check for updates.

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

Unique name used to identify the cache policy.

Link copied to clipboard

Configuration for including HTTP headers, cookies, and URL query strings in the cache key. For more information, refer to the Parameters In Cache Key And Forwarded To Origin section.