{-# 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.Distribution
-- 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.Distribution where

import Amazonka.CloudFront.Types.ActiveTrustedKeyGroups
import Amazonka.CloudFront.Types.ActiveTrustedSigners
import Amazonka.CloudFront.Types.AliasICPRecordal
import Amazonka.CloudFront.Types.DistributionConfig
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A distribution tells CloudFront where you want content to be delivered
-- from, and the details about how to track and manage content delivery.
--
-- /See:/ 'newDistribution' smart constructor.
data Distribution = Distribution'
  { -- | CloudFront automatically adds this field to the response if you’ve
    -- configured a cache behavior in this distribution to serve private
    -- content using key groups. This field contains a list of key groups and
    -- the public keys in each key group that CloudFront can use to verify the
    -- signatures of signed URLs or signed cookies.
    Distribution -> Maybe ActiveTrustedKeyGroups
activeTrustedKeyGroups :: Prelude.Maybe ActiveTrustedKeyGroups,
    -- | Amazon Web Services services in China customers must file for an
    -- Internet Content Provider (ICP) recordal if they want to serve content
    -- publicly on an alternate domain name, also known as a CNAME, that
    -- they\'ve added to CloudFront. AliasICPRecordal provides the ICP recordal
    -- status for CNAMEs associated with distributions.
    --
    -- For more information about ICP recordals, see
    -- <https://docs.amazonaws.cn/en_us/aws/latest/userguide/accounts-and-credentials.html Signup, Accounts, and Credentials>
    -- in /Getting Started with Amazon Web Services services in China/.
    Distribution -> Maybe [AliasICPRecordal]
aliasICPRecordals :: Prelude.Maybe [AliasICPRecordal],
    -- | We recommend using @TrustedKeyGroups@ instead of @TrustedSigners@.
    --
    -- CloudFront automatically adds this field to the response if you’ve
    -- configured a cache behavior in this distribution to serve private
    -- content using trusted signers. This field contains a list of account IDs
    -- and the active CloudFront key pairs in each account that CloudFront can
    -- use to verify the signatures of signed URLs or signed cookies.
    Distribution -> Maybe ActiveTrustedSigners
activeTrustedSigners :: Prelude.Maybe ActiveTrustedSigners,
    -- | The identifier for the distribution. For example: @EDFDVBD632BHDS5@.
    Distribution -> Text
id :: Prelude.Text,
    -- | The ARN (Amazon Resource Name) for the distribution. For example:
    -- @arn:aws:cloudfront::123456789012:distribution\/EDFDVBD632BHDS5@, where
    -- @123456789012@ is your account ID.
    Distribution -> Text
arn :: Prelude.Text,
    -- | This response element indicates the current status of the distribution.
    -- When the status is @Deployed@, the distribution\'s information is fully
    -- propagated to all CloudFront edge locations.
    Distribution -> Text
status :: Prelude.Text,
    -- | The date and time the distribution was last modified.
    Distribution -> ISO8601
lastModifiedTime :: Core.ISO8601,
    -- | The number of invalidation batches currently in progress.
    Distribution -> Int
inProgressInvalidationBatches :: Prelude.Int,
    -- | The domain name corresponding to the distribution, for example,
    -- @d111111abcdef8.cloudfront.net@.
    Distribution -> Text
domainName :: Prelude.Text,
    -- | The current configuration information for the distribution. Send a @GET@
    -- request to the @\/CloudFront API version\/distribution ID\/config@
    -- resource.
    Distribution -> DistributionConfig
distributionConfig :: DistributionConfig
  }
  deriving (Distribution -> Distribution -> Bool
(Distribution -> Distribution -> Bool)
-> (Distribution -> Distribution -> Bool) -> Eq Distribution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Distribution -> Distribution -> Bool
$c/= :: Distribution -> Distribution -> Bool
== :: Distribution -> Distribution -> Bool
$c== :: Distribution -> Distribution -> Bool
Prelude.Eq, Int -> Distribution -> ShowS
[Distribution] -> ShowS
Distribution -> String
(Int -> Distribution -> ShowS)
-> (Distribution -> String)
-> ([Distribution] -> ShowS)
-> Show Distribution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Distribution] -> ShowS
$cshowList :: [Distribution] -> ShowS
show :: Distribution -> String
$cshow :: Distribution -> String
showsPrec :: Int -> Distribution -> ShowS
$cshowsPrec :: Int -> Distribution -> ShowS
Prelude.Show, (forall x. Distribution -> Rep Distribution x)
-> (forall x. Rep Distribution x -> Distribution)
-> Generic Distribution
forall x. Rep Distribution x -> Distribution
forall x. Distribution -> Rep Distribution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Distribution x -> Distribution
$cfrom :: forall x. Distribution -> Rep Distribution x
Prelude.Generic)

