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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MacieV2.Types.IsDefinedInJob
import Amazonka.MacieV2.Types.IsMonitoredByJob
import qualified Amazonka.Prelude as Prelude

-- | Specifies whether any one-time or recurring classification jobs are
-- configured to analyze data in an S3 bucket, and, if so, the details of
-- the job that ran most recently.
--
-- /See:/ 'newJobDetails' smart constructor.
data JobDetails = JobDetails'
  { -- | Specifies whether any recurring jobs are configured to analyze data in
    -- the bucket. Possible values are:
    --
    -- -   TRUE - The bucket is explicitly included in the bucket definition
    --     (S3BucketDefinitionForJob) for one or more recurring jobs or the
    --     bucket matches the bucket criteria (S3BucketCriteriaForJob) for one
    --     or more recurring jobs. At least one of those jobs has a status
    --     other than CANCELLED.
    --
    -- -   FALSE - The bucket isn\'t explicitly included in the bucket
    --     definition (S3BucketDefinitionForJob) for any recurring jobs, the
    --     bucket doesn\'t match the bucket criteria (S3BucketCriteriaForJob)
    --     for any recurring jobs, or all the recurring jobs that are
    --     configured to analyze data in the bucket have a status of CANCELLED.
    --
    -- -   UNKNOWN - An exception occurred when Amazon Macie attempted to
    --     retrieve job data for the bucket.
    JobDetails -> Maybe IsMonitoredByJob
isMonitoredByJob :: Prelude.Maybe IsMonitoredByJob,
    -- | Specifies whether any one-time or recurring jobs are configured to
    -- analyze data in the bucket. Possible values are:
    --
    -- -   TRUE - The bucket is explicitly included in the bucket definition
    --     (S3BucketDefinitionForJob) for one or more jobs and at least one of
    --     those jobs has a status other than CANCELLED. Or the bucket matched
    --     the bucket criteria (S3BucketCriteriaForJob) for at least one job
    --     that previously ran.
    --
    -- -   FALSE - The bucket isn\'t explicitly included in the bucket
    --     definition (S3BucketDefinitionForJob) for any jobs, all the jobs
    --     that explicitly include the bucket in their bucket definitions have
    --     a status of CANCELLED, or the bucket didn\'t match the bucket
    --     criteria (S3BucketCriteriaForJob) for any jobs that previously ran.
    --
    -- -   UNKNOWN - An exception occurred when Amazon Macie attempted to
    --     retrieve job data for the bucket.
    JobDetails -> Maybe IsDefinedInJob
isDefinedInJob :: Prelude.Maybe IsDefinedInJob,
    -- | The unique identifier for the job that ran most recently and is
    -- configured to analyze data in the bucket, either the latest run of a
    -- recurring job or the only run of a one-time job.
    --
    -- This value is typically null if the value for the isDefinedInJob
    -- property is FALSE or UNKNOWN.
    JobDetails -> Maybe Text
lastJobId :: Prelude.Maybe Prelude.Text,
    -- | The date and time, in UTC and extended ISO 8601 format, when the job
    -- (lastJobId) started. If the job is a recurring job, this value indicates
    -- when the most recent run started.
    --
    -- This value is typically null if the value for the isDefinedInJob
    -- property is FALSE or UNKNOWN.
    JobDetails -> Maybe POSIX
lastJobRunTime :: Prelude.Maybe Core.POSIX
  }
  deriving (JobDetails -> JobDetails -> Bool
(JobDetails -> JobDetails -> Bool)
-> (JobDetails -> JobDetails -> Bool) -> Eq JobDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobDetails -> JobDetails -> Bool
$c/= :: JobDetails -> JobDetails -> Bool
== :: JobDetails -> JobDetails -> Bool
$c== :: JobDetails -> JobDetails -> Bool
Prelude.Eq, ReadPrec [JobDetails]
ReadPrec JobDetails
Int -> ReadS JobDetails
ReadS [JobDetails]
(Int -> ReadS JobDetails)
-> ReadS [JobDetails]
-> ReadPrec JobDetails
-> ReadPrec [JobDetails]
-> Read JobDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobDetails]
$creadListPrec :: ReadPrec [JobDetails]
readPrec :: ReadPrec JobDetails
$creadPrec :: ReadPrec JobDetails
readList :: ReadS [JobDetails]
$creadList :: ReadS [JobDetails]
readsPrec :: Int -> ReadS JobDetails
$creadsPrec :: Int -> ReadS JobDetails
Prelude.Read, Int -> JobDetails -> ShowS
[JobDetails] -> ShowS
JobDetails -> String
(Int -> JobDetails -> ShowS)
-> (JobDetails -> String)
-> ([JobDetails] -> ShowS)
-> Show JobDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobDetails] -> ShowS
$cshowList :: [JobDetails] -> ShowS
show :: JobDetails -> String
$cshow :: JobDetails -> String
showsPrec :: Int -> JobDetails -> ShowS
$cshowsPrec :: Int -> JobDetails -> ShowS
Prelude.Show, (forall x. JobDetails -> Rep JobDetails x)
-> (forall x. Rep JobDetails x -> JobDetails) -> Generic JobDetails
forall x. Rep JobDetails x -> JobDetails
forall x. JobDetails -> Rep JobDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JobDetails x -> JobDetails
$cfrom :: forall x. JobDetails -> Rep JobDetails x
Prelude.Generic)

