{-# 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.MGN.Types.JobLog
-- 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.MGN.Types.JobLog where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MGN.Types.JobLogEvent
import Amazonka.MGN.Types.JobLogEventData
import qualified Amazonka.Prelude as Prelude

-- | Job log.
--
-- /See:/ 'newJobLog' smart constructor.
data JobLog = JobLog'
  { -- | Job log event.
    JobLog -> Maybe JobLogEvent
event :: Prelude.Maybe JobLogEvent,
    -- | Job event data
    JobLog -> Maybe JobLogEventData
eventData :: Prelude.Maybe JobLogEventData,
    -- | Job log event date and time.
    JobLog -> Maybe Text
logDateTime :: Prelude.Maybe Prelude.Text
  }
  deriving (JobLog -> JobLog -> Bool
(JobLog -> JobLog -> Bool)
-> (JobLog -> JobLog -> Bool) -> Eq JobLog
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobLog -> JobLog -> Bool
$c/= :: JobLog -> JobLog -> Bool
== :: JobLog -> JobLog -> Bool
$c== :: JobLog -> JobLog -> Bool
Prelude.Eq, ReadPrec [JobLog]
ReadPrec JobLog
Int -> ReadS JobLog
ReadS [JobLog]
(Int -> ReadS JobLog)
-> ReadS [JobLog]
-> ReadPrec JobLog
-> ReadPrec [JobLog]
-> Read JobLog
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobLog]
$creadListPrec :: ReadPrec [JobLog]
readPrec :: ReadPrec JobLog
$creadPrec :: ReadPrec JobLog
readList :: ReadS [JobLog]
$creadList :: ReadS [JobLog]
readsPrec :: Int -> ReadS JobLog
$creadsPrec :: Int -> ReadS JobLog
Prelude.Read, Int -> JobLog -> ShowS
[JobLog] -> ShowS
JobLog -> String
(Int -> JobLog -> ShowS)
-> (JobLog -> String) -> ([JobLog] -> ShowS) -> Show JobLog
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobLog] -> ShowS
$cshowList :: [JobLog] -> ShowS
show :: JobLog -> String
$cshow :: JobLog -> String
showsPrec :: Int -> JobLog -> ShowS
$cshowsPrec :: Int -> JobLog -> ShowS
Prelude.Show, (forall x. JobLog -> Rep JobLog x)
-> (forall x. Rep JobLog x -> JobLog) -> Generic JobLog
forall x. Rep JobLog x -> JobLog
forall x. JobLog -> Rep JobLog x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JobLog x -> JobLog
$cfrom :: forall x. JobLog -> Rep JobLog x
Prelude.Generic)

-- |
-- Create a value of 'JobLog' 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:
--
-- 'event', 'jobLog_event' - Job log event.
--
-- 'eventData', 'jobLog_eventData' - Job event data
--
-- 'logDateTime', 'jobLog_logDateTime' - Job log event date and time.
newJobLog ::
  JobLog
newJobLog :: JobLog
newJobLog =
  JobLog' :: Maybe JobLogEvent -> Maybe JobLogEventData -> Maybe Text -> JobLog
JobLog'
    { $sel:event:JobLog' :: Maybe JobLogEvent
event = Maybe JobLogEvent
forall a. Maybe a
Prelude.Nothing,
      $sel:eventData:JobLog' :: Maybe JobLogEventData
eventData = Maybe JobLogEventData
forall a. Maybe a
Prelude.Nothing,
      $sel:logDateTime:JobLog' :: Maybe Text
logDateTime = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Job log event.
jobLog_event :: Lens.Lens' JobLog (Prelude.Maybe JobLogEvent)
jobLog_event :: (Maybe JobLogEvent -> f (Maybe JobLogEvent)) -> JobLog -> f JobLog
jobLog_event = (JobLog -> Maybe JobLogEvent)
-> (JobLog -> Maybe JobLogEvent -> JobLog)
-> Lens JobLog JobLog (Maybe JobLogEvent) (Maybe JobLogEvent)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobLog' {Maybe JobLogEvent
event :: Maybe JobLogEvent
$sel:event:JobLog' :: JobLog -> Maybe JobLogEvent
event} -> Maybe JobLogEvent
event) (\s :: JobLog
s@JobLog' {} Maybe JobLogEvent
a -> JobLog
s {$sel:event:JobLog' :: Maybe JobLogEvent
event = Maybe JobLogEvent
a} :: JobLog)

-- | Job event data
jobLog_eventData :: Lens.Lens' JobLog (Prelude.Maybe JobLogEventData)
jobLog_eventData :: (Maybe JobLogEventData -> f (Maybe JobLogEventData))
-> JobLog -> f JobLog
jobLog_eventData = (JobLog -> Maybe JobLogEventData)
-> (JobLog -> Maybe JobLogEventData -> JobLog)
-> Lens
     JobLog JobLog (Maybe JobLogEventData) (Maybe JobLogEventData)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobLog' {Maybe JobLogEventData
eventData :: Maybe JobLogEventData
$sel:eventData:JobLog' :: JobLog -> Maybe JobLogEventData
eventData} -> Maybe JobLogEventData
eventData) (\s :: JobLog
s@JobLog' {} Maybe JobLogEventData
a -> JobLog
s {$sel:eventData:JobLog' :: Maybe JobLogEventData
eventData = Maybe JobLogEventData
a} :: JobLog)

-- | Job log event date and time.
jobLog_logDateTime :: Lens.Lens' JobLog (Prelude.Maybe Prelude.Text)
jobLog_logDateTime :: (Maybe Text -> f (Maybe Text)) -> JobLog -> f JobLog
jobLog_logDateTime = (JobLog -> Maybe Text)
-> (JobLog -> Maybe Text -> JobLog)
-> Lens JobLog JobLog (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobLog' {Maybe Text
logDateTime :: Maybe Text
$sel:logDateTime:JobLog' :: JobLog -> Maybe Text
logDateTime} -> Maybe Text
logDateTime) (\s :: JobLog
s@JobLog' {} Maybe Text
a -> JobLog
s {$sel:logDateTime:JobLog' :: Maybe Text
logDateTime = Maybe Text
a} :: JobLog)

instance Core.FromJSON JobLog where
  parseJSON :: Value -> Parser JobLog
parseJSON =
    String -> (Object -> Parser JobLog) -> Value -> Parser JobLog
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"JobLog"
      ( \Object
x ->
          Maybe JobLogEvent -> Maybe JobLogEventData -> Maybe Text -> JobLog
JobLog'
            (Maybe JobLogEvent
 -> Maybe JobLogEventData -> Maybe Text -> JobLog)
-> Parser (Maybe JobLogEvent)
-> Parser (Maybe JobLogEventData -> Maybe Text -> JobLog)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe JobLogEvent)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"event")
            Parser (Maybe JobLogEventData -> Maybe Text -> JobLog)
-> Parser (Maybe JobLogEventData) -> Parser (Maybe Text -> JobLog)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe JobLogEventData)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"eventData")
            Parser (Maybe Text -> JobLog)
-> Parser (Maybe Text) -> Parser JobLog
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
"logDateTime")
      )

instance Prelude.Hashable JobLog

instance Prelude.NFData JobLog