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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(LastRunErrorStatus -> LastRunErrorStatus -> Bool)
-> (LastRunErrorStatus -> LastRunErrorStatus -> Bool)
-> Eq LastRunErrorStatus
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]
(Int -> ReadS LastRunErrorStatus)
-> ReadS [LastRunErrorStatus]
-> ReadPrec LastRunErrorStatus
-> ReadPrec [LastRunErrorStatus]
-> Read 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
(Int -> LastRunErrorStatus -> ShowS)
-> (LastRunErrorStatus -> String)
-> ([LastRunErrorStatus] -> ShowS)
-> Show LastRunErrorStatus
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. LastRunErrorStatus -> Rep LastRunErrorStatus x)
-> (forall x. Rep LastRunErrorStatus x -> LastRunErrorStatus)
-> Generic LastRunErrorStatus
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' :: Maybe LastRunErrorStatusCode -> LastRunErrorStatus
LastRunErrorStatus' {$sel:code:LastRunErrorStatus' :: Maybe LastRunErrorStatusCode
code = Maybe LastRunErrorStatusCode
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 :: (Maybe LastRunErrorStatusCode -> f (Maybe LastRunErrorStatusCode))
-> LastRunErrorStatus -> f LastRunErrorStatus
lastRunErrorStatus_code = (LastRunErrorStatus -> Maybe LastRunErrorStatusCode)
-> (LastRunErrorStatus
    -> Maybe LastRunErrorStatusCode -> LastRunErrorStatus)
-> Lens
     LastRunErrorStatus
     LastRunErrorStatus
     (Maybe LastRunErrorStatusCode)
     (Maybe LastRunErrorStatusCode)
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 Core.FromJSON LastRunErrorStatus where
  parseJSON :: Value -> Parser LastRunErrorStatus
parseJSON =
    String
-> (Object -> Parser LastRunErrorStatus)
-> Value
-> Parser LastRunErrorStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LastRunErrorStatus"
      ( \Object
x ->
          Maybe LastRunErrorStatusCode -> LastRunErrorStatus
LastRunErrorStatus' (Maybe LastRunErrorStatusCode -> LastRunErrorStatus)
-> Parser (Maybe LastRunErrorStatusCode)
-> Parser LastRunErrorStatus
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe LastRunErrorStatusCode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"code")
      )

instance Prelude.Hashable LastRunErrorStatus

instance Prelude.NFData LastRunErrorStatus