{-# 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.CloudWatchLogs.Types.ExportTask
-- 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.CloudWatchLogs.Types.ExportTask where

import Amazonka.CloudWatchLogs.Types.ExportTaskExecutionInfo
import Amazonka.CloudWatchLogs.Types.ExportTaskStatus
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

-- | Represents an export task.
--
-- /See:/ 'newExportTask' smart constructor.
data ExportTask = ExportTask'
  { -- | The name of the S3 bucket to which the log data was exported.
    ExportTask -> Maybe Text
destination :: Prelude.Maybe Prelude.Text,
    -- | The prefix that was used as the start of Amazon S3 key for every object
    -- exported.
    ExportTask -> Maybe Text
destinationPrefix :: Prelude.Maybe Prelude.Text,
    -- | Execution information about the export task.
    ExportTask -> Maybe ExportTaskExecutionInfo
executionInfo :: Prelude.Maybe ExportTaskExecutionInfo,
    -- | The start time, expressed as the number of milliseconds after
    -- @Jan 1, 1970 00:00:00 UTC@. Events with a timestamp before this time are
    -- not exported.
    ExportTask -> Maybe Natural
from :: Prelude.Maybe Prelude.Natural,
    -- | The name of the log group from which logs data was exported.
    ExportTask -> Maybe Text
logGroupName :: Prelude.Maybe Prelude.Text,
    -- | The status of the export task.
    ExportTask -> Maybe ExportTaskStatus
status :: Prelude.Maybe ExportTaskStatus,
    -- | The ID of the export task.
    ExportTask -> Maybe Text
taskId :: Prelude.Maybe Prelude.Text,
    -- | The name of the export task.
    ExportTask -> Maybe Text
taskName :: Prelude.Maybe Prelude.Text,
    -- | The end time, expressed as the number of milliseconds after
    -- @Jan 1, 1970 00:00:00 UTC@. Events with a timestamp later than this time
    -- are not exported.
    ExportTask -> Maybe Natural
to :: Prelude.Maybe Prelude.Natural
  }
  deriving (ExportTask -> ExportTask -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExportTask -> ExportTask -> Bool
$c/= :: ExportTask -> ExportTask -> Bool
== :: ExportTask -> ExportTask -> Bool
$c== :: ExportTask -> ExportTask -> Bool
Prelude.Eq, ReadPrec [ExportTask]
ReadPrec ExportTask
Int -> ReadS ExportTask
ReadS [ExportTask]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExportTask]
$creadListPrec :: ReadPrec [ExportTask]
readPrec :: ReadPrec ExportTask
$creadPrec :: ReadPrec ExportTask
readList :: ReadS [ExportTask]
$creadList :: ReadS [ExportTask]
readsPrec :: Int -> ReadS ExportTask
$creadsPrec :: Int -> ReadS ExportTask
Prelude.Read, Int -> ExportTask -> ShowS
[ExportTask] -> ShowS
ExportTask -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExportTask] -> ShowS
$cshowList :: [ExportTask] -> ShowS
show :: ExportTask -> String
$cshow :: ExportTask -> String
showsPrec :: Int -> ExportTask -> ShowS
$cshowsPrec :: Int -> ExportTask -> ShowS
Prelude.Show, forall x. Rep ExportTask x -> ExportTask
forall x. ExportTask -> Rep ExportTask x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExportTask x -> ExportTask
$cfrom :: forall x. ExportTask -> Rep ExportTask x
Prelude.Generic)

-- |
-- Create a value of 'ExportTask' 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:
--
-- 'destination', 'exportTask_destination' - The name of the S3 bucket to which the log data was exported.
--
-- 'destinationPrefix', 'exportTask_destinationPrefix' - The prefix that was used as the start of Amazon S3 key for every object
-- exported.
--
-- 'executionInfo', 'exportTask_executionInfo' - Execution information about the export task.
--
-- 'from', 'exportTask_from' - The start time, expressed as the number of milliseconds after
-- @Jan 1, 1970 00:00:00 UTC@. Events with a timestamp before this time are
-- not exported.
--
-- 'logGroupName', 'exportTask_logGroupName' - The name of the log group from which logs data was exported.
--
-- 'status', 'exportTask_status' - The status of the export task.
--
-- 'taskId', 'exportTask_taskId' - The ID of the export task.
--
-- 'taskName', 'exportTask_taskName' - The name of the export task.
--
-- 'to', 'exportTask_to' - The end time, expressed as the number of milliseconds after
-- @Jan 1, 1970 00:00:00 UTC@. Events with a timestamp later than this time
-- are not exported.
newExportTask ::
  ExportTask
