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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 ARN.
    TrialComponentSource -> Text
sourceArn :: Prelude.Text
  }
  deriving (TrialComponentSource -> TrialComponentSource -> Bool
(TrialComponentSource -> TrialComponentSource -> Bool)
-> (TrialComponentSource -> TrialComponentSource -> Bool)
-> Eq TrialComponentSource
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]
(Int -> ReadS TrialComponentSource)
-> ReadS [TrialComponentSource]
-> ReadPrec TrialComponentSource
-> ReadPrec [TrialComponentSource]
-> Read 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
(Int -> TrialComponentSource -> ShowS)
-> (TrialComponentSource -> String)
-> ([TrialComponentSource] -> ShowS)
-> Show TrialComponentSource
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. TrialComponentSource -> Rep TrialComponentSource x)
-> (forall x. Rep TrialComponentSource x -> TrialComponentSource)
-> Generic TrialComponentSource
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 ARN.
newTrialComponentSource ::
  -- | 'sourceArn'
  Prelude.Text ->
  TrialComponentSource
newTrialComponentSource :: Text -> TrialComponentSource
newTrialComponentSource Text
pSourceArn_ =
  TrialComponentSource' :: Maybe Text -> Text -> TrialComponentSource
TrialComponentSource'
    { $sel:sourceType:TrialComponentSource' :: Maybe Text
sourceType = Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> TrialComponentSource -> f TrialComponentSource
trialComponentSource_sourceType = (TrialComponentSource -> Maybe Text)
-> (TrialComponentSource -> Maybe Text -> TrialComponentSource)
-> Lens
     TrialComponentSource TrialComponentSource (Maybe Text) (Maybe Text)
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 ARN.
trialComponentSource_sourceArn :: Lens.Lens' TrialComponentSource Prelude.Text
trialComponentSource_sourceArn :: (Text -> f Text) -> TrialComponentSource -> f TrialComponentSource
trialComponentSource_sourceArn = (TrialComponentSource -> Text)
-> (TrialComponentSource -> Text -> TrialComponentSource)
-> Lens TrialComponentSource TrialComponentSource Text Text
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 Core.FromJSON TrialComponentSource where
  parseJSON :: Value -> Parser TrialComponentSource
parseJSON =
    String
-> (Object -> Parser TrialComponentSource)
-> Value
-> Parser TrialComponentSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TrialComponentSource"
      ( \Object
x ->
          Maybe Text -> Text -> TrialComponentSource
TrialComponentSource'
            (Maybe Text -> Text -> TrialComponentSource)
-> Parser (Maybe Text) -> Parser (Text -> TrialComponentSource)
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
"SourceType")
            Parser (Text -> TrialComponentSource)
-> Parser Text -> Parser TrialComponentSource
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SourceArn")
      )

instance Prelude.Hashable TrialComponentSource

instance Prelude.NFData TrialComponentSource