-- |
-- Create a value of 'JobDetails' 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:
--
-- 'isMonitoredByJob', 'jobDetails_isMonitoredByJob' - Specifies whether any recurring jobs are configured to analyze data in
-- the bucket. Possible values are:
--
-- -   TRUE - The bucket is explicitly included in the bucket definition
--     (S3BucketDefinitionForJob) for one or more recurring jobs or the
--     bucket matches the bucket criteria (S3BucketCriteriaForJob) for one
--     or more recurring jobs. At least one of those jobs has a status
--     other than CANCELLED.
--
-- -   FALSE - The bucket isn\'t explicitly included in the bucket
--     definition (S3BucketDefinitionForJob) for any recurring jobs, the
--     bucket doesn\'t match the bucket criteria (S3BucketCriteriaForJob)
--     for any recurring jobs, or all the recurring jobs that are
--     configured to analyze data in the bucket have a status of CANCELLED.
--
-- -   UNKNOWN - An exception occurred when Amazon Macie attempted to
--     retrieve job data for the bucket.
--
-- 'isDefinedInJob', 'jobDetails_isDefinedInJob' - Specifies whether any one-time or recurring jobs are configured to
-- analyze data in the bucket. Possible values are:
--
-- -   TRUE - The bucket is explicitly included in the bucket definition
--     (S3BucketDefinitionForJob) for one or more jobs and at least one of
--     those jobs has a status other than CANCELLED. Or the bucket matched
--     the bucket criteria (S3BucketCriteriaForJob) for at least one job
--     that previously ran.
--
-- -   FALSE - The bucket isn\'t explicitly included in the bucket
--     definition (S3BucketDefinitionForJob) for any jobs, all the jobs
--     that explicitly include the bucket in their bucket definitions have
--     a status of CANCELLED, or the bucket didn\'t match the bucket
--     criteria (S3BucketCriteriaForJob) for any jobs that previously ran.
--
-- -   UNKNOWN - An exception occurred when Amazon Macie attempted to
--     retrieve job data for the bucket.
--
-- 'lastJobId', 'jobDetails_lastJobId' - The unique identifier for the job that ran most recently and is
-- configured to analyze data in the bucket, either the latest run of a
-- recurring job or the only run of a one-time job.
--
-- This value is typically null if the value for the isDefinedInJob
-- property is FALSE or UNKNOWN.
--
-- 'lastJobRunTime', 'jobDetails_lastJobRunTime' - The date and time, in UTC and extended ISO 8601 format, when the job
-- (lastJobId) started. If the job is a recurring job, this value indicates
-- when the most recent run started.
--
-- This value is typically null if the value for the isDefinedInJob
-- property is FALSE or UNKNOWN.
newJobDetails ::
  JobDetails
newJobDetails :: JobDetails
newJobDetails =
  JobDetails' :: Maybe IsMonitoredByJob
