{-# 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.OcspConfiguration where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data OcspConfiguration = OcspConfiguration'
{
OcspConfiguration -> Maybe Text
ocspCustomCname :: Prelude.Maybe Prelude.Text,
OcspConfiguration -> Bool
enabled :: Prelude.Bool
}
deriving (OcspConfiguration -> OcspConfiguration -> Bool
(OcspConfiguration -> OcspConfiguration -> Bool)
-> (OcspConfiguration -> OcspConfiguration -> Bool)
-> Eq OcspConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OcspConfiguration -> OcspConfiguration -> Bool
$c/= :: OcspConfiguration -> OcspConfiguration -> Bool
== :: OcspConfiguration -> OcspConfiguration -> Bool
$c== :: OcspConfiguration -> OcspConfiguration -> Bool
Prelude.Eq, ReadPrec [OcspConfiguration]
ReadPrec OcspConfiguration
Int -> ReadS OcspConfiguration
ReadS [OcspConfiguration]
(Int -> ReadS OcspConfiguration)
-> ReadS [OcspConfiguration]
-> ReadPrec OcspConfiguration
-> ReadPrec [OcspConfiguration]
-> Read OcspConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OcspConfiguration]
$creadListPrec :: ReadPrec [OcspConfiguration]
readPrec :: ReadPrec OcspConfiguration
$creadPrec :: ReadPrec OcspConfiguration
readList :: ReadS [OcspConfiguration]
$creadList :: ReadS [OcspConfiguration]
readsPrec :: Int -> ReadS OcspConfiguration
$creadsPrec :: Int -> ReadS OcspConfiguration
Prelude.Read, Int -> OcspConfiguration -> ShowS
[OcspConfiguration] -> ShowS
OcspConfiguration -> String
(Int -> OcspConfiguration -> ShowS)
-> (OcspConfiguration -> String)
-> ([OcspConfiguration] -> ShowS)
-> Show OcspConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OcspConfiguration] -> ShowS
$cshowList :: [OcspConfiguration] -> ShowS
show :: OcspConfiguration -> String
$cshow :: OcspConfiguration -> String
showsPrec :: Int -> OcspConfiguration -> ShowS
$cshowsPrec :: Int -> OcspConfiguration -> ShowS
Prelude.Show, (forall x. OcspConfiguration -> Rep OcspConfiguration x)
-> (forall x. Rep OcspConfiguration x -> OcspConfiguration)
-> Generic OcspConfiguration
forall x. Rep OcspConfiguration x -> OcspConfiguration
forall x. OcspConfiguration -> Rep OcspConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OcspConfiguration x -> OcspConfiguration
$cfrom :: forall x. OcspConfiguration -> Rep OcspConfiguration x
Prelude.Generic)
newOcspConfiguration ::
Prelude.Bool ->
OcspConfiguration
newOcspConfiguration :: Bool -> OcspConfiguration
newOcspConfiguration Bool
pEnabled_ =
OcspConfiguration' :: Maybe Text -> Bool -> OcspConfiguration
OcspConfiguration'
{ $sel:ocspCustomCname:OcspConfiguration' :: Maybe Text
ocspCustomCname =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:enabled:OcspConfiguration' :: Bool
enabled = Bool
pEnabled_
}
ocspConfiguration_ocspCustomCname :: Lens.Lens' OcspConfiguration (Prelude.Maybe Prelude.Text)
ocspConfiguration_ocspCustomCname :: (Maybe Text -> f (Maybe Text))
-> OcspConfiguration -> f OcspConfiguration
ocspConfiguration_ocspCustomCname = (OcspConfiguration -> Maybe Text)
-> (OcspConfiguration -> Maybe Text -> OcspConfiguration)
-> Lens
OcspConfiguration OcspConfiguration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OcspConfiguration' {Maybe Text
ocspCustomCname :: Maybe Text
$sel:ocspCustomCname:OcspConfiguration' :: OcspConfiguration -> Maybe Text
ocspCustomCname} -> Maybe Text
ocspCustomCname) (\s :: OcspConfiguration
s@OcspConfiguration' {} Maybe Text
a -> OcspConfiguration
s {$sel:ocspCustomCname:OcspConfiguration' :: Maybe Text
ocspCustomCname = Maybe Text
a} :: OcspConfiguration)
ocspConfiguration_enabled :: Lens.Lens' OcspConfiguration Prelude.Bool
ocspConfiguration_enabled :: (Bool -> f Bool) -> OcspConfiguration -> f OcspConfiguration
ocspConfiguration_enabled = (OcspConfiguration -> Bool)
-> (OcspConfiguration -> Bool -> OcspConfiguration)
-> Lens OcspConfiguration OcspConfiguration Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OcspConfiguration' {Bool
enabled :: Bool
$sel:enabled:OcspConfiguration' :: OcspConfiguration -> Bool
enabled} -> Bool
enabled) (\s :: OcspConfiguration
s@OcspConfiguration' {} Bool
a -> OcspConfiguration
s {$sel:enabled:OcspConfiguration' :: Bool
enabled = Bool
a} :: OcspConfiguration)
instance Core.FromJSON OcspConfiguration where
parseJSON :: Value -> Parser OcspConfiguration
parseJSON =
String
-> (Object -> Parser OcspConfiguration)
-> Value
-> Parser OcspConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"OcspConfiguration"
( \Object
x ->
Maybe Text -> Bool -> OcspConfiguration
OcspConfiguration'
(Maybe Text -> Bool -> OcspConfiguration)
-> Parser (Maybe Text) -> Parser (Bool -> OcspConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OcspCustomCname")
Parser (Bool -> OcspConfiguration)
-> Parser Bool -> Parser OcspConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Enabled")
)
instance Prelude.Hashable OcspConfiguration
instance Prelude.NFData OcspConfiguration
instance Core.ToJSON OcspConfiguration where
toJSON :: OcspConfiguration -> Value
toJSON OcspConfiguration' {Bool
Maybe Text
enabled :: Bool
ocspCustomCname :: Maybe Text
$sel:enabled:OcspConfiguration' :: OcspConfiguration -> Bool
$sel:ocspCustomCname:OcspConfiguration' :: OcspConfiguration -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"OcspCustomCname" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
ocspCustomCname,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Enabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
enabled)
]
)