{-# 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.Discovery.Types.ExportInfo
-- 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.Discovery.Types.ExportInfo where

import qualified Amazonka.Core as Core
import Amazonka.Discovery.Types.ExportStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information regarding the export status of discovered data. The value is
-- an array of objects.
--
-- /See:/ 'newExportInfo' smart constructor.
data ExportInfo = ExportInfo'
  { -- | A URL for an Amazon S3 bucket where you can review the exported data.
    -- The URL is displayed only if the export succeeded.
    ExportInfo -> Maybe Text
configurationsDownloadUrl :: Prelude.Maybe Prelude.Text,
    -- | The value of @startTime@ parameter in the @StartExportTask@ request. If
    -- no @startTime@ was requested, this result does not appear in
    -- @ExportInfo@.
    ExportInfo -> Maybe POSIX
requestedStartTime :: Prelude.Maybe Core.POSIX,
    -- | The @endTime@ used in the @StartExportTask@ request. If no @endTime@ was
    -- requested, this result does not appear in @ExportInfo@.
    ExportInfo -> Maybe POSIX
requestedEndTime :: Prelude.Maybe Core.POSIX,
    -- | If true, the export of agent information exceeded the size limit for a
    -- single export and the exported data is incomplete for the requested time
    -- range. To address this, select a smaller time range for the export by
    -- using @startDate@ and @endDate@.
    ExportInfo -> Maybe Bool
isTruncated :: Prelude.Maybe Prelude.Bool,
    -- | A unique identifier used to query an export.
    ExportInfo -> Text
exportId :: Prelude.Text,
    -- | The status of the data export job.
    ExportInfo -> ExportStatus
exportStatus :: ExportStatus,
    -- | A status message provided for API callers.
    ExportInfo -> Text
statusMessage :: Prelude.Text,
    -- | The time that the data export was initiated.
    ExportInfo -> POSIX
exportRequestTime :: Core.POSIX
  }
  deriving (ExportInfo -> ExportInfo -> Bool
(ExportInfo -> ExportInfo -> Bool)
-> (ExportInfo -> ExportInfo -> Bool) -> Eq ExportInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportInfo -> ExportInfo -> Bool
$c/= :: ExportInfo -> ExportInfo -> Bool
== :: ExportInfo -> ExportInfo -> Bool
$c== :: ExportInfo -> ExportInfo -> Bool
Prelude.Eq, ReadPrec [ExportInfo]
ReadPrec ExportInfo
Int -> ReadS ExportInfo
ReadS [ExportInfo]
(Int -> ReadS ExportInfo)
-> ReadS [ExportInfo]
-> ReadPrec ExportInfo
-> ReadPrec [ExportInfo]
-> Read ExportInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExportInfo]
$creadListPrec :: ReadPrec [ExportInfo]
readPrec :: ReadPrec ExportInfo
$creadPrec :: ReadPrec ExportInfo
readList :: ReadS [ExportInfo]
$creadList :: ReadS [ExportInfo]
readsPrec :: Int -> ReadS ExportInfo
$creadsPrec :: Int -> ReadS ExportInfo
Prelude.Read, Int -> ExportInfo -> ShowS
[ExportInfo] -> ShowS
ExportInfo -> String
(Int -> ExportInfo -> ShowS)
-> (ExportInfo -> String)
-> ([ExportInfo] -> ShowS)
-> Show ExportInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExportInfo] -> ShowS
$cshowList :: [ExportInfo] -> ShowS
show :: ExportInfo -> String
$cshow :: ExportInfo -> String
showsPrec :: Int -> ExportInfo -> ShowS
$cshowsPrec :: Int -> ExportInfo -> ShowS
Prelude.Show, (forall x. ExportInfo -> Rep ExportInfo x)
-> (forall x. Rep ExportInfo x -> ExportInfo) -> Generic ExportInfo
forall x. Rep ExportInfo x -> ExportInfo
forall x. ExportInfo -> Rep ExportInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExportInfo x -> ExportInfo
$cfrom :: forall x. ExportInfo -> Rep ExportInfo x
Prelude.Generic)

