{-# 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.WorkMail.Types.MailboxExportJob
-- 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.WorkMail.Types.MailboxExportJob 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
import Amazonka.WorkMail.Types.MailboxExportJobState

-- | The details of a mailbox export job, including the user or resource ID
-- associated with the mailbox and the S3 bucket that the mailbox contents
-- are exported to.
--
-- /See:/ 'newMailboxExportJob' smart constructor.
data MailboxExportJob = MailboxExportJob'
  { -- | The mailbox export job description.
    MailboxExportJob -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The mailbox export job end timestamp.
    MailboxExportJob -> Maybe POSIX
endTime :: Prelude.Maybe Data.POSIX,
    -- | The identifier of the user or resource associated with the mailbox.
    MailboxExportJob -> Maybe Text
entityId :: Prelude.Maybe Prelude.Text,
    -- | The estimated progress of the mailbox export job, in percentage points.
    MailboxExportJob -> Maybe Natural
estimatedProgress :: Prelude.Maybe Prelude.Natural,
    -- | The identifier of the mailbox export job.
    MailboxExportJob -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | The name of the S3 bucket.
    MailboxExportJob -> Maybe Text
s3BucketName :: Prelude.Maybe Prelude.Text,
    -- | The path to the S3 bucket and file that the mailbox export job exports
    -- to.
    MailboxExportJob -> Maybe Text
s3Path :: Prelude.Maybe Prelude.Text,
    -- | The mailbox export job start timestamp.
    MailboxExportJob -> Maybe POSIX
startTime :: Prelude.Maybe Data.POSIX,
    -- | The state of the mailbox export job.
    MailboxExportJob -> Maybe MailboxExportJobState
state :: Prelude.Maybe MailboxExportJobState
  }
  deriving (MailboxExportJob -> MailboxExportJob -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MailboxExportJob -> MailboxExportJob -> Bool
$c/= :: MailboxExportJob -> MailboxExportJob -> Bool
== :: MailboxExportJob -> MailboxExportJob -> Bool
$c== :: MailboxExportJob -> MailboxExportJob -> Bool
Prelude.Eq, ReadPrec [MailboxExportJob]
ReadPrec MailboxExportJob
Int -> ReadS MailboxExportJob
ReadS [MailboxExportJob]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MailboxExportJob]
$creadListPrec :: ReadPrec [MailboxExportJob]
readPrec :: ReadPrec MailboxExportJob
$creadPrec :: ReadPrec MailboxExportJob
readList :: ReadS [MailboxExportJob]
$creadList :: ReadS [MailboxExportJob]
readsPrec :: Int -> ReadS MailboxExportJob
$creadsPrec :: Int -> ReadS MailboxExportJob
Prelude.Read, Int -> MailboxExportJob -> ShowS
[MailboxExportJob] -> ShowS
MailboxExportJob -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MailboxExportJob] -> ShowS
$cshowList :: [MailboxExportJob] -> ShowS
show :: MailboxExportJob -> String
$cshow :: MailboxExportJob -> String
showsPrec :: Int -> MailboxExportJob -> ShowS
$cshowsPrec :: Int -> MailboxExportJob -> ShowS
Prelude.Show, forall x. Rep MailboxExportJob x -> MailboxExportJob
forall x. MailboxExportJob -> Rep MailboxExportJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MailboxExportJob x -> MailboxExportJob
$cfrom :: forall x. MailboxExportJob -> Rep MailboxExportJob x
Prelude.Generic)

