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

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

-- | Provides information about when a classification job was paused. For a
-- one-time job, this object also specifies when the job will expire and be
-- cancelled if it isn\'t resumed. For a recurring job, this object also
-- specifies when the paused job run will expire and be cancelled if it
-- isn\'t resumed. This object is present only if a job\'s current status
-- (jobStatus) is USER_PAUSED. The information in this object applies only
-- to a job that was paused while it had a status of RUNNING.
--
-- /See:/ 'newUserPausedDetails' smart constructor.
data UserPausedDetails = UserPausedDetails'
  { -- | The date and time, in UTC and extended ISO 8601 format, when the job or
    -- job run will expire and be cancelled if you don\'t resume it first.
    UserPausedDetails -> Maybe POSIX
jobExpiresAt :: Prelude.Maybe Core.POSIX,
    -- | The Amazon Resource Name (ARN) of the Health event that Amazon Macie
    -- sent to notify you of the job or job run\'s pending expiration and
    -- cancellation. This value is null if a job has been paused for less than
    -- 23 days.
    UserPausedDetails -> Maybe Text
jobImminentExpirationHealthEventArn :: Prelude.Maybe Prelude.Text,
    -- | The date and time, in UTC and extended ISO 8601 format, when you paused
    -- the job.
    UserPausedDetails -> Maybe POSIX
jobPausedAt :: Prelude.Maybe Core.POSIX
  }
  deriving (UserPausedDetails -> UserPausedDetails -> Bool
(UserPausedDetails -> UserPausedDetails -> Bool)
-> (UserPausedDetails -> UserPausedDetails -> Bool)
-> Eq UserPausedDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UserPausedDetails -> UserPausedDetails -> Bool
$c/= :: UserPausedDetails -> UserPausedDetails -> Bool
== :: UserPausedDetails -> UserPausedDetails -> Bool
$c== :: UserPausedDetails -> UserPausedDetails -> Bool
Prelude.Eq, ReadPrec [UserPausedDetails]
ReadPrec UserPausedDetails
Int -> ReadS UserPausedDetails
ReadS [UserPausedDetails]
(Int -> ReadS UserPausedDetails)
-> ReadS [UserPausedDetails]
-> ReadPrec UserPausedDetails
-> ReadPrec [UserPausedDetails]
-> Read UserPausedDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UserPausedDetails]
$creadListPrec :: ReadPrec [UserPausedDetails]
readPrec :: ReadPrec UserPausedDetails
$creadPrec :: ReadPrec UserPausedDetails
readList :: ReadS [UserPausedDetails]
$creadList :: ReadS [UserPausedDetails]
readsPrec :: Int -> ReadS UserPausedDetails
$creadsPrec :: Int -> ReadS UserPausedDetails
Prelude.Read, Int -> UserPausedDetails -> ShowS
[UserPausedDetails] -> ShowS
UserPausedDetails -> String
(Int -> UserPausedDetails -> ShowS)
-> (UserPausedDetails -> String)
-> ([UserPausedDetails] -> ShowS)
-> Show UserPausedDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UserPausedDetails] -> ShowS
$cshowList :: [UserPausedDetails] -> ShowS
show :: UserPausedDetails -> String
$cshow :: UserPausedDetails -> String
showsPrec :: Int -> UserPausedDetails -> ShowS
$cshowsPrec :: Int -> UserPausedDetails -> ShowS
Prelude.Show, (forall x. UserPausedDetails -> Rep UserPausedDetails x)
-> (forall x. Rep UserPausedDetails x -> UserPausedDetails)
-> Generic UserPausedDetails
forall x. Rep UserPausedDetails x -> UserPausedDetails
forall x. UserPausedDetails -> Rep UserPausedDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UserPausedDetails x -> UserPausedDetails
$cfrom :: forall x. UserPausedDetails -> Rep UserPausedDetails x
Prelude.Generic)

-- |
-- Create a value of 'UserPausedDetails' 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:
--
-- 'jobExpiresAt', 'userPausedDetails_jobExpiresAt' - The date and time, in UTC and extended ISO 8601 format, when the job or
-- job run will expire and be cancelled if you don\'t resume it first.
--
-- 'jobImminentExpirationHealthEventArn', 'userPausedDetails_jobImminentExpirationHealthEventArn' - The Amazon Resource Name (ARN) of the Health event that Amazon Macie
-- sent to notify you of the job or job run\'s pending expiration and
-- cancellation. This value is null if a job has been paused for less than
-- 23 days.
--
-- 'jobPausedAt', 'userPausedDetails_jobPausedAt' - The date and time, in UTC and extended ISO 8601 format, when you paused
-- the job.
newUserPausedDetails ::
  UserPausedDetails
newUserPausedDetails :: UserPausedDetails
newUserPausedDetails =
  UserPausedDetails' :: Maybe POSIX -> Maybe Text -> Maybe POSIX -> UserPausedDetails
