{-# 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.MacieV2.Types.LastRunErrorStatus
-- 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.MacieV2.Types.LastRunErrorStatus where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MacieV2.Types.LastRunErrorStatusCode
import qualified Amazonka.Prelude as Prelude

-- | Specifies whether any account- or bucket-level access errors occurred
-- when a classification job ran. For information about using logging data
-- to investigate these errors, see
-- <https://docs.aws.amazon.com/macie/latest/user/discovery-jobs-monitor-cw-logs.html Monitoring sensitive data discovery jobs>
-- in the /Amazon Macie User Guide/.
--
-- /See:/ 'newLastRunErrorStatus' smart constructor.
data LastRunErrorStatus = LastRunErrorStatus'
  { -- | Specifies whether any account- or bucket-level access errors occurred
    -- when the job ran. For a recurring job, this value indicates the error
    -- status of the job\'s most recent run. Possible values are:
    --
    -- -   ERROR - One or more errors occurred. Amazon Macie didn\'t process
    --     all the data specified for the job.
    --
    -- -   NONE - No errors occurred. Macie processed all the data specified
    --     for the job.
    LastRunErrorStatus -> Maybe LastRunErrorStatusCode
code :: Prelude.Maybe LastRunErrorStatusCode
  }
  deriving (LastRunErrorStatus -> LastRunErrorStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LastRunErrorStatus -> LastRunErrorStatus -> Bool
$c/= :: LastRunErrorStatus -> LastRunErrorStatus -> Bool
== :: LastRunErrorStatus -> LastRunErrorStatus -> Bool
$c== :: LastRunErrorStatus -> LastRunErrorStatus -> Bool
Prelude.Eq, ReadPrec [LastRunErrorStatus]
ReadPrec LastRunErrorStatus
Int -> ReadS LastRunErrorStatus
ReadS [LastRunErrorStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LastRunErrorStatus]
$creadListPrec :: ReadPrec [LastRunErrorStatus]
readPrec :: ReadPrec LastRunErrorStatus
$creadPrec :: ReadPrec LastRunErrorStatus
readList :: ReadS [LastRunErrorStatus]
$creadList :: ReadS [LastRunErrorStatus]
readsPrec :: Int -> ReadS LastRunErrorStatus
$creadsPrec :: Int -> ReadS LastRunErrorStatus
Prelude.Read, Int -> LastRunErrorStatus -> ShowS
[LastRunErrorStatus] -> ShowS
LastRunErrorStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LastRunErrorStatus] -> ShowS
$cshowList :: [LastRunErrorStatus] -> ShowS
show :: LastRunErrorStatus -> String
$cshow :: LastRunErrorStatus -> String
showsPrec :: Int -> LastRunErrorStatus -> ShowS
$cshowsPrec :: Int -> LastRunErrorStatus -> ShowS
Prelude.Show, forall x. Rep LastRunErrorStatus x -> LastRunErrorStatus
forall x. LastRunErrorStatus -> Rep LastRunErrorStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LastRunErrorStatus x -> LastRunErrorStatus
$cfrom :: forall x. LastRunErrorStatus -> Rep LastRunErrorStatus x
Prelude.Generic)

-- |
-- Create a value of 'LastRunErrorStatus' 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:
--
-- 'code', 'lastRunErrorStatus_code' - Specifies whether any account- or bucket-level access errors occurred
-- when the job ran. For a recurring job, this value indicates the error
-- status of the job\'s most recent run. Possible values are:
--
-- -   ERROR - One or more errors occurred. Amazon Macie didn\'t process
--     all the data specified for the job.
--
-- -   NONE - No errors occurred. Macie processed all the data specified
--     for the job.
newLastRunErrorStatus ::
  LastRunErrorStatus
newLastRunErrorStatus :: LastRunErrorStatus
newLastRunErrorStatus =
  LastRunErrorStatus' {$sel:code:LastRunErrorStatus' :: Maybe LastRunErrorStatusCode
code = forall a. Maybe a
Prelude.Nothing}

-- | Specifies whether any account- or bucket-level access errors occurred
-- when the job ran. For a recurring job, this value indicates the error
-- status of the job\'s most recent run. Possible values are:
--
-- -   ERROR - One or more errors occurred. Amazon Macie didn\'t process
--     all the data specified for the job.
--
-- -   NONE - No errors occurred. Macie processed all the data specified
--     for the job.
lastRunErrorStatus_code :: Lens.Lens' LastRunErrorStatus (Prelude.Maybe LastRunErrorStatusCode)
lastRunErrorStatus_code :: Lens' LastRunErrorStatus (Maybe LastRunErrorStatusCode)
lastRunErrorStatus_code = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastRunErrorStatus' {Maybe LastRunErrorStatusCode
code :: Maybe LastRunErrorStatusCode
$sel:code:LastRunErrorStatus' :: LastRunErrorStatus -> Maybe LastRunErrorStatusCode
code} -> Maybe LastRunErrorStatusCode
code) (\s :: LastRunErrorStatus
s@LastRunErrorStatus' {} Maybe LastRunErrorStatusCode
a -> LastRunErrorStatus
s {$sel:code:LastRunErrorStatus' :: Maybe LastRunErrorStatusCode
code = Maybe LastRunErrorStatusCode
a} :: LastRunErrorStatus)

instance Data.FromJSON LastRunErrorStatus where
  parseJSON :: Value -> Parser LastRunErrorStatus
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LastRunErrorStatus"
      ( \Object
x ->
          Maybe LastRunErrorStatusCode -> LastRunErrorStatus
LastRunErrorStatus' 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
"code")
      )

instance Prelude.Hashable LastRunErrorStatus where
  hashWithSalt :: Int -> LastRunErrorStatus -> Int
hashWithSalt Int
_salt LastRunErrorStatus' {Maybe LastRunErrorStatusCode
code :: Maybe LastRunErrorStatusCode
$sel:code:LastRunErrorStatus' :: LastRunErrorStatus -> Maybe LastRunErrorStatusCode
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LastRunErrorStatusCode
code

instance Prelude.NFData LastRunErrorStatus where
  rnf :: LastRunErrorStatus -> ()
rnf LastRunErrorStatus' {Maybe LastRunErrorStatusCode
code :: Maybe LastRunErrorStatusCode
$sel:code:LastRunErrorStatus' :: LastRunErrorStatus -> Maybe LastRunErrorStatusCode
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe LastRunErrorStatusCode
code