-- |
-- Create a value of 'Distribution' 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:
--
-- 'activeTrustedKeyGroups', 'distribution_activeTrustedKeyGroups' - CloudFront automatically adds this field to the response if you’ve
-- configured a cache behavior in this distribution to serve private
-- content using key groups. This field contains a list of key groups and
-- the public keys in each key group that CloudFront can use to verify the
-- signatures of signed URLs or signed cookies.
--
-- 'aliasICPRecordals', 'distribution_aliasICPRecordals' - Amazon Web Services services in China customers must file for an
-- Internet Content Provider (ICP) recordal if they want to serve content
-- publicly on an alternate domain name, also known as a CNAME, that
-- they\'ve added to CloudFront. AliasICPRecordal provides the ICP recordal
-- status for CNAMEs associated with distributions.
--
-- For more information about ICP recordals, see
-- <https://docs.amazonaws.cn/en_us/aws/latest/userguide/accounts-and-credentials.html Signup, Accounts, and Credentials>
-- in /Getting Started with Amazon Web Services services in China/.
--
-- 'activeTrustedSigners', 'distribution_activeTrustedSigners' - We recommend using @TrustedKeyGroups@ instead of @TrustedSigners@.
--
-- CloudFront automatically adds this field to the response if you’ve
-- configured a cache behavior in this distribution to serve private
-- content using trusted signers. This field contains a list of account IDs
-- and the active CloudFront key pairs in each account that CloudFront can
-- use to verify the signatures of signed URLs or signed cookies.
--
-- 'id', 'distribution_id' - The identifier for the distribution. For example: @EDFDVBD632BHDS5@.
--
-- 'arn', 'distribution_arn' - The ARN (Amazon Resource Name) for the distribution. For example:
-- @arn:aws:cloudfront::123456789012:distribution\/EDFDVBD632BHDS5@, where
-- @123456789012@ is your account ID.
--
-- 'status', 'distribution_status' - This response element indicates the current status of the distribution.
-- When the status is @Deployed@, the distribution\'s information is fully
-- propagated to all CloudFront edge locations.
--
-- 'lastModifiedTime', 'distribution_lastModifiedTime' - The date and time the distribution was last modified.
--
-- 'inProgressInvalidationBatches', 'distribution_inProgressInvalidationBatches' - The number of invalidation batches currently in progress.
--
-- 'domainName', 'distribution_domainName' - The domain name corresponding to the distribution, for example,
-- @d111111abcdef8.cloudfront.net@.
--
-- 'distributionConfig', 'distribution_distributionConfig' - The current configuration information for the distribution. Send a @GET@
-- request to the @\/CloudFront API version\/distribution ID\/config@
-- resource.
newDistribution ::
  -- | 'id'
  Prelude.Text ->
  -- | 'arn'
  Prelude.Text ->
  -- | 'status'
  Prelude.Text ->
  -- | 'lastModifiedTime'
  Prelude.UTCTime ->
  -- | 'inProgressInvalidationBatches'
  Prelude.Int ->
  -- | 'domainName'
  Prelude.Text ->
  -- | 'distributionConfig'
  DistributionConfig ->
  Distribution
newDistribution :: Text
-> Text
-> Text
-> UTCTime
-> Int
-> Text
-> DistributionConfig
-> Distribution
newDistribution
  Text
pId_
  Text
pARN_
  Text
pStatus_
  UTCTime
pLastModifiedTime_
  Int
pInProgressInvalidationBatches_
  Text
pDomainName_
  DistributionConfig
pDistributionConfig_ =
    Distribution' :: Maybe ActiveTrustedKeyGroups
