{-# 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.CrlConfiguration where
import Amazonka.CertificateManagerPCA.Types.S3ObjectAcl
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CrlConfiguration = CrlConfiguration'
{
CrlConfiguration -> Maybe Text
customCname :: Prelude.Maybe Prelude.Text,
CrlConfiguration -> Maybe Natural
expirationInDays :: Prelude.Maybe Prelude.Natural,
CrlConfiguration -> Maybe S3ObjectAcl
s3ObjectAcl :: Prelude.Maybe S3ObjectAcl,
CrlConfiguration -> Maybe Text
s3BucketName :: Prelude.Maybe Prelude.Text,
CrlConfiguration -> Bool
enabled :: Prelude.Bool
}
deriving (CrlConfiguration -> CrlConfiguration -> Bool
(CrlConfiguration -> CrlConfiguration -> Bool)
-> (CrlConfiguration -> CrlConfiguration -> Bool)
-> Eq CrlConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CrlConfiguration -> CrlConfiguration -> Bool
$c/= :: CrlConfiguration -> CrlConfiguration -> Bool
== :: CrlConfiguration -> CrlConfiguration -> Bool
$c== :: CrlConfiguration -> CrlConfiguration -> Bool
Prelude.Eq, ReadPrec [CrlConfiguration]
ReadPrec CrlConfiguration
Int -> ReadS CrlConfiguration
ReadS [CrlConfiguration]
(Int -> ReadS CrlConfiguration)
-> ReadS [CrlConfiguration]
-> ReadPrec CrlConfiguration
-> ReadPrec [CrlConfiguration]
-> Read CrlConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CrlConfiguration]
$creadListPrec :: ReadPrec [CrlConfiguration]
readPrec :: ReadPrec CrlConfiguration
$creadPrec :: ReadPrec CrlConfiguration
readList :: ReadS [CrlConfiguration]
$creadList :: ReadS [CrlConfiguration]
readsPrec :: Int -> ReadS CrlConfiguration
$creadsPrec :: Int -> ReadS CrlConfiguration
Prelude.Read, Int -> CrlConfiguration -> ShowS
[CrlConfiguration] -> ShowS
CrlConfiguration -> String
(Int -> CrlConfiguration -> ShowS)
-> (CrlConfiguration -> String)
-> ([CrlConfiguration] -> ShowS)
-> Show CrlConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CrlConfiguration] -> ShowS
$cshowList :: [CrlConfiguration] -> ShowS
show :: CrlConfiguration -> String
$cshow :: CrlConfiguration -> String
showsPrec :: Int -> CrlConfiguration -> ShowS
$cshowsPrec :: Int -> CrlConfiguration -> ShowS
Prelude.Show, (forall x. CrlConfiguration -> Rep CrlConfiguration x)
-> (forall x. Rep CrlConfiguration x -> CrlConfiguration)
-> Generic CrlConfiguration
forall x. Rep CrlConfiguration x -> CrlConfiguration
forall x. CrlConfiguration -> Rep CrlConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CrlConfiguration x -> CrlConfiguration
$cfrom :: forall x. CrlConfiguration -> Rep CrlConfiguration x
Prelude.Generic)
newCrlConfiguration ::
Prelude.Bool ->
CrlConfiguration
newCrlConfiguration :: Bool -> CrlConfiguration
newCrlConfiguration Bool
pEnabled_ =
CrlConfiguration' :: Maybe Text
-> Maybe Natural
-> Maybe S3ObjectAcl
-> Maybe Text
-> Bool
-> CrlConfiguration
CrlConfiguration'
{ $sel:customCname:CrlConfiguration' :: Maybe Text
customCname = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:expirationInDays:CrlConfiguration' :: Maybe Natural
expirationInDays = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:s3ObjectAcl:CrlConfiguration' :: Maybe S3ObjectAcl
s3ObjectAcl = Maybe S3ObjectAcl
forall a. Maybe a
Prelude.Nothing,
$sel:s3BucketName:CrlConfiguration' :: Maybe Text
s3BucketName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:enabled:CrlConfiguration' :: Bool
enabled = Bool
pEnabled_
}
crlConfiguration_customCname :: Lens.Lens' CrlConfiguration (Prelude.Maybe Prelude.Text)
crlConfiguration_customCname :: (Maybe Text -> f (Maybe Text))
-> CrlConfiguration -> f CrlConfiguration
crlConfiguration_customCname = (CrlConfiguration -> Maybe Text)
-> (CrlConfiguration -> Maybe Text -> CrlConfiguration)
-> Lens CrlConfiguration CrlConfiguration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrlConfiguration' {Maybe Text
customCname :: Maybe Text
$sel:customCname:CrlConfiguration' :: CrlConfiguration -> Maybe Text
customCname} -> Maybe Text
customCname) (\s :: CrlConfiguration
s@CrlConfiguration' {} Maybe Text
a -> CrlConfiguration
s {$sel:customCname:CrlConfiguration' :: Maybe Text
customCname = Maybe Text
a} :: CrlConfiguration)
crlConfiguration_expirationInDays :: Lens.Lens' CrlConfiguration (Prelude.Maybe Prelude.Natural)
crlConfiguration_expirationInDays :: (Maybe Natural -> f (Maybe Natural))
-> CrlConfiguration -> f CrlConfiguration
crlConfiguration_expirationInDays = (CrlConfiguration -> Maybe Natural)
-> (CrlConfiguration -> Maybe Natural -> CrlConfiguration)
-> Lens
CrlConfiguration CrlConfiguration (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrlConfiguration' {Maybe Natural
expirationInDays :: Maybe Natural
$sel:expirationInDays:CrlConfiguration' :: CrlConfiguration -> Maybe Natural
expirationInDays} -> Maybe Natural
expirationInDays) (\s :: CrlConfiguration
s@CrlConfiguration' {} Maybe Natural
a -> CrlConfiguration
s {$sel:expirationInDays:CrlConfiguration' :: Maybe Natural
expirationInDays = Maybe Natural
a} :: CrlConfiguration)
crlConfiguration_s3ObjectAcl :: Lens.Lens' CrlConfiguration (Prelude.Maybe S3ObjectAcl)
crlConfiguration_s3ObjectAcl :: (Maybe S3ObjectAcl -> f (Maybe S3ObjectAcl))
-> CrlConfiguration -> f CrlConfiguration
crlConfiguration_s3ObjectAcl = (CrlConfiguration -> Maybe S3ObjectAcl)
-> (CrlConfiguration -> Maybe S3ObjectAcl -> CrlConfiguration)
-> Lens
CrlConfiguration
CrlConfiguration
(Maybe S3ObjectAcl)
(Maybe S3ObjectAcl)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrlConfiguration' {Maybe S3ObjectAcl
s3ObjectAcl :: Maybe S3ObjectAcl
$sel:s3ObjectAcl:CrlConfiguration' :: CrlConfiguration -> Maybe S3ObjectAcl
s3ObjectAcl} -> Maybe S3ObjectAcl
s3ObjectAcl) (\s :: CrlConfiguration
s@CrlConfiguration' {} Maybe S3ObjectAcl
a -> CrlConfiguration
s {$sel:s3ObjectAcl:CrlConfiguration' :: Maybe S3ObjectAcl
s3ObjectAcl = Maybe S3ObjectAcl
a} :: CrlConfiguration)
crlConfiguration_s3BucketName :: Lens.Lens' CrlConfiguration (Prelude.Maybe Prelude.Text)
crlConfiguration_s3BucketName :: (Maybe Text -> f (Maybe Text))
-> CrlConfiguration -> f CrlConfiguration
crlConfiguration_s3BucketName = (CrlConfiguration -> Maybe Text)
-> (CrlConfiguration -> Maybe Text -> CrlConfiguration)
-> Lens CrlConfiguration CrlConfiguration (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrlConfiguration' {Maybe Text
s3BucketName :: Maybe Text
$sel:s3BucketName:CrlConfiguration' :: CrlConfiguration -> Maybe Text
s3BucketName} -> Maybe Text
s3BucketName) (\s :: CrlConfiguration
s@CrlConfiguration' {} Maybe Text
a -> CrlConfiguration
s {$sel:s3BucketName:CrlConfiguration' :: Maybe Text
s3BucketName = Maybe Text
a} :: CrlConfiguration)
crlConfiguration_enabled :: Lens.Lens' CrlConfiguration Prelude.Bool
crlConfiguration_enabled :: (Bool -> f Bool) -> CrlConfiguration -> f CrlConfiguration
crlConfiguration_enabled = (CrlConfiguration -> Bool)
-> (CrlConfiguration -> Bool -> CrlConfiguration)
-> Lens CrlConfiguration CrlConfiguration Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CrlConfiguration' {Bool
enabled :: Bool
$sel:enabled:CrlConfiguration' :: CrlConfiguration -> Bool
enabled} -> Bool
enabled) (\s :: CrlConfiguration
s@CrlConfiguration' {} Bool
a -> CrlConfiguration
s {$sel:enabled:CrlConfiguration' :: Bool
enabled = Bool
a} :: CrlConfiguration)
instance Core.FromJSON CrlConfiguration where
parseJSON :: Value -> Parser CrlConfiguration
parseJSON =
String
-> (Object -> Parser CrlConfiguration)
-> Value
-> Parser CrlConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CrlConfiguration"
( \Object
x ->
Maybe Text
-> Maybe Natural
-> Maybe S3ObjectAcl
-> Maybe Text
-> Bool
-> CrlConfiguration
CrlConfiguration'
(Maybe Text
-> Maybe Natural
-> Maybe S3ObjectAcl
-> Maybe Text
-> Bool
-> CrlConfiguration)
-> Parser (Maybe Text)
-> Parser
(Maybe Natural
-> Maybe S3ObjectAcl -> Maybe Text -> Bool -> CrlConfiguration)
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
"CustomCname")
Parser
(Maybe Natural
-> Maybe S3ObjectAcl -> Maybe Text -> Bool -> CrlConfiguration)
-> Parser (Maybe Natural)
-> Parser
(Maybe S3ObjectAcl -> Maybe Text -> Bool -> CrlConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ExpirationInDays")
Parser
(Maybe S3ObjectAcl -> Maybe Text -> Bool -> CrlConfiguration)
-> Parser (Maybe S3ObjectAcl)
-> Parser (Maybe Text -> Bool -> CrlConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe S3ObjectAcl)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"S3ObjectAcl")
Parser (Maybe Text -> Bool -> CrlConfiguration)
-> Parser (Maybe Text) -> Parser (Bool -> CrlConfiguration)
forall (f :: * -> *) a b. Applicative f => 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
"S3BucketName")
Parser (Bool -> CrlConfiguration)
-> Parser Bool -> Parser CrlConfiguration
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 CrlConfiguration
instance Prelude.NFData CrlConfiguration
instance Core.ToJSON CrlConfiguration where
toJSON :: CrlConfiguration -> Value
toJSON CrlConfiguration' {Bool
Maybe Natural
Maybe Text
Maybe S3ObjectAcl
enabled :: Bool
s3BucketName :: Maybe Text
s3ObjectAcl :: Maybe S3ObjectAcl
expirationInDays :: Maybe Natural
customCname :: Maybe Text
$sel:enabled:CrlConfiguration' :: CrlConfiguration -> Bool
$sel:s3BucketName:CrlConfiguration' :: CrlConfiguration -> Maybe Text
$sel:s3ObjectAcl:CrlConfiguration' :: CrlConfiguration -> Maybe S3ObjectAcl
$sel:expirationInDays:CrlConfiguration' :: CrlConfiguration -> Maybe Natural
$sel:customCname:CrlConfiguration' :: CrlConfiguration -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"CustomCname" 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
customCname,
(Text
"ExpirationInDays" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
expirationInDays,
(Text
"S3ObjectAcl" Text -> S3ObjectAcl -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (S3ObjectAcl -> Pair) -> Maybe S3ObjectAcl -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3ObjectAcl
s3ObjectAcl,
(Text
"S3BucketName" 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
s3BucketName,
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)
]
)