{-# 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.SageMaker.Types.TrialComponentSourceDetail
-- 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.SageMaker.Types.TrialComponentSourceDetail where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.ProcessingJob
import Amazonka.SageMaker.Types.TrainingJob
import Amazonka.SageMaker.Types.TransformJob

-- | Detailed information about the source of a trial component. Either
-- @ProcessingJob@ or @TrainingJob@ is returned.
--
-- /See:/ 'newTrialComponentSourceDetail' smart constructor.
data TrialComponentSourceDetail = TrialComponentSourceDetail'
  { -- | Information about a training job that\'s the source of a trial
    -- component.
    TrialComponentSourceDetail -> Maybe TrainingJob
trainingJob :: Prelude.Maybe TrainingJob,
    -- | The Amazon Resource Name (ARN) of the source.
    TrialComponentSourceDetail -> Maybe Text
sourceArn :: Prelude.Maybe Prelude.Text,
    -- | Information about a processing job that\'s the source of a trial
    -- component.
    TrialComponentSourceDetail -> Maybe ProcessingJob
processingJob :: Prelude.Maybe ProcessingJob,
    -- | Information about a transform job that\'s the source of a trial
    -- component.
    TrialComponentSourceDetail -> Maybe TransformJob
transformJob :: Prelude.Maybe TransformJob
  }
  deriving (TrialComponentSourceDetail -> TrialComponentSourceDetail -> Bool
(TrialComponentSourceDetail -> TrialComponentSourceDetail -> Bool)
-> (TrialComponentSourceDetail
    -> TrialComponentSourceDetail -> Bool)
-> Eq TrialComponentSourceDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TrialComponentSourceDetail -> TrialComponentSourceDetail -> Bool
$c/= :: TrialComponentSourceDetail -> TrialComponentSourceDetail -> Bool
== :: TrialComponentSourceDetail -> TrialComponentSourceDetail -> Bool
$c== :: TrialComponentSourceDetail -> TrialComponentSourceDetail -> Bool
Prelude.Eq, ReadPrec [TrialComponentSourceDetail]
ReadPrec TrialComponentSourceDetail
Int -> ReadS TrialComponentSourceDetail
ReadS [TrialComponentSourceDetail]
(Int -> ReadS TrialComponentSourceDetail)
-> ReadS [TrialComponentSourceDetail]
-> ReadPrec TrialComponentSourceDetail
-> ReadPrec [TrialComponentSourceDetail]
-> Read TrialComponentSourceDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TrialComponentSourceDetail]
$creadListPrec :: ReadPrec [TrialComponentSourceDetail]
readPrec :: ReadPrec TrialComponentSourceDetail
$creadPrec :: ReadPrec TrialComponentSourceDetail
readList :: ReadS [TrialComponentSourceDetail]
$creadList :: ReadS [TrialComponentSourceDetail]
readsPrec :: Int -> ReadS TrialComponentSourceDetail
$creadsPrec :: Int -> ReadS TrialComponentSourceDetail
Prelude.Read, Int -> TrialComponentSourceDetail -> ShowS
[TrialComponentSourceDetail] -> ShowS
TrialComponentSourceDetail -> String
(Int -> TrialComponentSourceDetail -> ShowS)
-> (TrialComponentSourceDetail -> String)
-> ([TrialComponentSourceDetail] -> ShowS)
-> Show TrialComponentSourceDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TrialComponentSourceDetail] -> ShowS
$cshowList :: [TrialComponentSourceDetail] -> ShowS
show :: TrialComponentSourceDetail -> String
$cshow :: TrialComponentSourceDetail -> String
showsPrec :: Int -> TrialComponentSourceDetail -> ShowS
$cshowsPrec :: Int -> TrialComponentSourceDetail -> ShowS
Prelude.Show, (forall x.
 TrialComponentSourceDetail -> Rep TrialComponentSourceDetail x)
-> (forall x.
    Rep TrialComponentSourceDetail x -> TrialComponentSourceDetail)
-> Generic TrialComponentSourceDetail
forall x.
Rep TrialComponentSourceDetail x -> TrialComponentSourceDetail
forall x.
TrialComponentSourceDetail -> Rep TrialComponentSourceDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TrialComponentSourceDetail x -> TrialComponentSourceDetail
$cfrom :: forall x.
TrialComponentSourceDetail -> Rep TrialComponentSourceDetail x
Prelude.Generic)