-> Maybe [AliasICPRecordal]
-> Maybe ActiveTrustedSigners
-> Text
-> Text
-> Text
-> ISO8601
-> Int
-> Text
-> DistributionConfig
-> Distribution
Distribution'
      { $sel:activeTrustedKeyGroups:Distribution' :: Maybe ActiveTrustedKeyGroups
activeTrustedKeyGroups =
          Maybe ActiveTrustedKeyGroups
forall a. Maybe a
Prelude.Nothing,
        $sel:aliasICPRecordals:Distribution' :: Maybe [AliasICPRecordal]
aliasICPRecordals = Maybe [AliasICPRecordal]
forall a. Maybe a
Prelude.Nothing,
        $sel:activeTrustedSigners:Distribution' :: Maybe ActiveTrustedSigners
activeTrustedSigners = Maybe ActiveTrustedSigners
forall a. Maybe a
Prelude.Nothing,
        $sel:id:Distribution' :: Text
id = Text
pId_,
        $sel:arn:Distribution' :: Text
arn = Text
pARN_,
        $sel:status:Distribution' :: Text
status = Text
pStatus_,
        $sel:lastModifiedTime:Distribution' :: ISO8601
lastModifiedTime =
          Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged ISO8601 (Identity ISO8601))
-> UTCTime -> ISO8601
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastModifiedTime_,
        $sel:inProgressInvalidationBatches:Distribution' :: Int
inProgressInvalidationBatches =
          Int
pInProgressInvalidationBatches_,
        $sel:domainName:Distribution' :: Text
domainName = Text
pDomainName_,
        $sel:distributionConfig:Distribution' :: DistributionConfig
distributionConfig = DistributionConfig
pDistributionConfig_
      }

-- | CloudFront automatically adds this field to the response if you’ve
-- configured a cache behavior in this distribution to serve private
-- content using key groups. This field contains a list of key groups and
-- the public keys in each key group that CloudFront can use to verify the
-- signatures of signed URLs or signed cookies.
distribution_activeTrustedKeyGroups :: Lens.Lens' Distribution (Prelude.Maybe ActiveTrustedKeyGroups)
distribution_activeTrustedKeyGroups :: (Maybe ActiveTrustedKeyGroups -> f (Maybe ActiveTrustedKeyGroups))
-> Distribution -> f Distribution
distribution_activeTrustedKeyGroups = (Distribution -> Maybe ActiveTrustedKeyGroups)
-> (Distribution -> Maybe ActiveTrustedKeyGroups -> Distribution)
-> Lens
     Distribution
     Distribution
     (Maybe ActiveTrustedKeyGroups)
     (Maybe ActiveTrustedKeyGroups)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Distribution' {Maybe ActiveTrustedKeyGroups
activeTrustedKeyGroups :: Maybe ActiveTrustedKeyGroups
$sel:activeTrustedKeyGroups:Distribution' :: Distribution -> Maybe ActiveTrustedKeyGroups
activeTrustedKeyGroups} -> Maybe ActiveTrustedKeyGroups
activeTrustedKeyGroups) (\s :: Distribution
s@Distribution' {} Maybe ActiveTrustedKeyGroups
a -> Distribution
s {$sel:activeTrustedKeyGroups:Distribution' :: Maybe ActiveTrustedKeyGroups
activeTrustedKeyGroups = Maybe ActiveTrustedKeyGroups
a} :: Distribution)

-- | Amazon Web Services services in China customers must file for an
-- Internet Content Provider (ICP) recordal if they want to serve content
-- publicly on an alternate domain name, also known as a CNAME, that
-- they\'ve added to CloudFront. AliasICPRecordal provides the ICP recordal
-- status for CNAMEs associated with distributions.
--
-- For more information about ICP recordals, see
-- <https://docs.amazonaws.cn/en_us/aws/latest/userguide/accounts-and-credentials.html Signup, Accounts, and Credentials>
-- in /Getting Started with Amazon Web Services services in China/.
distribution_aliasICPRecordals :: Lens.Lens' Distribution (Prelude.Maybe [AliasICPRecordal])
distribution_aliasICPRecordals :: (Maybe [AliasICPRecordal] -> f (Maybe [AliasICPRecordal]))
-> Distribution -> f Distribution
distribution_aliasICPRecordals = (Distribution -> Maybe [AliasICPRecordal])
-> (Distribution -> Maybe [AliasICPRecordal] -> Distribution)
-> Lens
     Distribution
     Distribution
     (Maybe [AliasICPRecordal])
     (Maybe [AliasICPRecordal])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Distribution' {Maybe [AliasICPRecordal]
