{-# 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.JobLogEventData
-- 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.JobLogEventData where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Job log data
--
-- /See:/ 'newJobLogEventData' smart constructor.
data JobLogEventData = JobLogEventData'
  { -- | Job error.
    JobLogEventData -> Maybe Text
rawError :: Prelude.Maybe Prelude.Text,
    -- | Job Event Target instance ID.
    JobLogEventData -> Maybe Text
targetInstanceID :: Prelude.Maybe Prelude.Text,
    -- | Job Event Source Server ID.
    JobLogEventData -> Maybe Text
sourceServerID :: Prelude.Maybe Prelude.Text,
    -- | Job Event conversion Server ID.
    JobLogEventData -> Maybe Text
conversionServerID :: Prelude.Maybe Prelude.Text
  }
  deriving (JobLogEventData -> JobLogEventData -> Bool
(JobLogEventData -> JobLogEventData -> Bool)
-> (JobLogEventData -> JobLogEventData -> Bool)
-> Eq JobLogEventData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobLogEventData -> JobLogEventData -> Bool
$c/= :: JobLogEventData -> JobLogEventData -> Bool
== :: JobLogEventData -> JobLogEventData -> Bool
$c== :: JobLogEventData -> JobLogEventData -> Bool
Prelude.Eq, ReadPrec [JobLogEventData]
ReadPrec JobLogEventData
Int -> ReadS JobLogEventData
ReadS [JobLogEventData]
(Int -> ReadS JobLogEventData)
-> ReadS [JobLogEventData]
-> ReadPrec JobLogEventData
-> ReadPrec [JobLogEventData]
-> Read JobLogEventData
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobLogEventData]
$creadListPrec :: ReadPrec [JobLogEventData]
readPrec :: ReadPrec JobLogEventData
$creadPrec :: ReadPrec JobLogEventData
readList :: ReadS [JobLogEventData]
$creadList :: ReadS [JobLogEventData]
readsPrec :: Int -> ReadS JobLogEventData
$creadsPrec :: Int -> ReadS JobLogEventData
Prelude.Read, Int -> JobLogEventData -> ShowS
[JobLogEventData] -> ShowS
JobLogEventData -> String
(Int -> JobLogEventData -> ShowS)
-> (JobLogEventData -> String)
-> ([JobLogEventData] -> ShowS)
-> Show JobLogEventData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobLogEventData] -> ShowS
$cshowList :: [JobLogEventData] -> ShowS
show :: JobLogEventData -> String
$cshow :: JobLogEventData -> String
showsPrec :: Int -> JobLogEventData -> ShowS
$cshowsPrec :: Int -> JobLogEventData -> ShowS
Prelude.Show, (forall x. JobLogEventData -> Rep JobLogEventData x)
-> (forall x. Rep JobLogEventData x -> JobLogEventData)
-> Generic JobLogEventData
forall x. Rep JobLogEventData x -> JobLogEventData
forall x. JobLogEventData -> Rep JobLogEventData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JobLogEventData x -> JobLogEventData
$cfrom :: forall x. JobLogEventData -> Rep JobLogEventData x
Prelude.Generic)

-- |
-- Create a value of 'JobLogEventData' 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:
--
-- 'rawError', 'jobLogEventData_rawError' - Job error.
--
-- 'targetInstanceID', 'jobLogEventData_targetInstanceID' - Job Event Target instance ID.
--
-- 'sourceServerID', 'jobLogEventData_sourceServerID' - Job Event Source Server ID.
--
-- 'conversionServerID', 'jobLogEventData_conversionServerID' - Job Event conversion Server ID.
newJobLogEventData ::
  JobLogEventData
newJobLogEventData :: JobLogEventData
newJobLogEventData =
  JobLogEventData' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> JobLogEventData
JobLogEventData'
    { $sel:rawError:JobLogEventData' :: Maybe Text
rawError = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:targetInstanceID:JobLogEventData' :: Maybe Text
targetInstanceID = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceServerID:JobLogEventData' :: Maybe Text
sourceServerID = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:conversionServerID:JobLogEventData' :: Maybe Text
conversionServerID = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Job error.
jobLogEventData_rawError :: Lens.Lens' JobLogEventData (Prelude.Maybe Prelude.Text)
jobLogEventData_rawError :: (Maybe Text -> f (Maybe Text))
-> JobLogEventData -> f JobLogEventData
jobLogEventData_rawError = (JobLogEventData -> Maybe Text)
-> (JobLogEventData -> Maybe Text -> JobLogEventData)
-> Lens JobLogEventData JobLogEventData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobLogEventData' {Maybe Text
rawError :: Maybe Text
$sel:rawError:JobLogEventData' :: JobLogEventData -> Maybe Text
rawError} -> Maybe Text
rawError) (\s :: JobLogEventData
s@JobLogEventData' {} Maybe Text
a -> JobLogEventData
s {$sel:rawError:JobLogEventData' :: Maybe Text
rawError = Maybe Text
a} :: JobLogEventData)