newExportTask :: ExportTask
newExportTask =
  ExportTask'
    { $sel:destination:ExportTask' :: Maybe Text
destination = forall a. Maybe a
Prelude.Nothing,
      $sel:destinationPrefix:ExportTask' :: Maybe Text
destinationPrefix = forall a. Maybe a
Prelude.Nothing,
      $sel:executionInfo:ExportTask' :: Maybe ExportTaskExecutionInfo
executionInfo = forall a. Maybe a
Prelude.Nothing,
      $sel:from:ExportTask' :: Maybe Natural
from = forall a. Maybe a
Prelude.Nothing,
      $sel:logGroupName:ExportTask' :: Maybe Text
logGroupName = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ExportTask' :: Maybe ExportTaskStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:taskId:ExportTask' :: Maybe Text
taskId = forall a. Maybe a
Prelude.Nothing,
      $sel:taskName:ExportTask' :: Maybe Text
taskName = forall a. Maybe a
Prelude.Nothing,
      $sel:to:ExportTask' :: Maybe Natural
to = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the S3 bucket to which the log data was exported.
exportTask_destination :: Lens.Lens' ExportTask (Prelude.Maybe Prelude.Text)
exportTask_destination :: Lens' ExportTask (Maybe Text)
exportTask_destination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportTask' {Maybe Text
destination :: Maybe Text
$sel:destination:ExportTask' :: ExportTask -> Maybe Text
destination} -> Maybe Text
destination) (\s :: ExportTask
s@ExportTask' {} Maybe Text
a -> ExportTask
s {$sel:destination:ExportTask' :: Maybe Text
destination = Maybe Text
a} :: ExportTask)

-- | The prefix that was used as the start of Amazon S3 key for every object
-- exported.
exportTask_destinationPrefix :: Lens.Lens' ExportTask (Prelude.Maybe Prelude.Text)
exportTask_destinationPrefix :: Lens' ExportTask (Maybe Text)
exportTask_destinationPrefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportTask' {Maybe Text
destinationPrefix :: Maybe Text
$sel:destinationPrefix:ExportTask' :: ExportTask -> Maybe Text
destinationPrefix} -> Maybe Text
destinationPrefix) (\s :: ExportTask
s@ExportTask' {} Maybe Text
a -> ExportTask
s {$sel:destinationPrefix:ExportTask' :: Maybe Text
destinationPrefix = Maybe Text
a} :: ExportTask)

-- | Execution information about the export task.
exportTask_executionInfo :: Lens.Lens' ExportTask (Prelude.Maybe ExportTaskExecutionInfo)
exportTask_executionInfo :: Lens' ExportTask (Maybe ExportTaskExecutionInfo)
exportTask_executionInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportTask' {Maybe ExportTaskExecutionInfo
executionInfo :: Maybe ExportTaskExecutionInfo
$sel:executionInfo:ExportTask' :: ExportTask -> Maybe ExportTaskExecutionInfo
executionInfo} -> Maybe ExportTaskExecutionInfo
executionInfo) (\s :: ExportTask
s@ExportTask' {} Maybe ExportTaskExecutionInfo
a -> ExportTask
s {$sel:executionInfo:ExportTask' :: Maybe ExportTaskExecutionInfo
executionInfo = Maybe ExportTaskExecutionInfo
a} :: ExportTask)

-- | The start time, expressed as the number of milliseconds after
-- @Jan 1, 1970 00:00:00 UTC@. Events with a timestamp before this time are
-- not exported.
exportTask_from :: Lens.Lens' ExportTask (Prelude.Maybe Prelude.Natural)
exportTask_from :: Lens' ExportTask (Maybe Natural)
exportTask_from = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportTask' {Maybe Natural
from :: Maybe Natural
$sel:from:ExportTask' :: ExportTask -> Maybe Natural
from} -> Maybe Natural
from) (\s :: ExportTask
s@ExportTask' {} Maybe Natural
a -> ExportTask
s {$sel:from:ExportTask' :: Maybe Natural
from = Maybe Natural
a} :: ExportTask)

-- | The name of the log group from which logs data was exported.
exportTask_logGroupName :: Lens.Lens' ExportTask (Prelude.Maybe Prelude.Text)
exportTask_logGroupName :: Lens' ExportTask (Maybe Text)
exportTask_logGroupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportTask' {Maybe Text
logGroupName :: Maybe Text
$sel:logGroupName:ExportTask' :: ExportTask -> Maybe Text
logGroupName} -> Maybe Text
logGroupName) (\s :: ExportTask
s@ExportTask' {} Maybe Text
a -> ExportTask
s {$sel:logGroupName:ExportTask' :: Maybe Text
logGroupName = Maybe Text
a} :: ExportTask)

-- | The status of the export task.
exportTask_status :: Lens.Lens' ExportTask (Prelude.Maybe ExportTaskStatus)
exportTask_status :: Lens' ExportTask (Maybe ExportTaskStatus)
exportTask_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportTask' {Maybe ExportTaskStatus
status :: Maybe ExportTaskStatus
$sel:status:ExportTask' :: ExportTask -> Maybe ExportTaskStatus
status} -> Maybe ExportTaskStatus
status) (\s :: ExportTask
s@ExportTask' {} Maybe ExportTaskStatus
a -> ExportTask
s {$sel:status:ExportTask' :: Maybe ExportTaskStatus
status = Maybe ExportTaskStatus
a} :: ExportTask)

