{-# 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.AuditSuppression
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoT.Types.AuditSuppression where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types.ResourceIdentifier
import qualified Amazonka.Prelude as Prelude

-- | Filters out specific findings of a Device Defender audit.
--
-- /See:/ 'newAuditSuppression' smart constructor.
data AuditSuppression = AuditSuppression'
  { -- | The description of the audit suppression.
    AuditSuppression -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The expiration date (epoch timestamp in seconds) that you want the
    -- suppression to adhere to.
    AuditSuppression -> Maybe POSIX
expirationDate :: Prelude.Maybe Data.POSIX,
    -- | Indicates whether a suppression should exist indefinitely or not.
    AuditSuppression -> Maybe Bool
suppressIndefinitely :: Prelude.Maybe Prelude.Bool,
    AuditSuppression -> Text
checkName :: Prelude.Text,
    AuditSuppression -> ResourceIdentifier
resourceIdentifier :: ResourceIdentifier
  }
  deriving (AuditSuppression -> AuditSuppression -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AuditSuppression -> AuditSuppression -> Bool
$c/= :: AuditSuppression -> AuditSuppression -> Bool
== :: AuditSuppression -> AuditSuppression -> Bool
$c== :: AuditSuppression -> AuditSuppression -> Bool
Prelude.Eq, ReadPrec [AuditSuppression]
ReadPrec AuditSuppression
Int -> ReadS AuditSuppression
ReadS [AuditSuppression]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AuditSuppression]
$creadListPrec :: ReadPrec [AuditSuppression]
readPrec :: ReadPrec AuditSuppression
$creadPrec :: ReadPrec AuditSuppression
readList :: ReadS [AuditSuppression]
$creadList :: ReadS [AuditSuppression]
readsPrec :: Int -> ReadS AuditSuppression
$creadsPrec :: Int -> ReadS AuditSuppression
Prelude.Read, Int -> AuditSuppression -> ShowS
[AuditSuppression] -> ShowS
AuditSuppression -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AuditSuppression] -> ShowS
$cshowList :: [AuditSuppression] -> ShowS
show :: AuditSuppression -> String
$cshow :: AuditSuppression -> String
showsPrec :: Int -> AuditSuppression -> ShowS
$cshowsPrec :: Int -> AuditSuppression -> ShowS
Prelude.Show, forall x. Rep AuditSuppression x -> AuditSuppression
forall x. AuditSuppression -> Rep AuditSuppression x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AuditSuppression x -> AuditSuppression
$cfrom :: forall x. AuditSuppression -> Rep AuditSuppression x
Prelude.Generic)

-- |
-- Create a value of 'AuditSuppression' 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:
--
-- 'description', 'auditSuppression_description' - The description of the audit suppression.
--
-- 'expirationDate', 'auditSuppression_expirationDate' - The expiration date (epoch timestamp in seconds) that you want the
-- suppression to adhere to.
--
-- 'suppressIndefinitely', 'auditSuppression_suppressIndefinitely' - Indicates whether a suppression should exist indefinitely or not.
--
-- 'checkName', 'auditSuppression_checkName' - Undocumented member.
--
-- 'resourceIdentifier', 'auditSuppression_resourceIdentifier' - Undocumented member.
newAuditSuppression ::
  -- | 'checkName'
  Prelude.Text ->
  -- | 'resourceIdentifier'
  ResourceIdentifier ->
  AuditSuppression
newAuditSuppression :: Text -> ResourceIdentifier -> AuditSuppression
newAuditSuppression Text
pCheckName_ ResourceIdentifier
pResourceIdentifier_ =
  AuditSuppression'
    { $sel:description:AuditSuppression' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:expirationDate:AuditSuppression' :: Maybe POSIX
expirationDate = forall a. Maybe a
Prelude.Nothing,
      $sel:suppressIndefinitely:AuditSuppression' :: Maybe Bool
suppressIndefinitely = forall a. Maybe a
Prelude.Nothing,
      $sel:checkName:AuditSuppression' :: Text
checkName = Text
pCheckName_,
      $sel:resourceIdentifier:AuditSuppression' :: ResourceIdentifier
resourceIdentifier = ResourceIdentifier
pResourceIdentifier_
    }

-- | The description of the audit suppression.
auditSuppression_description :: Lens.Lens' AuditSuppression (Prelude.Maybe Prelude.Text)
auditSuppression_description :: Lens' AuditSuppression (Maybe Text)
auditSuppression_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuditSuppression' {Maybe Text
description :: Maybe Text
$sel:description:AuditSuppression' :: AuditSuppression -> Maybe Text
description} -> Maybe Text
description) (\s :: AuditSuppression
s@AuditSuppression' {} Maybe Text
a -> AuditSuppression
s {$sel:description:AuditSuppression' :: Maybe Text
description = Maybe Text
a} :: AuditSuppression)

