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

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

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

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

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

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

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

instance Prelude.NFData TrialSource