Class DistributionProps.Builder
java.lang.Object
software.amazon.awscdk.services.cloudfront.DistributionProps.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<DistributionProps>
- Enclosing interface:
DistributionProps
@Stability(Stable)
public static final class DistributionProps.Builder
extends Object
implements software.amazon.jsii.Builder<DistributionProps>
A builder for
DistributionProps
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadditionalBehaviors
(Map<String, ? extends BehaviorOptions> additionalBehaviors) Sets the value ofDistributionProps.getAdditionalBehaviors()
build()
Builds the configured instance.certificate
(ICertificate certificate) Sets the value ofDistributionProps.getCertificate()
Sets the value ofDistributionProps.getComment()
defaultBehavior
(BehaviorOptions defaultBehavior) Sets the value ofDistributionProps.getDefaultBehavior()
defaultRootObject
(String defaultRootObject) Sets the value ofDistributionProps.getDefaultRootObject()
domainNames
(List<String> domainNames) Sets the value ofDistributionProps.getDomainNames()
Sets the value ofDistributionProps.getEnabled()
enableIpv6
(Boolean enableIpv6) Sets the value ofDistributionProps.getEnableIpv6()
enableLogging
(Boolean enableLogging) Sets the value ofDistributionProps.getEnableLogging()
errorResponses
(List<? extends ErrorResponse> errorResponses) Sets the value ofDistributionProps.getErrorResponses()
geoRestriction
(GeoRestriction geoRestriction) Sets the value ofDistributionProps.getGeoRestriction()
httpVersion
(HttpVersion httpVersion) Sets the value ofDistributionProps.getHttpVersion()
Sets the value ofDistributionProps.getLogBucket()
logFilePrefix
(String logFilePrefix) Sets the value ofDistributionProps.getLogFilePrefix()
logIncludesCookies
(Boolean logIncludesCookies) Sets the value ofDistributionProps.getLogIncludesCookies()
minimumProtocolVersion
(SecurityPolicyProtocol minimumProtocolVersion) Sets the value ofDistributionProps.getMinimumProtocolVersion()
priceClass
(PriceClass priceClass) Sets the value ofDistributionProps.getPriceClass()
sslSupportMethod
(SSLMethod sslSupportMethod) Sets the value ofDistributionProps.getSslSupportMethod()
Sets the value ofDistributionProps.getWebAclId()
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
defaultBehavior
@Stability(Stable) public DistributionProps.Builder defaultBehavior(BehaviorOptions defaultBehavior) Sets the value ofDistributionProps.getDefaultBehavior()
- Parameters:
defaultBehavior
- The default behavior for the distribution. This parameter is required.- Returns:
this
-
additionalBehaviors
@Stability(Stable) public DistributionProps.Builder additionalBehaviors(Map<String, ? extends BehaviorOptions> additionalBehaviors) Sets the value ofDistributionProps.getAdditionalBehaviors()
- Parameters:
additionalBehaviors
- Additional behaviors for the distribution, mapped by the pathPattern that specifies which requests to apply the behavior to.- Returns:
this
-
certificate
Sets the value ofDistributionProps.getCertificate()
- Parameters:
certificate
- A certificate to associate with the distribution. The certificate must be located in N. Virginia (us-east-1).- Returns:
this
-
comment
Sets the value ofDistributionProps.getComment()
- Parameters:
comment
- Any comments you want to include about the distribution.- Returns:
this
-
defaultRootObject
Sets the value ofDistributionProps.getDefaultRootObject()
- Parameters:
defaultRootObject
- 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/).- Returns:
this
-
domainNames
Sets the value ofDistributionProps.getDomainNames()
- Parameters:
domainNames
- 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 must add (at least one of) the domain names of the certificate to this list.- Returns:
this
-
enabled
Sets the value ofDistributionProps.getEnabled()
- Parameters:
enabled
- Enable or disable the distribution.- Returns:
this
-
enableIpv6
Sets the value ofDistributionProps.getEnableIpv6()
- Parameters:
enableIpv6
- 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.- Returns:
this
-
enableLogging
Sets the value ofDistributionProps.getEnableLogging()
- Parameters:
enableLogging
- Enable access logging for the distribution.- Returns:
this
-
errorResponses
@Stability(Stable) public DistributionProps.Builder errorResponses(List<? extends ErrorResponse> errorResponses) Sets the value ofDistributionProps.getErrorResponses()
- Parameters:
errorResponses
- How CloudFront should handle requests that are not successful (e.g., PageNotFound).- Returns:
this
-
geoRestriction
Sets the value ofDistributionProps.getGeoRestriction()
- Parameters:
geoRestriction
- Controls the countries in which your content is distributed.- Returns:
this
-
httpVersion
Sets the value ofDistributionProps.getHttpVersion()
- Parameters:
httpVersion
- 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).- Returns:
this
-
logBucket
Sets the value ofDistributionProps.getLogBucket()
- Parameters:
logBucket
- The Amazon S3 bucket to store the access logs in.- Returns:
this
-
logFilePrefix
Sets the value ofDistributionProps.getLogFilePrefix()
- Parameters:
logFilePrefix
- An optional string that you want CloudFront to prefix to the access log filenames for this distribution.- Returns:
this
-
logIncludesCookies
Sets the value ofDistributionProps.getLogIncludesCookies()
- Parameters:
logIncludesCookies
- Specifies whether you want CloudFront to include cookies in access logs.- Returns:
this
-
minimumProtocolVersion
@Stability(Stable) public DistributionProps.Builder minimumProtocolVersion(SecurityPolicyProtocol minimumProtocolVersion) Sets the value ofDistributionProps.getMinimumProtocolVersion()
- Parameters:
minimumProtocolVersion
- 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.- Returns:
this
-
priceClass
Sets the value ofDistributionProps.getPriceClass()
- Parameters:
priceClass
- 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.- Returns:
this
-
sslSupportMethod
Sets the value ofDistributionProps.getSslSupportMethod()
- Parameters:
sslSupportMethod
- 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/
- Returns:
this
-
webAclId
Sets the value ofDistributionProps.getWebAclId()
- Parameters:
webAclId
- 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 examplearn: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 example473e64fd-f30b-4765-81a0-62ad96dd167a
.- Returns:
this
-
build
Builds the configured instance.- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<DistributionProps>
- Returns:
- a new instance of
DistributionProps
- Throws:
NullPointerException
- if any required attribute was not provided
-