{-# 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.IoT.Types.AuditCheckConfiguration
-- 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.IoT.Types.AuditCheckConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Which audit checks are enabled and disabled for this account.
--
-- /See:/ 'newAuditCheckConfiguration' smart constructor.
data AuditCheckConfiguration = AuditCheckConfiguration'
  { -- | True if this audit check is enabled for this account.
    AuditCheckConfiguration -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool
  }
  deriving (AuditCheckConfiguration -> AuditCheckConfiguration -> Bool
(AuditCheckConfiguration -> AuditCheckConfiguration -> Bool)
-> (AuditCheckConfiguration -> AuditCheckConfiguration -> Bool)
-> Eq AuditCheckConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AuditCheckConfiguration -> AuditCheckConfiguration -> Bool
$c/= :: AuditCheckConfiguration -> AuditCheckConfiguration -> Bool
== :: AuditCheckConfiguration -> AuditCheckConfiguration -> Bool
$c== :: AuditCheckConfiguration -> AuditCheckConfiguration -> Bool
Prelude.Eq, ReadPrec [AuditCheckConfiguration]
ReadPrec AuditCheckConfiguration
Int -> ReadS AuditCheckConfiguration
ReadS [AuditCheckConfiguration]
(Int -> ReadS AuditCheckConfiguration)
-> ReadS [AuditCheckConfiguration]
-> ReadPrec AuditCheckConfiguration
-> ReadPrec [AuditCheckConfiguration]
-> Read AuditCheckConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AuditCheckConfiguration]
$creadListPrec :: ReadPrec [AuditCheckConfiguration]
readPrec :: ReadPrec AuditCheckConfiguration
$creadPrec :: ReadPrec AuditCheckConfiguration
readList :: ReadS [AuditCheckConfiguration]
$creadList :: ReadS [AuditCheckConfiguration]
readsPrec :: Int -> ReadS AuditCheckConfiguration
$creadsPrec :: Int -> ReadS AuditCheckConfiguration
Prelude.Read, Int -> AuditCheckConfiguration -> ShowS
[AuditCheckConfiguration] -> ShowS
AuditCheckConfiguration -> String
(Int -> AuditCheckConfiguration -> ShowS)
-> (AuditCheckConfiguration -> String)
-> ([AuditCheckConfiguration] -> ShowS)
-> Show AuditCheckConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AuditCheckConfiguration] -> ShowS
$cshowList :: [AuditCheckConfiguration] -> ShowS
show :: AuditCheckConfiguration -> String
$cshow :: AuditCheckConfiguration -> String
showsPrec :: Int -> AuditCheckConfiguration -> ShowS
$cshowsPrec :: Int -> AuditCheckConfiguration -> ShowS
Prelude.Show, (forall x.
 AuditCheckConfiguration -> Rep AuditCheckConfiguration x)
-> (forall x.
    Rep AuditCheckConfiguration x -> AuditCheckConfiguration)
-> Generic AuditCheckConfiguration
forall x. Rep AuditCheckConfiguration x -> AuditCheckConfiguration
forall x. AuditCheckConfiguration -> Rep AuditCheckConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AuditCheckConfiguration x -> AuditCheckConfiguration
$cfrom :: forall x. AuditCheckConfiguration -> Rep AuditCheckConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'AuditCheckConfiguration' 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:
--
-- 'enabled', 'auditCheckConfiguration_enabled' - True if this audit check is enabled for this account.
newAuditCheckConfiguration ::
  AuditCheckConfiguration
newAuditCheckConfiguration :: AuditCheckConfiguration
newAuditCheckConfiguration =
  AuditCheckConfiguration' :: Maybe Bool -> AuditCheckConfiguration
AuditCheckConfiguration' {$sel:enabled:AuditCheckConfiguration' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing}

-- | True if this audit check is enabled for this account.
auditCheckConfiguration_enabled :: Lens.Lens' AuditCheckConfiguration (Prelude.Maybe Prelude.Bool)
auditCheckConfiguration_enabled :: (Maybe Bool -> f (Maybe Bool))
-> AuditCheckConfiguration -> f AuditCheckConfiguration
auditCheckConfiguration_enabled = (AuditCheckConfiguration -> Maybe Bool)
-> (AuditCheckConfiguration
    -> Maybe Bool -> AuditCheckConfiguration)
-> Lens
     AuditCheckConfiguration
     AuditCheckConfiguration
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuditCheckConfiguration' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:AuditCheckConfiguration' :: AuditCheckConfiguration -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: AuditCheckConfiguration
s@AuditCheckConfiguration' {} Maybe Bool
a -> AuditCheckConfiguration
s {$sel:enabled:AuditCheckConfiguration' :: Maybe Bool
enabled = Maybe Bool
a} :: AuditCheckConfiguration)

instance Core.FromJSON AuditCheckConfiguration where
  parseJSON :: Value -> Parser AuditCheckConfiguration
parseJSON =
    String
-> (Object -> Parser AuditCheckConfiguration)
-> Value
-> Parser AuditCheckConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AuditCheckConfiguration"
      ( \Object
x ->
          Maybe Bool -> AuditCheckConfiguration
AuditCheckConfiguration'
            (Maybe Bool -> AuditCheckConfiguration)
-> Parser (Maybe Bool) -> Parser AuditCheckConfiguration
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"enabled")
      )

instance Prelude.Hashable AuditCheckConfiguration

instance Prelude.NFData AuditCheckConfiguration

instance Core.ToJSON AuditCheckConfiguration where
  toJSON :: AuditCheckConfiguration -> Value
toJSON AuditCheckConfiguration' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:AuditCheckConfiguration' :: AuditCheckConfiguration -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"enabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enabled]
      )