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