-- |
-- Create a value of 'ExportInfo' 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:
--
-- 'configurationsDownloadUrl', 'exportInfo_configurationsDownloadUrl' - A URL for an Amazon S3 bucket where you can review the exported data.
-- The URL is displayed only if the export succeeded.
--
-- 'requestedStartTime', 'exportInfo_requestedStartTime' - The value of @startTime@ parameter in the @StartExportTask@ request. If
-- no @startTime@ was requested, this result does not appear in
-- @ExportInfo@.
--
-- 'requestedEndTime', 'exportInfo_requestedEndTime' - The @endTime@ used in the @StartExportTask@ request. If no @endTime@ was
-- requested, this result does not appear in @ExportInfo@.
--
-- 'isTruncated', 'exportInfo_isTruncated' - If true, the export of agent information exceeded the size limit for a
-- single export and the exported data is incomplete for the requested time
-- range. To address this, select a smaller time range for the export by
-- using @startDate@ and @endDate@.
--
-- 'exportId', 'exportInfo_exportId' - A unique identifier used to query an export.
--
-- 'exportStatus', 'exportInfo_exportStatus' - The status of the data export job.
--
-- 'statusMessage', 'exportInfo_statusMessage' - A status message provided for API callers.
--
-- 'exportRequestTime', 'exportInfo_exportRequestTime' - The time that the data export was initiated.
newExportInfo ::
  -- | 'exportId'
  Prelude.Text ->
  -- | 'exportStatus'
  ExportStatus ->
  -- | 'statusMessage'
  Prelude.Text ->
  -- | 'exportRequestTime'
  Prelude.UTCTime ->
  ExportInfo
newExportInfo :: Text -> ExportStatus -> Text -> UTCTime -> ExportInfo
newExportInfo
  Text
pExportId_
  ExportStatus
pExportStatus_
  Text
pStatusMessage_
  UTCTime
pExportRequestTime_ =
    ExportInfo' :: Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Bool
-> Text
-> ExportStatus
-> Text
-> POSIX
-> ExportInfo
ExportInfo'
      { $sel:configurationsDownloadUrl:ExportInfo' :: Maybe Text
configurationsDownloadUrl =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:requestedStartTime:ExportInfo' :: Maybe POSIX
requestedStartTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:requestedEndTime:ExportInfo' :: Maybe POSIX
requestedEndTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:isTruncated:ExportInfo' :: Maybe Bool
isTruncated = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:exportId:ExportInfo' :: Text
exportId = Text
pExportId_,
        $sel:exportStatus:ExportInfo' :: ExportStatus
exportStatus = ExportStatus
pExportStatus_,
        $sel:statusMessage:ExportInfo' :: Text
statusMessage = Text
pStatusMessage_,
        $sel:exportRequestTime:ExportInfo' :: POSIX
exportRequestTime =
          Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pExportRequestTime_
      }

-- | A URL for an Amazon S3 bucket where you can review the exported data.
-- The URL is displayed only if the export succeeded.
exportInfo_configurationsDownloadUrl :: Lens.Lens' ExportInfo (Prelude.Maybe Prelude.Text)
exportInfo_configurationsDownloadUrl :: (Maybe Text -> f (Maybe Text)) -> ExportInfo -> f ExportInfo
exportInfo_configurationsDownloadUrl = (ExportInfo -> Maybe Text)
-> (ExportInfo -> Maybe Text -> ExportInfo)
-> Lens ExportInfo ExportInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportInfo' {Maybe Text
configurationsDownloadUrl :: Maybe Text
$sel:configurationsDownloadUrl:ExportInfo' :: ExportInfo -> Maybe Text
configurationsDownloadUrl} -> Maybe Text
configurationsDownloadUrl) (\s :: ExportInfo
s@ExportInfo' {} Maybe Text
a -> ExportInfo
s {$sel:configurationsDownloadUrl:ExportInfo' :: Maybe Text
configurationsDownloadUrl = Maybe Text
a} :: ExportInfo)