-- |
-- Create a value of 'MailboxExportJob' 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:
--
-- 'description', 'mailboxExportJob_description' - The mailbox export job description.
--
-- 'endTime', 'mailboxExportJob_endTime' - The mailbox export job end timestamp.
--
-- 'entityId', 'mailboxExportJob_entityId' - The identifier of the user or resource associated with the mailbox.
--
-- 'estimatedProgress', 'mailboxExportJob_estimatedProgress' - The estimated progress of the mailbox export job, in percentage points.
--
-- 'jobId', 'mailboxExportJob_jobId' - The identifier of the mailbox export job.
--
-- 's3BucketName', 'mailboxExportJob_s3BucketName' - The name of the S3 bucket.
--
-- 's3Path', 'mailboxExportJob_s3Path' - The path to the S3 bucket and file that the mailbox export job exports
-- to.
--
-- 'startTime', 'mailboxExportJob_startTime' - The mailbox export job start timestamp.
--
-- 'state', 'mailboxExportJob_state' - The state of the mailbox export job.
newMailboxExportJob ::
  MailboxExportJob
newMailboxExportJob :: MailboxExportJob
newMailboxExportJob =
  MailboxExportJob'
    { $sel:description:MailboxExportJob' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:MailboxExportJob' :: Maybe POSIX
endTime = forall a. Maybe a
Prelude.Nothing,
      $sel:entityId:MailboxExportJob' :: Maybe Text
entityId = forall a. Maybe a
Prelude.Nothing,
      $sel:estimatedProgress:MailboxExportJob' :: Maybe Natural
estimatedProgress = forall a. Maybe a
Prelude.Nothing,
      $sel:jobId:MailboxExportJob' :: Maybe Text
jobId = forall a. Maybe a
Prelude.Nothing,
      $sel:s3BucketName:MailboxExportJob' :: Maybe Text
s3BucketName = forall a. Maybe a
Prelude.Nothing,
      $sel:s3Path:MailboxExportJob' :: Maybe Text
s3Path = forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:MailboxExportJob' :: Maybe POSIX
startTime = forall a. Maybe a
Prelude.Nothing,
      $sel:state:MailboxExportJob' :: Maybe MailboxExportJobState
state = forall a. Maybe a
Prelude.Nothing
    }

-- | The mailbox export job description.
mailboxExportJob_description :: Lens.Lens' MailboxExportJob (Prelude.Maybe Prelude.Text)
mailboxExportJob_description :: Lens' MailboxExportJob (Maybe Text)
mailboxExportJob_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MailboxExportJob' {Maybe Text
description :: Maybe Text
$sel:description:MailboxExportJob' :: MailboxExportJob -> Maybe Text
description} -> Maybe Text
description) (\s :: MailboxExportJob
s@MailboxExportJob' {} Maybe Text
a -> MailboxExportJob
s {$sel:description:MailboxExportJob' :: Maybe Text
description = Maybe Text
a} :: MailboxExportJob)

-- | The mailbox export job end timestamp.
mailboxExportJob_endTime :: Lens.Lens' MailboxExportJob (Prelude.Maybe Prelude.UTCTime)
mailboxExportJob_endTime :: Lens' MailboxExportJob (Maybe UTCTime)
mailboxExportJob_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MailboxExportJob' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:MailboxExportJob' :: MailboxExportJob -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: MailboxExportJob
s@MailboxExportJob' {} Maybe POSIX
a -> MailboxExportJob
s {$sel:endTime:MailboxExportJob' :: Maybe POSIX
endTime = Maybe POSIX
a} :: MailboxExportJob) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The identifier of the user or resource associated with the mailbox.
mailboxExportJob_entityId :: Lens.Lens' MailboxExportJob (Prelude.Maybe Prelude.Text)
mailboxExportJob_entityId :: Lens' MailboxExportJob (Maybe Text)
mailboxExportJob_entityId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MailboxExportJob' {Maybe Text
entityId :: Maybe Text
$sel:entityId:MailboxExportJob' :: MailboxExportJob -> Maybe Text
entityId} -> Maybe Text
entityId) (\s :: MailboxExportJob
s@MailboxExportJob' {} Maybe Text
a -> MailboxExportJob
s {$sel:entityId:MailboxExportJob' :: Maybe Text
entityId = Maybe Text
a} :: MailboxExportJob)

