Class CachePolicyProps.Builder
java.lang.Object
software.amazon.awscdk.services.cloudfront.CachePolicyProps.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<CachePolicyProps>
- Enclosing interface:
CachePolicyProps
@Stability(Stable)
public static final class CachePolicyProps.Builder
extends Object
implements software.amazon.jsii.Builder<CachePolicyProps>
A builder for
CachePolicyProps
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the configured instance.cachePolicyName
(String cachePolicyName) Sets the value ofCachePolicyProps.getCachePolicyName()
Sets the value ofCachePolicyProps.getComment()
cookieBehavior
(CacheCookieBehavior cookieBehavior) Sets the value ofCachePolicyProps.getCookieBehavior()
defaultTtl
(Duration defaultTtl) Sets the value ofCachePolicyProps.getDefaultTtl()
enableAcceptEncodingBrotli
(Boolean enableAcceptEncodingBrotli) Sets the value ofCachePolicyProps.getEnableAcceptEncodingBrotli()
enableAcceptEncodingGzip
(Boolean enableAcceptEncodingGzip) Sets the value ofCachePolicyProps.getEnableAcceptEncodingGzip()
headerBehavior
(CacheHeaderBehavior headerBehavior) Sets the value ofCachePolicyProps.getHeaderBehavior()
Sets the value ofCachePolicyProps.getMaxTtl()
Sets the value ofCachePolicyProps.getMinTtl()
queryStringBehavior
(CacheQueryStringBehavior queryStringBehavior) Sets the value ofCachePolicyProps.getQueryStringBehavior()
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
cachePolicyName
Sets the value ofCachePolicyProps.getCachePolicyName()
- Parameters:
cachePolicyName
- A unique name to identify the cache policy. The name must only include '-', '_', or alphanumeric characters.- Returns:
this
-
comment
Sets the value ofCachePolicyProps.getComment()
- Parameters:
comment
- A comment to describe the cache policy. The comment cannot be longer than 128 characters.- Returns:
this
-
cookieBehavior
@Stability(Stable) public CachePolicyProps.Builder cookieBehavior(CacheCookieBehavior cookieBehavior) Sets the value ofCachePolicyProps.getCookieBehavior()
- Parameters:
cookieBehavior
- Determines whether any cookies in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin.- Returns:
this
-
defaultTtl
Sets the value ofCachePolicyProps.getDefaultTtl()
- Parameters:
defaultTtl
- The default amount of time for objects to stay in the CloudFront cache. Only used when the origin does not send Cache-Control or Expires headers with the object.- Returns:
this
-
enableAcceptEncodingBrotli
@Stability(Stable) public CachePolicyProps.Builder enableAcceptEncodingBrotli(Boolean enableAcceptEncodingBrotli) Sets the value ofCachePolicyProps.getEnableAcceptEncodingBrotli()
- Parameters:
enableAcceptEncodingBrotli
- Whether to normalize and include theAccept-Encoding
header in the cache key when theAccept-Encoding
header is 'br'.- Returns:
this
-
enableAcceptEncodingGzip
@Stability(Stable) public CachePolicyProps.Builder enableAcceptEncodingGzip(Boolean enableAcceptEncodingGzip) Sets the value ofCachePolicyProps.getEnableAcceptEncodingGzip()
- Parameters:
enableAcceptEncodingGzip
- Whether to normalize and include theAccept-Encoding
header in the cache key when theAccept-Encoding
header is 'gzip'.- Returns:
this
-
headerBehavior
@Stability(Stable) public CachePolicyProps.Builder headerBehavior(CacheHeaderBehavior headerBehavior) Sets the value ofCachePolicyProps.getHeaderBehavior()
- Parameters:
headerBehavior
- Determines whether any HTTP headers are included in the cache key and automatically included in requests that CloudFront sends to the origin.- Returns:
this
-
maxTtl
Sets the value ofCachePolicyProps.getMaxTtl()
- Parameters:
maxTtl
- The maximum amount of time for objects to stay in the CloudFront cache. CloudFront uses this value only when the origin sends Cache-Control or Expires headers with the object.- Returns:
this
-
minTtl
Sets the value ofCachePolicyProps.getMinTtl()
- Parameters:
minTtl
- The minimum amount of time for objects to stay in the CloudFront cache.- Returns:
this
-
queryStringBehavior
@Stability(Stable) public CachePolicyProps.Builder queryStringBehavior(CacheQueryStringBehavior queryStringBehavior) Sets the value ofCachePolicyProps.getQueryStringBehavior()
- Parameters:
queryStringBehavior
- Determines whether any query strings are included in the cache key and automatically included in requests that CloudFront sends to the origin.- Returns:
this
-
build
Builds the configured instance.- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<CachePolicyProps>
- Returns:
- a new instance of
CachePolicyProps
- Throws:
NullPointerException
- if any required attribute was not provided
-