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

import Amazonka.CloudWatchLogs.Types.ExportTaskExecutionInfo
import Amazonka.CloudWatchLogs.Types.ExportTaskStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents an export task.
--
-- /See:/ 'newExportTask' smart constructor.
data ExportTask = ExportTask'
  { -- | The prefix that was used as the start of Amazon S3 key for every object
    -- exported.
    ExportTask -> Maybe Text
destinationPrefix :: Prelude.Maybe Prelude.Text,
    -- | The name of the S3 bucket to which the log data was exported.
    ExportTask -> Maybe Text
destination :: Prelude.Maybe Prelude.Text,
    -- | The status of the export task.
    ExportTask -> Maybe ExportTaskStatus
status :: Prelude.Maybe ExportTaskStatus,
    -- | The name of the export task.
    ExportTask -> Maybe Text
taskName :: Prelude.Maybe Prelude.Text,
    -- | The ID of the export task.
    ExportTask -> Maybe Text
taskId :: 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,
    -- | 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,
    -- | Execution information about the export task.
    ExportTask -> Maybe ExportTaskExecutionInfo
executionInfo :: Prelude.Maybe ExportTaskExecutionInfo
  }
  deriving (ExportTask -> ExportTask -> Bool
(ExportTask -> ExportTask -> Bool)
-> (ExportTask -> ExportTask -> Bool) -> Eq ExportTask
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]
(Int -> ReadS ExportTask)
-> ReadS [ExportTask]
-> ReadPrec ExportTask
-> ReadPrec [ExportTask]
-> Read 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
(Int -> ExportTask -> ShowS)
-> (ExportTask -> String)
-> ([ExportTask] -> ShowS)
-> Show ExportTask
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. ExportTask -> Rep ExportTask x)
-> (forall x. Rep ExportTask x -> ExportTask) -> Generic ExportTask
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:
--
-- 'destinationPrefix', 'exportTask_destinationPrefix' - The prefix that was used as the start of Amazon S3 key for every object
-- exported.
--
-- 'destination', 'exportTask_destination' - The name of the S3 bucket to which the log data was exported.
--
-- 'status', 'exportTask_status' - The status of the export task.
--
-- 'taskName', 'exportTask_taskName' - The name of the export task.
--
-- 'taskId', 'exportTask_taskId' - The ID 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.
--
-- '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.
--
-- 'executionInfo', 'exportTask_executionInfo' - Execution information about the export task.
newExportTask ::
  ExportTask
newExportTask :: ExportTask
newExportTask =
  ExportTask' :: Maybe Text
-> Maybe Text
-> Maybe ExportTaskStatus
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe Natural
-> Maybe Text
-> Maybe ExportTaskExecutionInfo
-> ExportTask
ExportTask'
    { $sel:destinationPrefix:ExportTask' :: Maybe Text
destinationPrefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:destination:ExportTask' :: Maybe Text
destination = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:ExportTask' :: Maybe ExportTaskStatus
status = Maybe ExportTaskStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:taskName:ExportTask' :: Maybe Text
taskName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:taskId:ExportTask' :: Maybe Text
taskId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:to:ExportTask' :: Maybe Natural
to = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:from:ExportTask' :: Maybe Natural
from = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:logGroupName:ExportTask' :: Maybe Text
logGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:executionInfo:ExportTask' :: Maybe ExportTaskExecutionInfo
executionInfo = Maybe ExportTaskExecutionInfo
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Text -> f (Maybe Text)) -> ExportTask -> f ExportTask
exportTask_destinationPrefix = (ExportTask -> Maybe Text)
-> (ExportTask -> Maybe Text -> ExportTask)
-> Lens ExportTask ExportTask (Maybe Text) (Maybe Text)
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)

-- | The name of the S3 bucket to which the log data was exported.
exportTask_destination :: Lens.Lens' ExportTask (Prelude.Maybe Prelude.Text)
exportTask_destination :: (Maybe Text -> f (Maybe Text)) -> ExportTask -> f ExportTask
exportTask_destination = (ExportTask -> Maybe Text)
-> (ExportTask -> Maybe Text -> ExportTask)
-> Lens ExportTask ExportTask (Maybe Text) (Maybe Text)
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 status of the export task.
exportTask_status :: Lens.Lens' ExportTask (Prelude.Maybe ExportTaskStatus)
exportTask_status :: (Maybe ExportTaskStatus -> f (Maybe ExportTaskStatus))
-> ExportTask -> f ExportTask
exportTask_status = (ExportTask -> Maybe ExportTaskStatus)
-> (ExportTask -> Maybe ExportTaskStatus -> ExportTask)
-> Lens
     ExportTask
     ExportTask
     (Maybe ExportTaskStatus)
     (Maybe ExportTaskStatus)
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 name of the export task.
exportTask_taskName :: Lens.Lens' ExportTask (Prelude.Maybe Prelude.Text)
exportTask_taskName :: (Maybe Text -> f (Maybe Text)) -> ExportTask -> f ExportTask
exportTask_taskName = (ExportTask -> Maybe Text)
-> (ExportTask -> Maybe Text -> ExportTask)
-> Lens ExportTask ExportTask (Maybe Text) (Maybe Text)
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 ID of the export task.
exportTask_taskId :: Lens.Lens' ExportTask (Prelude.Maybe Prelude.Text)
exportTask_taskId :: (Maybe Text -> f (Maybe Text)) -> ExportTask -> f ExportTask
exportTask_taskId = (ExportTask -> Maybe Text)
-> (ExportTask -> Maybe Text -> ExportTask)
-> Lens ExportTask ExportTask (Maybe Text) (Maybe Text)
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 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 :: (Maybe Natural -> f (Maybe Natural)) -> ExportTask -> f ExportTask
exportTask_to = (ExportTask -> Maybe Natural)
-> (ExportTask -> Maybe Natural -> ExportTask)
-> Lens ExportTask ExportTask (Maybe Natural) (Maybe Natural)
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)

-- | 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 :: (Maybe Natural -> f (Maybe Natural)) -> ExportTask -> f ExportTask
exportTask_from = (ExportTask -> Maybe Natural)
-> (ExportTask -> Maybe Natural -> ExportTask)
-> Lens ExportTask ExportTask (Maybe Natural) (Maybe Natural)
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 :: (Maybe Text -> f (Maybe Text)) -> ExportTask -> f ExportTask
exportTask_logGroupName = (ExportTask -> Maybe Text)
-> (ExportTask -> Maybe Text -> ExportTask)
-> Lens ExportTask ExportTask (Maybe Text) (Maybe Text)
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)

-- | Execution information about the export task.
exportTask_executionInfo :: Lens.Lens' ExportTask (Prelude.Maybe ExportTaskExecutionInfo)
exportTask_executionInfo :: (Maybe ExportTaskExecutionInfo
 -> f (Maybe ExportTaskExecutionInfo))
-> ExportTask -> f ExportTask
exportTask_executionInfo = (ExportTask -> Maybe ExportTaskExecutionInfo)
-> (ExportTask -> Maybe ExportTaskExecutionInfo -> ExportTask)
-> Lens
     ExportTask
     ExportTask
     (Maybe ExportTaskExecutionInfo)
     (Maybe ExportTaskExecutionInfo)
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)

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

instance Prelude.Hashable ExportTask

instance Prelude.NFData ExportTask