{-# 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.EncryptionEntities where
import Amazonka.CloudFront.Types.EncryptionEntity
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data EncryptionEntities = EncryptionEntities'
{
EncryptionEntities -> Maybe [EncryptionEntity]
items :: Prelude.Maybe [EncryptionEntity],
EncryptionEntities -> Int
quantity :: Prelude.Int
}
deriving (EncryptionEntities -> EncryptionEntities -> Bool
(EncryptionEntities -> EncryptionEntities -> Bool)
-> (EncryptionEntities -> EncryptionEntities -> Bool)
-> Eq EncryptionEntities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EncryptionEntities -> EncryptionEntities -> Bool
$c/= :: EncryptionEntities -> EncryptionEntities -> Bool
== :: EncryptionEntities -> EncryptionEntities -> Bool
$c== :: EncryptionEntities -> EncryptionEntities -> Bool
Prelude.Eq, ReadPrec [EncryptionEntities]
ReadPrec EncryptionEntities
Int -> ReadS EncryptionEntities
ReadS [EncryptionEntities]
(Int -> ReadS EncryptionEntities)
-> ReadS [EncryptionEntities]
-> ReadPrec EncryptionEntities
-> ReadPrec [EncryptionEntities]
-> Read EncryptionEntities
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EncryptionEntities]
$creadListPrec :: ReadPrec [EncryptionEntities]
readPrec :: ReadPrec EncryptionEntities
$creadPrec :: ReadPrec EncryptionEntities
readList :: ReadS [EncryptionEntities]
$creadList :: ReadS [EncryptionEntities]
readsPrec :: Int -> ReadS EncryptionEntities
$creadsPrec :: Int -> ReadS EncryptionEntities
Prelude.Read, Int -> EncryptionEntities -> ShowS
[EncryptionEntities] -> ShowS
EncryptionEntities -> String
(Int -> EncryptionEntities -> ShowS)
-> (EncryptionEntities -> String)
-> ([EncryptionEntities] -> ShowS)
-> Show EncryptionEntities
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EncryptionEntities] -> ShowS
$cshowList :: [EncryptionEntities] -> ShowS
show :: EncryptionEntities -> String
$cshow :: EncryptionEntities -> String
showsPrec :: Int -> EncryptionEntities -> ShowS
$cshowsPrec :: Int -> EncryptionEntities -> ShowS
Prelude.Show, (forall x. EncryptionEntities -> Rep EncryptionEntities x)
-> (forall x. Rep EncryptionEntities x -> EncryptionEntities)
-> Generic EncryptionEntities
forall x. Rep EncryptionEntities x -> EncryptionEntities
forall x. EncryptionEntities -> Rep EncryptionEntities x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EncryptionEntities x -> EncryptionEntities
$cfrom :: forall x. EncryptionEntities -> Rep EncryptionEntities x
Prelude.Generic)
newEncryptionEntities ::
Prelude.Int ->
EncryptionEntities
newEncryptionEntities :: Int -> EncryptionEntities
newEncryptionEntities Int
pQuantity_ =
EncryptionEntities' :: Maybe [EncryptionEntity] -> Int -> EncryptionEntities
EncryptionEntities'
{ $sel:items:EncryptionEntities' :: Maybe [EncryptionEntity]
items = Maybe [EncryptionEntity]
forall a. Maybe a
Prelude.Nothing,
$sel:quantity:EncryptionEntities' :: Int
quantity = Int
pQuantity_
}
encryptionEntities_items :: Lens.Lens' EncryptionEntities (Prelude.Maybe [EncryptionEntity])
encryptionEntities_items :: (Maybe [EncryptionEntity] -> f (Maybe [EncryptionEntity]))
-> EncryptionEntities -> f EncryptionEntities
encryptionEntities_items = (EncryptionEntities -> Maybe [EncryptionEntity])
-> (EncryptionEntities
-> Maybe [EncryptionEntity] -> EncryptionEntities)
-> Lens
EncryptionEntities
EncryptionEntities
(Maybe [EncryptionEntity])
(Maybe [EncryptionEntity])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EncryptionEntities' {Maybe [EncryptionEntity]
items :: Maybe [EncryptionEntity]
$sel:items:EncryptionEntities' :: EncryptionEntities -> Maybe [EncryptionEntity]
items} -> Maybe [EncryptionEntity]
items) (\s :: EncryptionEntities
s@EncryptionEntities' {} Maybe [EncryptionEntity]
a -> EncryptionEntities
s {$sel:items:EncryptionEntities' :: Maybe [EncryptionEntity]
items = Maybe [EncryptionEntity]
a} :: EncryptionEntities) ((Maybe [EncryptionEntity] -> f (Maybe [EncryptionEntity]))
-> EncryptionEntities -> f EncryptionEntities)
-> ((Maybe [EncryptionEntity] -> f (Maybe [EncryptionEntity]))
-> Maybe [EncryptionEntity] -> f (Maybe [EncryptionEntity]))
-> (Maybe [EncryptionEntity] -> f (Maybe [EncryptionEntity]))
-> EncryptionEntities
-> f EncryptionEntities
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[EncryptionEntity]
[EncryptionEntity]
[EncryptionEntity]
[EncryptionEntity]
-> Iso
(Maybe [EncryptionEntity])
(Maybe [EncryptionEntity])
(Maybe [EncryptionEntity])
(Maybe [EncryptionEntity])
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
[EncryptionEntity]
[EncryptionEntity]
[EncryptionEntity]
[EncryptionEntity]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
encryptionEntities_quantity :: Lens.Lens' EncryptionEntities Prelude.Int
encryptionEntities_quantity :: (Int -> f Int) -> EncryptionEntities -> f EncryptionEntities
encryptionEntities_quantity = (EncryptionEntities -> Int)
-> (EncryptionEntities -> Int -> EncryptionEntities)
-> Lens EncryptionEntities EncryptionEntities Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EncryptionEntities' {Int
quantity :: Int
$sel:quantity:EncryptionEntities' :: EncryptionEntities -> Int
quantity} -> Int
quantity) (\s :: EncryptionEntities
s@EncryptionEntities' {} Int
a -> EncryptionEntities
s {$sel:quantity:EncryptionEntities' :: Int
quantity = Int
a} :: EncryptionEntities)
instance Core.FromXML EncryptionEntities where
parseXML :: [Node] -> Either String EncryptionEntities
parseXML [Node]
x =
Maybe [EncryptionEntity] -> Int -> EncryptionEntities
EncryptionEntities'
(Maybe [EncryptionEntity] -> Int -> EncryptionEntities)
-> Either String (Maybe [EncryptionEntity])
-> Either String (Int -> EncryptionEntities)
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 [EncryptionEntity]))
-> Either String (Maybe [EncryptionEntity])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [EncryptionEntity])
-> [Node] -> Either String (Maybe [EncryptionEntity])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [EncryptionEntity]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"EncryptionEntity")
)
Either String (Int -> EncryptionEntities)
-> Either String Int -> Either String EncryptionEntities
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 EncryptionEntities
instance Prelude.NFData EncryptionEntities
instance Core.ToXML EncryptionEntities where
toXML :: EncryptionEntities -> XML
toXML EncryptionEntities' {Int
Maybe [EncryptionEntity]
quantity :: Int
items :: Maybe [EncryptionEntity]
$sel:quantity:EncryptionEntities' :: EncryptionEntities -> Int
$sel:items:EncryptionEntities' :: EncryptionEntities -> Maybe [EncryptionEntity]
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"Items"
Name -> XML -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe XML -> XML
forall a. ToXML a => a -> XML
Core.toXML
( Name -> [EncryptionEntity] -> XML
forall a. (IsList a, ToXML (Item a)) => Name -> a -> XML
Core.toXMLList Name
"EncryptionEntity"
([EncryptionEntity] -> XML)
-> Maybe [EncryptionEntity] -> Maybe XML
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [EncryptionEntity]
items
),
Name
"Quantity" Name -> Int -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Int
quantity
]