aliasICPRecordals :: Maybe [AliasICPRecordal]
$sel:aliasICPRecordals:Distribution' :: Distribution -> Maybe [AliasICPRecordal]
aliasICPRecordals} -> Maybe [AliasICPRecordal]
aliasICPRecordals) (\s :: Distribution
s@Distribution' {} Maybe [AliasICPRecordal]
a -> Distribution
s {$sel:aliasICPRecordals:Distribution' :: Maybe [AliasICPRecordal]
aliasICPRecordals = Maybe [AliasICPRecordal]
a} :: Distribution) ((Maybe [AliasICPRecordal] -> f (Maybe [AliasICPRecordal]))
 -> Distribution -> f Distribution)
-> ((Maybe [AliasICPRecordal] -> f (Maybe [AliasICPRecordal]))
    -> Maybe [AliasICPRecordal] -> f (Maybe [AliasICPRecordal]))
-> (Maybe [AliasICPRecordal] -> f (Maybe [AliasICPRecordal]))
-> Distribution
-> f Distribution
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AliasICPRecordal]
  [AliasICPRecordal]
  [AliasICPRecordal]
  [AliasICPRecordal]
-> Iso
     (Maybe [AliasICPRecordal])
     (Maybe [AliasICPRecordal])
     (Maybe [AliasICPRecordal])
     (Maybe [AliasICPRecordal])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [AliasICPRecordal]
  [AliasICPRecordal]
  [AliasICPRecordal]
  [AliasICPRecordal]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | We recommend using @TrustedKeyGroups@ instead of @TrustedSigners@.
--
-- CloudFront automatically adds this field to the response if you’ve
-- configured a cache behavior in this distribution to serve private
-- content using trusted signers. This field contains a list of account IDs
-- and the active CloudFront key pairs in each account that CloudFront can
-- use to verify the signatures of signed URLs or signed cookies.
distribution_activeTrustedSigners :: Lens.Lens' Distribution (Prelude.Maybe ActiveTrustedSigners)
distribution_activeTrustedSigners :: (Maybe ActiveTrustedSigners -> f (Maybe ActiveTrustedSigners))
-> Distribution -> f Distribution
distribution_activeTrustedSigners = (Distribution -> Maybe ActiveTrustedSigners)
-> (Distribution -> Maybe ActiveTrustedSigners -> Distribution)
-> Lens
     Distribution
     Distribution
     (Maybe ActiveTrustedSigners)
     (Maybe ActiveTrustedSigners)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Distribution' {Maybe ActiveTrustedSigners
activeTrustedSigners :: Maybe ActiveTrustedSigners
$sel:activeTrustedSigners:Distribution' :: Distribution -> Maybe ActiveTrustedSigners
activeTrustedSigners} -> Maybe ActiveTrustedSigners
activeTrustedSigners) (\s :: Distribution
s@Distribution' {} Maybe ActiveTrustedSigners
a -> Distribution
s {$sel:activeTrustedSigners:Distribution' :: Maybe ActiveTrustedSigners
activeTrustedSigners = Maybe ActiveTrustedSigners
a} :: Distribution)

-- | The identifier for the distribution. For example: @EDFDVBD632BHDS5@.
distribution_id :: Lens.Lens' Distribution Prelude.Text
distribution_id :: (Text -> f Text) -> Distribution -> f Distribution
distribution_id = (Distribution -> Text)
-> (Distribution -> Text -> Distribution)
-> Lens Distribution Distribution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Distribution' {Text
id :: Text
$sel:id:Distribution' :: Distribution -> Text
id} -> Text
id) (\s :: Distribution
s@Distribution' {} Text
a -> Distribution
s {$sel:id:Distribution' :: Text
id = Text
a} :: Distribution)

-- | The ARN (Amazon Resource Name) for the distribution. For example:
-- @arn:aws:cloudfront::123456789012:distribution\/EDFDVBD632BHDS5@, where
-- @123456789012@ is your account ID.
distribution_arn :: Lens.Lens' Distribution Prelude.Text
distribution_arn :: (Text -> f Text) -> Distribution -> f Distribution
distribution_arn = (Distribution -> Text)
-> (Distribution -> Text -> Distribution)
-> Lens Distribution Distribution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Distribution' {Text
arn :: Text
$sel:arn:Distribution' :: Distribution -> Text
arn} -> Text
arn) (\s :: Distribution
s@Distribution' {} Text
a -> Distribution
s {$sel:arn:Distribution' :: Text
arn = Text
a} :: Distribution)