-- | The estimated progress of the mailbox export job, in percentage points.
mailboxExportJob_estimatedProgress :: Lens.Lens' MailboxExportJob (Prelude.Maybe Prelude.Natural)
mailboxExportJob_estimatedProgress :: Lens' MailboxExportJob (Maybe Natural)
mailboxExportJob_estimatedProgress = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MailboxExportJob' {Maybe Natural
estimatedProgress :: Maybe Natural
$sel:estimatedProgress:MailboxExportJob' :: MailboxExportJob -> Maybe Natural
estimatedProgress} -> Maybe Natural
estimatedProgress) (\s :: MailboxExportJob
s@MailboxExportJob' {} Maybe Natural
a -> MailboxExportJob
s {$sel:estimatedProgress:MailboxExportJob' :: Maybe Natural
estimatedProgress = Maybe Natural
a} :: MailboxExportJob)

-- | The identifier of the mailbox export job.
mailboxExportJob_jobId :: Lens.Lens' MailboxExportJob (Prelude.Maybe Prelude.Text)
mailboxExportJob_jobId :: Lens' MailboxExportJob (Maybe Text)
mailboxExportJob_jobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MailboxExportJob' {Maybe Text
jobId :: Maybe Text
$sel:jobId:MailboxExportJob' :: MailboxExportJob -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: MailboxExportJob
s@MailboxExportJob' {} Maybe Text
a -> MailboxExportJob
s {$sel:jobId:MailboxExportJob' :: Maybe Text
jobId = Maybe Text
a} :: MailboxExportJob)

-- | The name of the S3 bucket.
mailboxExportJob_s3BucketName :: Lens.Lens' MailboxExportJob (Prelude.Maybe Prelude.Text)
mailboxExportJob_s3BucketName :: Lens' MailboxExportJob (Maybe Text)
mailboxExportJob_s3BucketName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MailboxExportJob' {Maybe Text
s3BucketName :: Maybe Text
$sel:s3BucketName:MailboxExportJob' :: MailboxExportJob -> Maybe Text
s3BucketName} -> Maybe Text
s3BucketName) (\s :: MailboxExportJob
s@MailboxExportJob' {} Maybe Text
a -> MailboxExportJob
s {$sel:s3BucketName:MailboxExportJob' :: Maybe Text
s3BucketName = Maybe Text
a} :: MailboxExportJob)

-- | The path to the S3 bucket and file that the mailbox export job exports
-- to.
mailboxExportJob_s3Path :: Lens.Lens' MailboxExportJob (Prelude.Maybe Prelude.Text)
mailboxExportJob_s3Path :: Lens' MailboxExportJob (Maybe Text)
mailboxExportJob_s3Path = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MailboxExportJob' {Maybe Text
s3Path :: Maybe Text
$sel:s3Path:MailboxExportJob' :: MailboxExportJob -> Maybe Text
s3Path} -> Maybe Text
s3Path) (\s :: MailboxExportJob
s@MailboxExportJob' {} Maybe Text
a -> MailboxExportJob
s {$sel:s3Path:MailboxExportJob' :: Maybe Text
s3Path = Maybe Text
a} :: MailboxExportJob)

-- | The mailbox export job start timestamp.
mailboxExportJob_startTime :: Lens.Lens' MailboxExportJob (Prelude.Maybe Prelude.UTCTime)
mailboxExportJob_startTime :: Lens' MailboxExportJob (Maybe UTCTime)
mailboxExportJob_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MailboxExportJob' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:MailboxExportJob' :: MailboxExportJob -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: MailboxExportJob
s@MailboxExportJob' {} Maybe POSIX
a -> MailboxExportJob
s {$sel:startTime:MailboxExportJob' :: Maybe POSIX
startTime = Maybe POSIX
a} :: MailboxExportJob) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The state of the mailbox export job.
mailboxExportJob_state :: Lens.Lens' MailboxExportJob (Prelude.Maybe MailboxExportJobState)
mailboxExportJob_state :: Lens' MailboxExportJob (Maybe MailboxExportJobState)
mailboxExportJob_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MailboxExportJob' {Maybe MailboxExportJobState
state :: Maybe MailboxExportJobState
$sel:state:MailboxExportJob' :: MailboxExportJob -> Maybe MailboxExportJobState
state} -> Maybe MailboxExportJobState
state) (\s :: MailboxExportJob
s@MailboxExportJob' {} Maybe MailboxExportJobState
a -> MailboxExportJob
s {$sel:state:MailboxExportJob' :: Maybe MailboxExportJobState
state = Maybe MailboxExportJobState
a} :: MailboxExportJob)

