{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.CertificateManagerPCA.Types.CrlConfiguration
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
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

-- | Contains configuration information for a certificate revocation list
-- (CRL). Your private certificate authority (CA) creates base CRLs. Delta
-- CRLs are not supported. You can enable CRLs for your new or an existing
-- private CA by setting the __Enabled__ parameter to @true@. Your private
-- CA writes CRLs to an S3 bucket that you specify in the __S3BucketName__
-- parameter. You can hide the name of your bucket by specifying a value
-- for the __CustomCname__ parameter. Your private CA copies the CNAME or
-- the S3 bucket name to the __CRL Distribution Points__ extension of each
-- certificate it issues. Your S3 bucket policy must give write permission
-- to ACM Private CA.
--
-- ACM Private CA assets that are stored in Amazon S3 can be protected with
-- encryption. For more information, see
-- <https://docs.aws.amazon.com/acm-pca/latest/userguide/PcaCreateCa.html#crl-encryption Encrypting Your CRLs>.
--
-- Your private CA uses the value in the __ExpirationInDays__ parameter to
-- calculate the __nextUpdate__ field in the CRL. The CRL is refreshed at
-- 1\/2 the age of next update or when a certificate is revoked. When a
-- certificate is revoked, it is recorded in the next CRL that is generated
-- and in the next audit report. Only time valid certificates are listed in
-- the CRL. Expired certificates are not included.
--
-- A CRL is typically updated approximately 30 minutes after a certificate
-- is revoked. If for any reason a CRL update fails, ACM Private CA makes
-- further attempts every 15 minutes.
--
-- CRLs contain the following fields:
--
-- -   __Version__: The current version number defined in RFC 5280 is V2.
--     The integer value is 0x1.
--
-- -   __Signature Algorithm__: The name of the algorithm used to sign the
--     CRL.
--
-- -   __Issuer__: The X.500 distinguished name of your private CA that
--     issued the CRL.
--
-- -   __Last Update__: The issue date and time of this CRL.
--
-- -   __Next Update__: The day and time by which the next CRL will be
--     issued.
--
-- -   __Revoked Certificates__: List of revoked certificates. Each list
--     item contains the following information.
--
--     -   __Serial Number__: The serial number, in hexadecimal format, of
--         the revoked certificate.
--
--     -   __Revocation Date__: Date and time the certificate was revoked.
--
--     -   __CRL Entry Extensions__: Optional extensions for the CRL entry.
--
--         -   __X509v3 CRL Reason Code__: Reason the certificate was
--             revoked.
--
-- -   __CRL Extensions__: Optional extensions for the CRL.
--
--     -   __X509v3 Authority Key Identifier__: Identifies the public key
--         associated with the private key used to sign the certificate.
--
--     -   __X509v3 CRL Number:__: Decimal sequence number for the CRL.
--
-- -   __Signature Algorithm__: Algorithm used by your private CA to sign
--     the CRL.
--
-- -   __Signature Value__: Signature computed over the CRL.
--
-- Certificate revocation lists created by ACM Private CA are DER-encoded.
-- You can use the following OpenSSL command to list a CRL.
--
-- @openssl crl -inform DER -text -in crl_path -noout@
--
-- For more information, see
-- <https://docs.aws.amazon.com/acm-pca/latest/userguide/crl-planning.html Planning a certificate revocation list (CRL)>
-- in the /AWS Certificate Manager Private Certificate Authority (PCA) User
-- Guide/
--
-- /See:/ 'newCrlConfiguration' smart constructor.
data CrlConfiguration = CrlConfiguration'
  { -- | Name inserted into the certificate __CRL Distribution Points__ extension
    -- that enables the use of an alias for the CRL distribution point. Use
    -- this value if you don\'t want the name of your S3 bucket to be public.
    CrlConfiguration -> Maybe Text
customCname :: Prelude.Maybe Prelude.Text,
    -- | Validity period of the CRL in days.
    CrlConfiguration -> Maybe Natural
expirationInDays :: Prelude.Maybe Prelude.Natural,
    -- | Determines whether the CRL will be publicly readable or privately held
    -- in the CRL Amazon S3 bucket. If you choose PUBLIC_READ, the CRL will be
    -- accessible over the public internet. If you choose
    -- BUCKET_OWNER_FULL_CONTROL, only the owner of the CRL S3 bucket can
    -- access the CRL, and your PKI clients may need an alternative method of
    -- access.
    --
    -- If no value is specified, the default is @PUBLIC_READ@.
    --
    -- /Note:/ This default can cause CA creation to fail in some
    -- circumstances. If you have have enabled the Block Public Access (BPA)
    -- feature in your S3 account, then you must specify the value of this
    -- parameter as @BUCKET_OWNER_FULL_CONTROL@, and not doing so results in an
    -- error. If you have disabled BPA in S3, then you can specify either
    -- @BUCKET_OWNER_FULL_CONTROL@ or @PUBLIC_READ@ as the value.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/acm-pca/latest/userguide/PcaCreateCa.html#s3-bpa Blocking public access to the S3 bucket>.
    CrlConfiguration -> Maybe S3ObjectAcl
s3ObjectAcl :: Prelude.Maybe S3ObjectAcl,
    -- | Name of the S3 bucket that contains the CRL. If you do not provide a
    -- value for the __CustomCname__ argument, the name of your S3 bucket is
    -- placed into the __CRL Distribution Points__ extension of the issued
    -- certificate. You can change the name of your bucket by calling the
    -- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_UpdateCertificateAuthority.html UpdateCertificateAuthority>
    -- operation. You must specify a
    -- <https://docs.aws.amazon.com/acm-pca/latest/userguide/PcaCreateCa.html#s3-policies bucket policy>
    -- that allows ACM Private CA to write the CRL to your bucket.
    CrlConfiguration -> Maybe Text
s3BucketName :: Prelude.Maybe Prelude.Text,
    -- | Boolean value that specifies whether certificate revocation lists (CRLs)
    -- are enabled. You can use this value to enable certificate revocation for
    -- a new CA when you call the
    -- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_CreateCertificateAuthority.html CreateCertificateAuthority>
    -- action or for an existing CA when you call the
    -- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_UpdateCertificateAuthority.html UpdateCertificateAuthority>
    -- action.
    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)

-- |
-- Create a value of 'CrlConfiguration' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'customCname', 'crlConfiguration_customCname' - Name inserted into the certificate __CRL Distribution Points__ extension
-- that enables the use of an alias for the CRL distribution point. Use
-- this value if you don\'t want the name of your S3 bucket to be public.
--
-- 'expirationInDays', 'crlConfiguration_expirationInDays' - Validity period of the CRL in days.
--
-- 's3ObjectAcl', 'crlConfiguration_s3ObjectAcl' - Determines whether the CRL will be publicly readable or privately held
-- in the CRL Amazon S3 bucket. If you choose PUBLIC_READ, the CRL will be
-- accessible over the public internet. If you choose
-- BUCKET_OWNER_FULL_CONTROL, only the owner of the CRL S3 bucket can
-- access the CRL, and your PKI clients may need an alternative method of
-- access.
--
-- If no value is specified, the default is @PUBLIC_READ@.
--
-- /Note:/ This default can cause CA creation to fail in some
-- circumstances. If you have have enabled the Block Public Access (BPA)
-- feature in your S3 account, then you must specify the value of this
-- parameter as @BUCKET_OWNER_FULL_CONTROL@, and not doing so results in an
-- error. If you have disabled BPA in S3, then you can specify either
-- @BUCKET_OWNER_FULL_CONTROL@ or @PUBLIC_READ@ as the value.
--
-- For more information, see
-- <https://docs.aws.amazon.com/acm-pca/latest/userguide/PcaCreateCa.html#s3-bpa Blocking public access to the S3 bucket>.
--
-- 's3BucketName', 'crlConfiguration_s3BucketName' - Name of the S3 bucket that contains the CRL. If you do not provide a
-- value for the __CustomCname__ argument, the name of your S3 bucket is
-- placed into the __CRL Distribution Points__ extension of the issued
-- certificate. You can change the name of your bucket by calling the
-- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_UpdateCertificateAuthority.html UpdateCertificateAuthority>
-- operation. You must specify a
-- <https://docs.aws.amazon.com/acm-pca/latest/userguide/PcaCreateCa.html#s3-policies bucket policy>
-- that allows ACM Private CA to write the CRL to your bucket.
--
-- 'enabled', 'crlConfiguration_enabled' - Boolean value that specifies whether certificate revocation lists (CRLs)
-- are enabled. You can use this value to enable certificate revocation for
-- a new CA when you call the
-- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_CreateCertificateAuthority.html CreateCertificateAuthority>
-- action or for an existing CA when you call the
-- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_UpdateCertificateAuthority.html UpdateCertificateAuthority>
-- action.
newCrlConfiguration ::
  -- | 'enabled'
  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_
    }

