{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.CloudFront.Types.DistributionConfig
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CloudFront.Types.DistributionConfig where

import Amazonka.CloudFront.Types.Aliases
import Amazonka.CloudFront.Types.CacheBehaviors
import Amazonka.CloudFront.Types.CustomErrorResponses
import Amazonka.CloudFront.Types.DefaultCacheBehavior
import Amazonka.CloudFront.Types.HttpVersion
import Amazonka.CloudFront.Types.LoggingConfig
import Amazonka.CloudFront.Types.OriginGroups
import Amazonka.CloudFront.Types.Origins
import Amazonka.CloudFront.Types.PriceClass
import Amazonka.CloudFront.Types.Restrictions
import Amazonka.CloudFront.Types.ViewerCertificate
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A distribution configuration.
--
-- /See:/ 'newDistributionConfig' smart constructor.
data DistributionConfig = DistributionConfig'
  { -- | (Optional) Specify the maximum HTTP version that you want viewers to use
    -- to communicate with CloudFront. The default value for new web
    -- distributions is http2. Viewers that don\'t support HTTP\/2
    -- automatically use an earlier HTTP version.
    --
    -- For viewers and CloudFront to use HTTP\/2, viewers must support TLS 1.2
    -- or later, and must support Server Name Identification (SNI).
    --
    -- In general, configuring CloudFront to communicate with viewers using
    -- HTTP\/2 reduces latency. You can improve performance by optimizing for
    -- HTTP\/2. For more information, do an Internet search for \"http\/2
    -- optimization.\"
    DistributionConfig -> Maybe HttpVersion
httpVersion :: Prelude.Maybe HttpVersion,
    -- | A complex type that contains information about origin groups for this
    -- distribution.
    DistributionConfig -> Maybe OriginGroups
originGroups :: Prelude.Maybe OriginGroups,
    -- | A complex type that contains information about CNAMEs (alternate domain
    -- names), if any, for this distribution.
    DistributionConfig -> Maybe Aliases
aliases :: Prelude.Maybe Aliases,
    -- | 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 (@http:\/\/www.example.com@) instead of an object in your
    -- distribution (@http:\/\/www.example.com\/product-description.html@).
    -- Specifying a default root object avoids exposing the contents of your
    -- distribution.
    --
    -- Specify only the object name, for example, @index.html@. Don\'t add a
    -- @\/@ before the object name.
    --
    -- If you don\'t want to specify a default root object when you create a
    -- distribution, include an empty @DefaultRootObject@ element.
    --
    -- To delete the default root object from an existing distribution, update
    -- the distribution configuration and include an empty @DefaultRootObject@
    -- element.
    --
    -- To replace the default root object, update the distribution
    -- configuration and specify the new object.
    --
    -- For more information about the default root object, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DefaultRootObject.html Creating a Default Root Object>
    -- in the /Amazon CloudFront Developer Guide/.
    DistributionConfig -> Maybe Text
defaultRootObject :: Prelude.Maybe Prelude.Text,
    -- | 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. Viewers who
    -- are in or near regions that are excluded from your specified price class
    -- may encounter slower performance.
    --
    -- For more information about price classes, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PriceClass.html Choosing the Price Class for a CloudFront Distribution>
    -- in the /Amazon CloudFront Developer Guide/. For information about
    -- CloudFront pricing, including how price classes (such as Price Class
    -- 100) map to CloudFront regions, see
    -- <http://aws.amazon.com/cloudfront/pricing/ Amazon CloudFront Pricing>.
    DistributionConfig -> Maybe PriceClass
priceClass :: Prelude.Maybe PriceClass,
    -- | A complex type that controls the following:
    --
    -- -   Whether CloudFront replaces HTTP status codes in the 4xx and 5xx
    --     range with custom error messages before returning the response to
    --     the viewer.
    --
    -- -   How long CloudFront caches HTTP status codes in the 4xx and 5xx
    --     range.
    --
    -- For more information about custom error pages, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/custom-error-pages.html Customizing Error Responses>
    -- in the /Amazon CloudFront Developer Guide/.
    DistributionConfig -> Maybe CustomErrorResponses
customErrorResponses :: Prelude.Maybe CustomErrorResponses,
    -- | A unique identifier that specifies the WAF web ACL, if any, to associate
    -- with this distribution. To specify a web ACL created using the latest
    -- version of 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 WAF Classic, use the ACL ID, for
    -- example @473e64fd-f30b-4765-81a0-62ad96dd167a@.
    --
    -- WAF is a web application firewall that lets you monitor the HTTP and
    -- HTTPS requests that are forwarded to CloudFront, and lets you control
    -- access to your content. Based on conditions that you specify, such as
    -- the IP addresses that requests originate from or the values of query
    -- strings, CloudFront responds to requests either with the requested
    -- content or with an HTTP 403 status code (Forbidden). You can also
    -- configure CloudFront to return a custom error page when a request is
    -- blocked. For more information about WAF, see the
    -- <https://docs.aws.amazon.com/waf/latest/developerguide/what-is-aws-waf.html WAF Developer Guide>.
    DistributionConfig -> Maybe Text
webACLId :: Prelude.Maybe Prelude.Text,
    -- | A complex type that determines the distribution’s SSL\/TLS configuration
    -- for communicating with viewers.
    DistributionConfig -> Maybe ViewerCertificate
viewerCertificate :: Prelude.Maybe ViewerCertificate,
    -- | A complex type that identifies ways in which you want to restrict
    -- distribution of your content.
    DistributionConfig -> Maybe Restrictions
restrictions :: Prelude.Maybe Restrictions,
    -- | A complex type that controls whether access logs are written for the
    -- distribution.
    --
    -- For more information about logging, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/AccessLogs.html Access Logs>
    -- in the /Amazon CloudFront Developer Guide/.
    DistributionConfig -> Maybe LoggingConfig
logging :: Prelude.Maybe LoggingConfig,
    -- | A complex type that contains zero or more @CacheBehavior@ elements.
    DistributionConfig -> Maybe CacheBehaviors
cacheBehaviors :: Prelude.Maybe CacheBehaviors,
    -- | If you want CloudFront to respond to IPv6 DNS requests with an IPv6
    -- address for your distribution, specify @true@. 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.
    --
    -- In general, you should enable IPv6 if you have users on IPv6 networks
    -- who want to access your content. However, if you\'re using signed URLs
    -- or signed cookies to restrict access to your content, and if you\'re
    -- using a custom policy that includes the @IpAddress@ parameter to
    -- restrict the IP addresses that can access your content, don\'t enable
    -- IPv6. If you want to restrict access to some content by IP address and
    -- not restrict access to other content (or restrict access but not by IP
    -- address), you can create two distributions. For more information, see
    -- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-creating-signed-url-custom-policy.html Creating a Signed URL Using a Custom Policy>
    -- in the /Amazon CloudFront Developer Guide/.
    --
    -- If you\'re using an Route 53 Amazon Web Services Integration alias
    -- resource record set to route traffic to your CloudFront distribution,
    -- you need to create a second alias resource record set when both of the
    -- following are true:
    --
    -- -   You enable IPv6 for the distribution
    --
    -- -   You\'re using alternate domain names in the URLs for your objects
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-cloudfront-distribution.html Routing Traffic to an Amazon CloudFront Web Distribution by Using Your Domain Name>
    -- in the /Route 53 Amazon Web Services Integration Developer Guide/.
    --
    -- If you created a CNAME resource record set, either with Route 53 Amazon
    -- Web Services Integration or with another DNS service, you don\'t need to
    -- make any changes. A CNAME record will route traffic to your distribution
    -- regardless of the IP address format of the viewer request.
    DistributionConfig -> Maybe Bool
isIPV6Enabled :: Prelude.Maybe Prelude.Bool,
    -- | A unique value (for example, a date-time stamp) that ensures that the
    -- request can\'t be replayed.
    --
    -- If the value of @CallerReference@ is new (regardless of the content of
    -- the @DistributionConfig@ object), CloudFront creates a new distribution.
    --
    -- If @CallerReference@ is a value that you already sent in a previous
    -- request to create a distribution, CloudFront returns a
    -- @DistributionAlreadyExists@ error.
    DistributionConfig -> Text
callerReference :: Prelude.Text,
    -- | A complex type that contains information about origins for this
    -- distribution.
    DistributionConfig -> Origins
origins :: Origins,
    -- | A complex type that describes the default cache behavior if you don\'t
    -- specify a @CacheBehavior@ element or if files don\'t match any of the
    -- values of @PathPattern@ in @CacheBehavior@ elements. You must create
    -- exactly one default cache behavior.
    DistributionConfig -> DefaultCacheBehavior
defaultCacheBehavior :: DefaultCacheBehavior,
    -- | An optional comment to describe the distribution. The comment cannot be
    -- longer than 128 characters.
    DistributionConfig -> Sensitive Text
comment :: Core.Sensitive Prelude.Text,
    -- | From this field, you can enable or disable the selected distribution.
    DistributionConfig -> Bool
enabled :: Prelude.Bool
  }
  deriving (DistributionConfig -> DistributionConfig -> Bool
(DistributionConfig -> DistributionConfig -> Bool)
-> (DistributionConfig -> DistributionConfig -> Bool)
-> Eq DistributionConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DistributionConfig -> DistributionConfig -> Bool
$c/= :: DistributionConfig -> DistributionConfig -> Bool
== :: DistributionConfig -> DistributionConfig -> Bool
$c== :: DistributionConfig -> DistributionConfig -> Bool
Prelude.Eq, Int -> DistributionConfig -> ShowS
[DistributionConfig] -> ShowS
DistributionConfig -> String
(Int -> DistributionConfig -> ShowS)
-> (DistributionConfig -> String)
-> ([DistributionConfig] -> ShowS)
-> Show DistributionConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DistributionConfig] -> ShowS
$cshowList :: [DistributionConfig] -> ShowS
show :: DistributionConfig -> String
$cshow :: DistributionConfig -> String
showsPrec :: Int -> DistributionConfig -> ShowS
$cshowsPrec :: Int -> DistributionConfig -> ShowS
Prelude.Show, (forall x. DistributionConfig -> Rep DistributionConfig x)
-> (forall x. Rep DistributionConfig x -> DistributionConfig)
-> Generic DistributionConfig
forall x. Rep DistributionConfig x -> DistributionConfig
forall x. DistributionConfig -> Rep DistributionConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DistributionConfig x -> DistributionConfig
$cfrom :: forall x. DistributionConfig -> Rep DistributionConfig x
Prelude.Generic)