instance Data.FromJSON MailboxExportJob where
  parseJSON :: Value -> Parser MailboxExportJob
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MailboxExportJob"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe MailboxExportJobState
-> MailboxExportJob
MailboxExportJob'
            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
"Description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EndTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EntityId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EstimatedProgress")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"JobId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"S3BucketName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"S3Path")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StartTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"State")
      )

instance Prelude.Hashable MailboxExportJob where
  hashWithSalt :: Int -> MailboxExportJob -> Int
hashWithSalt Int
_salt MailboxExportJob' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe MailboxExportJobState
state :: Maybe MailboxExportJobState
startTime :: Maybe POSIX
s3Path :: Maybe Text
s3BucketName :: Maybe Text
jobId :: Maybe Text
estimatedProgress :: Maybe Natural
entityId :: Maybe Text
endTime :: Maybe POSIX
description :: Maybe Text
$sel:state:MailboxExportJob' :: MailboxExportJob -> Maybe MailboxExportJobState
$sel:startTime:MailboxExportJob' :: MailboxExportJob -> Maybe POSIX
$sel:s3Path:MailboxExportJob' :: MailboxExportJob -> Maybe Text
$sel:s3BucketName:MailboxExportJob' :: MailboxExportJob -> Maybe Text
$sel:jobId:MailboxExportJob' :: MailboxExportJob -> Maybe Text
$sel:estimatedProgress:MailboxExportJob' :: MailboxExportJob -> Maybe Natural
$sel:entityId:MailboxExportJob' :: MailboxExportJob -> Maybe Text
$sel:endTime:MailboxExportJob' :: MailboxExportJob -> Maybe POSIX
$sel:description:MailboxExportJob' :: MailboxExportJob -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
endTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
entityId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
estimatedProgress
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
jobId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3BucketName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3Path
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
startTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MailboxExportJobState
state

instance Prelude.NFData MailboxExportJob where
  rnf :: MailboxExportJob -> ()
rnf MailboxExportJob' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe MailboxExportJobState
state :: Maybe MailboxExportJobState
startTime :: Maybe POSIX
s3Path :: Maybe Text
s3BucketName :: Maybe Text
jobId :: Maybe Text
estimatedProgress :: Maybe Natural
entityId :: Maybe Text
endTime :: Maybe POSIX
description :: Maybe Text
$sel:state:MailboxExportJob' :: MailboxExportJob -> Maybe MailboxExportJobState
$sel:startTime:MailboxExportJob' :: MailboxExportJob -> Maybe POSIX
$sel:s3Path:MailboxExportJob' :: MailboxExportJob -> Maybe Text
$sel:s3BucketName:MailboxExportJob' :: MailboxExportJob -> Maybe Text
$sel:jobId:MailboxExportJob' :: MailboxExportJob -> Maybe Text
$sel:estimatedProgress:MailboxExportJob' :: MailboxExportJob -> Maybe Natural
$sel:entityId:MailboxExportJob' :: MailboxExportJob -> Maybe Text
$sel:endTime:MailboxExportJob' :: MailboxExportJob -> Maybe POSIX
$sel:description:MailboxExportJob' :: MailboxExportJob -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
endTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
entityId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
estimatedProgress
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
jobId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3BucketName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3Path
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
startTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MailboxExportJobState
state