Class: AWSCDK::CloudFront::CachePolicyProps
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::CloudFront::CachePolicyProps
- Defined in:
- cloud_front/cache_policy_props.rb
Overview
Properties for creating a Cache Policy.
Instance Attribute Summary collapse
-
#cache_policy_name ⇒ String?
readonly
A unique name to identify the cache policy.
-
#comment ⇒ String?
readonly
A comment to describe the cache policy.
-
#cookie_behavior ⇒ AWSCDK::CloudFront::CacheCookieBehavior?
readonly
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_ttl ⇒ AWSCDK::Duration?
readonly
The default amount of time for objects to stay in the CloudFront cache.
-
#enable_accept_encoding_brotli ⇒ Boolean?
readonly
Whether to normalize and include the
Accept-Encodingheader in the cache key when theAccept-Encodingheader is 'br'. -
#enable_accept_encoding_gzip ⇒ Boolean?
readonly
Whether to normalize and include the
Accept-Encodingheader in the cache key when theAccept-Encodingheader is 'gzip'. -
#header_behavior ⇒ AWSCDK::CloudFront::CacheHeaderBehavior?
readonly
Determines whether any HTTP headers are included in the cache key and automatically included in requests that CloudFront sends to the origin.
-
#max_ttl ⇒ AWSCDK::Duration?
readonly
The maximum amount of time for objects to stay in the CloudFront cache.
-
#min_ttl ⇒ AWSCDK::Duration?
readonly
The minimum amount of time for objects to stay in the CloudFront cache.
-
#query_string_behavior ⇒ AWSCDK::CloudFront::CacheQueryStringBehavior?
readonly
Determines whether any query strings are included in the cache key and automatically included in requests that CloudFront sends to the origin.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cache_policy_name: nil, comment: nil, cookie_behavior: nil, default_ttl: nil, enable_accept_encoding_brotli: nil, enable_accept_encoding_gzip: nil, header_behavior: nil, max_ttl: nil, min_ttl: nil, query_string_behavior: nil) ⇒ CachePolicyProps
constructor
A new instance of CachePolicyProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(cache_policy_name: nil, comment: nil, cookie_behavior: nil, default_ttl: nil, enable_accept_encoding_brotli: nil, enable_accept_encoding_gzip: nil, header_behavior: nil, max_ttl: nil, min_ttl: nil, query_string_behavior: nil) ⇒ CachePolicyProps
Returns a new instance of CachePolicyProps.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'cloud_front/cache_policy_props.rb', line 17 def initialize(cache_policy_name: nil, comment: nil, cookie_behavior: nil, default_ttl: nil, enable_accept_encoding_brotli: nil, enable_accept_encoding_gzip: nil, header_behavior: nil, max_ttl: nil, min_ttl: nil, query_string_behavior: nil) @cache_policy_name = cache_policy_name Jsii::Type.check_type(@cache_policy_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "cachePolicyName") unless @cache_policy_name.nil? @comment = comment Jsii::Type.check_type(@comment, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "comment") unless @comment.nil? @cookie_behavior = Jsii::Type.check_type(@cookie_behavior, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5DYWNoZUNvb2tpZUJlaGF2aW9yIn0=")), "cookieBehavior") unless @cookie_behavior.nil? @default_ttl = default_ttl Jsii::Type.check_type(@default_ttl, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "defaultTtl") unless @default_ttl.nil? @enable_accept_encoding_brotli = enable_accept_encoding_brotli Jsii::Type.check_type(@enable_accept_encoding_brotli, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableAcceptEncodingBrotli") unless @enable_accept_encoding_brotli.nil? @enable_accept_encoding_gzip = enable_accept_encoding_gzip Jsii::Type.check_type(@enable_accept_encoding_gzip, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableAcceptEncodingGzip") unless @enable_accept_encoding_gzip.nil? @header_behavior = header_behavior Jsii::Type.check_type(@header_behavior, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5DYWNoZUhlYWRlckJlaGF2aW9yIn0=")), "headerBehavior") unless @header_behavior.nil? @max_ttl = max_ttl Jsii::Type.check_type(@max_ttl, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "maxTtl") unless @max_ttl.nil? @min_ttl = min_ttl Jsii::Type.check_type(@min_ttl, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5EdXJhdGlvbiJ9")), "minTtl") unless @min_ttl.nil? @query_string_behavior = query_string_behavior Jsii::Type.check_type(@query_string_behavior, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5DYWNoZVF1ZXJ5U3RyaW5nQmVoYXZpb3IifQ==")), "queryStringBehavior") unless @query_string_behavior.nil? end |
Instance Attribute Details
#cache_policy_name ⇒ String? (readonly)
Default: - generated from the id
A unique name to identify the cache policy.
The name must only include '-', '_', or alphanumeric characters.
46 47 48 |
# File 'cloud_front/cache_policy_props.rb', line 46 def cache_policy_name @cache_policy_name end |
#comment ⇒ String? (readonly)
Default: - no comment
A comment to describe the cache policy.
The comment cannot be longer than 128 characters.
53 54 55 |
# File 'cloud_front/cache_policy_props.rb', line 53 def comment @comment end |
#cookie_behavior ⇒ AWSCDK::CloudFront::CacheCookieBehavior? (readonly)
Default: CacheCookieBehavior.none()
Determines whether any cookies in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin.
58 59 60 |
# File 'cloud_front/cache_policy_props.rb', line 58 def @cookie_behavior end |
#default_ttl ⇒ AWSCDK::Duration? (readonly)
Default: - The greater of 1 day and minTtl
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.
65 66 67 |
# File 'cloud_front/cache_policy_props.rb', line 65 def default_ttl @default_ttl end |
#enable_accept_encoding_brotli ⇒ Boolean? (readonly)
Default: false
Whether to normalize and include the Accept-Encoding header in the cache key when the Accept-Encoding header is 'br'.
70 71 72 |
# File 'cloud_front/cache_policy_props.rb', line 70 def enable_accept_encoding_brotli @enable_accept_encoding_brotli end |
#enable_accept_encoding_gzip ⇒ Boolean? (readonly)
Default: false
Whether to normalize and include the Accept-Encoding header in the cache key when the Accept-Encoding header is 'gzip'.
75 76 77 |
# File 'cloud_front/cache_policy_props.rb', line 75 def enable_accept_encoding_gzip @enable_accept_encoding_gzip end |
#header_behavior ⇒ AWSCDK::CloudFront::CacheHeaderBehavior? (readonly)
Default: CacheHeaderBehavior.none()
Determines whether any HTTP headers are included in the cache key and automatically included in requests that CloudFront sends to the origin.
80 81 82 |
# File 'cloud_front/cache_policy_props.rb', line 80 def header_behavior @header_behavior end |
#max_ttl ⇒ AWSCDK::Duration? (readonly)
Default: - The greater of 1 year and defaultTtl
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.
87 88 89 |
# File 'cloud_front/cache_policy_props.rb', line 87 def max_ttl @max_ttl end |
#min_ttl ⇒ AWSCDK::Duration? (readonly)
Default: Duration.seconds(0)
The minimum amount of time for objects to stay in the CloudFront cache.
92 93 94 |
# File 'cloud_front/cache_policy_props.rb', line 92 def min_ttl @min_ttl end |
#query_string_behavior ⇒ AWSCDK::CloudFront::CacheQueryStringBehavior? (readonly)
Default: CacheQueryStringBehavior.none()
Determines whether any query strings are included in the cache key and automatically included in requests that CloudFront sends to the origin.
97 98 99 |
# File 'cloud_front/cache_policy_props.rb', line 97 def query_string_behavior @query_string_behavior end |
Class Method Details
.jsii_properties ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'cloud_front/cache_policy_props.rb', line 99 def self.jsii_properties { :cache_policy_name => "cachePolicyName", :comment => "comment", :cookie_behavior => "cookieBehavior", :default_ttl => "defaultTtl", :enable_accept_encoding_brotli => "enableAcceptEncodingBrotli", :enable_accept_encoding_gzip => "enableAcceptEncodingGzip", :header_behavior => "headerBehavior", :max_ttl => "maxTtl", :min_ttl => "minTtl", :query_string_behavior => "queryStringBehavior", } end |
Instance Method Details
#to_jsii ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'cloud_front/cache_policy_props.rb', line 114 def to_jsii result = {} result.merge!({ "cachePolicyName" => @cache_policy_name, "comment" => @comment, "cookieBehavior" => @cookie_behavior, "defaultTtl" => @default_ttl, "enableAcceptEncodingBrotli" => @enable_accept_encoding_brotli, "enableAcceptEncodingGzip" => @enable_accept_encoding_gzip, "headerBehavior" => @header_behavior, "maxTtl" => @max_ttl, "minTtl" => @min_ttl, "queryStringBehavior" => @query_string_behavior, }) result.compact end |