-- | The value of @startTime@ parameter in the @StartExportTask@ request. If
-- no @startTime@ was requested, this result does not appear in
-- @ExportInfo@.
exportInfo_requestedStartTime :: Lens.Lens' ExportInfo (Prelude.Maybe Prelude.UTCTime)
exportInfo_requestedStartTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> ExportInfo -> f ExportInfo
exportInfo_requestedStartTime = (ExportInfo -> Maybe POSIX)
-> (ExportInfo -> Maybe POSIX -> ExportInfo)
-> Lens ExportInfo ExportInfo (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportInfo' {Maybe POSIX
requestedStartTime :: Maybe POSIX
$sel:requestedStartTime:ExportInfo' :: ExportInfo -> Maybe POSIX
requestedStartTime} -> Maybe POSIX
requestedStartTime) (\s :: ExportInfo
s@ExportInfo' {} Maybe POSIX
a -> ExportInfo
s {$sel:requestedStartTime:ExportInfo' :: Maybe POSIX
requestedStartTime = Maybe POSIX
a} :: ExportInfo) ((Maybe POSIX -> f (Maybe POSIX)) -> ExportInfo -> f ExportInfo)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ExportInfo
-> f ExportInfo
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 @endTime@ used in the @StartExportTask@ request. If no @endTime@ was
-- requested, this result does not appear in @ExportInfo@.
exportInfo_requestedEndTime :: Lens.Lens' ExportInfo (Prelude.Maybe Prelude.UTCTime)
exportInfo_requestedEndTime :: (Maybe UTCTime -> f (Maybe UTCTime)) -> ExportInfo -> f ExportInfo
exportInfo_requestedEndTime = (ExportInfo -> Maybe POSIX)
-> (ExportInfo -> Maybe POSIX -> ExportInfo)
-> Lens ExportInfo ExportInfo (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportInfo' {Maybe POSIX
requestedEndTime :: Maybe POSIX
$sel:requestedEndTime:ExportInfo' :: ExportInfo -> Maybe POSIX
requestedEndTime} -> Maybe POSIX
requestedEndTime) (\s :: ExportInfo
s@ExportInfo' {} Maybe POSIX
a -> ExportInfo
s {$sel:requestedEndTime:ExportInfo' :: Maybe POSIX
requestedEndTime = Maybe POSIX
a} :: ExportInfo) ((Maybe POSIX -> f (Maybe POSIX)) -> ExportInfo -> f ExportInfo)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ExportInfo
-> f ExportInfo
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

-- | If true, the export of agent information exceeded the size limit for a
-- single export and the exported data is incomplete for the requested time
-- range. To address this, select a smaller time range for the export by
-- using @startDate@ and @endDate@.
exportInfo_isTruncated :: Lens.Lens' ExportInfo (Prelude.Maybe Prelude.Bool)
exportInfo_isTruncated :: (Maybe Bool -> f (Maybe Bool)) -> ExportInfo -> f ExportInfo
exportInfo_isTruncated = (ExportInfo -> Maybe Bool)
-> (ExportInfo -> Maybe Bool -> ExportInfo)
-> Lens ExportInfo ExportInfo (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportInfo' {Maybe Bool
isTruncated :: Maybe Bool
$sel:isTruncated:ExportInfo' :: ExportInfo -> Maybe Bool
isTruncated} -> Maybe Bool
isTruncated) (\s :: ExportInfo
s@ExportInfo' {} Maybe Bool
a -> ExportInfo
s {$sel:isTruncated:ExportInfo' :: Maybe Bool
isTruncated = Maybe Bool
a} :: ExportInfo)

-- | A unique identifier used to query an export.
exportInfo_exportId :: Lens.Lens' ExportInfo Prelude.Text
exportInfo_exportId :: (Text -> f Text) -> ExportInfo -> f ExportInfo
exportInfo_exportId = (ExportInfo -> Text)
-> (ExportInfo -> Text -> ExportInfo)
-> Lens ExportInfo ExportInfo Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportInfo' {Text
exportId :: Text
$sel:exportId:ExportInfo' :: ExportInfo -> Text
exportId} -> Text
exportId) (\s :: ExportInfo
s@ExportInfo' {} Text
a -> ExportInfo
s {$sel:exportId:ExportInfo' :: Text
exportId = Text
a} :: ExportInfo)

-- | The status of the data export job.
exportInfo_exportStatus :: Lens.Lens' ExportInfo ExportStatus
exportInfo_exportStatus :: (ExportStatus -> f ExportStatus) -> ExportInfo -> f ExportInfo
exportInfo_exportStatus = (ExportInfo -> ExportStatus)
-> (ExportInfo -> ExportStatus -> ExportInfo)
-> Lens ExportInfo ExportInfo ExportStatus ExportStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportInfo' {ExportStatus
exportStatus :: ExportStatus
$sel:exportStatus:ExportInfo' :: ExportInfo -> ExportStatus
exportStatus} -> ExportStatus
exportStatus) (\s :: ExportInfo
s@ExportInfo' {} ExportStatus
a -> ExportInfo
s {$sel:exportStatus:ExportInfo' :: ExportStatus
exportStatus = ExportStatus
a} :: ExportInfo)