-- |
-- Create a value of 'DistributionConfig' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpVersion', 'distributionConfig_httpVersion' - (Optional) Specify the maximum HTTP version that you want viewers to use
-- to communicate with CloudFront. The default value for new web
-- distributions is http2. Viewers that don\'t support HTTP\/2
-- automatically use an earlier HTTP version.
--
-- For viewers and CloudFront to use HTTP\/2, viewers must support TLS 1.2
-- or later, and must support Server Name Identification (SNI).
--
-- In general, configuring CloudFront to communicate with viewers using
-- HTTP\/2 reduces latency. You can improve performance by optimizing for
-- HTTP\/2. For more information, do an Internet search for \"http\/2
-- optimization.\"
--
-- 'originGroups', 'distributionConfig_originGroups' - A complex type that contains information about origin groups for this
-- distribution.
--
-- 'aliases', 'distributionConfig_aliases' - A complex type that contains information about CNAMEs (alternate domain
-- names), if any, for this distribution.
--
-- 'defaultRootObject', 'distributionConfig_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 (@http:\/\/www.example.com@) instead of an object in your
-- distribution (@http:\/\/www.example.com\/product-description.html@).
-- Specifying a default root object avoids exposing the contents of your
-- distribution.
--
-- Specify only the object name, for example, @index.html@. Don\'t add a
-- @\/@ before the object name.
--
-- If you don\'t want to specify a default root object when you create a
-- distribution, include an empty @DefaultRootObject@ element.
--
-- To delete the default root object from an existing distribution, update
-- the distribution configuration and include an empty @DefaultRootObject@
-- element.
--
-- To replace the default root object, update the distribution
-- configuration and specify the new object.
--
-- For more information about the default root object, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DefaultRootObject.html Creating a Default Root Object>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'priceClass', 'distributionConfig_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. Viewers who
-- are in or near regions that are excluded from your specified price class
-- may encounter slower performance.
--
-- For more information about price classes, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PriceClass.html Choosing the Price Class for a CloudFront Distribution>
-- in the /Amazon CloudFront Developer Guide/. For information about
-- CloudFront pricing, including how price classes (such as Price Class
-- 100) map to CloudFront regions, see
-- <http://aws.amazon.com/cloudfront/pricing/ Amazon CloudFront Pricing>.
--
-- 'customErrorResponses', 'distributionConfig_customErrorResponses' - A complex type that controls the following:
--
-- -   Whether CloudFront replaces HTTP status codes in the 4xx and 5xx
--     range with custom error messages before returning the response to
--     the viewer.
--
-- -   How long CloudFront caches HTTP status codes in the 4xx and 5xx
--     range.
--
-- For more information about custom error pages, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/custom-error-pages.html Customizing Error Responses>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'webACLId', 'distributionConfig_webACLId' - A unique identifier that specifies the WAF web ACL, if any, to associate
-- with this distribution. To specify a web ACL created using the latest
-- version of 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 WAF Classic, use the ACL ID, for
-- example @473e64fd-f30b-4765-81a0-62ad96dd167a@.
--
-- WAF is a web application firewall that lets you monitor the HTTP and
-- HTTPS requests that are forwarded to CloudFront, and lets you control
-- access to your content. Based on conditions that you specify, such as
-- the IP addresses that requests originate from or the values of query
-- strings, CloudFront responds to requests either with the requested
-- content or with an HTTP 403 status code (Forbidden). You can also
-- configure CloudFront to return a custom error page when a request is
-- blocked. For more information about WAF, see the
-- <https://docs.aws.amazon.com/waf/latest/developerguide/what-is-aws-waf.html WAF Developer Guide>.
--
-- 'viewerCertificate', 'distributionConfig_viewerCertificate' - A complex type that determines the distribution’s SSL\/TLS configuration
-- for communicating with viewers.
--
-- 'restrictions', 'distributionConfig_restrictions' - A complex type that identifies ways in which you want to restrict
-- distribution of your content.
--
-- 'logging', 'distributionConfig_logging' - A complex type that controls whether access logs are written for the
-- distribution.
--
-- For more information about logging, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/AccessLogs.html Access Logs>
-- in the /Amazon CloudFront Developer Guide/.
--
-- 'cacheBehaviors', 'distributionConfig_cacheBehaviors' - A complex type that contains zero or more @CacheBehavior@ elements.
--
-- 'isIPV6Enabled', 'distributionConfig_isIPV6Enabled' - If you want CloudFront to respond to IPv6 DNS requests with an IPv6
-- address for your distribution, specify @true@. 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.
--
-- In general, you should enable IPv6 if you have users on IPv6 networks
-- who want to access your content. However, if you\'re using signed URLs
-- or signed cookies to restrict access to your content, and if you\'re
-- using a custom policy that includes the @IpAddress@ parameter to
-- restrict the IP addresses that can access your content, don\'t enable
-- IPv6. If you want to restrict access to some content by IP address and
-- not restrict access to other content (or restrict access but not by IP
-- address), you can create two distributions. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-creating-signed-url-custom-policy.html Creating a Signed URL Using a Custom Policy>
-- in the /Amazon CloudFront Developer Guide/.
--
-- If you\'re using an Route 53 Amazon Web Services Integration alias
-- resource record set to route traffic to your CloudFront distribution,
-- you need to create a second alias resource record set when both of the
-- following are true:
--
-- -   You enable IPv6 for the distribution
--
-- -   You\'re using alternate domain names in the URLs for your objects
--
-- For more information, see
-- <https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-cloudfront-distribution.html Routing Traffic to an Amazon CloudFront Web Distribution by Using Your Domain Name>
-- in the /Route 53 Amazon Web Services Integration Developer Guide/.
--
-- If you created a CNAME resource record set, either with Route 53 Amazon
-- Web Services Integration or with another DNS service, you don\'t need to
-- make any changes. A CNAME record will route traffic to your distribution
-- regardless of the IP address format of the viewer request.
--
-- 'callerReference', 'distributionConfig_callerReference' - A unique value (for example, a date-time stamp) that ensures that the
-- request can\'t be replayed.
--
-- If the value of @CallerReference@ is new (regardless of the content of
-- the @DistributionConfig@ object), CloudFront creates a new distribution.
--
-- If @CallerReference@ is a value that you already sent in a previous
-- request to create a distribution, CloudFront returns a
-- @DistributionAlreadyExists@ error.
--
-- 'origins', 'distributionConfig_origins' - A complex type that contains information about origins for this
-- distribution.
--
-- 'defaultCacheBehavior', 'distributionConfig_defaultCacheBehavior' - A complex type that describes the default cache behavior if you don\'t
-- specify a @CacheBehavior@ element or if files don\'t match any of the
-- values of @PathPattern@ in @CacheBehavior@ elements. You must create
-- exactly one default cache behavior.
--
-- 'comment', 'distributionConfig_comment' - An optional comment to describe the distribution. The comment cannot be
-- longer than 128 characters.
--
-- 'enabled', 'distributionConfig_enabled' - From this field, you can enable or disable the selected distribution.
newDistributionConfig ::
  -- | 'callerReference'
  Prelude.Text ->
  -- | 'origins'
  Origins ->
  -- | 'defaultCacheBehavior'
  DefaultCacheBehavior ->
  -- | 'comment'
  Prelude.Text ->
  -- | 'enabled'
  Prelude.Bool ->
  DistributionConfig