-> Maybe IsDefinedInJob -> Maybe Text -> Maybe POSIX -> JobDetails
JobDetails'
    { $sel:isMonitoredByJob:JobDetails' :: Maybe IsMonitoredByJob
isMonitoredByJob = Maybe IsMonitoredByJob
forall a. Maybe a
Prelude.Nothing,
      $sel:isDefinedInJob:JobDetails' :: Maybe IsDefinedInJob
isDefinedInJob = Maybe IsDefinedInJob
forall a. Maybe a
Prelude.Nothing,
      $sel:lastJobId:JobDetails' :: Maybe Text
lastJobId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastJobRunTime:JobDetails' :: Maybe POSIX
lastJobRunTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies whether any recurring jobs are configured to analyze data in
-- the bucket. Possible values are:
--
-- -   TRUE - The bucket is explicitly included in the bucket definition
--     (S3BucketDefinitionForJob) for one or more recurring jobs or the
--     bucket matches the bucket criteria (S3BucketCriteriaForJob) for one
--     or more recurring jobs. At least one of those jobs has a status
--     other than CANCELLED.
--
-- -   FALSE - The bucket isn\'t explicitly included in the bucket
--     definition (S3BucketDefinitionForJob) for any recurring jobs, the
--     bucket doesn\'t match the bucket criteria (S3BucketCriteriaForJob)
--     for any recurring jobs, or all the recurring jobs that are
--     configured to analyze data in the bucket have a status of CANCELLED.
--
-- -   UNKNOWN - An exception occurred when Amazon Macie attempted to
--     retrieve job data for the bucket.
jobDetails_isMonitoredByJob :: Lens.Lens' JobDetails (Prelude.Maybe IsMonitoredByJob)
jobDetails_isMonitoredByJob :: (Maybe IsMonitoredByJob -> f (Maybe IsMonitoredByJob))
-> JobDetails -> f JobDetails
jobDetails_isMonitoredByJob = (JobDetails -> Maybe IsMonitoredByJob)
-> (JobDetails -> Maybe IsMonitoredByJob -> JobDetails)
-> Lens
     JobDetails
     JobDetails
     (Maybe IsMonitoredByJob)
     (Maybe IsMonitoredByJob)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDetails' {Maybe IsMonitoredByJob
isMonitoredByJob :: Maybe IsMonitoredByJob
$sel:isMonitoredByJob:JobDetails' :: JobDetails -> Maybe IsMonitoredByJob
isMonitoredByJob} -> Maybe IsMonitoredByJob
isMonitoredByJob) (\s :: JobDetails
s@JobDetails' {} Maybe IsMonitoredByJob
a -> JobDetails
s {$sel:isMonitoredByJob:JobDetails' :: Maybe IsMonitoredByJob
isMonitoredByJob = Maybe IsMonitoredByJob
a} :: JobDetails)

-- | Specifies whether any one-time or recurring jobs are configured to
-- analyze data in the bucket. Possible values are:
--
-- -   TRUE - The bucket is explicitly included in the bucket definition
--     (S3BucketDefinitionForJob) for one or more jobs and at least one of
--     those jobs has a status other than CANCELLED. Or the bucket matched
--     the bucket criteria (S3BucketCriteriaForJob) for at least one job
--     that previously ran.
--
-- -   FALSE - The bucket isn\'t explicitly included in the bucket
--     definition (S3BucketDefinitionForJob) for any jobs, all the jobs
--     that explicitly include the bucket in their bucket definitions have
--     a status of CANCELLED, or the bucket didn\'t match the bucket
--     criteria (S3BucketCriteriaForJob) for any jobs that previously ran.
--
-- -   UNKNOWN - An exception occurred when Amazon Macie attempted to
--     retrieve job data for the bucket.
jobDetails_isDefinedInJob :: Lens.Lens' JobDetails (Prelude.Maybe IsDefinedInJob)
jobDetails_isDefinedInJob :: (Maybe IsDefinedInJob -> f (Maybe IsDefinedInJob))
-> JobDetails -> f JobDetails
jobDetails_isDefinedInJob = (JobDetails -> Maybe IsDefinedInJob)
-> (JobDetails -> Maybe IsDefinedInJob -> JobDetails)
-> Lens
     JobDetails JobDetails (Maybe IsDefinedInJob) (Maybe IsDefinedInJob)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDetails' {Maybe IsDefinedInJob