-- | Job Event Target instance ID.
jobLogEventData_targetInstanceID :: Lens.Lens' JobLogEventData (Prelude.Maybe Prelude.Text)
jobLogEventData_targetInstanceID :: (Maybe Text -> f (Maybe Text))
-> JobLogEventData -> f JobLogEventData
jobLogEventData_targetInstanceID = (JobLogEventData -> Maybe Text)
-> (JobLogEventData -> Maybe Text -> JobLogEventData)
-> Lens JobLogEventData JobLogEventData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobLogEventData' {Maybe Text
targetInstanceID :: Maybe Text
$sel:targetInstanceID:JobLogEventData' :: JobLogEventData -> Maybe Text
targetInstanceID} -> Maybe Text
targetInstanceID) (\s :: JobLogEventData
s@JobLogEventData' {} Maybe Text
a -> JobLogEventData
s {$sel:targetInstanceID:JobLogEventData' :: Maybe Text
targetInstanceID = Maybe Text
a} :: JobLogEventData)

-- | Job Event Source Server ID.
jobLogEventData_sourceServerID :: Lens.Lens' JobLogEventData (Prelude.Maybe Prelude.Text)
jobLogEventData_sourceServerID :: (Maybe Text -> f (Maybe Text))
-> JobLogEventData -> f JobLogEventData
jobLogEventData_sourceServerID = (JobLogEventData -> Maybe Text)
-> (JobLogEventData -> Maybe Text -> JobLogEventData)
-> Lens JobLogEventData JobLogEventData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobLogEventData' {Maybe Text
sourceServerID :: Maybe Text
$sel:sourceServerID:JobLogEventData' :: JobLogEventData -> Maybe Text
sourceServerID} -> Maybe Text
sourceServerID) (\s :: JobLogEventData
s@JobLogEventData' {} Maybe Text
a -> JobLogEventData
s {$sel:sourceServerID:JobLogEventData' :: Maybe Text
sourceServerID = Maybe Text
a} :: JobLogEventData)

-- | Job Event conversion Server ID.
jobLogEventData_conversionServerID :: Lens.Lens' JobLogEventData (Prelude.Maybe Prelude.Text)
jobLogEventData_conversionServerID :: (Maybe Text -> f (Maybe Text))
-> JobLogEventData -> f JobLogEventData
jobLogEventData_conversionServerID = (JobLogEventData -> Maybe Text)
-> (JobLogEventData -> Maybe Text -> JobLogEventData)
-> Lens JobLogEventData JobLogEventData (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobLogEventData' {Maybe Text
conversionServerID :: Maybe Text
$sel:conversionServerID:JobLogEventData' :: JobLogEventData -> Maybe Text
conversionServerID} -> Maybe Text
conversionServerID) (\s :: JobLogEventData
s@JobLogEventData' {} Maybe Text
a -> JobLogEventData
s {$sel:conversionServerID:JobLogEventData' :: Maybe Text
conversionServerID = Maybe Text
a} :: JobLogEventData)

instance Core.FromJSON JobLogEventData where
  parseJSON :: Value -> Parser JobLogEventData
parseJSON =
    String
-> (Object -> Parser JobLogEventData)
-> Value
-> Parser JobLogEventData
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"JobLogEventData"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> JobLogEventData
JobLogEventData'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Maybe Text -> JobLogEventData)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> JobLogEventData)
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
"rawError")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> JobLogEventData)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> JobLogEventData)
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
"targetInstanceID")
            Parser (Maybe Text -> Maybe Text -> JobLogEventData)
-> Parser (Maybe Text) -> Parser (Maybe Text -> JobLogEventData)
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
"sourceServerID")
            Parser (Maybe Text -> JobLogEventData)
-> Parser (Maybe Text) -> Parser JobLogEventData
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
"conversionServerID")
      )

instance Prelude.Hashable JobLogEventData

instance Prelude.NFData JobLogEventData