Class: AWSCDK::CloudFront::CloudFrontWebDistributionProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
cloud_front/cloud_front_web_distribution_props.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(origin_configs:, comment: nil, default_root_object: nil, enabled: nil, enable_ip_v6: nil, error_configurations: nil, geo_restriction: nil, http_version: nil, logging_config: nil, price_class: nil, viewer_certificate: nil, viewer_protocol_policy: nil, web_acl_id: nil) ⇒ CloudFrontWebDistributionProps

Returns a new instance of CloudFrontWebDistributionProps.

Parameters:

  • origin_configs (Array<AWSCDK::CloudFront::SourceConfiguration>)

    The origin configurations for this distribution.

  • comment (String, nil) (defaults to: nil)

    A comment for this distribution in the CloudFront console.

  • default_root_object (String, nil) (defaults to: nil)

    The default object to serve.

  • enabled (Boolean, nil) (defaults to: nil)

    Enable or disable the distribution.

  • enable_ip_v6 (Boolean, nil) (defaults to: nil)

    If your distribution should have IPv6 enabled.

  • error_configurations (Array<AWSCDK::CloudFront::CfnDistribution::CustomErrorResponseProperty>, nil) (defaults to: nil)

    How CloudFront should handle requests that are not successful (eg PageNotFound).

  • geo_restriction (AWSCDK::CloudFront::GeoRestriction, nil) (defaults to: nil)

    Controls the countries in which your content is distributed.

  • http_version (AWSCDK::CloudFront::HttpVersion, nil) (defaults to: nil)

    The max supported HTTP Versions.

  • logging_config (AWSCDK::CloudFront::LoggingConfiguration, nil) (defaults to: nil)

    Optional - if we should enable logging.

  • price_class (AWSCDK::CloudFront::PriceClass, nil) (defaults to: nil)

    The price class for the distribution (this impacts how many locations CloudFront uses for your distribution, and billing).

  • viewer_certificate (AWSCDK::CloudFront::ViewerCertificate, nil) (defaults to: nil)

    Specifies whether you want viewers to use HTTP or HTTPS to request your objects, whether you're using an alternate domain name with HTTPS, and if so, if you're using AWS Certificate Manager (ACM) or a third-party certificate authority.

  • viewer_protocol_policy (AWSCDK::CloudFront::ViewerProtocolPolicy, nil) (defaults to: nil)

    The default viewer policy for incoming clients.

  • web_acl_id (String, nil) (defaults to: nil)

    Unique identifier that specifies the AWS WAF web ACL to associate with this CloudFront distribution.



19
20
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
# File 'cloud_front/cloud_front_web_distribution_props.rb', line 19

