{-# 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.TrialComponentSource
-- 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.TrialComponentSource 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

-- | The Amazon Resource Name (ARN) and job type of the source of a trial
-- component.
--
-- /See:/ 'newTrialComponentSource' smart constructor.
data TrialComponentSource = TrialComponentSource'
  { -- | The source job type.
    TrialComponentSource -> Maybe Text
sourceType :: Prelude.Maybe Prelude.Text,
    -- | The source Amazon Resource Name (ARN).
    TrialComponentSource -> Text
sourceArn :: Prelude.Text
  }
  deriving (TrialComponentSource -> TrialComponentSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TrialComponentSource -> TrialComponentSource -> Bool
$c/= :: TrialComponentSource -> TrialComponentSource -> Bool
== :: TrialComponentSource -> TrialComponentSource -> Bool
$c== :: TrialComponentSource -> TrialComponentSource -> Bool
Prelude.Eq, ReadPrec [TrialComponentSource]
ReadPrec TrialComponentSource
Int -> ReadS TrialComponentSource
ReadS [TrialComponentSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TrialComponentSource]
$creadListPrec :: ReadPrec [TrialComponentSource]
readPrec :: ReadPrec TrialComponentSource
$creadPrec :: ReadPrec TrialComponentSource
readList :: ReadS [TrialComponentSource]
$creadList :: ReadS [TrialComponentSource]
readsPrec :: Int -> ReadS TrialComponentSource
$creadsPrec :: Int -> ReadS TrialComponentSource
Prelude.Read, Int -> TrialComponentSource -> ShowS
[TrialComponentSource] -> ShowS
TrialComponentSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TrialComponentSource] -> ShowS
$cshowList :: [TrialComponentSource] -> ShowS
show :: TrialComponentSource -> String
$cshow :: TrialComponentSource -> String
showsPrec :: Int -> TrialComponentSource -> ShowS
$cshowsPrec :: Int -> TrialComponentSource -> ShowS
Prelude.Show, forall x. Rep TrialComponentSource x -> TrialComponentSource
forall x. TrialComponentSource -> Rep TrialComponentSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TrialComponentSource x -> TrialComponentSource
$cfrom :: forall x. TrialComponentSource -> Rep TrialComponentSource x
Prelude.Generic)

-- |
-- Create a value of 'TrialComponentSource' 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:
--
-- 'sourceType', 'trialComponentSource_sourceType' - The source job type.
--
-- 'sourceArn', 'trialComponentSource_sourceArn' - The source Amazon Resource Name (ARN).
newTrialComponentSource ::
  -- | 'sourceArn'
  Prelude.Text ->
  TrialComponentSource
newTrialComponentSource :: Text -> TrialComponentSource
newTrialComponentSource Text
pSourceArn_ =
  TrialComponentSource'
    { $sel:sourceType:TrialComponentSource' :: Maybe Text
sourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceArn:TrialComponentSource' :: Text
sourceArn = Text
pSourceArn_
    }

-- | The source job type.
trialComponentSource_sourceType :: Lens.Lens' TrialComponentSource (Prelude.Maybe Prelude.Text)
trialComponentSource_sourceType :: Lens' TrialComponentSource (Maybe Text)
trialComponentSource_sourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrialComponentSource' {Maybe Text
sourceType :: Maybe Text
$sel:sourceType:TrialComponentSource' :: TrialComponentSource -> Maybe Text
sourceType} -> Maybe Text
sourceType) (\s :: TrialComponentSource
s@TrialComponentSource' {} Maybe Text
a -> TrialComponentSource
s {$sel:sourceType:TrialComponentSource' :: Maybe Text
sourceType = Maybe Text
a} :: TrialComponentSource)

-- | The source Amazon Resource Name (ARN).
trialComponentSource_sourceArn :: Lens.Lens' TrialComponentSource Prelude.Text
trialComponentSource_sourceArn :: Lens' TrialComponentSource Text
trialComponentSource_sourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrialComponentSource' {Text
sourceArn :: Text
$sel:sourceArn:TrialComponentSource' :: TrialComponentSource -> Text
sourceArn} -> Text
sourceArn) (\s :: TrialComponentSource
s@TrialComponentSource' {} Text
a -> TrialComponentSource
s {$sel:sourceArn:TrialComponentSource' :: Text
sourceArn = Text
a} :: TrialComponentSource)

instance Data.FromJSON TrialComponentSource where
  parseJSON :: Value -> Parser TrialComponentSource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TrialComponentSource"
      ( \Object
x ->
          Maybe Text -> Text -> TrialComponentSource
TrialComponentSource'
            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
"SourceType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"SourceArn")
      )

instance Prelude.Hashable TrialComponentSource where
  hashWithSalt :: Int -> TrialComponentSource -> Int
hashWithSalt Int
_salt TrialComponentSource' {Maybe Text
Text
sourceArn :: Text
sourceType :: Maybe Text
$sel:sourceArn:TrialComponentSource' :: TrialComponentSource -> Text
$sel:sourceType:TrialComponentSource' :: TrialComponentSource -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sourceArn

instance Prelude.NFData TrialComponentSource where
  rnf :: TrialComponentSource -> ()
rnf TrialComponentSource' {Maybe Text
Text
sourceArn :: Text
sourceType :: Maybe Text
$sel:sourceArn:TrialComponentSource' :: TrialComponentSource -> Text
$sel:sourceType:TrialComponentSource' :: TrialComponentSource -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sourceArn