isDefinedInJob :: Maybe IsDefinedInJob
$sel:isDefinedInJob:JobDetails' :: JobDetails -> Maybe IsDefinedInJob
isDefinedInJob} -> Maybe IsDefinedInJob
isDefinedInJob) (\s :: JobDetails
s@JobDetails' {} Maybe IsDefinedInJob
a -> JobDetails
s {$sel:isDefinedInJob:JobDetails' :: Maybe IsDefinedInJob
isDefinedInJob = Maybe IsDefinedInJob
a} :: JobDetails)

-- | The unique identifier for the job that ran most recently and is
-- configured to analyze data in the bucket, either the latest run of a
-- recurring job or the only run of a one-time job.
--
-- This value is typically null if the value for the isDefinedInJob
-- property is FALSE or UNKNOWN.
jobDetails_lastJobId :: Lens.Lens' JobDetails (Prelude.Maybe Prelude.Text)
jobDetails_lastJobId :: (Maybe Text -> f (Maybe Text)) -> JobDetails -> f JobDetails
jobDetails_lastJobId = (JobDetails -> Maybe Text)
-> (JobDetails -> Maybe Text -> JobDetails)
-> Lens JobDetails JobDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDetails' {Maybe Text
lastJobId :: Maybe Text
$sel:lastJobId:JobDetails' :: JobDetails -> Maybe Text
lastJobId} -> Maybe Text
lastJobId) (\s :: JobDetails
s@JobDetails' {} Maybe Text
a -> JobDetails
s {$sel:lastJobId:JobDetails' :: Maybe Text
lastJobId = Maybe Text
a} :: JobDetails)

-- | The date and time, in UTC and extended ISO 8601 format, when the job
-- (lastJobId) started. If the job is a recurring job, this value indicates
-- when the most recent run started.
--
-- This value is typically null if the value for the isDefinedInJob
-- property is FALSE or UNKNOWN.
jobDetails_lastJobRunTime :: Lens.Lens' JobDetails (Prelude.Maybe Prelude.UTCTime)
jobDetails_lastJobRunTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> JobDetails -> f JobDetails
jobDetails_lastJobRunTime = (JobDetails -> Maybe POSIX)
-> (JobDetails -> Maybe POSIX -> JobDetails)
-> Lens JobDetails JobDetails (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobDetails' {Maybe POSIX
lastJobRunTime :: Maybe POSIX
$sel:lastJobRunTime:JobDetails' :: JobDetails -> Maybe POSIX
lastJobRunTime} -> Maybe POSIX
lastJobRunTime) (\s :: JobDetails
s@JobDetails' {} Maybe POSIX
a -> JobDetails
s {$sel:lastJobRunTime:JobDetails' :: Maybe POSIX
lastJobRunTime = Maybe POSIX
a} :: JobDetails) ((Maybe POSIX -> f (Maybe POSIX)) -> JobDetails -> f JobDetails)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> JobDetails
-> f JobDetails
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

instance Core.FromJSON JobDetails where
  parseJSON :: Value -> Parser JobDetails
parseJSON =
    String
-> (Object -> Parser JobDetails) -> Value -> Parser JobDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"JobDetails"
      ( \Object
x ->
          Maybe IsMonitoredByJob
-> Maybe IsDefinedInJob -> Maybe Text -> Maybe POSIX -> JobDetails
JobDetails'
            (Maybe IsMonitoredByJob
 -> Maybe IsDefinedInJob -> Maybe Text -> Maybe POSIX -> JobDetails)
-> Parser (Maybe IsMonitoredByJob)
-> Parser
     (Maybe IsDefinedInJob -> Maybe Text -> Maybe POSIX -> JobDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe IsMonitoredByJob)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"isMonitoredByJob")
            Parser
  (Maybe IsDefinedInJob -> Maybe Text -> Maybe POSIX -> JobDetails)
-> Parser (Maybe IsDefinedInJob)
-> Parser (Maybe Text -> Maybe POSIX -> JobDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe IsDefinedInJob)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"isDefinedInJob")
            Parser (Maybe Text -> Maybe POSIX -> JobDetails)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> JobDetails)
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
"lastJobId")
            Parser (Maybe POSIX -> JobDetails)
-> Parser (Maybe POSIX) -> Parser JobDetails
forall (f :: * -> *) a b. Applicative f => 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
"lastJobRunTime")
      )

instance Prelude.Hashable JobDetails

instance Prelude.NFData JobDetails