-- | Name inserted into the certificate __CRL Distribution Points__ extension
-- that enables the use of an alias for the CRL distribution point. Use
-- this value if you don\'t want the name of your S3 bucket to be public.
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)

-- | Validity period of the CRL in days.
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)

-- | Determines whether the CRL will be publicly readable or privately held
-- in the CRL Amazon S3 bucket. If you choose PUBLIC_READ, the CRL will be
-- accessible over the public internet. If you choose
-- BUCKET_OWNER_FULL_CONTROL, only the owner of the CRL S3 bucket can
-- access the CRL, and your PKI clients may need an alternative method of
-- access.
--
-- If no value is specified, the default is @PUBLIC_READ@.
--
-- /Note:/ This default can cause CA creation to fail in some
-- circumstances. If you have have enabled the Block Public Access (BPA)
-- feature in your S3 account, then you must specify the value of this
-- parameter as @BUCKET_OWNER_FULL_CONTROL@, and not doing so results in an
-- error. If you have disabled BPA in S3, then you can specify either
-- @BUCKET_OWNER_FULL_CONTROL@ or @PUBLIC_READ@ as the value.
--
-- For more information, see
-- <https://docs.aws.amazon.com/acm-pca/latest/userguide/PcaCreateCa.html#s3-bpa Blocking public access to the S3 bucket>.
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)

-- | Name of the S3 bucket that contains the CRL. If you do not provide a
-- value for the __CustomCname__ argument, the name of your S3 bucket is
-- placed into the __CRL Distribution Points__ extension of the issued
-- certificate. You can change the name of your bucket by calling the
-- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_UpdateCertificateAuthority.html UpdateCertificateAuthority>
-- operation. You must specify a
-- <https://docs.aws.amazon.com/acm-pca/latest/userguide/PcaCreateCa.html#s3-policies bucket policy>
-- that allows ACM Private CA to write the CRL to your bucket.
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)

-- | Boolean value that specifies whether certificate revocation lists (CRLs)
-- are enabled. You can use this value to enable certificate revocation for
-- a new CA when you call the
-- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_CreateCertificateAuthority.html CreateCertificateAuthority>
-- action or for an existing CA when you call the
-- <https://docs.aws.amazon.com/acm-pca/latest/APIReference/API_UpdateCertificateAuthority.html UpdateCertificateAuthority>
-- action.
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)
          ]
      )