{-# 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.SecurityLake.Types.Failures
-- 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.SecurityLake.Types.Failures where

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

-- | List of all failures.
--
-- /See:/ 'newFailures' smart constructor.
data Failures = Failures'
  { -- | List of all exception messages.
    Failures -> Text
exceptionMessage :: Prelude.Text,
    -- | List of all remediation steps for failures.
    Failures -> Text
remediation :: Prelude.Text,
    -- | This error can occur if you configure the wrong timestamp format, or if
    -- the subset of entries used for validation had errors or missing values.
    Failures -> ISO8601
timestamp :: Data.ISO8601
  }
  deriving (Failures -> Failures -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Failures -> Failures -> Bool
$c/= :: Failures -> Failures -> Bool
== :: Failures -> Failures -> Bool
$c== :: Failures -> Failures -> Bool
Prelude.Eq, ReadPrec [Failures]
ReadPrec Failures
Int -> ReadS Failures
ReadS [Failures]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Failures]
$creadListPrec :: ReadPrec [Failures]
readPrec :: ReadPrec Failures
$creadPrec :: ReadPrec Failures
readList :: ReadS [Failures]
$creadList :: ReadS [Failures]
readsPrec :: Int -> ReadS Failures
$creadsPrec :: Int -> ReadS Failures
Prelude.Read, Int -> Failures -> ShowS
[Failures] -> ShowS
Failures -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Failures] -> ShowS
$cshowList :: [Failures] -> ShowS
show :: Failures -> String
$cshow :: Failures -> String
showsPrec :: Int -> Failures -> ShowS
$cshowsPrec :: Int -> Failures -> ShowS
Prelude.Show, forall x. Rep Failures x -> Failures
forall x. Failures -> Rep Failures x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Failures x -> Failures
$cfrom :: forall x. Failures -> Rep Failures x
Prelude.Generic)

-- |
-- Create a value of 'Failures' 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:
--
-- 'exceptionMessage', 'failures_exceptionMessage' - List of all exception messages.
--
-- 'remediation', 'failures_remediation' - List of all remediation steps for failures.
--
-- 'timestamp', 'failures_timestamp' - This error can occur if you configure the wrong timestamp format, or if
-- the subset of entries used for validation had errors or missing values.
newFailures ::
  -- | 'exceptionMessage'
  Prelude.Text ->
  -- | 'remediation'
  Prelude.Text ->
  -- | 'timestamp'
  Prelude.UTCTime ->
  Failures
newFailures :: Text -> Text -> UTCTime -> Failures
newFailures
  Text
pExceptionMessage_
  Text
pRemediation_
  UTCTime
pTimestamp_ =
    Failures'
      { $sel:exceptionMessage:Failures' :: Text
exceptionMessage = Text
pExceptionMessage_,
        $sel:remediation:Failures' :: Text
remediation = Text
pRemediation_,
        $sel:timestamp:Failures' :: ISO8601
timestamp = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pTimestamp_
      }

-- | List of all exception messages.
failures_exceptionMessage :: Lens.Lens' Failures Prelude.Text
failures_exceptionMessage :: Lens' Failures Text
failures_exceptionMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Failures' {Text
exceptionMessage :: Text
$sel:exceptionMessage:Failures' :: Failures -> Text
exceptionMessage} -> Text
exceptionMessage) (\s :: Failures
s@Failures' {} Text
a -> Failures
s {$sel:exceptionMessage:Failures' :: Text
exceptionMessage = Text
a} :: Failures)

-- | List of all remediation steps for failures.
failures_remediation :: Lens.Lens' Failures Prelude.Text
failures_remediation :: Lens' Failures Text
failures_remediation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Failures' {Text
remediation :: Text
$sel:remediation:Failures' :: Failures -> Text
remediation} -> Text
remediation) (\s :: Failures
s@Failures' {} Text
a -> Failures
s {$sel:remediation:Failures' :: Text
remediation = Text
a} :: Failures)

-- | This error can occur if you configure the wrong timestamp format, or if
-- the subset of entries used for validation had errors or missing values.
failures_timestamp :: Lens.Lens' Failures Prelude.UTCTime
failures_timestamp :: Lens' Failures UTCTime
failures_timestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Failures' {ISO8601
timestamp :: ISO8601
$sel:timestamp:Failures' :: Failures -> ISO8601
timestamp} -> ISO8601
timestamp) (\s :: Failures
s@Failures' {} ISO8601
a -> Failures
s {$sel:timestamp:Failures' :: ISO8601
timestamp = ISO8601
a} :: Failures) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON Failures where
  parseJSON :: Value -> Parser Failures
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Failures"
      ( \Object
x ->
          Text -> Text -> ISO8601 -> Failures
Failures'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"exceptionMessage")
            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
"remediation")
            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
"timestamp")
      )

instance Prelude.Hashable Failures where
  hashWithSalt :: Int -> Failures -> Int
hashWithSalt Int
_salt Failures' {Text
ISO8601
timestamp :: ISO8601
remediation :: Text
exceptionMessage :: Text
$sel:timestamp:Failures' :: Failures -> ISO8601
$sel:remediation:Failures' :: Failures -> Text
$sel:exceptionMessage:Failures' :: Failures -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
exceptionMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
remediation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
timestamp

instance Prelude.NFData Failures where
  rnf :: Failures -> ()
rnf Failures' {Text
ISO8601
timestamp :: ISO8601
remediation :: Text
exceptionMessage :: Text
$sel:timestamp:Failures' :: Failures -> ISO8601
$sel:remediation:Failures' :: Failures -> Text
$sel:exceptionMessage:Failures' :: Failures -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
exceptionMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
remediation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
timestamp