newDistributionConfig :: Text
-> Origins
-> DefaultCacheBehavior
-> Text
-> Bool
-> DistributionConfig
newDistributionConfig
  Text
pCallerReference_
  Origins
pOrigins_
  DefaultCacheBehavior
pDefaultCacheBehavior_
  Text
pComment_
  Bool
pEnabled_ =
    DistributionConfig' :: Maybe HttpVersion
-> Maybe OriginGroups
-> Maybe Aliases
-> Maybe Text
-> Maybe PriceClass
-> Maybe CustomErrorResponses
-> Maybe Text
-> Maybe ViewerCertificate
-> Maybe Restrictions
-> Maybe LoggingConfig
-> Maybe CacheBehaviors
-> Maybe Bool
-> Text
-> Origins
-> DefaultCacheBehavior
-> Sensitive Text
-> Bool
-> DistributionConfig
DistributionConfig'
      { $sel:httpVersion:DistributionConfig' :: Maybe HttpVersion
httpVersion = Maybe HttpVersion
forall a. Maybe a
Prelude.Nothing,
        $sel:originGroups:DistributionConfig' :: Maybe OriginGroups
originGroups = Maybe OriginGroups
forall a. Maybe a
Prelude.Nothing,
        $sel:aliases:DistributionConfig' :: Maybe Aliases
aliases = Maybe Aliases
forall a. Maybe a
Prelude.Nothing,
        $sel:defaultRootObject:DistributionConfig' :: Maybe Text
defaultRootObject = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:priceClass:DistributionConfig' :: Maybe PriceClass
priceClass = Maybe PriceClass
forall a. Maybe a
Prelude.Nothing,
        $sel:customErrorResponses:DistributionConfig' :: Maybe CustomErrorResponses
customErrorResponses = Maybe CustomErrorResponses
forall a. Maybe a
Prelude.Nothing,
        $sel:webACLId:DistributionConfig' :: Maybe Text
webACLId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:viewerCertificate:DistributionConfig' :: Maybe ViewerCertificate
viewerCertificate = Maybe ViewerCertificate
forall a. Maybe a
Prelude.Nothing,
        $sel:restrictions:DistributionConfig' :: Maybe Restrictions
restrictions = Maybe Restrictions
forall a. Maybe a
Prelude.Nothing,
        $sel:logging:DistributionConfig' :: Maybe LoggingConfig
logging = Maybe LoggingConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:cacheBehaviors:DistributionConfig' :: Maybe CacheBehaviors
cacheBehaviors = Maybe CacheBehaviors
forall a. Maybe a
Prelude.Nothing,
        $sel:isIPV6Enabled:DistributionConfig' :: Maybe Bool
isIPV6Enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:callerReference:DistributionConfig' :: Text
callerReference = Text
pCallerReference_,
        $sel:origins:DistributionConfig' :: Origins
origins = Origins
pOrigins_,
        $sel:defaultCacheBehavior:DistributionConfig' :: DefaultCacheBehavior
defaultCacheBehavior = DefaultCacheBehavior
pDefaultCacheBehavior_,
        $sel:comment:DistributionConfig' :: Sensitive Text
comment = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pComment_,
        $sel:enabled:DistributionConfig' :: Bool
enabled = Bool
pEnabled_
      }

-- | (Optional) Specify the maximum HTTP version that you want viewers to use
-- to communicate with CloudFront. The default value for new web
-- distributions is http2. Viewers that don\'t support HTTP\/2
-- automatically use an earlier HTTP version.
--
-- For viewers and CloudFront to use HTTP\/2, viewers must support TLS 1.2
-- or later, and must support Server Name Identification (SNI).
--
-- In general, configuring CloudFront to communicate with viewers using
-- HTTP\/2 reduces latency. You can improve performance by optimizing for
-- HTTP\/2. For more information, do an Internet search for \"http\/2
-- optimization.\"
distributionConfig_httpVersion :: Lens.Lens' DistributionConfig (Prelude.Maybe HttpVersion)
distributionConfig_httpVersion :: (Maybe HttpVersion -> f (Maybe HttpVersion))
-> DistributionConfig -> f DistributionConfig
distributionConfig_httpVersion = (DistributionConfig -> Maybe HttpVersion)
-> (DistributionConfig -> Maybe HttpVersion -> DistributionConfig)
-> Lens
     DistributionConfig
     DistributionConfig
     (Maybe HttpVersion)
     (Maybe HttpVersion)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionConfig' {Maybe HttpVersion
httpVersion :: Maybe HttpVersion
$sel:httpVersion:DistributionConfig' :: DistributionConfig -> Maybe HttpVersion
httpVersion} -> Maybe HttpVersion
httpVersion) (\s :: DistributionConfig
s@DistributionConfig' {} Maybe HttpVersion
a -> DistributionConfig
s {$sel:httpVersion:DistributionConfig' :: Maybe HttpVersion
httpVersion = Maybe HttpVersion
a} :: DistributionConfig)

-- | A complex type that contains information about origin groups for this
-- distribution.
distributionConfig_originGroups :: Lens.Lens' DistributionConfig (Prelude.Maybe OriginGroups)
distributionConfig_originGroups :: (Maybe OriginGroups -> f (Maybe OriginGroups))
-> DistributionConfig -> f DistributionConfig
distributionConfig_originGroups = (DistributionConfig -> Maybe OriginGroups)
-> (DistributionConfig -> Maybe OriginGroups -> DistributionConfig)
-> Lens
     DistributionConfig
     DistributionConfig
     (Maybe OriginGroups)
     (Maybe OriginGroups)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionConfig' {Maybe OriginGroups
originGroups :: Maybe OriginGroups
$sel:originGroups:DistributionConfig' :: DistributionConfig -> Maybe OriginGroups
originGroups} -> Maybe OriginGroups
originGroups) (\s :: DistributionConfig
s@DistributionConfig' {} Maybe OriginGroups
a -> DistributionConfig
s {$sel:originGroups:DistributionConfig' :: Maybe OriginGroups
originGroups = Maybe OriginGroups
a} :: DistributionConfig)

-- | A complex type that contains information about CNAMEs (alternate domain
-- names), if any, for this distribution.
distributionConfig_aliases :: Lens.Lens' DistributionConfig (Prelude.Maybe Aliases)
distributionConfig_aliases :: (Maybe Aliases -> f (Maybe Aliases))
-> DistributionConfig -> f DistributionConfig
distributionConfig_aliases = (DistributionConfig -> Maybe Aliases)
-> (DistributionConfig -> Maybe Aliases -> DistributionConfig)
-> Lens
     DistributionConfig
     DistributionConfig
     (Maybe Aliases)
     (Maybe Aliases)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionConfig' {Maybe Aliases
aliases :: Maybe Aliases
$sel:aliases:DistributionConfig' :: DistributionConfig -> Maybe Aliases
aliases} -> Maybe Aliases
aliases) (\s :: DistributionConfig
s@DistributionConfig' {} Maybe Aliases
a -> DistributionConfig
s {$sel:aliases:DistributionConfig' :: Maybe Aliases
aliases = Maybe Aliases
a} :: DistributionConfig)

-- | 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 (@http:\/\/www.example.com@) instead of an object in your
-- distribution (@http:\/\/www.example.com\/product-description.html@).
-- Specifying a default root object avoids exposing the contents of your
-- distribution.
--
-- Specify only the object name, for example, @index.html@. Don\'t add a
-- @\/@ before the object name.
--
-- If you don\'t want to specify a default root object when you create a
-- distribution, include an empty @DefaultRootObject@ element.
--
-- To delete the default root object from an existing distribution, update
-- the distribution configuration and include an empty @DefaultRootObject@
-- element.
--
-- To replace the default root object, update the distribution
-- configuration and specify the new object.
--
-- For more information about the default root object, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DefaultRootObject.html Creating a Default Root Object>
-- in the /Amazon CloudFront Developer Guide/.
distributionConfig_defaultRootObject :: Lens.Lens' DistributionConfig (Prelude.Maybe Prelude.Text)
distributionConfig_defaultRootObject :: (Maybe Text -> f (Maybe Text))
-> DistributionConfig -> f DistributionConfig
distributionConfig_defaultRootObject = (DistributionConfig -> Maybe Text)
-> (DistributionConfig -> Maybe Text -> DistributionConfig)
-> Lens
     DistributionConfig DistributionConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionConfig' {Maybe Text
defaultRootObject :: Maybe Text
$sel:defaultRootObject:DistributionConfig' :: DistributionConfig -> Maybe Text
defaultRootObject} -> Maybe Text
defaultRootObject) (\s :: DistributionConfig
s@DistributionConfig' {} Maybe Text
a -> DistributionConfig
s {$sel:defaultRootObject:DistributionConfig' :: Maybe Text
defaultRootObject = Maybe Text
a} :: DistributionConfig)

-- | 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. Viewers who
-- are in or near regions that are excluded from your specified price class
-- may encounter slower performance.
--
-- For more information about price classes, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PriceClass.html Choosing the Price Class for a CloudFront Distribution>
-- in the /Amazon CloudFront Developer Guide/. For information about
-- CloudFront pricing, including how price classes (such as Price Class
-- 100) map to CloudFront regions, see
-- <http://aws.amazon.com/cloudfront/pricing/ Amazon CloudFront Pricing>.
distributionConfig_priceClass :: Lens.Lens' DistributionConfig (Prelude.Maybe PriceClass)
distributionConfig_priceClass :: (Maybe PriceClass -> f (Maybe PriceClass))
-> DistributionConfig -> f DistributionConfig
distributionConfig_priceClass = (DistributionConfig -> Maybe PriceClass)
-> (DistributionConfig -> Maybe PriceClass -> DistributionConfig)
-> Lens
     DistributionConfig
     DistributionConfig
     (Maybe PriceClass)
     (Maybe PriceClass)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionConfig' {Maybe PriceClass
priceClass :: Maybe PriceClass
$sel:priceClass:DistributionConfig' :: DistributionConfig -> Maybe PriceClass
priceClass} -> Maybe PriceClass
priceClass) (\s :: DistributionConfig
s@DistributionConfig' {} Maybe PriceClass
a -> DistributionConfig
s {$sel:priceClass:DistributionConfig' :: Maybe PriceClass
priceClass = Maybe PriceClass
a} :: DistributionConfig)

-- | A complex type that controls the following:
--
-- -   Whether CloudFront replaces HTTP status codes in the 4xx and 5xx
--     range with custom error messages before returning the response to
--     the viewer.
--
-- -   How long CloudFront caches HTTP status codes in the 4xx and 5xx
--     range.
--
-- For more information about custom error pages, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/custom-error-pages.html Customizing Error Responses>
-- in the /Amazon CloudFront Developer Guide/.
distributionConfig_customErrorResponses :: Lens.Lens' DistributionConfig (Prelude.Maybe CustomErrorResponses)
distributionConfig_customErrorResponses :: (Maybe CustomErrorResponses -> f (Maybe CustomErrorResponses))
-> DistributionConfig -> f DistributionConfig
distributionConfig_customErrorResponses = (DistributionConfig -> Maybe CustomErrorResponses)
-> (DistributionConfig
    -> Maybe CustomErrorResponses -> DistributionConfig)
-> Lens
     DistributionConfig
     DistributionConfig
     (Maybe CustomErrorResponses)
     (Maybe CustomErrorResponses)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionConfig' {Maybe CustomErrorResponses
customErrorResponses :: Maybe CustomErrorResponses
$sel:customErrorResponses:DistributionConfig' :: DistributionConfig -> Maybe CustomErrorResponses
customErrorResponses} -> Maybe CustomErrorResponses
customErrorResponses) (\s :: DistributionConfig
s@DistributionConfig' {} Maybe CustomErrorResponses
a -> DistributionConfig
s {$sel:customErrorResponses:DistributionConfig' :: Maybe CustomErrorResponses
customErrorResponses = Maybe CustomErrorResponses
a} :: DistributionConfig)

-- | A unique identifier that specifies the WAF web ACL, if any, to associate
-- with this distribution. To specify a web ACL created using the latest
-- version of 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 WAF Classic, use the ACL ID, for
-- example @473e64fd-f30b-4765-81a0-62ad96dd167a@.
--
-- WAF is a web application firewall that lets you monitor the HTTP and
-- HTTPS requests that are forwarded to CloudFront, and lets you control
-- access to your content. Based on conditions that you specify, such as
-- the IP addresses that requests originate from or the values of query
-- strings, CloudFront responds to requests either with the requested
-- content or with an HTTP 403 status code (Forbidden). You can also
-- configure CloudFront to return a custom error page when a request is
-- blocked. For more information about WAF, see the
-- <https://docs.aws.amazon.com/waf/latest/developerguide/what-is-aws-waf.html WAF Developer Guide>.
distributionConfig_webACLId :: Lens.Lens' DistributionConfig (Prelude.Maybe Prelude.Text)
distributionConfig_webACLId :: (Maybe Text -> f (Maybe Text))
-> DistributionConfig -> f DistributionConfig
distributionConfig_webACLId = (DistributionConfig -> Maybe Text)
-> (DistributionConfig -> Maybe Text -> DistributionConfig)
-> Lens
     DistributionConfig DistributionConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionConfig' {Maybe Text
webACLId :: Maybe Text
$sel:webACLId:DistributionConfig' :: DistributionConfig -> Maybe Text
webACLId} -> Maybe Text
webACLId) (\s :: DistributionConfig
s@DistributionConfig' {} Maybe Text
a -> DistributionConfig
s {$sel:webACLId:DistributionConfig' :: Maybe Text
webACLId = Maybe Text
a} :: DistributionConfig)

-- | A complex type that determines the distribution’s SSL\/TLS configuration
-- for communicating with viewers.
distributionConfig_viewerCertificate :: Lens.Lens' DistributionConfig (Prelude.Maybe ViewerCertificate)
distributionConfig_viewerCertificate :: (Maybe ViewerCertificate -> f (Maybe ViewerCertificate))
-> DistributionConfig -> f DistributionConfig
distributionConfig_viewerCertificate = (DistributionConfig -> Maybe ViewerCertificate)
-> (DistributionConfig
    -> Maybe ViewerCertificate -> DistributionConfig)
-> Lens
     DistributionConfig
     DistributionConfig
     (Maybe ViewerCertificate)
     (Maybe ViewerCertificate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionConfig' {Maybe ViewerCertificate
viewerCertificate :: Maybe ViewerCertificate
$sel:viewerCertificate:DistributionConfig' :: DistributionConfig -> Maybe ViewerCertificate
viewerCertificate} -> Maybe ViewerCertificate
viewerCertificate) (\s :: DistributionConfig
s@DistributionConfig' {} Maybe ViewerCertificate
a -> DistributionConfig
s {$sel:viewerCertificate:DistributionConfig' :: Maybe ViewerCertificate
viewerCertificate = Maybe ViewerCertificate
a} :: DistributionConfig)

-- | A complex type that identifies ways in which you want to restrict
-- distribution of your content.
distributionConfig_restrictions :: Lens.Lens' DistributionConfig (Prelude.Maybe Restrictions)
distributionConfig_restrictions :: (Maybe Restrictions -> f (Maybe Restrictions))
-> DistributionConfig -> f DistributionConfig
distributionConfig_restrictions = (DistributionConfig -> Maybe Restrictions)
-> (DistributionConfig -> Maybe Restrictions -> DistributionConfig)
-> Lens
     DistributionConfig
     DistributionConfig
     (Maybe Restrictions)
     (Maybe Restrictions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionConfig' {Maybe Restrictions
restrictions :: Maybe Restrictions
$sel:restrictions:DistributionConfig' :: DistributionConfig -> Maybe Restrictions
restrictions} -> Maybe Restrictions
restrictions) (\s :: DistributionConfig
s@DistributionConfig' {} Maybe Restrictions
a -> DistributionConfig
s {$sel:restrictions:DistributionConfig' :: Maybe Restrictions
restrictions = Maybe Restrictions
a} :: DistributionConfig)

-- | A complex type that controls whether access logs are written for the
-- distribution.
--
-- For more information about logging, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/AccessLogs.html Access Logs>
-- in the /Amazon CloudFront Developer Guide/.
distributionConfig_logging :: Lens.Lens' DistributionConfig (Prelude.Maybe LoggingConfig)
distributionConfig_logging :: (Maybe LoggingConfig -> f (Maybe LoggingConfig))
-> DistributionConfig -> f DistributionConfig
distributionConfig_logging = (DistributionConfig -> Maybe LoggingConfig)
-> (DistributionConfig
    -> Maybe LoggingConfig -> DistributionConfig)
-> Lens
     DistributionConfig
     DistributionConfig
     (Maybe LoggingConfig)
     (Maybe LoggingConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionConfig' {Maybe LoggingConfig
logging :: Maybe LoggingConfig
$sel:logging:DistributionConfig' :: DistributionConfig -> Maybe LoggingConfig
logging} -> Maybe LoggingConfig
logging) (\s :: DistributionConfig
s@DistributionConfig' {} Maybe LoggingConfig
a -> DistributionConfig
s {$sel:logging:DistributionConfig' :: Maybe LoggingConfig
logging = Maybe LoggingConfig
a} :: DistributionConfig)

-- | A complex type that contains zero or more @CacheBehavior@ elements.
distributionConfig_cacheBehaviors :: Lens.Lens' DistributionConfig (Prelude.Maybe CacheBehaviors)
distributionConfig_cacheBehaviors :: (Maybe CacheBehaviors -> f (Maybe CacheBehaviors))
-> DistributionConfig -> f DistributionConfig
distributionConfig_cacheBehaviors = (DistributionConfig -> Maybe CacheBehaviors)
-> (DistributionConfig
    -> Maybe CacheBehaviors -> DistributionConfig)
-> Lens
     DistributionConfig
     DistributionConfig
     (Maybe CacheBehaviors)
     (Maybe CacheBehaviors)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionConfig' {Maybe CacheBehaviors
cacheBehaviors :: Maybe CacheBehaviors
$sel:cacheBehaviors:DistributionConfig' :: DistributionConfig -> Maybe CacheBehaviors
cacheBehaviors} -> Maybe CacheBehaviors
cacheBehaviors) (\s :: DistributionConfig
s@DistributionConfig' {} Maybe CacheBehaviors
a -> DistributionConfig
s {$sel:cacheBehaviors:DistributionConfig' :: Maybe CacheBehaviors
cacheBehaviors = Maybe CacheBehaviors
a} :: DistributionConfig)

-- | If you want CloudFront to respond to IPv6 DNS requests with an IPv6
-- address for your distribution, specify @true@. 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.
--
-- In general, you should enable IPv6 if you have users on IPv6 networks
-- who want to access your content. However, if you\'re using signed URLs
-- or signed cookies to restrict access to your content, and if you\'re
-- using a custom policy that includes the @IpAddress@ parameter to
-- restrict the IP addresses that can access your content, don\'t enable
-- IPv6. If you want to restrict access to some content by IP address and
-- not restrict access to other content (or restrict access but not by IP
-- address), you can create two distributions. For more information, see
-- <https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-creating-signed-url-custom-policy.html Creating a Signed URL Using a Custom Policy>
-- in the /Amazon CloudFront Developer Guide/.
--
-- If you\'re using an Route 53 Amazon Web Services Integration alias
-- resource record set to route traffic to your CloudFront distribution,
-- you need to create a second alias resource record set when both of the
-- following are true:
--
-- -   You enable IPv6 for the distribution
--
-- -   You\'re using alternate domain names in the URLs for your objects
--
-- For more information, see
-- <https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-cloudfront-distribution.html Routing Traffic to an Amazon CloudFront Web Distribution by Using Your Domain Name>
-- in the /Route 53 Amazon Web Services Integration Developer Guide/.
--
-- If you created a CNAME resource record set, either with Route 53 Amazon
-- Web Services Integration or with another DNS service, you don\'t need to
-- make any changes. A CNAME record will route traffic to your distribution
-- regardless of the IP address format of the viewer request.
distributionConfig_isIPV6Enabled :: Lens.Lens' DistributionConfig (Prelude.Maybe Prelude.Bool)
distributionConfig_isIPV6Enabled :: (Maybe Bool -> f (Maybe Bool))
-> DistributionConfig -> f DistributionConfig
distributionConfig_isIPV6Enabled = (DistributionConfig -> Maybe Bool)
-> (DistributionConfig -> Maybe Bool -> DistributionConfig)
-> Lens
     DistributionConfig DistributionConfig (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionConfig' {Maybe Bool
isIPV6Enabled :: Maybe Bool
$sel:isIPV6Enabled:DistributionConfig' :: DistributionConfig -> Maybe Bool
isIPV6Enabled} -> Maybe Bool
isIPV6Enabled) (\s :: DistributionConfig
s@DistributionConfig' {} Maybe Bool
a -> DistributionConfig
s {$sel:isIPV6Enabled:DistributionConfig' :: Maybe Bool
isIPV6Enabled = Maybe Bool
a} :: DistributionConfig)

-- | A unique value (for example, a date-time stamp) that ensures that the
-- request can\'t be replayed.
--
-- If the value of @CallerReference@ is new (regardless of the content of
-- the @DistributionConfig@ object), CloudFront creates a new distribution.
--
-- If @CallerReference@ is a value that you already sent in a previous
-- request to create a distribution, CloudFront returns a
-- @DistributionAlreadyExists@ error.
distributionConfig_callerReference :: Lens.Lens' DistributionConfig Prelude.Text
distributionConfig_callerReference :: (Text -> f Text) -> DistributionConfig -> f DistributionConfig
distributionConfig_callerReference = (DistributionConfig -> Text)
-> (DistributionConfig -> Text -> DistributionConfig)
-> Lens DistributionConfig DistributionConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionConfig' {Text
callerReference :: Text
$sel:callerReference:DistributionConfig' :: DistributionConfig -> Text
callerReference} -> Text
callerReference) (\s :: DistributionConfig
s@DistributionConfig' {} Text
a -> DistributionConfig
s {$sel:callerReference:DistributionConfig' :: Text
callerReference = Text
a} :: DistributionConfig)

-- | A complex type that contains information about origins for this
-- distribution.
distributionConfig_origins :: Lens.Lens' DistributionConfig Origins
distributionConfig_origins :: (Origins -> f Origins)
-> DistributionConfig -> f DistributionConfig
distributionConfig_origins = (DistributionConfig -> Origins)
-> (DistributionConfig -> Origins -> DistributionConfig)
-> Lens DistributionConfig DistributionConfig Origins Origins
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionConfig' {Origins
origins :: Origins
$sel:origins:DistributionConfig' :: DistributionConfig -> Origins
origins} -> Origins
origins) (\s :: DistributionConfig
s@DistributionConfig' {} Origins
a -> DistributionConfig
s {$sel:origins:DistributionConfig' :: Origins
origins = Origins
a} :: DistributionConfig)

-- | A complex type that describes the default cache behavior if you don\'t
-- specify a @CacheBehavior@ element or if files don\'t match any of the
-- values of @PathPattern@ in @CacheBehavior@ elements. You must create
-- exactly one default cache behavior.
distributionConfig_defaultCacheBehavior :: Lens.Lens' DistributionConfig DefaultCacheBehavior
distributionConfig_defaultCacheBehavior :: (DefaultCacheBehavior -> f DefaultCacheBehavior)
-> DistributionConfig -> f DistributionConfig
distributionConfig_defaultCacheBehavior = (DistributionConfig -> DefaultCacheBehavior)
-> (DistributionConfig
    -> DefaultCacheBehavior -> DistributionConfig)
-> Lens
     DistributionConfig
     DistributionConfig
     DefaultCacheBehavior
     DefaultCacheBehavior
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionConfig' {DefaultCacheBehavior
defaultCacheBehavior :: DefaultCacheBehavior
$sel:defaultCacheBehavior:DistributionConfig' :: DistributionConfig -> DefaultCacheBehavior
defaultCacheBehavior} -> DefaultCacheBehavior
defaultCacheBehavior) (\s :: DistributionConfig
s@DistributionConfig' {} DefaultCacheBehavior
a -> DistributionConfig
s {$sel:defaultCacheBehavior:DistributionConfig' :: DefaultCacheBehavior
defaultCacheBehavior = DefaultCacheBehavior
a} :: DistributionConfig)

-- | An optional comment to describe the distribution. The comment cannot be
-- longer than 128 characters.
distributionConfig_comment :: Lens.Lens' DistributionConfig Prelude.Text
distributionConfig_comment :: (Text -> f Text) -> DistributionConfig -> f DistributionConfig
distributionConfig_comment = (DistributionConfig -> Sensitive Text)
-> (DistributionConfig -> Sensitive Text -> DistributionConfig)
-> Lens
     DistributionConfig
     DistributionConfig
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionConfig' {Sensitive Text
comment :: Sensitive Text
$sel:comment:DistributionConfig' :: DistributionConfig -> Sensitive Text
comment} -> Sensitive Text
comment) (\s :: DistributionConfig
s@DistributionConfig' {} Sensitive Text
a -> DistributionConfig
s {$sel:comment:DistributionConfig' :: Sensitive Text
comment = Sensitive Text
a} :: DistributionConfig) ((Sensitive Text -> f (Sensitive Text))
 -> DistributionConfig -> f DistributionConfig)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> DistributionConfig
-> f DistributionConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | From this field, you can enable or disable the selected distribution.
distributionConfig_enabled :: Lens.Lens' DistributionConfig Prelude.Bool
distributionConfig_enabled :: (Bool -> f Bool) -> DistributionConfig -> f DistributionConfig
distributionConfig_enabled = (DistributionConfig -> Bool)
-> (DistributionConfig -> Bool -> DistributionConfig)
-> Lens DistributionConfig DistributionConfig Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionConfig' {Bool
enabled :: Bool
$sel:enabled:DistributionConfig' :: DistributionConfig -> Bool
enabled} -> Bool
enabled) (\s :: DistributionConfig
s@DistributionConfig' {} Bool
a -> DistributionConfig
s {$sel:enabled:DistributionConfig' :: Bool
enabled = Bool
a} :: DistributionConfig)

instance Core.FromXML DistributionConfig where
  parseXML :: [Node] -> Either String DistributionConfig
parseXML [Node]
x =
    Maybe HttpVersion
-> Maybe OriginGroups
-> Maybe Aliases
-> Maybe Text
-> Maybe PriceClass
-> Maybe CustomErrorResponses
-> Maybe Text
-> Maybe ViewerCertificate
-> Maybe Restrictions
-> Maybe LoggingConfig
-> Maybe CacheBehaviors
-> Maybe Bool
-> Text
-> Origins
-> DefaultCacheBehavior
-> Sensitive Text
-> Bool
-> DistributionConfig
DistributionConfig'
      (Maybe HttpVersion
 -> Maybe OriginGroups
 -> Maybe Aliases
 -> Maybe Text
 -> Maybe PriceClass
 -> Maybe CustomErrorResponses
 -> Maybe Text
 -> Maybe ViewerCertificate
 -> Maybe Restrictions
 -> Maybe LoggingConfig
 -> Maybe CacheBehaviors
 -> Maybe Bool
 -> Text
 -> Origins
 -> DefaultCacheBehavior
 -> Sensitive Text
 -> Bool
 -> DistributionConfig)