-- | This response element indicates the current status of the distribution.
-- When the status is @Deployed@, the distribution\'s information is fully
-- propagated to all CloudFront edge locations.
distribution_status :: Lens.Lens' Distribution Prelude.Text
distribution_status :: (Text -> f Text) -> Distribution -> f Distribution
distribution_status = (Distribution -> Text)
-> (Distribution -> Text -> Distribution)
-> Lens Distribution Distribution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Distribution' {Text
status :: Text
$sel:status:Distribution' :: Distribution -> Text
status} -> Text
status) (\s :: Distribution
s@Distribution' {} Text
a -> Distribution
s {$sel:status:Distribution' :: Text
status = Text
a} :: Distribution)

-- | The date and time the distribution was last modified.
distribution_lastModifiedTime :: Lens.Lens' Distribution Prelude.UTCTime
distribution_lastModifiedTime :: (UTCTime -> f UTCTime) -> Distribution -> f Distribution
distribution_lastModifiedTime = (Distribution -> ISO8601)
-> (Distribution -> ISO8601 -> Distribution)
-> Lens Distribution Distribution ISO8601 ISO8601
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Distribution' {ISO8601
lastModifiedTime :: ISO8601
$sel:lastModifiedTime:Distribution' :: Distribution -> ISO8601
lastModifiedTime} -> ISO8601
lastModifiedTime) (\s :: Distribution
s@Distribution' {} ISO8601
a -> Distribution
s {$sel:lastModifiedTime:Distribution' :: ISO8601
lastModifiedTime = ISO8601
a} :: Distribution) ((ISO8601 -> f ISO8601) -> Distribution -> f Distribution)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> Distribution
-> f Distribution
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The number of invalidation batches currently in progress.
distribution_inProgressInvalidationBatches :: Lens.Lens' Distribution Prelude.Int
distribution_inProgressInvalidationBatches :: (Int -> f Int) -> Distribution -> f Distribution
distribution_inProgressInvalidationBatches = (Distribution -> Int)
-> (Distribution -> Int -> Distribution)
-> Lens Distribution Distribution Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Distribution' {Int
inProgressInvalidationBatches :: Int
$sel:inProgressInvalidationBatches:Distribution' :: Distribution -> Int
inProgressInvalidationBatches} -> Int
inProgressInvalidationBatches) (\s :: Distribution
s@Distribution' {} Int
a -> Distribution
s {$sel:inProgressInvalidationBatches:Distribution' :: Int
inProgressInvalidationBatches = Int
a} :: Distribution)

-- | The domain name corresponding to the distribution, for example,
-- @d111111abcdef8.cloudfront.net@.
distribution_domainName :: Lens.Lens' Distribution Prelude.Text
distribution_domainName :: (Text -> f Text) -> Distribution -> f Distribution
distribution_domainName = (Distribution -> Text)
-> (Distribution -> Text -> Distribution)
-> Lens Distribution Distribution Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Distribution' {Text
domainName :: Text
$sel:domainName:Distribution' :: Distribution -> Text
domainName} -> Text
domainName) (\s :: Distribution
s@Distribution' {} Text
a -> Distribution
s {$sel:domainName:Distribution' :: Text
domainName = Text
a} :: Distribution)

-- | The current configuration information for the distribution. Send a @GET@
-- request to the @\/CloudFront API version\/distribution ID\/config@
-- resource.
distribution_distributionConfig :: Lens.Lens' Distribution DistributionConfig
distribution_distributionConfig :: (DistributionConfig -> f DistributionConfig)
-> Distribution -> f Distribution
distribution_distributionConfig = (Distribution -> DistributionConfig)
-> (Distribution -> DistributionConfig -> Distribution)
-> Lens
     Distribution Distribution DistributionConfig DistributionConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Distribution' {DistributionConfig
distributionConfig :: DistributionConfig
$sel:distributionConfig:Distribution' :: Distribution -> DistributionConfig
distributionConfig} -> DistributionConfig
distributionConfig) (\s :: Distribution
s@Distribution' {} DistributionConfig
a -> Distribution
s {$sel:distributionConfig:Distribution' :: DistributionConfig
distributionConfig = DistributionConfig
a} :: Distribution)

