CfnCachePolicy
- class aws_cdk.aws_cloudfront.CfnCachePolicy(scope, id, *, cache_policy_config)
Bases:
CfnResource
A cache policy.
When it’s attached to a cache behavior, the cache policy determines the following:
The values that CloudFront includes in the cache key. These values can include HTTP headers, cookies, and URL query strings. CloudFront uses the cache key to find an object in its cache that it can return to the viewer.
The default, minimum, and maximum time to live (TTL) values that you want objects to stay in the CloudFront cache.
The headers, cookies, and query strings that are included in the cache key are also included in requests that CloudFront sends to the origin. CloudFront sends a request when it can’t find a valid object in its cache that matches the request’s cache key. If you want to send values to the origin but not include them in the cache key, use
OriginRequestPolicy
.- See:
- CloudformationResource:
AWS::CloudFront::CachePolicy
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_cloudfront as cloudfront cfn_cache_policy = cloudfront.CfnCachePolicy(self, "MyCfnCachePolicy", cache_policy_config=cloudfront.CfnCachePolicy.CachePolicyConfigProperty( default_ttl=123, max_ttl=123, min_ttl=123, name="name", parameters_in_cache_key_and_forwarded_to_origin=cloudfront.CfnCachePolicy.ParametersInCacheKeyAndForwardedToOriginProperty( cookies_config=cloudfront.CfnCachePolicy.CookiesConfigProperty( cookie_behavior="cookieBehavior", # the properties below are optional cookies=["cookies"] ), enable_accept_encoding_gzip=False, headers_config=cloudfront.CfnCachePolicy.HeadersConfigProperty( header_behavior="headerBehavior", # the properties below are optional headers=["headers"] ), query_strings_config=cloudfront.CfnCachePolicy.QueryStringsConfigProperty( query_string_behavior="queryStringBehavior", # the properties below are optional query_strings=["queryStrings"] ), # the properties below are optional enable_accept_encoding_brotli=False ), # the properties below are optional comment="comment" ) )
- Parameters:
scope (
Construct
) – Scope in which this resource is defined.id (
str
) – Construct identifier for this resource (unique in its scope).cache_policy_config (
Union
[IResolvable
,CachePolicyConfigProperty
,Dict
[str
,Any
]]) – The cache policy configuration.
Methods
- add_deletion_override(path)
Syntactic sugar for
addOverride(path, undefined)
.- Parameters:
path (
str
) – The path of the value to delete.- Return type:
None
- add_dependency(target)
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- add_depends_on(target)
(deprecated) Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
- Parameters:
target (
CfnResource
) –- Deprecated:
use addDependency
- Stability:
deprecated
- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –value (
Any
) –
- See:
- Return type:
None
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- add_override(path, value)
Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters:
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type:
None
- add_property_deletion_override(property_path)
Adds an override that deletes the value of a property from the resource definition.
- Parameters:
property_path (
str
) – The path to the property.- Return type:
None
- add_property_override(property_path, value)
Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters:
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type:
None
- apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)
Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT
). A list of resources that support this policy can be found in the following link:- Parameters:
policy (
Optional
[RemovalPolicy
]) –apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resource, please consult that specific resource’s documentation.
- See:
- Return type:
None
- get_att(attribute_name, type_hint=None)
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters:
attribute_name (
str
) – The name of the attribute.type_hint (
Optional
[ResolutionTypeHint
]) –
- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –- See:
- Return type:
Any
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) – tree inspector to collect and process attributes.- Return type:
None
- obtain_dependencies()
Retrieves an array of resources this resource depends on.
This assembles dependencies on resources across stacks (including nested stacks) automatically.
- Return type:
List
[Union
[Stack
,CfnResource
]]
- obtain_resource_dependencies()
Get a shallow copy of dependencies between this resource and other resources in the same stack.
- Return type:
List
[CfnResource
]
- override_logical_id(new_logical_id)
Overrides the auto-generated logical ID with a specific ID.
- Parameters:
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type:
None
- remove_dependency(target)
Indicates that this resource no longer depends on another resource.
This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- replace_dependency(target, new_target)
Replaces one dependency with another.
- Parameters:
target (
CfnResource
) – The dependency to replace.new_target (
CfnResource
) – The new dependency to add.
- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
- Returns:
a string representation of this resource
Attributes
- CFN_RESOURCE_TYPE_NAME = 'AWS::CloudFront::CachePolicy'
- attr_id
The unique identifier for the cache policy.
For example:
2766f7b2-75c5-41c6-8f06-bf4303a2f2f5
.- CloudformationAttribute:
Id
- attr_last_modified_time
The date and time when the cache policy was last modified.
- CloudformationAttribute:
LastModifiedTime
- cache_policy_config
The cache policy configuration.
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- creation_stack
return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- logical_id
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Returns:
the logical ID as a stringified token. This value will only get resolved during synthesis.
- node
The tree node.
- ref
Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
Static Methods
- classmethod is_cfn_element(x)
Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters:
x (
Any
) –- Return type:
bool
- Returns:
The construct as a stack element or undefined if it is not a stack element.
- classmethod is_cfn_resource(x)
Check whether the given object is a CfnResource.
- Parameters:
x (
Any
) –- Return type:
bool
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
instances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructs
library on disk are seen as independent, completely different libraries. As a consequence, the classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
the other class.npm install
will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.
CachePolicyConfigProperty
- class CfnCachePolicy.CachePolicyConfigProperty(*, default_ttl, max_ttl, min_ttl, name, parameters_in_cache_key_and_forwarded_to_origin, comment=None)
Bases:
object
A cache policy configuration.
This configuration determines the following:
The values that CloudFront includes in the cache key. These values can include HTTP headers, cookies, and URL query strings. CloudFront uses the cache key to find an object in its cache that it can return to the viewer.
The default, minimum, and maximum time to live (TTL) values that you want objects to stay in the CloudFront cache.
The headers, cookies, and query strings that are included in the cache key are also included in requests that CloudFront sends to the origin. CloudFront sends a request when it can’t find a valid object in its cache that matches the request’s cache key. If you want to send values to the origin but not include them in the cache key, use
OriginRequestPolicy
.- Parameters:
default_ttl (
Union
[int
,float
]) – 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. CloudFront uses this value as the object’s time to live (TTL) only when the origin does not sendCache-Control
orExpires
headers with the object. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide . The default value for this field is 86400 seconds (one day). If the value ofMinTTL
is more than 86400 seconds, then the default value for this field is the same as the value ofMinTTL
.max_ttl (
Union
[int
,float
]) –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. CloudFront uses this value only when the origin sends
Cache-Control
orExpires
headers with the object. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide . The default value for this field is 31536000 seconds (one year). If the value ofMinTTL
orDefaultTTL
is more than 31536000 seconds, then the default value for this field is the same as the value ofDefaultTTL
.min_ttl (
Union
[int
,float
]) –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. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide .
name (
str
) – A unique name to identify the cache policy.parameters_in_cache_key_and_forwarded_to_origin (
Union
[IResolvable
,ParametersInCacheKeyAndForwardedToOriginProperty
,Dict
[str
,Any
]]) – The HTTP headers, cookies, and URL query strings to include in the cache key. The values included in the cache key are also included in requests that CloudFront sends to the origin.comment (
Optional
[str
]) – A comment to describe the cache policy. The comment cannot be longer than 128 characters.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_cloudfront as cloudfront cache_policy_config_property = cloudfront.CfnCachePolicy.CachePolicyConfigProperty( default_ttl=123, max_ttl=123, min_ttl=123, name="name", parameters_in_cache_key_and_forwarded_to_origin=cloudfront.CfnCachePolicy.ParametersInCacheKeyAndForwardedToOriginProperty( cookies_config=cloudfront.CfnCachePolicy.CookiesConfigProperty( cookie_behavior="cookieBehavior", # the properties below are optional cookies=["cookies"] ), enable_accept_encoding_gzip=False, headers_config=cloudfront.CfnCachePolicy.HeadersConfigProperty( header_behavior="headerBehavior", # the properties below are optional headers=["headers"] ), query_strings_config=cloudfront.CfnCachePolicy.QueryStringsConfigProperty( query_string_behavior="queryStringBehavior", # the properties below are optional query_strings=["queryStrings"] ), # the properties below are optional enable_accept_encoding_brotli=False ), # the properties below are optional comment="comment" )
Attributes
- comment
A comment to describe the cache policy.
The comment cannot be longer than 128 characters.
- default_ttl
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.
CloudFront uses this value as the object’s time to live (TTL) only when the origin does not send
Cache-Control
orExpires
headers with the object. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide .The default value for this field is 86400 seconds (one day). If the value of
MinTTL
is more than 86400 seconds, then the default value for this field is the same as the value ofMinTTL
.
- max_ttl
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.
CloudFront uses this value only when the origin sends
Cache-Control
orExpires
headers with the object. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide .The default value for this field is 31536000 seconds (one year). If the value of
MinTTL
orDefaultTTL
is more than 31536000 seconds, then the default value for this field is the same as the value ofDefaultTTL
.
- min_ttl
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.
For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide .
- name
A unique name to identify the cache policy.
- parameters_in_cache_key_and_forwarded_to_origin
The HTTP headers, cookies, and URL query strings to include in the cache key.
The values included in the cache key are also included in requests that CloudFront sends to the origin.
HeadersConfigProperty
- class CfnCachePolicy.HeadersConfigProperty(*, header_behavior, headers=None)
Bases:
object
An object that determines whether any HTTP headers (and if so, which headers) are included in the cache key and in requests that CloudFront sends to the origin.
- Parameters:
header_behavior (
str
) – Determines whether any HTTP headers are included in the cache key and in requests that CloudFront sends to the origin. Valid values are: -none
– No HTTP headers are included in the cache key or in requests that CloudFront sends to the origin. Even when this field is set tonone
, any headers that are listed in anOriginRequestPolicy
are included in origin requests. -whitelist
– Only the HTTP headers that are listed in theHeaders
type are included in the cache key and in requests that CloudFront sends to the origin.headers (
Optional
[Sequence
[str
]]) – Contains a list of HTTP header names.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_cloudfront as cloudfront headers_config_property = cloudfront.CfnCachePolicy.HeadersConfigProperty( header_behavior="headerBehavior", # the properties below are optional headers=["headers"] )
Attributes
- header_behavior
Determines whether any HTTP headers are included in the cache key and in requests that CloudFront sends to the origin.
Valid values are:
none
– No HTTP headers are included in the cache key or in requests that CloudFront sends to the origin. Even when this field is set tonone
, any headers that are listed in anOriginRequestPolicy
are included in origin requests.whitelist
– Only the HTTP headers that are listed in theHeaders
type are included in the cache key and in requests that CloudFront sends to the origin.
- headers
Contains a list of HTTP header names.
ParametersInCacheKeyAndForwardedToOriginProperty
- class CfnCachePolicy.ParametersInCacheKeyAndForwardedToOriginProperty(*, cookies_config, enable_accept_encoding_gzip, headers_config, query_strings_config, enable_accept_encoding_brotli=None)
Bases:
object
This object determines the values that CloudFront includes in the cache key.
These values can include HTTP headers, cookies, and URL query strings. CloudFront uses the cache key to find an object in its cache that it can return to the viewer.
The headers, cookies, and query strings that are included in the cache key are also included in requests that CloudFront sends to the origin. CloudFront sends a request when it can’t find an object in its cache that matches the request’s cache key. If you want to send values to the origin but not include them in the cache key, use
OriginRequestPolicy
.- Parameters:
cookies_config (
Union
[IResolvable
,CookiesConfigProperty
,Dict
[str
,Any
]]) – An object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the cache key and in requests that CloudFront sends to the origin.enable_accept_encoding_gzip (
Union
[bool
,IResolvable
]) – A flag that can affect whether theAccept-Encoding
HTTP header is included in the cache key and included in requests that CloudFront sends to the origin. This field is related to theEnableAcceptEncodingBrotli
field. If one or both of these fields istrue
and the viewer request includes theAccept-Encoding
header, then CloudFront does the following: - Normalizes the value of the viewer’sAccept-Encoding
header - Includes the normalized header in the cache key - Includes the normalized header in the request to the origin, if a request is necessary For more information, see Compression support in the Amazon CloudFront Developer Guide . If you set this value totrue
, and this cache behavior also has an origin request policy attached, do not include theAccept-Encoding
header in the origin request policy. CloudFront always includes theAccept-Encoding
header in origin requests when the value of this field istrue
, so including this header in an origin request policy has no effect. If both of these fields arefalse
, then CloudFront treats theAccept-Encoding
header the same as any other HTTP header in the viewer request. By default, it’s not included in the cache key and it’s not included in origin requests. In this case, you can manually addAccept-Encoding
to the headers whitelist like any other HTTP header.headers_config (
Union
[IResolvable
,HeadersConfigProperty
,Dict
[str
,Any
]]) – An object that determines whether any HTTP headers (and if so, which headers) are included in the cache key and in requests that CloudFront sends to the origin.query_strings_config (
Union
[IResolvable
,QueryStringsConfigProperty
,Dict
[str
,Any
]]) – An object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the cache key and in requests that CloudFront sends to the origin.enable_accept_encoding_brotli (
Union
[bool
,IResolvable
,None
]) –A flag that can affect whether the
Accept-Encoding
HTTP header is included in the cache key and included in requests that CloudFront sends to the origin. This field is related to theEnableAcceptEncodingGzip
field. If one or both of these fields istrue
and the viewer request includes theAccept-Encoding
header, then CloudFront does the following: - Normalizes the value of the viewer’sAccept-Encoding
header - Includes the normalized header in the cache key - Includes the normalized header in the request to the origin, if a request is necessary For more information, see Compression support in the Amazon CloudFront Developer Guide . If you set this value totrue
, and this cache behavior also has an origin request policy attached, do not include theAccept-Encoding
header in the origin request policy. CloudFront always includes theAccept-Encoding
header in origin requests when the value of this field istrue
, so including this header in an origin request policy has no effect. If both of these fields arefalse
, then CloudFront treats theAccept-Encoding
header the same as any other HTTP header in the viewer request. By default, it’s not included in the cache key and it’s not included in origin requests. In this case, you can manually addAccept-Encoding
to the headers whitelist like any other HTTP header.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_cloudfront as cloudfront parameters_in_cache_key_and_forwarded_to_origin_property = cloudfront.CfnCachePolicy.ParametersInCacheKeyAndForwardedToOriginProperty( cookies_config=cloudfront.CfnCachePolicy.CookiesConfigProperty( cookie_behavior="cookieBehavior", # the properties below are optional cookies=["cookies"] ), enable_accept_encoding_gzip=False, headers_config=cloudfront.CfnCachePolicy.HeadersConfigProperty( header_behavior="headerBehavior", # the properties below are optional headers=["headers"] ), query_strings_config=cloudfront.CfnCachePolicy.QueryStringsConfigProperty( query_string_behavior="queryStringBehavior", # the properties below are optional query_strings=["queryStrings"] ), # the properties below are optional enable_accept_encoding_brotli=False )
Attributes
- cookies_config
An object that determines whether any cookies in viewer requests (and if so, which cookies) are included in the cache key and in requests that CloudFront sends to the origin.
- enable_accept_encoding_brotli
A flag that can affect whether the
Accept-Encoding
HTTP header is included in the cache key and included in requests that CloudFront sends to the origin.This field is related to the
EnableAcceptEncodingGzip
field. If one or both of these fields istrue
and the viewer request includes theAccept-Encoding
header, then CloudFront does the following:Normalizes the value of the viewer’s
Accept-Encoding
headerIncludes the normalized header in the cache key
Includes the normalized header in the request to the origin, if a request is necessary
For more information, see Compression support in the Amazon CloudFront Developer Guide .
If you set this value to
true
, and this cache behavior also has an origin request policy attached, do not include theAccept-Encoding
header in the origin request policy. CloudFront always includes theAccept-Encoding
header in origin requests when the value of this field istrue
, so including this header in an origin request policy has no effect.If both of these fields are
false
, then CloudFront treats theAccept-Encoding
header the same as any other HTTP header in the viewer request. By default, it’s not included in the cache key and it’s not included in origin requests. In this case, you can manually addAccept-Encoding
to the headers whitelist like any other HTTP header.
- enable_accept_encoding_gzip
A flag that can affect whether the
Accept-Encoding
HTTP header is included in the cache key and included in requests that CloudFront sends to the origin.This field is related to the
EnableAcceptEncodingBrotli
field. If one or both of these fields istrue
and the viewer request includes theAccept-Encoding
header, then CloudFront does the following:Normalizes the value of the viewer’s
Accept-Encoding
headerIncludes the normalized header in the cache key
Includes the normalized header in the request to the origin, if a request is necessary
For more information, see Compression support in the Amazon CloudFront Developer Guide .
If you set this value to
true
, and this cache behavior also has an origin request policy attached, do not include theAccept-Encoding
header in the origin request policy. CloudFront always includes theAccept-Encoding
header in origin requests when the value of this field istrue
, so including this header in an origin request policy has no effect.If both of these fields are
false
, then CloudFront treats theAccept-Encoding
header the same as any other HTTP header in the viewer request. By default, it’s not included in the cache key and it’s not included in origin requests. In this case, you can manually addAccept-Encoding
to the headers whitelist like any other HTTP header.
- headers_config
An object that determines whether any HTTP headers (and if so, which headers) are included in the cache key and in requests that CloudFront sends to the origin.
- query_strings_config
An object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the cache key and in requests that CloudFront sends to the origin.
QueryStringsConfigProperty
- class CfnCachePolicy.QueryStringsConfigProperty(*, query_string_behavior, query_strings=None)
Bases:
object
An object that determines whether any URL query strings in viewer requests (and if so, which query strings) are included in the cache key and in requests that CloudFront sends to the origin.
- Parameters:
query_string_behavior (
str
) – Determines whether any URL query strings in viewer requests are included in the cache key and in requests that CloudFront sends to the origin. Valid values are: -none
– No query strings in viewer requests are included in the cache key or in requests that CloudFront sends to the origin. Even when this field is set tonone
, any query strings that are listed in anOriginRequestPolicy
are included in origin requests. -whitelist
– Only the query strings in viewer requests that are listed in theQueryStringNames
type are included in the cache key and in requests that CloudFront sends to the origin. -allExcept
– All query strings in viewer requests are included in the cache key and in requests that CloudFront sends to the origin, except those that are listed in theQueryStringNames
type, which are not included. -all
– All query strings in viewer requests are included in the cache key and in requests that CloudFront sends to the origin.query_strings (
Optional
[Sequence
[str
]]) – Contains a list of query string names.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_cloudfront as cloudfront query_strings_config_property = cloudfront.CfnCachePolicy.QueryStringsConfigProperty( query_string_behavior="queryStringBehavior", # the properties below are optional query_strings=["queryStrings"] )
Attributes
- query_string_behavior
Determines whether any URL query strings in viewer requests are included in the cache key and in requests that CloudFront sends to the origin.
Valid values are:
none
– No query strings in viewer requests are included in the cache key or in requests that CloudFront sends to the origin. Even when this field is set tonone
, any query strings that are listed in anOriginRequestPolicy
are included in origin requests.whitelist
– Only the query strings in viewer requests that are listed in theQueryStringNames
type are included in the cache key and in requests that CloudFront sends to the origin.allExcept
– All query strings in viewer requests are included in the cache key and in requests that CloudFront sends to the origin, except those that are listed in theQueryStringNames
type, which are not included.all
– All query strings in viewer requests are included in the cache key and in requests that CloudFront sends to the origin.
- query_strings
Contains a list of query string names.