-> Either String (Maybe HttpVersion)
-> Either
     String
     (Maybe OriginGroups
      -> Maybe Aliases
      -> Maybe Text
      -> Maybe PriceClass
      -> Maybe CustomErrorResponses
      -> Maybe Text
      -> Maybe ViewerCertificate
      -> Maybe Restrictions
      -> Maybe LoggingConfig
      -> Maybe CacheBehaviors
      -> Maybe Bool
      -> Text
      -> Origins
      -> DefaultCacheBehavior
      -> Sensitive Text
      -> Bool
      -> DistributionConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe HttpVersion)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"HttpVersion")
      Either
  String
  (Maybe OriginGroups
   -> Maybe Aliases
   -> Maybe Text
   -> Maybe PriceClass
   -> Maybe CustomErrorResponses
   -> Maybe Text
   -> Maybe ViewerCertificate
   -> Maybe Restrictions
   -> Maybe LoggingConfig
   -> Maybe CacheBehaviors
   -> Maybe Bool
   -> Text
   -> Origins
   -> DefaultCacheBehavior
   -> Sensitive Text
   -> Bool
   -> DistributionConfig)
-> Either String (Maybe OriginGroups)
-> Either
     String
     (Maybe Aliases
      -> Maybe Text
      -> Maybe PriceClass
      -> Maybe CustomErrorResponses
      -> Maybe Text
      -> Maybe ViewerCertificate
      -> Maybe Restrictions
      -> Maybe LoggingConfig
      -> Maybe CacheBehaviors
      -> Maybe Bool
      -> Text
      -> Origins
      -> DefaultCacheBehavior
      -> Sensitive Text
      -> Bool
      -> DistributionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe OriginGroups)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"OriginGroups")
      Either
  String
  (Maybe Aliases
   -> Maybe Text
   -> Maybe PriceClass
   -> Maybe CustomErrorResponses
   -> Maybe Text
   -> Maybe ViewerCertificate
   -> Maybe Restrictions
   -> Maybe LoggingConfig
   -> Maybe CacheBehaviors
   -> Maybe Bool
   -> Text
   -> Origins
   -> DefaultCacheBehavior
   -> Sensitive Text
   -> Bool
   -> DistributionConfig)
-> Either String (Maybe Aliases)
-> Either
     String
     (Maybe Text
      -> Maybe PriceClass
      -> Maybe CustomErrorResponses
      -> Maybe Text
      -> Maybe ViewerCertificate
      -> Maybe Restrictions
      -> Maybe LoggingConfig
      -> Maybe CacheBehaviors
      -> Maybe Bool
      -> Text
      -> Origins
      -> DefaultCacheBehavior
      -> Sensitive Text
      -> Bool
      -> DistributionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Aliases)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Aliases")
      Either
  String
  (Maybe Text
   -> Maybe PriceClass
   -> Maybe CustomErrorResponses
   -> Maybe Text
   -> Maybe ViewerCertificate
   -> Maybe Restrictions
   -> Maybe LoggingConfig
   -> Maybe CacheBehaviors
   -> Maybe Bool
   -> Text
   -> Origins
   -> DefaultCacheBehavior
   -> Sensitive Text
   -> Bool
   -> DistributionConfig)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe PriceClass
      -> Maybe CustomErrorResponses
      -> Maybe Text
      -> Maybe ViewerCertificate
      -> Maybe Restrictions
      -> Maybe LoggingConfig
      -> Maybe CacheBehaviors
      -> Maybe Bool
      -> Text
      -> Origins
      -> DefaultCacheBehavior
      -> Sensitive Text
      -> Bool
      -> DistributionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DefaultRootObject")
      Either
  String
  (Maybe PriceClass
   -> Maybe CustomErrorResponses
   -> Maybe Text
   -> Maybe ViewerCertificate
   -> Maybe Restrictions
   -> Maybe LoggingConfig
   -> Maybe CacheBehaviors
   -> Maybe Bool
   -> Text
   -> Origins
   -> DefaultCacheBehavior
   -> Sensitive Text
   -> Bool
   -> DistributionConfig)
-> Either String (Maybe PriceClass)
-> Either
     String
     (Maybe CustomErrorResponses
      -> Maybe Text
      -> Maybe ViewerCertificate
      -> Maybe Restrictions
      -> Maybe LoggingConfig
      -> Maybe CacheBehaviors
      -> Maybe Bool
      -> Text
      -> Origins
      -> DefaultCacheBehavior
      -> Sensitive Text
      -> Bool
      -> DistributionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe PriceClass)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PriceClass")
      Either
  String
  (Maybe CustomErrorResponses
   -> Maybe Text
   -> Maybe ViewerCertificate
   -> Maybe Restrictions
   -> Maybe LoggingConfig
   -> Maybe CacheBehaviors
   -> Maybe Bool
   -> Text
   -> Origins
   -> DefaultCacheBehavior
   -> Sensitive Text
   -> Bool
   -> DistributionConfig)
-> Either String (Maybe CustomErrorResponses)
-> Either
     String
     (Maybe Text
      -> Maybe ViewerCertificate
      -> Maybe Restrictions
      -> Maybe LoggingConfig
      -> Maybe CacheBehaviors
      -> Maybe Bool
      -> Text
      -> Origins
      -> DefaultCacheBehavior
      -> Sensitive Text
      -> Bool
      -> DistributionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe CustomErrorResponses)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CustomErrorResponses")
      Either
  String
  (Maybe Text
   -> Maybe ViewerCertificate
   -> Maybe Restrictions
   -> Maybe LoggingConfig
   -> Maybe CacheBehaviors
   -> Maybe Bool
   -> Text
   -> Origins
   -> DefaultCacheBehavior
   -> Sensitive Text
   -> Bool
   -> DistributionConfig)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe ViewerCertificate
      -> Maybe Restrictions
      -> Maybe LoggingConfig
      -> Maybe CacheBehaviors
      -> Maybe Bool
      -> Text
      -> Origins
      -> DefaultCacheBehavior
      -> Sensitive Text
      -> Bool
      -> DistributionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"WebACLId")
      Either
  String
  (Maybe ViewerCertificate
   -> Maybe Restrictions
   -> Maybe LoggingConfig
   -> Maybe CacheBehaviors
   -> Maybe Bool
   -> Text
   -> Origins
   -> DefaultCacheBehavior
   -> Sensitive Text
   -> Bool
   -> DistributionConfig)
-> Either String (Maybe ViewerCertificate)
-> Either
     String
     (Maybe Restrictions
      -> Maybe LoggingConfig
      -> Maybe CacheBehaviors
      -> Maybe Bool
      -> Text
      -> Origins
      -> DefaultCacheBehavior
      -> Sensitive Text
      -> Bool
      -> DistributionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ViewerCertificate)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ViewerCertificate")
      Either
  String
  (Maybe Restrictions
   -> Maybe LoggingConfig
   -> Maybe CacheBehaviors
   -> Maybe Bool
   -> Text
   -> Origins
   -> DefaultCacheBehavior
   -> Sensitive Text
   -> Bool
   -> DistributionConfig)