-- |
-- Create a value of 'TrialComponentSourceDetail' 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:
--
-- 'trainingJob', 'trialComponentSourceDetail_trainingJob' - Information about a training job that\'s the source of a trial
-- component.
--
-- 'sourceArn', 'trialComponentSourceDetail_sourceArn' - The Amazon Resource Name (ARN) of the source.
--
-- 'processingJob', 'trialComponentSourceDetail_processingJob' - Information about a processing job that\'s the source of a trial
-- component.
--
-- 'transformJob', 'trialComponentSourceDetail_transformJob' - Information about a transform job that\'s the source of a trial
-- component.
newTrialComponentSourceDetail ::
  TrialComponentSourceDetail
newTrialComponentSourceDetail :: TrialComponentSourceDetail
newTrialComponentSourceDetail =
  TrialComponentSourceDetail' :: Maybe TrainingJob
-> Maybe Text
-> Maybe ProcessingJob
-> Maybe TransformJob
-> TrialComponentSourceDetail
TrialComponentSourceDetail'
    { $sel:trainingJob:TrialComponentSourceDetail' :: Maybe TrainingJob
trainingJob =
        Maybe TrainingJob
forall a. Maybe a
Prelude.Nothing,
      $sel:sourceArn:TrialComponentSourceDetail' :: Maybe Text
sourceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:processingJob:TrialComponentSourceDetail' :: Maybe ProcessingJob
processingJob = Maybe ProcessingJob
forall a. Maybe a
Prelude.Nothing,
      $sel:transformJob:TrialComponentSourceDetail' :: Maybe TransformJob
transformJob = Maybe TransformJob
forall a. Maybe a
Prelude.Nothing
    }

-- | Information about a training job that\'s the source of a trial
-- component.
trialComponentSourceDetail_trainingJob :: Lens.Lens' TrialComponentSourceDetail (Prelude.Maybe TrainingJob)
trialComponentSourceDetail_trainingJob :: (Maybe TrainingJob -> f (Maybe TrainingJob))
-> TrialComponentSourceDetail -> f TrialComponentSourceDetail
trialComponentSourceDetail_trainingJob = (TrialComponentSourceDetail -> Maybe TrainingJob)
-> (TrialComponentSourceDetail
    -> Maybe TrainingJob -> TrialComponentSourceDetail)
-> Lens
     TrialComponentSourceDetail
     TrialComponentSourceDetail
     (Maybe TrainingJob)
     (Maybe TrainingJob)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrialComponentSourceDetail' {Maybe TrainingJob
trainingJob :: Maybe TrainingJob
$sel:trainingJob:TrialComponentSourceDetail' :: TrialComponentSourceDetail -> Maybe TrainingJob
trainingJob} -> Maybe TrainingJob
trainingJob) (\s :: TrialComponentSourceDetail
s@TrialComponentSourceDetail' {} Maybe TrainingJob
a -> TrialComponentSourceDetail
s {$sel:trainingJob:TrialComponentSourceDetail' :: Maybe TrainingJob
trainingJob = Maybe TrainingJob
a} :: TrialComponentSourceDetail)

-- | The Amazon Resource Name (ARN) of the source.
trialComponentSourceDetail_sourceArn :: Lens.Lens' TrialComponentSourceDetail (Prelude.Maybe Prelude.Text)
trialComponentSourceDetail_sourceArn :: (Maybe Text -> f (Maybe Text))
-> TrialComponentSourceDetail -> f TrialComponentSourceDetail
trialComponentSourceDetail_sourceArn = (TrialComponentSourceDetail -> Maybe Text)
-> (TrialComponentSourceDetail
    -> Maybe Text -> TrialComponentSourceDetail)
-> Lens
     TrialComponentSourceDetail
     TrialComponentSourceDetail
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrialComponentSourceDetail' {Maybe Text
sourceArn :: Maybe Text
$sel:sourceArn:TrialComponentSourceDetail' :: TrialComponentSourceDetail -> Maybe Text
sourceArn} -> Maybe Text
sourceArn) (\s :: TrialComponentSourceDetail
s@TrialComponentSourceDetail' {} Maybe Text
a -> TrialComponentSourceDetail
s {$sel:sourceArn:TrialComponentSourceDetail' :: Maybe Text
sourceArn = Maybe Text
a} :: TrialComponentSourceDetail)