UserPausedDetails'
    { $sel:jobExpiresAt:UserPausedDetails' :: Maybe POSIX
jobExpiresAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:jobImminentExpirationHealthEventArn:UserPausedDetails' :: Maybe Text
jobImminentExpirationHealthEventArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobPausedAt:UserPausedDetails' :: Maybe POSIX
jobPausedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time, in UTC and extended ISO 8601 format, when the job or
-- job run will expire and be cancelled if you don\'t resume it first.
userPausedDetails_jobExpiresAt :: Lens.Lens' UserPausedDetails (Prelude.Maybe Prelude.UTCTime)
userPausedDetails_jobExpiresAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> UserPausedDetails -> f UserPausedDetails
userPausedDetails_jobExpiresAt = (UserPausedDetails -> Maybe POSIX)
-> (UserPausedDetails -> Maybe POSIX -> UserPausedDetails)
-> Lens
     UserPausedDetails UserPausedDetails (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserPausedDetails' {Maybe POSIX
jobExpiresAt :: Maybe POSIX
$sel:jobExpiresAt:UserPausedDetails' :: UserPausedDetails -> Maybe POSIX
jobExpiresAt} -> Maybe POSIX
jobExpiresAt) (\s :: UserPausedDetails
s@UserPausedDetails' {} Maybe POSIX
a -> UserPausedDetails
s {$sel:jobExpiresAt:UserPausedDetails' :: Maybe POSIX
jobExpiresAt = Maybe POSIX
a} :: UserPausedDetails) ((Maybe POSIX -> f (Maybe POSIX))
 -> UserPausedDetails -> f UserPausedDetails)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> UserPausedDetails
-> f UserPausedDetails
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

-- | The Amazon Resource Name (ARN) of the Health event that Amazon Macie
-- sent to notify you of the job or job run\'s pending expiration and
-- cancellation. This value is null if a job has been paused for less than
-- 23 days.
userPausedDetails_jobImminentExpirationHealthEventArn :: Lens.Lens' UserPausedDetails (Prelude.Maybe Prelude.Text)
userPausedDetails_jobImminentExpirationHealthEventArn :: (Maybe Text -> f (Maybe Text))
-> UserPausedDetails -> f UserPausedDetails
userPausedDetails_jobImminentExpirationHealthEventArn = (UserPausedDetails -> Maybe Text)
-> (UserPausedDetails -> Maybe Text -> UserPausedDetails)
-> Lens
     UserPausedDetails UserPausedDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserPausedDetails' {Maybe Text
jobImminentExpirationHealthEventArn :: Maybe Text
$sel:jobImminentExpirationHealthEventArn:UserPausedDetails' :: UserPausedDetails -> Maybe Text
jobImminentExpirationHealthEventArn} -> Maybe Text
jobImminentExpirationHealthEventArn) (\s :: UserPausedDetails
s@UserPausedDetails' {} Maybe Text
a -> UserPausedDetails
s {$sel:jobImminentExpirationHealthEventArn:UserPausedDetails' :: Maybe Text
jobImminentExpirationHealthEventArn = Maybe Text
a} :: UserPausedDetails)

-- | The date and time, in UTC and extended ISO 8601 format, when you paused
-- the job.
userPausedDetails_jobPausedAt :: Lens.Lens' UserPausedDetails (Prelude.Maybe Prelude.UTCTime)
userPausedDetails_jobPausedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> UserPausedDetails -> f UserPausedDetails
userPausedDetails_jobPausedAt = (UserPausedDetails -> Maybe POSIX)
-> (UserPausedDetails -> Maybe POSIX -> UserPausedDetails)
-> Lens
     UserPausedDetails UserPausedDetails (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UserPausedDetails' {Maybe POSIX
jobPausedAt :: Maybe POSIX
$sel:jobPausedAt:UserPausedDetails' :: UserPausedDetails -> Maybe POSIX
jobPausedAt} -> Maybe POSIX
jobPausedAt) (\s :: UserPausedDetails
s@UserPausedDetails' {} Maybe POSIX
a -> UserPausedDetails
s {$sel:jobPausedAt:UserPausedDetails' :: Maybe POSIX
jobPausedAt = Maybe POSIX
a} :: UserPausedDetails) ((Maybe POSIX -> f (Maybe POSIX))
 -> UserPausedDetails -> f UserPausedDetails)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> UserPausedDetails
-> f UserPausedDetails
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 UserPausedDetails where
  parseJSON :: Value -> Parser UserPausedDetails
parseJSON =
    String
-> (Object -> Parser UserPausedDetails)
-> Value
-> Parser UserPausedDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"UserPausedDetails"
      ( \Object
x ->
          Maybe POSIX -> Maybe Text -> Maybe POSIX -> UserPausedDetails
UserPausedDetails'
            (Maybe POSIX -> Maybe Text -> Maybe POSIX -> UserPausedDetails)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe POSIX -> UserPausedDetails)
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
"jobExpiresAt")
            Parser (Maybe Text -> Maybe POSIX -> UserPausedDetails)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> UserPausedDetails)
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
"jobImminentExpirationHealthEventArn")
            Parser (Maybe POSIX -> UserPausedDetails)
-> Parser (Maybe POSIX) -> Parser UserPausedDetails
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
"jobPausedAt")
      )

instance Prelude.Hashable UserPausedDetails

instance Prelude.NFData UserPausedDetails