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

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

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

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

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

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

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

instance Prelude.NFData ExperimentSource