Class: AWSCDK::CloudFront::DistributionProps
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::CloudFront::DistributionProps
- Defined in:
- cloud_front/distribution_props.rb
Overview
Properties for a Distribution.
Instance Attribute Summary collapse
-
#additional_behaviors ⇒ Hash{String => AWSCDK::CloudFront::BehaviorOptions}?
readonly
Additional behaviors for the distribution, mapped by the pathPattern that specifies which requests to apply the behavior to.
-
#certificate ⇒ AWSCDK::Interfaces::AWSCertificatemanager::ICertificateRef?
readonly
A certificate to associate with the distribution.
-
#comment ⇒ String?
readonly
Any comments you want to include about the distribution.
-
#default_behavior ⇒ AWSCDK::CloudFront::BehaviorOptions
readonly
The default behavior for the distribution.
-
#default_root_object ⇒ String?
readonly
The object that you want CloudFront to request from your origin (for example, index.html) when a viewer requests the root URL for your distribution.
-
#domain_names ⇒ Array<String>?
readonly
Alternative domain names for this distribution.
-
#enable_ipv6 ⇒ Boolean?
readonly
Whether CloudFront will respond to IPv6 DNS requests with an IPv6 address.
-
#enable_logging ⇒ Boolean?
readonly
Enable access logging for the distribution.
-
#enabled ⇒ Boolean?
readonly
Enable or disable the distribution.
-
#error_responses ⇒ Array<AWSCDK::CloudFront::ErrorResponse>?
readonly
How CloudFront should handle requests that are not successful (e.g., PageNotFound).
-
#geo_restriction ⇒ AWSCDK::CloudFront::GeoRestriction?
readonly
Controls the countries in which your content is distributed.
-
#http_version ⇒ AWSCDK::CloudFront::HttpVersion?
readonly
Specify the maximum HTTP version that you want viewers to use to communicate with CloudFront.
-
#log_bucket ⇒ AWSCDK::S3::IBucket?
readonly
The Amazon S3 bucket to store the access logs in.
-
#log_file_prefix ⇒ String?
readonly
An optional string that you want CloudFront to prefix to the access log filenames for this distribution.
-
#log_includes_cookies ⇒ Boolean?
readonly
Specifies whether you want CloudFront to include cookies in access logs.
-
#minimum_protocol_version ⇒ AWSCDK::CloudFront::SecurityPolicyProtocol?
readonly
The minimum version of the SSL protocol that you want CloudFront to use for HTTPS connections.
-
#price_class ⇒ AWSCDK::CloudFront::PriceClass?
readonly
The price class that corresponds with the maximum price that you want to pay for CloudFront service.
-
#publish_additional_metrics ⇒ Boolean?
readonly
Whether to enable additional CloudWatch metrics.
-
#ssl_support_method ⇒ AWSCDK::CloudFront::SSLMethod?
readonly
The SSL method CloudFront will use for your distribution.
-
#web_acl_id ⇒ String?
readonly
Unique identifier that specifies the AWS WAF web ACL to associate with this CloudFront distribution.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(default_behavior:, additional_behaviors: nil, certificate: nil, comment: nil, default_root_object: nil, domain_names: nil, enabled: nil, enable_ipv6: nil, enable_logging: nil, error_responses: nil, geo_restriction: nil, http_version: nil, log_bucket: nil, log_file_prefix: nil, log_includes_cookies: nil, minimum_protocol_version: nil, price_class: nil, publish_additional_metrics: nil, ssl_support_method: nil, web_acl_id: nil) ⇒ DistributionProps
constructor
A new instance of DistributionProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(default_behavior:, additional_behaviors: nil, certificate: nil, comment: nil, default_root_object: nil, domain_names: nil, enabled: nil, enable_ipv6: nil, enable_logging: nil, error_responses: nil, geo_restriction: nil, http_version: nil, log_bucket: nil, log_file_prefix: nil, log_includes_cookies: nil, minimum_protocol_version: nil, price_class: nil, publish_additional_metrics: nil, ssl_support_method: nil, web_acl_id: nil) ⇒ DistributionProps
Returns a new instance of DistributionProps.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'cloud_front/distribution_props.rb', line 27 def initialize(default_behavior:, additional_behaviors: nil, certificate: nil, comment: nil, default_root_object: nil, domain_names: nil, enabled: nil, enable_ipv6: nil, enable_logging: nil, error_responses: nil, geo_restriction: nil, http_version: nil, log_bucket: nil, log_file_prefix: nil, log_includes_cookies: nil, minimum_protocol_version: nil, price_class: nil, publish_additional_metrics: nil, ssl_support_method: nil, web_acl_id: nil) @default_behavior = default_behavior.is_a?(Hash) ? ::AWSCDK::CloudFront::BehaviorOptions.new(**default_behavior.transform_keys(&:to_sym)) : default_behavior Jsii::Type.check_type(@default_behavior, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5CZWhhdmlvck9wdGlvbnMifQ==")), "defaultBehavior") @additional_behaviors = additional_behaviors.is_a?(Hash) ? additional_behaviors.transform_values { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CloudFront::BehaviorOptions.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : additional_behaviors Jsii::Type.check_type(@additional_behaviors, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250LkJlaGF2aW9yT3B0aW9ucyJ9LCJraW5kIjoibWFwIn19")), "additionalBehaviors") unless @additional_behaviors.nil? @certificate = certificate Jsii::Type.check_type(@certificate, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5pbnRlcmZhY2VzLmF3c19jZXJ0aWZpY2F0ZW1hbmFnZXIuSUNlcnRpZmljYXRlUmVmIn0=")), "certificate") unless @certificate.nil? @comment = comment Jsii::Type.check_type(@comment, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "comment") unless @comment.nil? @default_root_object = default_root_object Jsii::Type.check_type(@default_root_object, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "defaultRootObject") unless @default_root_object.nil? @domain_names = domain_names Jsii::Type.check_type(@domain_names, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "domainNames") unless @domain_names.nil? @enabled = enabled Jsii::Type.check_type(@enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enabled") unless @enabled.nil? @enable_ipv6 = enable_ipv6 Jsii::Type.check_type(@enable_ipv6, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableIpv6") unless @enable_ipv6.nil? @enable_logging = enable_logging Jsii::Type.check_type(@enable_logging, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableLogging") unless @enable_logging.nil? @error_responses = error_responses.is_a?(Array) ? error_responses.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CloudFront::ErrorResponse.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : error_responses Jsii::Type.check_type(@error_responses, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250LkVycm9yUmVzcG9uc2UifSwia2luZCI6ImFycmF5In19")), "errorResponses") unless @error_responses.nil? @geo_restriction = geo_restriction Jsii::Type.check_type(@geo_restriction, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5HZW9SZXN0cmljdGlvbiJ9")), "geoRestriction") unless @geo_restriction.nil? @http_version = http_version Jsii::Type.check_type(@http_version, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5IdHRwVmVyc2lvbiJ9")), "httpVersion") unless @http_version.nil? @log_bucket = log_bucket Jsii::Type.check_type(@log_bucket, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfczMuSUJ1Y2tldCJ9")), "logBucket") unless @log_bucket.nil? @log_file_prefix = log_file_prefix Jsii::Type.check_type(@log_file_prefix, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "logFilePrefix") unless @log_file_prefix.nil? @log_includes_cookies = Jsii::Type.check_type(@log_includes_cookies, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "logIncludesCookies") unless @log_includes_cookies.nil? @minimum_protocol_version = minimum_protocol_version Jsii::Type.check_type(@minimum_protocol_version, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5TZWN1cml0eVBvbGljeVByb3RvY29sIn0=")), "minimumProtocolVersion") unless @minimum_protocol_version.nil? @price_class = price_class Jsii::Type.check_type(@price_class, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5QcmljZUNsYXNzIn0=")), "priceClass") unless @price_class.nil? @publish_additional_metrics = publish_additional_metrics Jsii::Type.check_type(@publish_additional_metrics, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "publishAdditionalMetrics") unless @publish_additional_metrics.nil? @ssl_support_method = ssl_support_method Jsii::Type.check_type(@ssl_support_method, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5TU0xNZXRob2QifQ==")), "sslSupportMethod") unless @ssl_support_method.nil? @web_acl_id = web_acl_id Jsii::Type.check_type(@web_acl_id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "webAclId") unless @web_acl_id.nil? end |
Instance Attribute Details
#additional_behaviors ⇒ Hash{String => AWSCDK::CloudFront::BehaviorOptions}? (readonly)
Default: - no additional behaviors are added.
Additional behaviors for the distribution, mapped by the pathPattern that specifies which requests to apply the behavior to.
78 79 80 |
# File 'cloud_front/distribution_props.rb', line 78 def additional_behaviors @additional_behaviors end |
#certificate ⇒ AWSCDK::Interfaces::AWSCertificatemanager::ICertificateRef? (readonly)
Default: - the CloudFront wildcard certificate (*.cloudfront.net) will be used.
A certificate to associate with the distribution.
The certificate must be located in N. Virginia (us-east-1).
85 86 87 |
# File 'cloud_front/distribution_props.rb', line 85 def certificate @certificate end |
#comment ⇒ String? (readonly)
Default: - no comment
Any comments you want to include about the distribution.
90 91 92 |
# File 'cloud_front/distribution_props.rb', line 90 def comment @comment end |
#default_behavior ⇒ AWSCDK::CloudFront::BehaviorOptions (readonly)
The default behavior for the distribution.
73 74 75 |
# File 'cloud_front/distribution_props.rb', line 73 def default_behavior @default_behavior end |
#default_root_object ⇒ String? (readonly)
Default: - no default root object
The object that you want CloudFront to request from your origin (for example, index.html) when a viewer requests the root URL for your distribution. If no default object is set, the request goes to the origin's root (e.g., example.com/).
95 96 97 |
# File 'cloud_front/distribution_props.rb', line 95 def default_root_object @default_root_object end |
#domain_names ⇒ Array<String>? (readonly)
Default: - The distribution will only support the default generated name (e.g., d111111abcdef8.cloudfront.net)
Alternative domain names for this distribution.
If you want to use your own domain name, such as www.example.com, instead of the cloudfront.net domain name, you can add an alternate domain name to your distribution. If you attach a certificate to the distribution, you should add (at least one of) the domain names of the certificate to this list.
When you want to move a domain name between distributions, you can associate a certificate without specifying any domain names. For more information, see the Moving an alternate domain name to a different distribution section in the README.
107 108 109 |
# File 'cloud_front/distribution_props.rb', line 107 def domain_names @domain_names end |
#enable_ipv6 ⇒ Boolean? (readonly)
Default: true
Whether CloudFront will respond to IPv6 DNS requests with an IPv6 address.
If you specify false, CloudFront responds to IPv6 DNS requests with the DNS response code NOERROR and with no IP addresses. This allows viewers to submit a second request, for an IPv4 address for your distribution.
120 121 122 |
# File 'cloud_front/distribution_props.rb', line 120 def enable_ipv6 @enable_ipv6 end |
#enable_logging ⇒ Boolean? (readonly)
Default: - false, unless logBucket is specified.
Enable access logging for the distribution.
125 126 127 |
# File 'cloud_front/distribution_props.rb', line 125 def enable_logging @enable_logging end |
#enabled ⇒ Boolean? (readonly)
Default: true
Enable or disable the distribution.
112 113 114 |
# File 'cloud_front/distribution_props.rb', line 112 def enabled @enabled end |
#error_responses ⇒ Array<AWSCDK::CloudFront::ErrorResponse>? (readonly)
Default: - No custom error responses.
How CloudFront should handle requests that are not successful (e.g., PageNotFound).
130 131 132 |
# File 'cloud_front/distribution_props.rb', line 130 def error_responses @error_responses end |
#geo_restriction ⇒ AWSCDK::CloudFront::GeoRestriction? (readonly)
Default: - No geographic restrictions
Controls the countries in which your content is distributed.
135 136 137 |
# File 'cloud_front/distribution_props.rb', line 135 def geo_restriction @geo_restriction end |
#http_version ⇒ AWSCDK::CloudFront::HttpVersion? (readonly)
Default: HttpVersion.HTTP2
Specify the maximum HTTP version that you want viewers to use to communicate with CloudFront.
For viewers and CloudFront to use HTTP/2, viewers must support TLS 1.2 or later, and must support server name identification (SNI).
142 143 144 |
# File 'cloud_front/distribution_props.rb', line 142 def http_version @http_version end |
#log_bucket ⇒ AWSCDK::S3::IBucket? (readonly)
Default: - A bucket is created if enableLogging is true
The Amazon S3 bucket to store the access logs in.
Make sure to set object_ownership to s3.ObjectOwnership.OBJECT_WRITER in your custom bucket.
149 150 151 |
# File 'cloud_front/distribution_props.rb', line 149 def log_bucket @log_bucket end |
#log_file_prefix ⇒ String? (readonly)
Default: - no prefix
An optional string that you want CloudFront to prefix to the access log filenames for this distribution.
154 155 156 |
# File 'cloud_front/distribution_props.rb', line 154 def log_file_prefix @log_file_prefix end |
#log_includes_cookies ⇒ Boolean? (readonly)
Default: false
Specifies whether you want CloudFront to include cookies in access logs.
159 160 161 |
# File 'cloud_front/distribution_props.rb', line 159 def @log_includes_cookies end |
#minimum_protocol_version ⇒ AWSCDK::CloudFront::SecurityPolicyProtocol? (readonly)
Default: - SecurityPolicyProtocol.TLS_V1_2_2021 if the '@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021' feature flag is set; otherwise, SecurityPolicyProtocol.TLS_V1_2_2019.
The minimum version of the SSL protocol that you want CloudFront to use for HTTPS connections.
CloudFront serves your objects only to browsers or devices that support at least the SSL version that you specify.
167 168 169 |
# File 'cloud_front/distribution_props.rb', line 167 def minimum_protocol_version @minimum_protocol_version end |
#price_class ⇒ AWSCDK::CloudFront::PriceClass? (readonly)
Default: PriceClass.PRICE_CLASS_ALL
The price class that corresponds with the maximum price that you want to pay for CloudFront service.
If you specify PriceClass_All, CloudFront responds to requests for your objects from all CloudFront edge locations. If you specify a price class other than PriceClass_All, CloudFront serves your objects from the CloudFront edge location that has the lowest latency among the edge locations in your price class.
176 177 178 |
# File 'cloud_front/distribution_props.rb', line 176 def price_class @price_class end |
#publish_additional_metrics ⇒ Boolean? (readonly)
Default: false
Whether to enable additional CloudWatch metrics.
182 183 184 |
# File 'cloud_front/distribution_props.rb', line 182 def publish_additional_metrics @publish_additional_metrics end |
#ssl_support_method ⇒ AWSCDK::CloudFront::SSLMethod? (readonly)
Default: SSLMethod.SNI
The SSL method CloudFront will use for your distribution.
Server Name Indication (SNI) - is an extension to the TLS computer networking protocol by which a client indicates which hostname it is attempting to connect to at the start of the handshaking process. This allows a server to present multiple certificates on the same IP address and TCP port number and hence allows multiple secure (HTTPS) websites (or any other service over TLS) to be served by the same IP address without requiring all those sites to use the same certificate.
CloudFront can use SNI to host multiple distributions on the same IP - which a large majority of clients will support.
If your clients cannot support SNI however - CloudFront can use dedicated IPs for your distribution - but there is a prorated monthly charge for using this feature. By default, we use SNI - but you can optionally enable dedicated IPs (VIP).
See the CloudFront SSL for more details about pricing : https://aws.amazon.com/cloudfront/custom-ssl-domains/
199 200 201 |
# File 'cloud_front/distribution_props.rb', line 199 def ssl_support_method @ssl_support_method end |
#web_acl_id ⇒ String? (readonly)
Default: - No AWS Web Application Firewall web access control list (web ACL).
Unique identifier that specifies the AWS WAF web ACL to associate with this CloudFront distribution.
To specify a web ACL created using the latest version of AWS WAF, use the ACL ARN, for example
arn:aws:wafv2:us-east-1:123456789012:global/webacl/ExampleWebACL/473e64fd-f30b-4765-81a0-62ad96dd167a.
To specify a web ACL created using AWS WAF Classic, use the ACL ID, for example 473e64fd-f30b-4765-81a0-62ad96dd167a.
209 210 211 |
# File 'cloud_front/distribution_props.rb', line 209 def web_acl_id @web_acl_id end |
Class Method Details
.jsii_properties ⇒ Object
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'cloud_front/distribution_props.rb', line 211 def self.jsii_properties { :default_behavior => "defaultBehavior", :additional_behaviors => "additionalBehaviors", :certificate => "certificate", :comment => "comment", :default_root_object => "defaultRootObject", :domain_names => "domainNames", :enabled => "enabled", :enable_ipv6 => "enableIpv6", :enable_logging => "enableLogging", :error_responses => "errorResponses", :geo_restriction => "geoRestriction", :http_version => "httpVersion", :log_bucket => "logBucket", :log_file_prefix => "logFilePrefix", :log_includes_cookies => "logIncludesCookies", :minimum_protocol_version => "minimumProtocolVersion", :price_class => "priceClass", :publish_additional_metrics => "publishAdditionalMetrics", :ssl_support_method => "sslSupportMethod", :web_acl_id => "webAclId", } end |
Instance Method Details
#to_jsii ⇒ Object
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'cloud_front/distribution_props.rb', line 236 def to_jsii result = {} result.merge!({ "defaultBehavior" => @default_behavior, "additionalBehaviors" => @additional_behaviors, "certificate" => @certificate, "comment" => @comment, "defaultRootObject" => @default_root_object, "domainNames" => @domain_names, "enabled" => @enabled, "enableIpv6" => @enable_ipv6, "enableLogging" => @enable_logging, "errorResponses" => @error_responses, "geoRestriction" => @geo_restriction, "httpVersion" => @http_version, "logBucket" => @log_bucket, "logFilePrefix" => @log_file_prefix, "logIncludesCookies" => @log_includes_cookies, "minimumProtocolVersion" => @minimum_protocol_version, "priceClass" => @price_class, "publishAdditionalMetrics" => @publish_additional_metrics, "sslSupportMethod" => @ssl_support_method, "webAclId" => @web_acl_id, }) result.compact end |