-- | A status message provided for API callers.
exportInfo_statusMessage :: Lens.Lens' ExportInfo Prelude.Text
exportInfo_statusMessage :: (Text -> f Text) -> ExportInfo -> f ExportInfo
exportInfo_statusMessage = (ExportInfo -> Text)
-> (ExportInfo -> Text -> ExportInfo)
-> Lens ExportInfo ExportInfo Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportInfo' {Text
statusMessage :: Text
$sel:statusMessage:ExportInfo' :: ExportInfo -> Text
statusMessage} -> Text
statusMessage) (\s :: ExportInfo
s@ExportInfo' {} Text
a -> ExportInfo
s {$sel:statusMessage:ExportInfo' :: Text
statusMessage = Text
a} :: ExportInfo)

-- | The time that the data export was initiated.
exportInfo_exportRequestTime :: Lens.Lens' ExportInfo Prelude.UTCTime
exportInfo_exportRequestTime :: (UTCTime -> f UTCTime) -> ExportInfo -> f ExportInfo
exportInfo_exportRequestTime = (ExportInfo -> POSIX)
-> (ExportInfo -> POSIX -> ExportInfo)
-> Lens ExportInfo ExportInfo POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportInfo' {POSIX
exportRequestTime :: POSIX
$sel:exportRequestTime:ExportInfo' :: ExportInfo -> POSIX
exportRequestTime} -> POSIX
exportRequestTime) (\s :: ExportInfo
s@ExportInfo' {} POSIX
a -> ExportInfo
s {$sel:exportRequestTime:ExportInfo' :: POSIX
exportRequestTime = POSIX
a} :: ExportInfo) ((POSIX -> f POSIX) -> ExportInfo -> f ExportInfo)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ExportInfo
-> f ExportInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON ExportInfo where
  parseJSON :: Value -> Parser ExportInfo
parseJSON =
    String
-> (Object -> Parser ExportInfo) -> Value -> Parser ExportInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ExportInfo"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Bool
-> Text
-> ExportStatus
-> Text
-> POSIX
-> ExportInfo
ExportInfo'
            (Maybe Text
 -> Maybe POSIX
 -> Maybe POSIX
 -> Maybe Bool
 -> Text
 -> ExportStatus
 -> Text
 -> POSIX
 -> ExportInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe POSIX
      -> Maybe Bool
      -> Text
      -> ExportStatus
      -> Text
      -> POSIX
      -> ExportInfo)
forall (f :: * -> *) a b. Functor 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
"configurationsDownloadUrl")
            Parser
  (Maybe POSIX
   -> Maybe POSIX
   -> Maybe Bool
   -> Text
   -> ExportStatus
   -> Text
   -> POSIX
   -> ExportInfo)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX
      -> Maybe Bool
      -> Text
      -> ExportStatus
      -> Text
      -> POSIX
      -> ExportInfo)
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
"requestedStartTime")
            Parser
  (Maybe POSIX
   -> Maybe Bool
   -> Text
   -> ExportStatus
   -> Text
   -> POSIX
   -> ExportInfo)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Bool -> Text -> ExportStatus -> Text -> POSIX -> ExportInfo)
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
"requestedEndTime")
            Parser
  (Maybe Bool -> Text -> ExportStatus -> Text -> POSIX -> ExportInfo)
-> Parser (Maybe Bool)
-> Parser (Text -> ExportStatus -> Text -> POSIX -> ExportInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"isTruncated")
            Parser (Text -> ExportStatus -> Text -> POSIX -> ExportInfo)
-> Parser Text
-> Parser (ExportStatus -> Text -> POSIX -> ExportInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"exportId")
            Parser (ExportStatus -> Text -> POSIX -> ExportInfo)
-> Parser ExportStatus -> Parser (Text -> POSIX -> ExportInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ExportStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"exportStatus")
            Parser (Text -> POSIX -> ExportInfo)
-> Parser Text -> Parser (POSIX -> ExportInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"statusMessage")
            Parser (POSIX -> ExportInfo) -> Parser POSIX -> Parser ExportInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"exportRequestTime")
      )

instance Prelude.Hashable ExportInfo

instance Prelude.NFData ExportInfo