Class: AWSCDK::CloudFront::BehaviorOptions
- Inherits:
-
AddBehaviorOptions
- Object
- AddBehaviorOptions
- AWSCDK::CloudFront::BehaviorOptions
- Defined in:
- cloud_front/behavior_options.rb
Overview
Options for creating a new behavior.
Instance Attribute Summary collapse
-
#allowed_methods ⇒ AWSCDK::CloudFront::AllowedMethods?
readonly
HTTP methods to allow for this behavior.
-
#cache_policy ⇒ AWSCDK::Interfaces::AWSCloudfront::ICachePolicyRef?
readonly
The cache policy for this behavior.
-
#cached_methods ⇒ AWSCDK::CloudFront::CachedMethods?
readonly
HTTP methods to cache for this behavior.
-
#compress ⇒ Boolean?
readonly
Whether you want CloudFront to automatically compress certain files for this cache behavior.
-
#edge_lambdas ⇒ Array<AWSCDK::CloudFront::EdgeLambda>?
readonly
The Lambda@Edge functions to invoke before serving the contents.
-
#enable_grpc ⇒ Boolean?
readonly
Enables your CloudFront distribution to receive gRPC requests and to proxy them directly to your origins.
-
#function_associations ⇒ Array<AWSCDK::CloudFront::FunctionAssociation>?
readonly
The CloudFront functions to invoke before serving the contents.
-
#origin ⇒ AWSCDK::CloudFront::IOrigin
readonly
The origin that you want CloudFront to route requests to when they match this behavior.
-
#origin_request_policy ⇒ AWSCDK::Interfaces::AWSCloudfront::IOriginRequestPolicyRef?
readonly
The origin request policy for this behavior.
-
#realtime_log_config ⇒ AWSCDK::Interfaces::AWSCloudfront::IRealtimeLogConfigRef?
readonly
The real-time log configuration to be attached to this cache behavior.
-
#response_headers_policy ⇒ AWSCDK::Interfaces::AWSCloudfront::IResponseHeadersPolicyRef?
readonly
The response headers policy for this behavior.
-
#smooth_streaming ⇒ Boolean?
readonly
Set this to true to indicate you want to distribute media files in the Microsoft Smooth Streaming format using this behavior.
-
#trusted_key_groups ⇒ Array<AWSCDK::Interfaces::AWSCloudfront::IKeyGroupRef>?
readonly
A list of Key Groups that CloudFront can use to validate signed URLs or signed cookies.
-
#viewer_protocol_policy ⇒ AWSCDK::CloudFront::ViewerProtocolPolicy?
readonly
The protocol that viewers can use to access the files controlled by this behavior.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(allowed_methods: nil, cached_methods: nil, cache_policy: nil, compress: nil, edge_lambdas: nil, enable_grpc: nil, function_associations: nil, origin_request_policy: nil, realtime_log_config: nil, response_headers_policy: nil, smooth_streaming: nil, trusted_key_groups: nil, viewer_protocol_policy: nil, origin:) ⇒ BehaviorOptions
constructor
A new instance of BehaviorOptions.
- #to_jsii ⇒ Object
Constructor Details
#initialize(allowed_methods: nil, cached_methods: nil, cache_policy: nil, compress: nil, edge_lambdas: nil, enable_grpc: nil, function_associations: nil, origin_request_policy: nil, realtime_log_config: nil, response_headers_policy: nil, smooth_streaming: nil, trusted_key_groups: nil, viewer_protocol_policy: nil, origin:) ⇒ BehaviorOptions
Returns a new instance of BehaviorOptions.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'cloud_front/behavior_options.rb', line 21 def initialize(allowed_methods: nil, cached_methods: nil, cache_policy: nil, compress: nil, edge_lambdas: nil, enable_grpc: nil, function_associations: nil, origin_request_policy: nil, realtime_log_config: nil, response_headers_policy: nil, smooth_streaming: nil, trusted_key_groups: nil, viewer_protocol_policy: nil, origin:) @allowed_methods = allowed_methods Jsii::Type.check_type(@allowed_methods, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5BbGxvd2VkTWV0aG9kcyJ9")), "allowedMethods") unless @allowed_methods.nil? @cached_methods = cached_methods Jsii::Type.check_type(@cached_methods, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5DYWNoZWRNZXRob2RzIn0=")), "cachedMethods") unless @cached_methods.nil? @cache_policy = cache_policy Jsii::Type.check_type(@cache_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19jbG91ZGZyb250LklDYWNoZVBvbGljeVJlZiJ9")), "cachePolicy") unless @cache_policy.nil? @compress = compress Jsii::Type.check_type(@compress, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "compress") unless @compress.nil? @edge_lambdas = edge_lambdas.is_a?(Array) ? edge_lambdas.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CloudFront::EdgeLambda.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : edge_lambdas Jsii::Type.check_type(@edge_lambdas, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250LkVkZ2VMYW1iZGEifSwia2luZCI6ImFycmF5In19")), "edgeLambdas") unless @edge_lambdas.nil? @enable_grpc = enable_grpc Jsii::Type.check_type(@enable_grpc, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableGrpc") unless @enable_grpc.nil? @function_associations = function_associations.is_a?(Array) ? function_associations.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CloudFront::FunctionAssociation.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : function_associations Jsii::Type.check_type(@function_associations, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250LkZ1bmN0aW9uQXNzb2NpYXRpb24ifSwia2luZCI6ImFycmF5In19")), "functionAssociations") unless @function_associations.nil? @origin_request_policy = origin_request_policy Jsii::Type.check_type(@origin_request_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19jbG91ZGZyb250LklPcmlnaW5SZXF1ZXN0UG9saWN5UmVmIn0=")), "originRequestPolicy") unless @origin_request_policy.nil? @realtime_log_config = realtime_log_config Jsii::Type.check_type(@realtime_log_config, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19jbG91ZGZyb250LklSZWFsdGltZUxvZ0NvbmZpZ1JlZiJ9")), "realtimeLogConfig") unless @realtime_log_config.nil? @response_headers_policy = response_headers_policy Jsii::Type.check_type(@response_headers_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19jbG91ZGZyb250LklSZXNwb25zZUhlYWRlcnNQb2xpY3lSZWYifQ==")), "responseHeadersPolicy") unless @response_headers_policy.nil? @smooth_streaming = smooth_streaming Jsii::Type.check_type(@smooth_streaming, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "smoothStreaming") unless @smooth_streaming.nil? @trusted_key_groups = trusted_key_groups Jsii::Type.check_type(@trusted_key_groups, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmludGVyZmFjZXMuYXdzX2Nsb3VkZnJvbnQuSUtleUdyb3VwUmVmIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "trustedKeyGroups") unless @trusted_key_groups.nil? @viewer_protocol_policy = viewer_protocol_policy Jsii::Type.check_type(@viewer_protocol_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5WaWV3ZXJQcm90b2NvbFBvbGljeSJ9")), "viewerProtocolPolicy") unless @viewer_protocol_policy.nil? @origin = origin Jsii::Type.check_type(@origin, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5JT3JpZ2luIn0=")), "origin") end |
Instance Attribute Details
#allowed_methods ⇒ AWSCDK::CloudFront::AllowedMethods? (readonly)
Default: AllowedMethods.ALLOW_GET_HEAD
HTTP methods to allow for this behavior.
56 57 58 |
# File 'cloud_front/behavior_options.rb', line 56 def allowed_methods @allowed_methods end |
#cache_policy ⇒ AWSCDK::Interfaces::AWSCloudfront::ICachePolicyRef? (readonly)
Default: CachePolicy.CACHING_OPTIMIZED
The cache policy for this behavior.
The cache policy determines what values are included in the cache key, and the time-to-live (TTL) values for the cache.
70 71 72 |
# File 'cloud_front/behavior_options.rb', line 70 def cache_policy @cache_policy end |
#cached_methods ⇒ AWSCDK::CloudFront::CachedMethods? (readonly)
Default: CachedMethods.CACHE_GET_HEAD
HTTP methods to cache for this behavior.
61 62 63 |
# File 'cloud_front/behavior_options.rb', line 61 def cached_methods @cached_methods end |
#compress ⇒ Boolean? (readonly)
Default: true
Whether you want CloudFront to automatically compress certain files for this cache behavior.
See https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html#compressed-content-cloudfront-file-types for file types CloudFront will compress.
78 79 80 |
# File 'cloud_front/behavior_options.rb', line 78 def compress @compress end |
#edge_lambdas ⇒ Array<AWSCDK::CloudFront::EdgeLambda>? (readonly)
Default: - no Lambda functions will be invoked
The Lambda@Edge functions to invoke before serving the contents.
84 85 86 |
# File 'cloud_front/behavior_options.rb', line 84 def edge_lambdas @edge_lambdas end |
#enable_grpc ⇒ Boolean? (readonly)
Default: false
Enables your CloudFront distribution to receive gRPC requests and to proxy them directly to your origins.
If the enable_grpc is set to true, the following restrictions apply:
- The
allowed_methodsproperty must beAllowedMethods.ALLOW_ALLto include POST method because gRPC only supports POST method. - The
http_versionproperty must beHttpVersion.HTTP2orHttpVersion.HTTP2_AND_3because gRPC only supports versions including HTTP/2. - The
edge_lambdasproperty can't be specified because gRPC is not supported with Lambda@Edge.
96 97 98 |
# File 'cloud_front/behavior_options.rb', line 96 def enable_grpc @enable_grpc end |
#function_associations ⇒ Array<AWSCDK::CloudFront::FunctionAssociation>? (readonly)
Default: - no functions will be invoked
The CloudFront functions to invoke before serving the contents.
101 102 103 |
# File 'cloud_front/behavior_options.rb', line 101 def function_associations @function_associations end |
#origin ⇒ AWSCDK::CloudFront::IOrigin (readonly)
The origin that you want CloudFront to route requests to when they match this behavior.
141 142 143 |
# File 'cloud_front/behavior_options.rb', line 141 def origin @origin end |
#origin_request_policy ⇒ AWSCDK::Interfaces::AWSCloudfront::IOriginRequestPolicyRef? (readonly)
Default: - none
The origin request policy for this behavior.
The origin request policy determines which values (e.g., headers, cookies) are included in requests that CloudFront sends to the origin.
109 110 111 |
# File 'cloud_front/behavior_options.rb', line 109 def origin_request_policy @origin_request_policy end |
#realtime_log_config ⇒ AWSCDK::Interfaces::AWSCloudfront::IRealtimeLogConfigRef? (readonly)
Default: - none
The real-time log configuration to be attached to this cache behavior.
114 115 116 |
# File 'cloud_front/behavior_options.rb', line 114 def realtime_log_config @realtime_log_config end |
#response_headers_policy ⇒ AWSCDK::Interfaces::AWSCloudfront::IResponseHeadersPolicyRef? (readonly)
Default: - none
The response headers policy for this behavior.
The response headers policy determines which headers are included in responses
121 122 123 |
# File 'cloud_front/behavior_options.rb', line 121 def response_headers_policy @response_headers_policy end |
#smooth_streaming ⇒ Boolean? (readonly)
Default: false
Set this to true to indicate you want to distribute media files in the Microsoft Smooth Streaming format using this behavior.
126 127 128 |
# File 'cloud_front/behavior_options.rb', line 126 def smooth_streaming @smooth_streaming end |
#trusted_key_groups ⇒ Array<AWSCDK::Interfaces::AWSCloudfront::IKeyGroupRef>? (readonly)
Default: - no KeyGroups are associated with cache behavior
A list of Key Groups that CloudFront can use to validate signed URLs or signed cookies.
132 133 134 |
# File 'cloud_front/behavior_options.rb', line 132 def trusted_key_groups @trusted_key_groups end |
#viewer_protocol_policy ⇒ AWSCDK::CloudFront::ViewerProtocolPolicy? (readonly)
Default: ViewerProtocolPolicy.ALLOW_ALL
The protocol that viewers can use to access the files controlled by this behavior.
137 138 139 |
# File 'cloud_front/behavior_options.rb', line 137 def viewer_protocol_policy @viewer_protocol_policy end |
Class Method Details
.jsii_properties ⇒ Object
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'cloud_front/behavior_options.rb', line 143 def self.jsii_properties { :allowed_methods => "allowedMethods", :cached_methods => "cachedMethods", :cache_policy => "cachePolicy", :compress => "compress", :edge_lambdas => "edgeLambdas", :enable_grpc => "enableGrpc", :function_associations => "functionAssociations", :origin_request_policy => "originRequestPolicy", :realtime_log_config => "realtimeLogConfig", :response_headers_policy => "responseHeadersPolicy", :smooth_streaming => "smoothStreaming", :trusted_key_groups => "trustedKeyGroups", :viewer_protocol_policy => "viewerProtocolPolicy", :origin => "origin", } end |
Instance Method Details
#to_jsii ⇒ Object
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'cloud_front/behavior_options.rb', line 162 def to_jsii result = {} result.merge!(super) result.merge!({ "allowedMethods" => @allowed_methods, "cachedMethods" => @cached_methods, "cachePolicy" => @cache_policy, "compress" => @compress, "edgeLambdas" => @edge_lambdas, "enableGrpc" => @enable_grpc, "functionAssociations" => @function_associations, "originRequestPolicy" => @origin_request_policy, "realtimeLogConfig" => @realtime_log_config, "responseHeadersPolicy" => @response_headers_policy, "smoothStreaming" => @smooth_streaming, "trustedKeyGroups" => @trusted_key_groups, "viewerProtocolPolicy" => @viewer_protocol_policy, "origin" => @origin, }) result.compact end |