{-# 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-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.AuditSuppression where

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

-- | Filters out specific findings of a Device Defender audit.
--
-- /See:/ 'newAuditSuppression' smart constructor.
data AuditSuppression = AuditSuppression'
  { -- | The expiration date (epoch timestamp in seconds) that you want the
    -- suppression to adhere to.
    AuditSuppression -> Maybe POSIX
expirationDate :: Prelude.Maybe Core.POSIX,
    -- | Indicates whether a suppression should exist indefinitely or not.
    AuditSuppression -> Maybe Bool
suppressIndefinitely :: Prelude.Maybe Prelude.Bool,
    -- | The description of the audit suppression.
    AuditSuppression -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    AuditSuppression -> Text
checkName :: Prelude.Text,
    AuditSuppression -> ResourceIdentifier
resourceIdentifier :: ResourceIdentifier
  }
  deriving (AuditSuppression -> AuditSuppression -> Bool
(AuditSuppression -> AuditSuppression -> Bool)
-> (AuditSuppression -> AuditSuppression -> Bool)
-> Eq AuditSuppression
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]
(Int -> ReadS AuditSuppression)
-> ReadS [AuditSuppression]
-> ReadPrec AuditSuppression
-> ReadPrec [AuditSuppression]
-> Read 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
(Int -> AuditSuppression -> ShowS)
-> (AuditSuppression -> String)
-> ([AuditSuppression] -> ShowS)
-> Show AuditSuppression
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. AuditSuppression -> Rep AuditSuppression x)
-> (forall x. Rep AuditSuppression x -> AuditSuppression)
-> Generic AuditSuppression
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:
--
-- '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.
--
-- 'description', 'auditSuppression_description' - The description of the audit suppression.
--
-- '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' :: Maybe POSIX
-> Maybe Bool
-> Maybe Text
-> Text
-> ResourceIdentifier
-> AuditSuppression
AuditSuppression'
    { $sel:expirationDate:AuditSuppression' :: Maybe POSIX
expirationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:suppressIndefinitely:AuditSuppression' :: Maybe Bool
suppressIndefinitely = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:description:AuditSuppression' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:checkName:AuditSuppression' :: Text
checkName = Text
pCheckName_,
      $sel:resourceIdentifier:AuditSuppression' :: ResourceIdentifier
resourceIdentifier = ResourceIdentifier
pResourceIdentifier_
    }

-- | 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 :: (Maybe UTCTime -> f (Maybe UTCTime))
-> AuditSuppression -> f AuditSuppression
auditSuppression_expirationDate = (AuditSuppression -> Maybe POSIX)
-> (AuditSuppression -> Maybe POSIX -> AuditSuppression)
-> Lens
     AuditSuppression AuditSuppression (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> AuditSuppression -> f AuditSuppression)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> AuditSuppression
-> f AuditSuppression
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Indicates whether a suppression should exist indefinitely or not.
auditSuppression_suppressIndefinitely :: Lens.Lens' AuditSuppression (Prelude.Maybe Prelude.Bool)
auditSuppression_suppressIndefinitely :: (Maybe Bool -> f (Maybe Bool))
-> AuditSuppression -> f AuditSuppression
auditSuppression_suppressIndefinitely = (AuditSuppression -> Maybe Bool)
-> (AuditSuppression -> Maybe Bool -> AuditSuppression)
-> Lens AuditSuppression AuditSuppression (Maybe Bool) (Maybe Bool)
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)

-- | The description of the audit suppression.
auditSuppression_description :: Lens.Lens' AuditSuppression (Prelude.Maybe Prelude.Text)
auditSuppression_description :: (Maybe Text -> f (Maybe Text))
-> AuditSuppression -> f AuditSuppression
auditSuppression_description = (AuditSuppression -> Maybe Text)
-> (AuditSuppression -> Maybe Text -> AuditSuppression)
-> Lens AuditSuppression AuditSuppression (Maybe Text) (Maybe Text)
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)

-- | Undocumented member.
auditSuppression_checkName :: Lens.Lens' AuditSuppression Prelude.Text
auditSuppression_checkName :: (Text -> f Text) -> AuditSuppression -> f AuditSuppression
auditSuppression_checkName = (AuditSuppression -> Text)
-> (AuditSuppression -> Text -> AuditSuppression)
-> Lens AuditSuppression AuditSuppression Text Text
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 :: (ResourceIdentifier -> f ResourceIdentifier)
-> AuditSuppression -> f AuditSuppression
auditSuppression_resourceIdentifier = (AuditSuppression -> ResourceIdentifier)
-> (AuditSuppression -> ResourceIdentifier -> AuditSuppression)
-> Lens
     AuditSuppression
     AuditSuppression
     ResourceIdentifier
     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 Core.FromJSON AuditSuppression where
  parseJSON :: Value -> Parser AuditSuppression
parseJSON =
    String
-> (Object -> Parser AuditSuppression)
-> Value
-> Parser AuditSuppression
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AuditSuppression"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Bool
-> Maybe Text
-> Text
-> ResourceIdentifier
-> AuditSuppression
AuditSuppression'
            (Maybe POSIX
 -> Maybe Bool
 -> Maybe Text
 -> Text
 -> ResourceIdentifier
 -> AuditSuppression)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Bool
      -> Maybe Text -> Text -> ResourceIdentifier -> AuditSuppression)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"expirationDate")
            Parser
  (Maybe Bool
   -> Maybe Text -> Text -> ResourceIdentifier -> AuditSuppression)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text -> Text -> ResourceIdentifier -> AuditSuppression)
forall (f :: * -> *) a b. Applicative f => 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
"suppressIndefinitely")
            Parser
  (Maybe Text -> Text -> ResourceIdentifier -> AuditSuppression)
-> Parser (Maybe Text)
-> Parser (Text -> ResourceIdentifier -> AuditSuppression)
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
"description")
            Parser (Text -> ResourceIdentifier -> AuditSuppression)
-> Parser Text -> Parser (ResourceIdentifier -> AuditSuppression)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"checkName")
            Parser (ResourceIdentifier -> AuditSuppression)
-> Parser ResourceIdentifier -> Parser AuditSuppression
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ResourceIdentifier
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"resourceIdentifier")
      )

instance Prelude.Hashable AuditSuppression

instance Prelude.NFData AuditSuppression