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