Interface Behavior
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
Behavior.Jsii$Proxy
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import software.amazon.awscdk.*; import software.amazon.awscdk.services.cloudfront.*; import software.amazon.awscdk.services.lambda.*; Function function_; KeyGroup keyGroup; Version version; Behavior behavior = Behavior.builder() .allowedMethods(CloudFrontAllowedMethods.GET_HEAD) .cachedMethods(CloudFrontAllowedCachedMethods.GET_HEAD) .compress(false) .defaultTtl(Duration.minutes(30)) .forwardedValues(ForwardedValuesProperty.builder() .queryString(false) // the properties below are optional .cookies(CookiesProperty.builder() .forward("forward") // the properties below are optional .whitelistedNames(List.of("whitelistedNames")) .build()) .headers(List.of("headers")) .queryStringCacheKeys(List.of("queryStringCacheKeys")) .build()) .functionAssociations(List.of(FunctionAssociation.builder() .eventType(FunctionEventType.VIEWER_REQUEST) .function(function_) .build())) .isDefaultBehavior(false) .lambdaFunctionAssociations(List.of(LambdaFunctionAssociation.builder() .eventType(LambdaEdgeEventType.ORIGIN_REQUEST) .lambdaFunction(version) // the properties below are optional .includeBody(false) .build())) .maxTtl(Duration.minutes(30)) .minTtl(Duration.minutes(30)) .pathPattern("pathPattern") .trustedKeyGroups(List.of(keyGroup)) .trustedSigners(List.of("trustedSigners")) .viewerProtocolPolicy(ViewerProtocolPolicy.HTTPS_ONLY) .build();
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Behavior.Builder
builder()
default CloudFrontAllowedMethods
The method this CloudFront distribution responds do.default CloudFrontAllowedCachedMethods
Which methods are cached by CloudFront by default.default Boolean
If CloudFront should automatically compress some content types.default Duration
The default amount of time CloudFront will cache an object.The values CloudFront will forward to the origin when making a request.default List<FunctionAssociation>
The CloudFront functions to invoke before serving the contents.default Boolean
If this behavior is the default behavior for the distribution.default List<LambdaFunctionAssociation>
Declares associated lambda@edge functions for this distribution behaviour.default Duration
The max amount of time you want objects to stay in the cache before CloudFront queries your origin.default Duration
The minimum amount of time that you want objects to stay in the cache before CloudFront queries your origin.default String
The path this behavior responds to.A list of Key Groups that CloudFront can use to validate signed URLs or signed cookies.Deprecated.We recommend using trustedKeyGroups instead of trustedSigners.default ViewerProtocolPolicy
The viewer policy for this behavior.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getAllowedMethods
The method this CloudFront distribution responds do.Default: GET_HEAD
-
getCachedMethods
Which methods are cached by CloudFront by default.Default: GET_HEAD
-
getCompress
If CloudFront should automatically compress some content types.Default: true
-
getDefaultTtl
The default amount of time CloudFront will cache an object.This value applies only when your custom origin does not add HTTP headers, such as Cache-Control max-age, Cache-Control s-maxage, and Expires to objects.
Default: 86400 (1 day)
-
getForwardedValues
The values CloudFront will forward to the origin when making a request.Default: none (no cookies - no headers)
-
getFunctionAssociations
The CloudFront functions to invoke before serving the contents.Default: - no functions will be invoked
-
getIsDefaultBehavior
If this behavior is the default behavior for the distribution.You must specify exactly one default distribution per CloudFront distribution. The default behavior is allowed to omit the "path" property.
-
getLambdaFunctionAssociations
@Stability(Stable) @Nullable default List<LambdaFunctionAssociation> getLambdaFunctionAssociations()Declares associated lambda@edge functions for this distribution behaviour.Default: No lambda function associated
-
getMaxTtl
The max amount of time you want objects to stay in the cache before CloudFront queries your origin.Default: Duration.seconds(31536000) (one year)
-
getMinTtl
The minimum amount of time that you want objects to stay in the cache before CloudFront queries your origin. -
getPathPattern
The path this behavior responds to.Required for all non-default behaviors. (The default behavior implicitly has "*" as the path pattern. )
-
getTrustedKeyGroups
A list of Key Groups that CloudFront can use to validate signed URLs or signed cookies.Default: - no KeyGroups are associated with cache behavior
- See Also:
-
getTrustedSigners
Deprecated.- We recommend using trustedKeyGroups instead of trustedSigners.
(deprecated) Trusted signers is how CloudFront allows you to serve private content.The signers are the account IDs that are allowed to sign cookies/presigned URLs for this distribution.
If you pass a non empty value, all requests for this behavior must be signed (no public access will be allowed)
-
getViewerProtocolPolicy
The viewer policy for this behavior.Default: - the distribution wide viewer protocol policy will be used
-
builder
- Returns:
- a
Behavior.Builder
ofBehavior
-