{-# 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 #-}
module Amazonka.CloudFront.Types.DistributionList where
import Amazonka.CloudFront.Types.DistributionSummary
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DistributionList = DistributionList'
{
DistributionList -> Maybe [DistributionSummary]
items :: Prelude.Maybe [DistributionSummary],
DistributionList -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text,
DistributionList -> Text
marker :: Prelude.Text,
DistributionList -> Int
maxItems :: Prelude.Int,
DistributionList -> Bool
isTruncated :: Prelude.Bool,
DistributionList -> Int
quantity :: Prelude.Int
}
deriving (DistributionList -> DistributionList -> Bool
(DistributionList -> DistributionList -> Bool)
-> (DistributionList -> DistributionList -> Bool)
-> Eq DistributionList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DistributionList -> DistributionList -> Bool
$c/= :: DistributionList -> DistributionList -> Bool
== :: DistributionList -> DistributionList -> Bool
$c== :: DistributionList -> DistributionList -> Bool
Prelude.Eq, ReadPrec [DistributionList]
ReadPrec DistributionList
Int -> ReadS DistributionList
ReadS [DistributionList]
(Int -> ReadS DistributionList)
-> ReadS [DistributionList]
-> ReadPrec DistributionList
-> ReadPrec [DistributionList]
-> Read DistributionList
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DistributionList]
$creadListPrec :: ReadPrec [DistributionList]
readPrec :: ReadPrec DistributionList
$creadPrec :: ReadPrec DistributionList
readList :: ReadS [DistributionList]
$creadList :: ReadS [DistributionList]
readsPrec :: Int -> ReadS DistributionList
$creadsPrec :: Int -> ReadS DistributionList
Prelude.Read, Int -> DistributionList -> ShowS
[DistributionList] -> ShowS
DistributionList -> String
(Int -> DistributionList -> ShowS)
-> (DistributionList -> String)
-> ([DistributionList] -> ShowS)
-> Show DistributionList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DistributionList] -> ShowS
$cshowList :: [DistributionList] -> ShowS
show :: DistributionList -> String
$cshow :: DistributionList -> String
showsPrec :: Int -> DistributionList -> ShowS
$cshowsPrec :: Int -> DistributionList -> ShowS
Prelude.Show, (forall x. DistributionList -> Rep DistributionList x)
-> (forall x. Rep DistributionList x -> DistributionList)
-> Generic DistributionList
forall x. Rep DistributionList x -> DistributionList
forall x. DistributionList -> Rep DistributionList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DistributionList x -> DistributionList
$cfrom :: forall x. DistributionList -> Rep DistributionList x
Prelude.Generic)
newDistributionList ::
Prelude.Text ->
Prelude.Int ->
Prelude.Bool ->
Prelude.Int ->
DistributionList
newDistributionList :: Text -> Int -> Bool -> Int -> DistributionList
newDistributionList
Text
pMarker_
Int
pMaxItems_
Bool
pIsTruncated_
Int
pQuantity_ =
DistributionList' :: Maybe [DistributionSummary]
-> Maybe Text -> Text -> Int -> Bool -> Int -> DistributionList
DistributionList'
{ $sel:items:DistributionList' :: Maybe [DistributionSummary]
items = Maybe [DistributionSummary]
forall a. Maybe a
Prelude.Nothing,
$sel:nextMarker:DistributionList' :: Maybe Text
nextMarker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:marker:DistributionList' :: Text
marker = Text
pMarker_,
$sel:maxItems:DistributionList' :: Int
maxItems = Int
pMaxItems_,
$sel:isTruncated:DistributionList' :: Bool
isTruncated = Bool
pIsTruncated_,
$sel:quantity:DistributionList' :: Int
quantity = Int
pQuantity_
}
distributionList_items :: Lens.Lens' DistributionList (Prelude.Maybe [DistributionSummary])
distributionList_items :: (Maybe [DistributionSummary] -> f (Maybe [DistributionSummary]))
-> DistributionList -> f DistributionList
distributionList_items = (DistributionList -> Maybe [DistributionSummary])
-> (DistributionList
-> Maybe [DistributionSummary] -> DistributionList)
-> Lens
DistributionList
DistributionList
(Maybe [DistributionSummary])
(Maybe [DistributionSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionList' {Maybe [DistributionSummary]
items :: Maybe [DistributionSummary]
$sel:items:DistributionList' :: DistributionList -> Maybe [DistributionSummary]
items} -> Maybe [DistributionSummary]
items) (\s :: DistributionList
s@DistributionList' {} Maybe [DistributionSummary]
a -> DistributionList
s {$sel:items:DistributionList' :: Maybe [DistributionSummary]
items = Maybe [DistributionSummary]
a} :: DistributionList) ((Maybe [DistributionSummary] -> f (Maybe [DistributionSummary]))
-> DistributionList -> f DistributionList)
-> ((Maybe [DistributionSummary]
-> f (Maybe [DistributionSummary]))
-> Maybe [DistributionSummary] -> f (Maybe [DistributionSummary]))
-> (Maybe [DistributionSummary] -> f (Maybe [DistributionSummary]))
-> DistributionList
-> f DistributionList
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[DistributionSummary]
[DistributionSummary]
[DistributionSummary]
[DistributionSummary]
-> Iso
(Maybe [DistributionSummary])
(Maybe [DistributionSummary])
(Maybe [DistributionSummary])
(Maybe [DistributionSummary])
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
[DistributionSummary]
[DistributionSummary]
[DistributionSummary]
[DistributionSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
distributionList_nextMarker :: Lens.Lens' DistributionList (Prelude.Maybe Prelude.Text)
distributionList_nextMarker :: (Maybe Text -> f (Maybe Text))
-> DistributionList -> f DistributionList
distributionList_nextMarker = (DistributionList -> Maybe Text)
-> (DistributionList -> Maybe Text -> DistributionList)
-> Lens DistributionList DistributionList (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionList' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:DistributionList' :: DistributionList -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: DistributionList
s@DistributionList' {} Maybe Text
a -> DistributionList
s {$sel:nextMarker:DistributionList' :: Maybe Text
nextMarker = Maybe Text
a} :: DistributionList)
distributionList_marker :: Lens.Lens' DistributionList Prelude.Text
distributionList_marker :: (Text -> f Text) -> DistributionList -> f DistributionList
distributionList_marker = (DistributionList -> Text)
-> (DistributionList -> Text -> DistributionList)
-> Lens DistributionList DistributionList Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionList' {Text
marker :: Text
$sel:marker:DistributionList' :: DistributionList -> Text
marker} -> Text
marker) (\s :: DistributionList
s@DistributionList' {} Text
a -> DistributionList
s {$sel:marker:DistributionList' :: Text
marker = Text
a} :: DistributionList)
distributionList_maxItems :: Lens.Lens' DistributionList Prelude.Int
distributionList_maxItems :: (Int -> f Int) -> DistributionList -> f DistributionList
distributionList_maxItems = (DistributionList -> Int)
-> (DistributionList -> Int -> DistributionList)
-> Lens DistributionList DistributionList Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionList' {Int
maxItems :: Int
$sel:maxItems:DistributionList' :: DistributionList -> Int
maxItems} -> Int
maxItems) (\s :: DistributionList
s@DistributionList' {} Int
a -> DistributionList
s {$sel:maxItems:DistributionList' :: Int
maxItems = Int
a} :: DistributionList)
distributionList_isTruncated :: Lens.Lens' DistributionList Prelude.Bool
distributionList_isTruncated :: (Bool -> f Bool) -> DistributionList -> f DistributionList
distributionList_isTruncated = (DistributionList -> Bool)
-> (DistributionList -> Bool -> DistributionList)
-> Lens DistributionList DistributionList Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionList' {Bool
isTruncated :: Bool
$sel:isTruncated:DistributionList' :: DistributionList -> Bool
isTruncated} -> Bool
isTruncated) (\s :: DistributionList
s@DistributionList' {} Bool
a -> DistributionList
s {$sel:isTruncated:DistributionList' :: Bool
isTruncated = Bool
a} :: DistributionList)
distributionList_quantity :: Lens.Lens' DistributionList Prelude.Int
distributionList_quantity :: (Int -> f Int) -> DistributionList -> f DistributionList
distributionList_quantity = (DistributionList -> Int)
-> (DistributionList -> Int -> DistributionList)
-> Lens DistributionList DistributionList Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DistributionList' {Int
quantity :: Int
$sel:quantity:DistributionList' :: DistributionList -> Int
quantity} -> Int
quantity) (\s :: DistributionList
s@DistributionList' {} Int
a -> DistributionList
s {$sel:quantity:DistributionList' :: Int
quantity = Int
a} :: DistributionList)
instance Core.FromXML DistributionList where
parseXML :: [Node] -> Either String DistributionList
parseXML [Node]
x =
Maybe [DistributionSummary]
-> Maybe Text -> Text -> Int -> Bool -> Int -> DistributionList
DistributionList'
(Maybe [DistributionSummary]
-> Maybe Text -> Text -> Int -> Bool -> Int -> DistributionList)
-> Either String (Maybe [DistributionSummary])
-> Either
String
(Maybe Text -> Text -> Int -> Bool -> Int -> DistributionList)
forall (f :: * -> *) a b. Functor 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
"Items" 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 [DistributionSummary]))
-> Either String (Maybe [DistributionSummary])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [DistributionSummary])
-> [Node] -> Either String (Maybe [DistributionSummary])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [DistributionSummary]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"DistributionSummary")
)
Either
String
(Maybe Text -> Text -> Int -> Bool -> Int -> DistributionList)
-> Either String (Maybe Text)
-> Either String (Text -> Int -> Bool -> Int -> DistributionList)
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
"NextMarker")
Either String (Text -> Int -> Bool -> Int -> DistributionList)
-> Either String Text
-> Either String (Int -> Bool -> Int -> DistributionList)
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
"Marker")
Either String (Int -> Bool -> Int -> DistributionList)
-> Either String Int
-> Either String (Bool -> Int -> DistributionList)
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
"MaxItems")
Either String (Bool -> Int -> DistributionList)
-> Either String Bool -> Either String (Int -> DistributionList)
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
"IsTruncated")
Either String (Int -> DistributionList)
-> Either String Int -> Either String DistributionList
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
"Quantity")
instance Prelude.Hashable DistributionList
instance Prelude.NFData DistributionList