/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include #include #include #include namespace Aws { namespace Utils { namespace Xml { class XmlNode; } // namespace Xml } // namespace Utils namespace CloudFront { namespace Model { /** *

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.

See Also:

AWS * API Reference

*/ class CachePolicyConfig { public: AWS_CLOUDFRONT_API CachePolicyConfig(); AWS_CLOUDFRONT_API CachePolicyConfig(const Aws::Utils::Xml::XmlNode& xmlNode); AWS_CLOUDFRONT_API CachePolicyConfig& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); AWS_CLOUDFRONT_API void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; /** *

A comment to describe the cache policy. The comment cannot be longer than 128 * characters.

*/ inline const Aws::String& GetComment() const{ return m_comment; } /** *

A comment to describe the cache policy. The comment cannot be longer than 128 * characters.

*/ inline bool CommentHasBeenSet() const { return m_commentHasBeenSet; } /** *

A comment to describe the cache policy. The comment cannot be longer than 128 * characters.

*/ inline void SetComment(const Aws::String& value) { m_commentHasBeenSet = true; m_comment = value; } /** *

A comment to describe the cache policy. The comment cannot be longer than 128 * characters.

*/ inline void SetComment(Aws::String&& value) { m_commentHasBeenSet = true; m_comment = std::move(value); } /** *

A comment to describe the cache policy. The comment cannot be longer than 128 * characters.

*/ inline void SetComment(const char* value) { m_commentHasBeenSet = true; m_comment.assign(value); } /** *

A comment to describe the cache policy. The comment cannot be longer than 128 * characters.

*/ inline CachePolicyConfig& WithComment(const Aws::String& value) { SetComment(value); return *this;} /** *

A comment to describe the cache policy. The comment cannot be longer than 128 * characters.

*/ inline CachePolicyConfig& WithComment(Aws::String&& value) { SetComment(std::move(value)); return *this;} /** *

A comment to describe the cache policy. The comment cannot be longer than 128 * characters.

*/ inline CachePolicyConfig& WithComment(const char* value) { SetComment(value); return *this;} /** *

A unique name to identify the cache policy.

*/ inline const Aws::String& GetName() const{ return m_name; } /** *

A unique name to identify the cache policy.

*/ inline bool NameHasBeenSet() const { return m_nameHasBeenSet; } /** *

A unique name to identify the cache policy.

*/ inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; } /** *

A unique name to identify the cache policy.

*/ inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); } /** *

A unique name to identify the cache policy.

*/ inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); } /** *

A unique name to identify the cache policy.

*/ inline CachePolicyConfig& WithName(const Aws::String& value) { SetName(value); return *this;} /** *

A unique name to identify the cache policy.

*/ inline CachePolicyConfig& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;} /** *

A unique name to identify the cache policy.

*/ inline CachePolicyConfig& WithName(const char* value) { SetName(value); return *this;} /** *

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 * or Expires 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 of * MinTTL.

*/ inline long long GetDefaultTTL() const{ return m_defaultTTL; } /** *

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 * or Expires 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 of * MinTTL.

*/ inline bool DefaultTTLHasBeenSet() const { return m_defaultTTLHasBeenSet; } /** *

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 * or Expires 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 of * MinTTL.

*/ inline void SetDefaultTTL(long long value) { m_defaultTTLHasBeenSet = true; m_defaultTTL = value; } /** *

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 * or Expires 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 of * MinTTL.

*/ inline CachePolicyConfig& WithDefaultTTL(long long value) { SetDefaultTTL(value); return *this;} /** *

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 or Expires 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 or * DefaultTTL is more than 31536000 seconds, then the default value * for this field is the same as the value of DefaultTTL.

*/ inline long long GetMaxTTL() const{ return m_maxTTL; } /** *

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 or Expires 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 or * DefaultTTL is more than 31536000 seconds, then the default value * for this field is the same as the value of DefaultTTL.

*/ inline bool MaxTTLHasBeenSet() const { return m_maxTTLHasBeenSet; } /** *

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 or Expires 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 or * DefaultTTL is more than 31536000 seconds, then the default value * for this field is the same as the value of DefaultTTL.

*/ inline void SetMaxTTL(long long value) { m_maxTTLHasBeenSet = true; m_maxTTL = value; } /** *

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 or Expires 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 or * DefaultTTL is more than 31536000 seconds, then the default value * for this field is the same as the value of DefaultTTL.

*/ inline CachePolicyConfig& WithMaxTTL(long long value) { SetMaxTTL(value); return *this;} /** *

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.

*/ inline long long GetMinTTL() const{ return m_minTTL; } /** *

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.

*/ inline bool MinTTLHasBeenSet() const { return m_minTTLHasBeenSet; } /** *

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.

*/ inline void SetMinTTL(long long value) { m_minTTLHasBeenSet = true; m_minTTL = value; } /** *

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.

*/ inline CachePolicyConfig& WithMinTTL(long long value) { SetMinTTL(value); return *this;} /** *

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.

*/ inline const ParametersInCacheKeyAndForwardedToOrigin& GetParametersInCacheKeyAndForwardedToOrigin() const{ return m_parametersInCacheKeyAndForwardedToOrigin; } /** *

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.

*/ inline bool ParametersInCacheKeyAndForwardedToOriginHasBeenSet() const { return m_parametersInCacheKeyAndForwardedToOriginHasBeenSet; } /** *

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.

*/ inline void SetParametersInCacheKeyAndForwardedToOrigin(const ParametersInCacheKeyAndForwardedToOrigin& value) { m_parametersInCacheKeyAndForwardedToOriginHasBeenSet = true; m_parametersInCacheKeyAndForwardedToOrigin = value; } /** *

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.

*/ inline void SetParametersInCacheKeyAndForwardedToOrigin(ParametersInCacheKeyAndForwardedToOrigin&& value) { m_parametersInCacheKeyAndForwardedToOriginHasBeenSet = true; m_parametersInCacheKeyAndForwardedToOrigin = std::move(value); } /** *

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.

*/ inline CachePolicyConfig& WithParametersInCacheKeyAndForwardedToOrigin(const ParametersInCacheKeyAndForwardedToOrigin& value) { SetParametersInCacheKeyAndForwardedToOrigin(value); return *this;} /** *

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.

*/ inline CachePolicyConfig& WithParametersInCacheKeyAndForwardedToOrigin(ParametersInCacheKeyAndForwardedToOrigin&& value) { SetParametersInCacheKeyAndForwardedToOrigin(std::move(value)); return *this;} private: Aws::String m_comment; bool m_commentHasBeenSet = false; Aws::String m_name; bool m_nameHasBeenSet = false; long long m_defaultTTL; bool m_defaultTTLHasBeenSet = false; long long m_maxTTL; bool m_maxTTLHasBeenSet = false; long long m_minTTL; bool m_minTTLHasBeenSet = false; ParametersInCacheKeyAndForwardedToOrigin m_parametersInCacheKeyAndForwardedToOrigin; bool m_parametersInCacheKeyAndForwardedToOriginHasBeenSet = false; }; } // namespace Model } // namespace CloudFront } // namespace Aws