{-# 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-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.TrialSource 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 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
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]
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
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. 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'
    { $sel:sourceType:TrialSource' :: Maybe Text
sourceType = 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 :: Lens' TrialSource (Maybe Text)
trialSource_sourceType = 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 :: Lens' TrialSource Text
trialSource_sourceArn = 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 Data.FromJSON TrialSource where
  parseJSON :: Value -> Parser TrialSource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TrialSource"
      ( \Object
x ->
          Maybe Text -> Text -> TrialSource
TrialSource'
            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 TrialSource where
  hashWithSalt :: Int -> TrialSource -> Int
hashWithSalt Int
_salt TrialSource' {Maybe Text
Text
sourceArn :: Text
sourceType :: Maybe Text
$sel:sourceArn:TrialSource' :: TrialSource -> Text
$sel:sourceType:TrialSource' :: TrialSource -> 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 TrialSource where
  rnf :: TrialSource -> ()
rnf TrialSource' {Maybe Text
Text
sourceArn :: Text
sourceType :: Maybe Text
$sel:sourceArn:TrialSource' :: TrialSource -> Text
$sel:sourceType:TrialSource' :: TrialSource -> 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