-- | The ID of the export task.
exportTask_taskId :: Lens.Lens' ExportTask (Prelude.Maybe Prelude.Text)
exportTask_taskId :: Lens' ExportTask (Maybe Text)
exportTask_taskId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportTask' {Maybe Text
taskId :: Maybe Text
$sel:taskId:ExportTask' :: ExportTask -> Maybe Text
taskId} -> Maybe Text
taskId) (\s :: ExportTask
s@ExportTask' {} Maybe Text
a -> ExportTask
s {$sel:taskId:ExportTask' :: Maybe Text
taskId = Maybe Text
a} :: ExportTask)

-- | The name of the export task.
exportTask_taskName :: Lens.Lens' ExportTask (Prelude.Maybe Prelude.Text)
exportTask_taskName :: Lens' ExportTask (Maybe Text)
exportTask_taskName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportTask' {Maybe Text
taskName :: Maybe Text
$sel:taskName:ExportTask' :: ExportTask -> Maybe Text
taskName} -> Maybe Text
taskName) (\s :: ExportTask
s@ExportTask' {} Maybe Text
a -> ExportTask
s {$sel:taskName:ExportTask' :: Maybe Text
taskName = Maybe Text
a} :: ExportTask)

-- | The end time, expressed as the number of milliseconds after
-- @Jan 1, 1970 00:00:00 UTC@. Events with a timestamp later than this time
-- are not exported.
exportTask_to :: Lens.Lens' ExportTask (Prelude.Maybe Prelude.Natural)
exportTask_to :: Lens' ExportTask (Maybe Natural)
exportTask_to = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExportTask' {Maybe Natural
to :: Maybe Natural
$sel:to:ExportTask' :: ExportTask -> Maybe Natural
to} -> Maybe Natural
to) (\s :: ExportTask
s@ExportTask' {} Maybe Natural
a -> ExportTask
s {$sel:to:ExportTask' :: Maybe Natural
to = Maybe Natural
a} :: ExportTask)

instance Data.FromJSON ExportTask where
  parseJSON :: Value -> Parser ExportTask
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ExportTask"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe ExportTaskExecutionInfo
-> Maybe Natural
-> Maybe Text
-> Maybe ExportTaskStatus
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> ExportTask
ExportTask'
            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
"destination")
            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
"destinationPrefix")
            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
"executionInfo")
            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
"from")
            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
"logGroupName")
            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
"status")
            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
"taskId")
            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
"taskName")
            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
"to")
      )

instance Prelude.Hashable ExportTask where
  hashWithSalt :: Int -> ExportTask -> Int
hashWithSalt Int
_salt ExportTask' {Maybe Natural
Maybe Text
Maybe ExportTaskExecutionInfo
Maybe ExportTaskStatus
to :: Maybe Natural
taskName :: Maybe Text
taskId :: Maybe Text
status :: Maybe ExportTaskStatus
logGroupName :: Maybe Text
from :: Maybe Natural
executionInfo :: Maybe ExportTaskExecutionInfo
destinationPrefix :: Maybe Text
destination :: Maybe Text
$sel:to:ExportTask' :: ExportTask -> Maybe Natural
$sel:taskName:ExportTask' :: ExportTask -> Maybe Text
$sel:taskId:ExportTask' :: ExportTask -> Maybe Text
$sel:status:ExportTask' :: ExportTask -> Maybe ExportTaskStatus
$sel:logGroupName:ExportTask' :: ExportTask -> Maybe Text
$sel:from:ExportTask' :: ExportTask -> Maybe Natural
$sel:executionInfo:ExportTask' :: ExportTask -> Maybe ExportTaskExecutionInfo
$sel:destinationPrefix:ExportTask' :: ExportTask -> Maybe Text
$sel:destination:ExportTask' :: ExportTask -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
destination
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
destinationPrefix
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ExportTaskExecutionInfo
executionInfo
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
from
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
logGroupName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ExportTaskStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
taskId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
taskName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
to

instance Prelude.NFData ExportTask where
  rnf :: ExportTask -> ()
rnf ExportTask' {Maybe Natural
Maybe Text
Maybe ExportTaskExecutionInfo
Maybe ExportTaskStatus
to :: Maybe Natural
taskName :: Maybe Text
taskId :: Maybe Text
status :: Maybe ExportTaskStatus
logGroupName :: Maybe Text
from :: Maybe Natural
executionInfo :: Maybe ExportTaskExecutionInfo
destinationPrefix :: Maybe Text
destination :: Maybe Text
$sel:to:ExportTask' :: ExportTask -> Maybe Natural
$sel:taskName:ExportTask' :: ExportTask -> Maybe Text
$sel:taskId:ExportTask' :: ExportTask -> Maybe Text
$sel:status:ExportTask' :: ExportTask -> Maybe ExportTaskStatus
$sel:logGroupName:ExportTask' :: ExportTask -> Maybe Text
$sel:from:ExportTask' :: ExportTask -> Maybe Natural
$sel:executionInfo:ExportTask' :: ExportTask -> Maybe ExportTaskExecutionInfo
$sel:destinationPrefix:ExportTask' :: ExportTask -> Maybe Text
$sel:destination:ExportTask' :: ExportTask -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
destination
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
destinationPrefix
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ExportTaskExecutionInfo
executionInfo
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
from
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
logGroupName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ExportTaskStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
taskId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
taskName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
to