-- | Information about a processing job that\'s the source of a trial
-- component.
trialComponentSourceDetail_processingJob :: Lens.Lens' TrialComponentSourceDetail (Prelude.Maybe ProcessingJob)
trialComponentSourceDetail_processingJob :: (Maybe ProcessingJob -> f (Maybe ProcessingJob))
-> TrialComponentSourceDetail -> f TrialComponentSourceDetail
trialComponentSourceDetail_processingJob = (TrialComponentSourceDetail -> Maybe ProcessingJob)
-> (TrialComponentSourceDetail
    -> Maybe ProcessingJob -> TrialComponentSourceDetail)
-> Lens
     TrialComponentSourceDetail
     TrialComponentSourceDetail
     (Maybe ProcessingJob)
     (Maybe ProcessingJob)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrialComponentSourceDetail' {Maybe ProcessingJob
processingJob :: Maybe ProcessingJob
$sel:processingJob:TrialComponentSourceDetail' :: TrialComponentSourceDetail -> Maybe ProcessingJob
processingJob} -> Maybe ProcessingJob
processingJob) (\s :: TrialComponentSourceDetail
s@TrialComponentSourceDetail' {} Maybe ProcessingJob
a -> TrialComponentSourceDetail
s {$sel:processingJob:TrialComponentSourceDetail' :: Maybe ProcessingJob
processingJob = Maybe ProcessingJob
a} :: TrialComponentSourceDetail)

-- | Information about a transform job that\'s the source of a trial
-- component.
trialComponentSourceDetail_transformJob :: Lens.Lens' TrialComponentSourceDetail (Prelude.Maybe TransformJob)
trialComponentSourceDetail_transformJob :: (Maybe TransformJob -> f (Maybe TransformJob))
-> TrialComponentSourceDetail -> f TrialComponentSourceDetail
trialComponentSourceDetail_transformJob = (TrialComponentSourceDetail -> Maybe TransformJob)
-> (TrialComponentSourceDetail
    -> Maybe TransformJob -> TrialComponentSourceDetail)
-> Lens
     TrialComponentSourceDetail
     TrialComponentSourceDetail
     (Maybe TransformJob)
     (Maybe TransformJob)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrialComponentSourceDetail' {Maybe TransformJob
transformJob :: Maybe TransformJob
$sel:transformJob:TrialComponentSourceDetail' :: TrialComponentSourceDetail -> Maybe TransformJob
transformJob} -> Maybe TransformJob
transformJob) (\s :: TrialComponentSourceDetail
s@TrialComponentSourceDetail' {} Maybe TransformJob
a -> TrialComponentSourceDetail
s {$sel:transformJob:TrialComponentSourceDetail' :: Maybe TransformJob
transformJob = Maybe TransformJob
a} :: TrialComponentSourceDetail)

instance Core.FromJSON TrialComponentSourceDetail where
  parseJSON :: Value -> Parser TrialComponentSourceDetail
parseJSON =
    String
-> (Object -> Parser TrialComponentSourceDetail)
-> Value
-> Parser TrialComponentSourceDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TrialComponentSourceDetail"
      ( \Object
x ->
          Maybe TrainingJob
-> Maybe Text
-> Maybe ProcessingJob
-> Maybe TransformJob
-> TrialComponentSourceDetail
TrialComponentSourceDetail'
            (Maybe TrainingJob
 -> Maybe Text
 -> Maybe ProcessingJob
 -> Maybe TransformJob
 -> TrialComponentSourceDetail)
-> Parser (Maybe TrainingJob)
-> Parser
     (Maybe Text
      -> Maybe ProcessingJob
      -> Maybe TransformJob
      -> TrialComponentSourceDetail)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe TrainingJob)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TrainingJob")
            Parser
  (Maybe Text
   -> Maybe ProcessingJob
   -> Maybe TransformJob
   -> TrialComponentSourceDetail)
-> Parser (Maybe Text)
-> Parser
     (Maybe ProcessingJob
      -> Maybe TransformJob -> TrialComponentSourceDetail)
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
"SourceArn")
            Parser
  (Maybe ProcessingJob
   -> Maybe TransformJob -> TrialComponentSourceDetail)
-> Parser (Maybe ProcessingJob)
-> Parser (Maybe TransformJob -> TrialComponentSourceDetail)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ProcessingJob)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProcessingJob")
            Parser (Maybe TransformJob -> TrialComponentSourceDetail)
-> Parser (Maybe TransformJob) -> Parser TrialComponentSourceDetail
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TransformJob)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TransformJob")
      )

instance Prelude.Hashable TrialComponentSourceDetail

instance Prelude.NFData TrialComponentSourceDetail