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