CachePolicy

class aws_cdk.aws_cloudfront.CachePolicy(scope, id, *, cache_policy_name=None, comment=None, cookie_behavior=None, default_ttl=None, enable_accept_encoding_brotli=None, enable_accept_encoding_gzip=None, header_behavior=None, max_ttl=None, min_ttl=None, query_string_behavior=None)

Bases: aws_cdk.core.Resource

(experimental) A Cache Policy configuration.

Stability

experimental

Resource

AWS::CloudFront::CachePolicy

Parameters
  • scope (Construct) –

  • id (str) –

  • cache_policy_name (Optional[str]) – (experimental) A unique name to identify the cache policy. The name must only include ‘-‘, ‘_’, or alphanumeric characters. Default: - generated from the id

  • comment (Optional[str]) – (experimental) A comment to describe the cache policy. Default: - no comment

  • cookie_behavior (Optional[CacheCookieBehavior]) – (experimental) Determines whether any cookies in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin. Default: CacheCookieBehavior.none()

  • default_ttl (Optional[Duration]) – (experimental) 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. Default: - The greater of 1 day and minTtl

  • enable_accept_encoding_brotli (Optional[bool]) – (experimental) Whether to normalize and include the Accept-Encoding header in the cache key when the Accept-Encoding header is ‘br’. Default: false

  • enable_accept_encoding_gzip (Optional[bool]) – (experimental) Whether to normalize and include the Accept-Encoding header in the cache key when the Accept-Encoding header is ‘gzip’. Default: false

  • header_behavior (Optional[CacheHeaderBehavior]) – (experimental) Determines whether any HTTP headers are included in the cache key and automatically included in requests that CloudFront sends to the origin. Default: CacheHeaderBehavior.none()

  • max_ttl (Optional[Duration]) – (experimental) 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. Default: - The greater of 1 year and defaultTtl

  • min_ttl (Optional[Duration]) – (experimental) The minimum amount of time for objects to stay in the CloudFront cache. Default: Duration.seconds(0)

  • query_string_behavior (Optional[CacheQueryStringBehavior]) – (experimental) Determines whether any query strings are included in the cache key and automatically included in requests that CloudFront sends to the origin. Default: CacheQueryStringBehavior.none()

Stability

experimental

Methods

to_string()

Returns a string representation of this construct.

Return type

str

Attributes

CACHING_DISABLED = <jsii._reference_map.InterfaceDynamicProxy object>
CACHING_OPTIMIZED = <jsii._reference_map.InterfaceDynamicProxy object>
CACHING_OPTIMIZED_FOR_UNCOMPRESSED_OBJECTS = <jsii._reference_map.InterfaceDynamicProxy object>
ELEMENTAL_MEDIA_PACKAGE = <jsii._reference_map.InterfaceDynamicProxy object>
cache_policy_id

(experimental) The ID of the cache policy.

Stability

experimental

Return type

str

env

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.

Return type

ResourceEnvironment

node

The construct tree node associated with this construct.

Return type

ConstructNode

stack

The stack in which this resource is defined.

Return type

Stack

Static Methods

classmethod from_cache_policy_id(scope, id, cache_policy_id)

(experimental) Imports a Cache Policy from its id.

Parameters
  • scope (Construct) –

  • id (str) –

  • cache_policy_id (str) –

Stability

experimental

Return type

ICachePolicy

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool