{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SageMaker.Types.TrialComponentSourceDetail where

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

-- | Information about a processing job that\'s the source of a trial
-- component.
trialComponentSourceDetail_processingJob :: Lens.Lens' TrialComponentSourceDetail (Prelude.Maybe ProcessingJob)
trialComponentSourceDetail_processingJob :: Lens' TrialComponentSourceDetail (Maybe ProcessingJob)
trialComponentSourceDetail_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)

-- | The Amazon Resource Name (ARN) of the source.
trialComponentSourceDetail_sourceArn :: Lens.Lens' TrialComponentSourceDetail (Prelude.Maybe Prelude.Text)
trialComponentSourceDetail_sourceArn :: Lens' TrialComponentSourceDetail (Maybe Text)
trialComponentSourceDetail_sourceArn = 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 training job that\'s the source of a trial
-- component.
trialComponentSourceDetail_trainingJob :: Lens.Lens' TrialComponentSourceDetail (Prelude.Maybe TrainingJob)
trialComponentSourceDetail_trainingJob :: Lens' TrialComponentSourceDetail (Maybe TrainingJob)
trialComponentSourceDetail_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)

-- | Information about a transform job that\'s the source of a trial
-- component.
trialComponentSourceDetail_transformJob :: Lens.Lens' TrialComponentSourceDetail (Prelude.Maybe TransformJob)
trialComponentSourceDetail_transformJob :: Lens' TrialComponentSourceDetail (Maybe TransformJob)
trialComponentSourceDetail_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 Data.FromJSON TrialComponentSourceDetail where
  parseJSON :: Value -> Parser TrialComponentSourceDetail
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TrialComponentSourceDetail"
      ( \Object
x ->
          Maybe ProcessingJob
-> Maybe Text
-> Maybe TrainingJob
-> Maybe TransformJob
-> TrialComponentSourceDetail
TrialComponentSourceDetail'
            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
"ProcessingJob")
            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
"SourceArn")
            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
"TrainingJob")
            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
"TransformJob")
      )

instance Prelude.Hashable TrialComponentSourceDetail where
  hashWithSalt :: Int -> TrialComponentSourceDetail -> Int
hashWithSalt Int
_salt TrialComponentSourceDetail' {Maybe Text
Maybe TransformJob
Maybe TrainingJob
Maybe ProcessingJob
transformJob :: Maybe TransformJob
trainingJob :: Maybe TrainingJob
sourceArn :: Maybe Text
processingJob :: Maybe ProcessingJob
$sel:transformJob:TrialComponentSourceDetail' :: TrialComponentSourceDetail -> Maybe TransformJob
$sel:trainingJob:TrialComponentSourceDetail' :: TrialComponentSourceDetail -> Maybe TrainingJob
$sel:sourceArn:TrialComponentSourceDetail' :: TrialComponentSourceDetail -> Maybe Text
$sel:processingJob:TrialComponentSourceDetail' :: TrialComponentSourceDetail -> Maybe ProcessingJob
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProcessingJob
processingJob
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TrainingJob
trainingJob
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TransformJob
transformJob

instance Prelude.NFData TrialComponentSourceDetail where
  rnf :: TrialComponentSourceDetail -> ()
rnf TrialComponentSourceDetail' {Maybe Text
Maybe TransformJob
Maybe TrainingJob
Maybe ProcessingJob
transformJob :: Maybe TransformJob
trainingJob :: Maybe TrainingJob
sourceArn :: Maybe Text
processingJob :: Maybe ProcessingJob
$sel:transformJob:TrialComponentSourceDetail' :: TrialComponentSourceDetail -> Maybe TransformJob
$sel:trainingJob:TrialComponentSourceDetail' :: TrialComponentSourceDetail -> Maybe TrainingJob
$sel:sourceArn:TrialComponentSourceDetail' :: TrialComponentSourceDetail -> Maybe Text
$sel:processingJob:TrialComponentSourceDetail' :: TrialComponentSourceDetail -> Maybe ProcessingJob
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ProcessingJob
processingJob
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TrainingJob
trainingJob
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TransformJob
transformJob