-- | The expiration date (epoch timestamp in seconds) that you want the
-- suppression to adhere to.
auditSuppression_expirationDate :: Lens.Lens' AuditSuppression (Prelude.Maybe Prelude.UTCTime)
auditSuppression_expirationDate :: Lens' AuditSuppression (Maybe UTCTime)
auditSuppression_expirationDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuditSuppression' {Maybe POSIX
expirationDate :: Maybe POSIX
$sel:expirationDate:AuditSuppression' :: AuditSuppression -> Maybe POSIX
expirationDate} -> Maybe POSIX
expirationDate) (\s :: AuditSuppression
s@AuditSuppression' {} Maybe POSIX
a -> AuditSuppression
s {$sel:expirationDate:AuditSuppression' :: Maybe POSIX
expirationDate = Maybe POSIX
a} :: AuditSuppression) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Indicates whether a suppression should exist indefinitely or not.
auditSuppression_suppressIndefinitely :: Lens.Lens' AuditSuppression (Prelude.Maybe Prelude.Bool)
auditSuppression_suppressIndefinitely :: Lens' AuditSuppression (Maybe Bool)
auditSuppression_suppressIndefinitely = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuditSuppression' {Maybe Bool
suppressIndefinitely :: Maybe Bool
$sel:suppressIndefinitely:AuditSuppression' :: AuditSuppression -> Maybe Bool
suppressIndefinitely} -> Maybe Bool
suppressIndefinitely) (\s :: AuditSuppression
s@AuditSuppression' {} Maybe Bool
a -> AuditSuppression
s {$sel:suppressIndefinitely:AuditSuppression' :: Maybe Bool
suppressIndefinitely = Maybe Bool
a} :: AuditSuppression)

-- | Undocumented member.
auditSuppression_checkName :: Lens.Lens' AuditSuppression Prelude.Text
auditSuppression_checkName :: Lens' AuditSuppression Text
auditSuppression_checkName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuditSuppression' {Text
checkName :: Text
$sel:checkName:AuditSuppression' :: AuditSuppression -> Text
checkName} -> Text
checkName) (\s :: AuditSuppression
s@AuditSuppression' {} Text
a -> AuditSuppression
s {$sel:checkName:AuditSuppression' :: Text
checkName = Text
a} :: AuditSuppression)

-- | Undocumented member.
auditSuppression_resourceIdentifier :: Lens.Lens' AuditSuppression ResourceIdentifier
auditSuppression_resourceIdentifier :: Lens' AuditSuppression ResourceIdentifier
auditSuppression_resourceIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuditSuppression' {ResourceIdentifier
resourceIdentifier :: ResourceIdentifier
$sel:resourceIdentifier:AuditSuppression' :: AuditSuppression -> ResourceIdentifier
resourceIdentifier} -> ResourceIdentifier
resourceIdentifier) (\s :: AuditSuppression
s@AuditSuppression' {} ResourceIdentifier
a -> AuditSuppression
s {$sel:resourceIdentifier:AuditSuppression' :: ResourceIdentifier
resourceIdentifier = ResourceIdentifier
a} :: AuditSuppression)

instance Data.FromJSON AuditSuppression where
  parseJSON :: Value -> Parser AuditSuppression
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AuditSuppression"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe Bool
-> Text
-> ResourceIdentifier
-> AuditSuppression
AuditSuppression'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"expirationDate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"suppressIndefinitely")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"checkName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"resourceIdentifier")
      )

instance Prelude.Hashable AuditSuppression where
  hashWithSalt :: Int -> AuditSuppression -> Int
hashWithSalt Int
_salt AuditSuppression' {Maybe Bool
Maybe Text
Maybe POSIX
Text
ResourceIdentifier
resourceIdentifier :: ResourceIdentifier
checkName :: Text
suppressIndefinitely :: Maybe Bool
expirationDate :: Maybe POSIX
description :: Maybe Text
$sel:resourceIdentifier:AuditSuppression' :: AuditSuppression -> ResourceIdentifier
$sel:checkName:AuditSuppression' :: AuditSuppression -> Text
$sel:suppressIndefinitely:AuditSuppression' :: AuditSuppression -> Maybe Bool
$sel:expirationDate:AuditSuppression' :: AuditSuppression -> Maybe POSIX
$sel:description:AuditSuppression' :: AuditSuppression -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
expirationDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
suppressIndefinitely
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
checkName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ResourceIdentifier
resourceIdentifier

instance Prelude.NFData AuditSuppression where
  rnf :: AuditSuppression -> ()
rnf AuditSuppression' {Maybe Bool
Maybe Text
Maybe POSIX
Text
ResourceIdentifier
resourceIdentifier :: ResourceIdentifier
checkName :: Text
suppressIndefinitely :: Maybe Bool
expirationDate :: Maybe POSIX
description :: Maybe Text
$sel:resourceIdentifier:AuditSuppression' :: AuditSuppression -> ResourceIdentifier
$sel:checkName:AuditSuppression' :: AuditSuppression -> Text
$sel:suppressIndefinitely:AuditSuppression' :: AuditSuppression -> Maybe Bool
$sel:expirationDate:AuditSuppression' :: AuditSuppression -> Maybe POSIX
$sel:description:AuditSuppression' :: AuditSuppression -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
expirationDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
suppressIndefinitely
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
checkName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ResourceIdentifier
resourceIdentifier