{-# 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.CertificateManagerPCA.Types.CsrExtensions where
import Amazonka.CertificateManagerPCA.Types.AccessDescription
import Amazonka.CertificateManagerPCA.Types.KeyUsage
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CsrExtensions = CsrExtensions'
{
CsrExtensions -> Maybe [AccessDescription]
subjectInformationAccess :: Prelude.Maybe [AccessDescription],
CsrExtensions -> Maybe KeyUsage
keyUsage :: Prelude.Maybe KeyUsage
}
deriving (CsrExtensions -> CsrExtensions -> Bool
(CsrExtensions -> CsrExtensions -> Bool)
-> (CsrExtensions -> CsrExtensions -> Bool) -> Eq CsrExtensions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CsrExtensions -> CsrExtensions -> Bool
$c/= :: CsrExtensions -> CsrExtensions -> Bool
== :: CsrExtensions -> CsrExtensions -> Bool
$c== :: CsrExtensions -> CsrExtensions -> Bool
Prelude.Eq, ReadPrec [CsrExtensions]
ReadPrec CsrExtensions
Int -> ReadS CsrExtensions
ReadS [CsrExtensions]
(Int -> ReadS CsrExtensions)
-> ReadS [CsrExtensions]
-> ReadPrec CsrExtensions
-> ReadPrec [CsrExtensions]
-> Read CsrExtensions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CsrExtensions]
$creadListPrec :: ReadPrec [CsrExtensions]
readPrec :: ReadPrec CsrExtensions
$creadPrec :: ReadPrec CsrExtensions
readList :: ReadS [CsrExtensions]
$creadList :: ReadS [CsrExtensions]
readsPrec :: Int -> ReadS CsrExtensions
$creadsPrec :: Int -> ReadS CsrExtensions
Prelude.Read, Int -> CsrExtensions -> ShowS
[CsrExtensions] -> ShowS
CsrExtensions -> String
(Int -> CsrExtensions -> ShowS)
-> (CsrExtensions -> String)
-> ([CsrExtensions] -> ShowS)
-> Show CsrExtensions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CsrExtensions] -> ShowS
$cshowList :: [CsrExtensions] -> ShowS
show :: CsrExtensions -> String
$cshow :: CsrExtensions -> String
showsPrec :: Int -> CsrExtensions -> ShowS
$cshowsPrec :: Int -> CsrExtensions -> ShowS
Prelude.Show, (forall x. CsrExtensions -> Rep CsrExtensions x)
-> (forall x. Rep CsrExtensions x -> CsrExtensions)
-> Generic CsrExtensions
forall x. Rep CsrExtensions x -> CsrExtensions
forall x. CsrExtensions -> Rep CsrExtensions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CsrExtensions x -> CsrExtensions
$cfrom :: forall x. CsrExtensions -> Rep CsrExtensions x
Prelude.Generic)
newCsrExtensions ::
CsrExtensions
newCsrExtensions :: CsrExtensions
newCsrExtensions =
CsrExtensions' :: Maybe [AccessDescription] -> Maybe KeyUsage -> CsrExtensions
CsrExtensions'
{ $sel:subjectInformationAccess:CsrExtensions' :: Maybe [AccessDescription]
subjectInformationAccess =
Maybe [AccessDescription]
forall a. Maybe a
Prelude.Nothing,
$sel:keyUsage:CsrExtensions' :: Maybe KeyUsage
keyUsage = Maybe KeyUsage
forall a. Maybe a
Prelude.Nothing
}
csrExtensions_subjectInformationAccess :: Lens.Lens' CsrExtensions (Prelude.Maybe [AccessDescription])
csrExtensions_subjectInformationAccess :: (Maybe [AccessDescription] -> f (Maybe [AccessDescription]))
-> CsrExtensions -> f CsrExtensions
csrExtensions_subjectInformationAccess = (CsrExtensions -> Maybe [AccessDescription])
-> (CsrExtensions -> Maybe [AccessDescription] -> CsrExtensions)
-> Lens
CsrExtensions
CsrExtensions
(Maybe [AccessDescription])
(Maybe [AccessDescription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CsrExtensions' {Maybe [AccessDescription]
subjectInformationAccess :: Maybe [AccessDescription]
$sel:subjectInformationAccess:CsrExtensions' :: CsrExtensions -> Maybe [AccessDescription]
subjectInformationAccess} -> Maybe [AccessDescription]
subjectInformationAccess) (\s :: CsrExtensions
s@CsrExtensions' {} Maybe [AccessDescription]
a -> CsrExtensions
s {$sel:subjectInformationAccess:CsrExtensions' :: Maybe [AccessDescription]
subjectInformationAccess = Maybe [AccessDescription]
a} :: CsrExtensions) ((Maybe [AccessDescription] -> f (Maybe [AccessDescription]))
-> CsrExtensions -> f CsrExtensions)
-> ((Maybe [AccessDescription] -> f (Maybe [AccessDescription]))
-> Maybe [AccessDescription] -> f (Maybe [AccessDescription]))
-> (Maybe [AccessDescription] -> f (Maybe [AccessDescription]))
-> CsrExtensions
-> f CsrExtensions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[AccessDescription]
[AccessDescription]
[AccessDescription]
[AccessDescription]
-> Iso
(Maybe [AccessDescription])
(Maybe [AccessDescription])
(Maybe [AccessDescription])
(Maybe [AccessDescription])
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
[AccessDescription]
[AccessDescription]
[AccessDescription]
[AccessDescription]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
csrExtensions_keyUsage :: Lens.Lens' CsrExtensions (Prelude.Maybe KeyUsage)
csrExtensions_keyUsage :: (Maybe KeyUsage -> f (Maybe KeyUsage))
-> CsrExtensions -> f CsrExtensions
csrExtensions_keyUsage = (CsrExtensions -> Maybe KeyUsage)
-> (CsrExtensions -> Maybe KeyUsage -> CsrExtensions)
-> Lens
CsrExtensions CsrExtensions (Maybe KeyUsage) (Maybe KeyUsage)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CsrExtensions' {Maybe KeyUsage
keyUsage :: Maybe KeyUsage
$sel:keyUsage:CsrExtensions' :: CsrExtensions -> Maybe KeyUsage
keyUsage} -> Maybe KeyUsage
keyUsage) (\s :: CsrExtensions
s@CsrExtensions' {} Maybe KeyUsage
a -> CsrExtensions
s {$sel:keyUsage:CsrExtensions' :: Maybe KeyUsage
keyUsage = Maybe KeyUsage
a} :: CsrExtensions)
instance Core.FromJSON CsrExtensions where
parseJSON :: Value -> Parser CsrExtensions
parseJSON =
String
-> (Object -> Parser CsrExtensions)
-> Value
-> Parser CsrExtensions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CsrExtensions"
( \Object
x ->
Maybe [AccessDescription] -> Maybe KeyUsage -> CsrExtensions
CsrExtensions'
(Maybe [AccessDescription] -> Maybe KeyUsage -> CsrExtensions)
-> Parser (Maybe [AccessDescription])
-> Parser (Maybe KeyUsage -> CsrExtensions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [AccessDescription]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SubjectInformationAccess"
Parser (Maybe (Maybe [AccessDescription]))
-> Maybe [AccessDescription] -> Parser (Maybe [AccessDescription])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AccessDescription]
forall a. Monoid a => a
Prelude.mempty
)
Parser (Maybe KeyUsage -> CsrExtensions)
-> Parser (Maybe KeyUsage) -> Parser CsrExtensions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe KeyUsage)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"KeyUsage")
)
instance Prelude.Hashable CsrExtensions
instance Prelude.NFData CsrExtensions
instance Core.ToJSON CsrExtensions where
toJSON :: CsrExtensions -> Value
toJSON CsrExtensions' {Maybe [AccessDescription]
Maybe KeyUsage
keyUsage :: Maybe KeyUsage
subjectInformationAccess :: Maybe [AccessDescription]
$sel:keyUsage:CsrExtensions' :: CsrExtensions -> Maybe KeyUsage
$sel:subjectInformationAccess:CsrExtensions' :: CsrExtensions -> Maybe [AccessDescription]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"SubjectInformationAccess" Text -> [AccessDescription] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([AccessDescription] -> Pair)
-> Maybe [AccessDescription] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AccessDescription]
subjectInformationAccess,
(Text
"KeyUsage" Text -> KeyUsage -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (KeyUsage -> Pair) -> Maybe KeyUsage -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe KeyUsage
keyUsage
]
)