-> Either String (Maybe Restrictions)
-> Either
     String
     (Maybe LoggingConfig
      -> Maybe CacheBehaviors
      -> Maybe Bool
      -> Text
      -> Origins
      -> DefaultCacheBehavior
      -> Sensitive Text
      -> Bool
      -> DistributionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Restrictions)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Restrictions")
      Either
  String
  (Maybe LoggingConfig
   -> Maybe CacheBehaviors
   -> Maybe Bool
   -> Text
   -> Origins
   -> DefaultCacheBehavior
   -> Sensitive Text
   -> Bool
   -> DistributionConfig)
-> Either String (Maybe LoggingConfig)
-> Either
     String
     (Maybe CacheBehaviors
      -> Maybe Bool
      -> Text
      -> Origins
      -> DefaultCacheBehavior
      -> Sensitive Text
      -> Bool
      -> DistributionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe LoggingConfig)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Logging")
      Either
  String
  (Maybe CacheBehaviors
   -> Maybe Bool
   -> Text
   -> Origins
   -> DefaultCacheBehavior
   -> Sensitive Text
   -> Bool
   -> DistributionConfig)
-> Either String (Maybe CacheBehaviors)
-> Either
     String
     (Maybe Bool
      -> Text
      -> Origins
      -> DefaultCacheBehavior
      -> Sensitive Text
      -> Bool
      -> DistributionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe CacheBehaviors)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CacheBehaviors")
      Either
  String
  (Maybe Bool
   -> Text
   -> Origins
   -> DefaultCacheBehavior
   -> Sensitive Text
   -> Bool
   -> DistributionConfig)
-> Either String (Maybe Bool)
-> Either
     String
     (Text
      -> Origins
      -> DefaultCacheBehavior
      -> Sensitive Text
      -> Bool
      -> DistributionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"IsIPV6Enabled")
      Either
  String
  (Text
   -> Origins
   -> DefaultCacheBehavior
   -> Sensitive Text
   -> Bool
   -> DistributionConfig)
-> Either String Text
-> Either
     String
     (Origins
      -> DefaultCacheBehavior
      -> Sensitive Text
      -> Bool
      -> DistributionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"CallerReference")
      Either
  String
  (Origins
   -> DefaultCacheBehavior
   -> Sensitive Text
   -> Bool
   -> DistributionConfig)
-> Either String Origins
-> Either
     String
     (DefaultCacheBehavior
      -> Sensitive Text -> Bool -> DistributionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Origins
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Origins")
      Either
  String
  (DefaultCacheBehavior
   -> Sensitive Text -> Bool -> DistributionConfig)
-> Either String DefaultCacheBehavior
-> Either String (Sensitive Text -> Bool -> DistributionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String DefaultCacheBehavior
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"DefaultCacheBehavior")
      Either String (Sensitive Text -> Bool -> DistributionConfig)
-> Either String (Sensitive Text)
-> Either String (Bool -> DistributionConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Sensitive Text)
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Comment")
      Either String (Bool -> DistributionConfig)
-> Either String Bool -> Either String DistributionConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Bool
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Enabled")

instance Prelude.Hashable DistributionConfig

instance Prelude.NFData DistributionConfig

instance Core.ToXML DistributionConfig where
  toXML :: DistributionConfig -> XML
toXML DistributionConfig' {Bool
Maybe Bool
Maybe Text
Maybe Aliases
Maybe CustomErrorResponses
Maybe HttpVersion
Maybe LoggingConfig
Maybe PriceClass
Maybe Restrictions
Maybe OriginGroups
Maybe ViewerCertificate
Maybe CacheBehaviors
Text
Sensitive Text
Origins
DefaultCacheBehavior
enabled :: Bool
comment :: Sensitive Text
defaultCacheBehavior :: DefaultCacheBehavior
origins :: Origins
callerReference :: Text
isIPV6Enabled :: Maybe Bool
cacheBehaviors :: Maybe CacheBehaviors
logging :: Maybe LoggingConfig
restrictions :: Maybe Restrictions
viewerCertificate :: Maybe ViewerCertificate
webACLId :: Maybe Text
customErrorResponses :: Maybe CustomErrorResponses
priceClass :: Maybe PriceClass
defaultRootObject :: Maybe Text
aliases :: Maybe Aliases
originGroups :: Maybe OriginGroups
httpVersion :: Maybe HttpVersion
$sel:enabled:DistributionConfig' :: DistributionConfig -> Bool
$sel:comment:DistributionConfig' :: DistributionConfig -> Sensitive Text
$sel:defaultCacheBehavior:DistributionConfig' :: DistributionConfig -> DefaultCacheBehavior
$sel:origins:DistributionConfig' :: DistributionConfig -> Origins
$sel:callerReference:DistributionConfig' :: DistributionConfig -> Text
$sel:isIPV6Enabled:DistributionConfig' :: DistributionConfig -> Maybe Bool
$sel:cacheBehaviors:DistributionConfig' :: DistributionConfig -> Maybe CacheBehaviors
$sel:logging:DistributionConfig' :: DistributionConfig -> Maybe LoggingConfig
$sel:restrictions:DistributionConfig' :: DistributionConfig -> Maybe Restrictions
$sel:viewerCertificate:DistributionConfig' :: DistributionConfig -> Maybe ViewerCertificate
$sel:webACLId:DistributionConfig' :: DistributionConfig -> Maybe Text
$sel:customErrorResponses:DistributionConfig' :: DistributionConfig -> Maybe CustomErrorResponses
$sel:priceClass:DistributionConfig' :: DistributionConfig -> Maybe PriceClass
$sel:defaultRootObject:DistributionConfig' :: DistributionConfig -> Maybe Text
$sel:aliases:DistributionConfig' :: DistributionConfig -> Maybe Aliases
$sel:originGroups:DistributionConfig' :: DistributionConfig -> Maybe OriginGroups
$sel:httpVersion:DistributionConfig' :: DistributionConfig -> Maybe HttpVersion
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ Name
"HttpVersion" Name -> Maybe HttpVersion -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe HttpVersion
httpVersion,
        Name
"OriginGroups" Name -> Maybe OriginGroups -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe OriginGroups
originGroups,
        Name
"Aliases" Name -> Maybe Aliases -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Aliases
aliases,
        Name
"DefaultRootObject" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
defaultRootObject,
        Name
"PriceClass" Name -> Maybe PriceClass -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe PriceClass
priceClass,
        Name
"CustomErrorResponses" Name -> Maybe CustomErrorResponses -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe CustomErrorResponses
customErrorResponses,
        Name
"WebACLId" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Text
webACLId,
        Name
"ViewerCertificate" Name -> Maybe ViewerCertificate -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe ViewerCertificate
viewerCertificate,
        Name
"Restrictions" Name -> Maybe Restrictions -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Restrictions
restrictions,
        Name
"Logging" Name -> Maybe LoggingConfig -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe LoggingConfig
logging,
        Name
"CacheBehaviors" Name -> Maybe CacheBehaviors -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe CacheBehaviors
cacheBehaviors,
        Name
"IsIPV6Enabled" Name -> Maybe Bool -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Bool
isIPV6Enabled,
        Name
"CallerReference" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
callerReference,
        Name
"Origins" Name -> Origins -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Origins
origins,
        Name
"DefaultCacheBehavior" Name -> DefaultCacheBehavior -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= DefaultCacheBehavior
defaultCacheBehavior,
        Name
"Comment" Name -> Sensitive Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Sensitive Text
comment,
        Name
"Enabled" Name -> Bool -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Bool
enabled
      ]