instance Core.FromXML Distribution where
  parseXML :: [Node] -> Either String Distribution
parseXML [Node]
x =
    Maybe ActiveTrustedKeyGroups
-> Maybe [AliasICPRecordal]
-> Maybe ActiveTrustedSigners
-> Text
-> Text
-> Text
-> ISO8601
-> Int
-> Text
-> DistributionConfig
-> Distribution
Distribution'
      (Maybe ActiveTrustedKeyGroups
 -> Maybe [AliasICPRecordal]
 -> Maybe ActiveTrustedSigners
 -> Text
 -> Text
 -> Text
 -> ISO8601
 -> Int
 -> Text
 -> DistributionConfig
 -> Distribution)
-> Either String (Maybe ActiveTrustedKeyGroups)
-> Either
     String
     (Maybe [AliasICPRecordal]
      -> Maybe ActiveTrustedSigners
      -> Text
      -> Text
      -> Text
      -> ISO8601
      -> Int
      -> Text
      -> DistributionConfig
      -> Distribution)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ActiveTrustedKeyGroups)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ActiveTrustedKeyGroups")
      Either
  String
  (Maybe [AliasICPRecordal]
   -> Maybe ActiveTrustedSigners
   -> Text
   -> Text
   -> Text
   -> ISO8601
   -> Int
   -> Text
   -> DistributionConfig
   -> Distribution)
-> Either String (Maybe [AliasICPRecordal])
-> Either
     String
     (Maybe ActiveTrustedSigners
      -> Text
      -> Text
      -> Text
      -> ISO8601
      -> Int
      -> Text
      -> DistributionConfig
      -> Distribution)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AliasICPRecordals"
                      Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [AliasICPRecordal]))
-> Either String (Maybe [AliasICPRecordal])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [AliasICPRecordal])
-> [Node] -> Either String (Maybe [AliasICPRecordal])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [AliasICPRecordal]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"AliasICPRecordal")
                  )
      Either
  String
  (Maybe ActiveTrustedSigners
   -> Text
   -> Text
   -> Text
   -> ISO8601
   -> Int
   -> Text
   -> DistributionConfig
   -> Distribution)
-> Either String (Maybe ActiveTrustedSigners)
-> Either
     String
     (Text
      -> Text
      -> Text
      -> ISO8601
      -> Int
      -> Text
      -> DistributionConfig
      -> Distribution)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ActiveTrustedSigners)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ActiveTrustedSigners")
      Either
  String
  (Text
   -> Text
   -> Text
   -> ISO8601
   -> Int
   -> Text
   -> DistributionConfig
   -> Distribution)
-> Either String Text
-> Either
     String
     (Text
      -> Text
      -> ISO8601
      -> Int
      -> Text
      -> DistributionConfig
      -> Distribution)
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
"Id")
      Either
  String
  (Text
   -> Text
   -> ISO8601
   -> Int
   -> Text
   -> DistributionConfig
   -> Distribution)
-> Either String Text
-> Either
     String
     (Text
      -> ISO8601 -> Int -> Text -> DistributionConfig -> Distribution)
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
"ARN")
      Either
  String
  (Text
   -> ISO8601 -> Int -> Text -> DistributionConfig -> Distribution)
-> Either String Text
-> Either
     String
     (ISO8601 -> Int -> Text -> DistributionConfig -> Distribution)
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
"Status")
      Either
  String
  (ISO8601 -> Int -> Text -> DistributionConfig -> Distribution)
-> Either String ISO8601
-> Either
     String (Int -> Text -> DistributionConfig -> Distribution)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ISO8601
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"LastModifiedTime")
      Either String (Int -> Text -> DistributionConfig -> Distribution)
-> Either String Int
-> Either String (Text -> DistributionConfig -> Distribution)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Int
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"InProgressInvalidationBatches")
      Either String (Text -> DistributionConfig -> Distribution)
-> Either String Text
-> Either String (DistributionConfig -> Distribution)
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
"DomainName")
      Either String (DistributionConfig -> Distribution)
-> Either String DistributionConfig -> Either String Distribution
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String DistributionConfig
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"DistributionConfig")

instance Prelude.Hashable Distribution

instance Prelude.NFData Distribution