def initialize(origin_configs:, comment: nil, default_root_object: nil, enabled: nil, enable_ip_v6: nil, error_configurations: nil, geo_restriction: nil, http_version: nil, logging_config: nil, price_class: nil, viewer_certificate: nil, viewer_protocol_policy: nil, web_acl_id: nil)
  @origin_configs = origin_configs.is_a?(Array) ? origin_configs.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CloudFront::SourceConfiguration.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : origin_configs
  Jsii::Type.check_type(@origin_configs, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250LlNvdXJjZUNvbmZpZ3VyYXRpb24ifSwia2luZCI6ImFycmF5In19")), "originConfigs")
  @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?
  @enabled = enabled
  Jsii::Type.check_type(@enabled, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enabled") unless @enabled.nil?
  @enable_ip_v6 = enable_ip_v6
  Jsii::Type.check_type(@enable_ip_v6, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableIpV6") unless @enable_ip_v6.nil?
  @error_configurations = error_configurations.is_a?(Array) ? error_configurations.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CloudFront::CfnDistribution::CustomErrorResponseProperty.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : error_configurations
  Jsii::Type.check_type(@error_configurations, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250LkNmbkRpc3RyaWJ1dGlvbi5DdXN0b21FcnJvclJlc3BvbnNlUHJvcGVydHkifSwia2luZCI6ImFycmF5In19")), "errorConfigurations") unless @error_configurations.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?
  @logging_config = logging_config.is_a?(Hash) ? ::AWSCDK::CloudFront::LoggingConfiguration.new(**logging_config.transform_keys(&:to_sym)) : logging_config
  Jsii::Type.check_type(@logging_config, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5Mb2dnaW5nQ29uZmlndXJhdGlvbiJ9")), "loggingConfig") unless @logging_config.nil?
  @price_class = price_class
  Jsii::Type.check_type(@price_class, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5QcmljZUNsYXNzIn0=")), "priceClass") unless @price_class.nil?
  @viewer_certificate = viewer_certificate
  Jsii::Type.check_type(@viewer_certificate, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWRmcm9udC5WaWV3ZXJDZXJ0aWZpY2F0ZSJ9")), "viewerCertificate") unless @viewer_certificate.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?
  @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

#commentString? (readonly)

Note:

Default: - No comment is added to distribution.

A comment for this distribution in the CloudFront console.

Returns:

  • (String, nil)


58
59
60
# File 'cloud_front/cloud_front_web_distribution_props.rb', line 58

def comment
  @comment
end

#default_root_objectString? (readonly)

Note:

Default: - "index.html" is served.

The default object to serve.

Returns:

  • (String, nil)


63
64
65
# File 'cloud_front/cloud_front_web_distribution_props.rb', line 63

def default_root_object
  @default_root_object
end

#enable_ip_v6Boolean? (readonly)

Note:

Default: true

If your distribution should have IPv6 enabled.

Returns:

  • (Boolean, nil)


73
74
75
# File 'cloud_front/cloud_front_web_distribution_props.rb', line 73

def enable_ip_v6
  @enable_ip_v6
end

#enabledBoolean? (readonly)

Note:

Default: true

Enable or disable the distribution.

Returns:

  • (Boolean, nil)


68
69
70
# File 'cloud_front/cloud_front_web_distribution_props.rb', line 68

def enabled
  @enabled
end

#error_configurationsArray<AWSCDK::CloudFront::CfnDistribution::CustomErrorResponseProperty>? (readonly)

Note:

Default: - No custom error configuration.

How CloudFront should handle requests that are not successful (eg PageNotFound).

By default, CloudFront does not replace HTTP status codes in the 4xx and 5xx range with custom error messages. CloudFront does not cache HTTP status codes.



81
82
83
# File 'cloud_front/cloud_front_web_distribution_props.rb', line 81

def error_configurations
  @error_configurations
end

#geo_restrictionAWSCDK::CloudFront::GeoRestriction? (readonly)

Note:

Default: No geo restriction

Controls the countries in which your content is distributed.



86
87
88
# File 'cloud_front/cloud_front_web_distribution_props.rb', line 86

def geo_restriction
  @geo_restriction
end

#http_versionAWSCDK::CloudFront::HttpVersion? (readonly)

Note:

Default: HttpVersion.HTTP2

The max supported HTTP Versions.



91
92
93
# File 'cloud_front/cloud_front_web_distribution_props.rb', line 91

def http_version
  @http_version
end

#logging_configAWSCDK::CloudFront::LoggingConfiguration? (readonly)

Note:

Default: - no logging is enabled by default.

Optional - if we should enable logging.

You can pass an empty object ({}) to have us auto create a bucket for logging. Omission of this property indicates no logging is to be enabled.



99
100
101
# File 'cloud_front/cloud_front_web_distribution_props.rb', line 99

def logging_config
  @logging_config
end

#origin_configsArray<AWSCDK::CloudFront::SourceConfiguration> (readonly)

The origin configurations for this distribution.

Behaviors are a part of the origin.



53
54
55
# File 'cloud_front/cloud_front_web_distribution_props.rb', line 53

def origin_configs
  @origin_configs
end

#price_classAWSCDK::CloudFront::PriceClass? (readonly)

Note:

Default: PriceClass.PRICE_CLASS_100 the cheapest option for CloudFront is picked by default.

The price class for the distribution (this impacts how many locations CloudFront uses for your distribution, and billing).



104
105
106
# File 'cloud_front/cloud_front_web_distribution_props.rb', line 104

def price_class
  @price_class
end

#viewer_certificateAWSCDK::CloudFront::ViewerCertificate? (readonly)

Note:

Default: ViewerCertificate.fromCloudFrontDefaultCertificate()

Specifies whether you want viewers to use HTTP or HTTPS to request your objects, whether you're using an alternate domain name with HTTPS, and if so, if you're using AWS Certificate Manager (ACM) or a third-party certificate authority.



110
111
112
# File 'cloud_front/cloud_front_web_distribution_props.rb', line 110

def viewer_certificate
  @viewer_certificate
end

#viewer_protocol_policyAWSCDK::CloudFront::ViewerProtocolPolicy? (readonly)

Note:

Default: RedirectToHTTPs

The default viewer policy for incoming clients.



115
116
117
# File 'cloud_front/cloud_front_web_distribution_props.rb', line 115

def viewer_protocol_policy
  @viewer_protocol_policy
end

#web_acl_idString? (readonly)

Note:

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.



126
127
128
# File 'cloud_front/cloud_front_web_distribution_props.rb', line 126

def web_acl_id
  @web_acl_id
end

Class Method Details

.jsii_propertiesObject



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'cloud_front/cloud_front_web_distribution_props.rb', line 128

def self.jsii_properties
  {
    :origin_configs => "originConfigs",
    :comment => "comment",
    :default_root_object => "defaultRootObject",
    :enabled => "enabled",
    :enable_ip_v6 => "enableIpV6",
    :error_configurations => "errorConfigurations",
    :geo_restriction => "geoRestriction",
    :http_version => "httpVersion",
    :logging_config => "loggingConfig",
    :price_class => "priceClass",
    :viewer_certificate => "viewerCertificate",
    :viewer_protocol_policy => "viewerProtocolPolicy",
    :web_acl_id => "webACLId",
  }
end

Instance Method Details

#to_jsiiObject



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'cloud_front/cloud_front_web_distribution_props.rb', line 146

def to_jsii
  result = {}
  result.merge!({
    "originConfigs" => @origin_configs,
    "comment" => @comment,
    "defaultRootObject" => @default_root_object,
    "enabled" => @enabled,
    "enableIpV6" => @enable_ip_v6,
    "errorConfigurations" => @error_configurations,
    "geoRestriction" => @geo_restriction,
    "httpVersion" => @http_version,
    "loggingConfig" => @logging_config,
    "priceClass" => @price_class,
    "viewerCertificate" => @viewer_certificate,
    "viewerProtocolPolicy" => @viewer_protocol_policy,
    "webACLId" => @web_acl_id,
  })
  result.compact
end