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

-- | Associates a SageMaker job as a trial component with an experiment and
-- trial. Specified when you call the following APIs:
--
-- -   CreateProcessingJob
--
-- -   CreateTrainingJob
--
-- -   CreateTransformJob
--
-- /See:/ 'newExperimentConfig' smart constructor.
data ExperimentConfig = ExperimentConfig'
  { -- | The name of an existing experiment to associate with the trial
    -- component.
    ExperimentConfig -> Maybe Text
experimentName :: Prelude.Maybe Prelude.Text,
    -- | The name of the experiment run to associate with the trial component.
    ExperimentConfig -> Maybe Text
runName :: Prelude.Maybe Prelude.Text,
    -- | The display name for the trial component. If this key isn\'t specified,
    -- the display name is the trial component name.
    ExperimentConfig -> Maybe Text
trialComponentDisplayName :: Prelude.Maybe Prelude.Text,
    -- | The name of an existing trial to associate the trial component with. If
    -- not specified, a new trial is created.
    ExperimentConfig -> Maybe Text
trialName :: Prelude.Maybe Prelude.Text
  }
  deriving (ExperimentConfig -> ExperimentConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExperimentConfig -> ExperimentConfig -> Bool
$c/= :: ExperimentConfig -> ExperimentConfig -> Bool
== :: ExperimentConfig -> ExperimentConfig -> Bool
$c== :: ExperimentConfig -> ExperimentConfig -> Bool
Prelude.Eq, ReadPrec [ExperimentConfig]
ReadPrec ExperimentConfig
Int -> ReadS ExperimentConfig
ReadS [ExperimentConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExperimentConfig]
$creadListPrec :: ReadPrec [ExperimentConfig]
readPrec :: ReadPrec ExperimentConfig
$creadPrec :: ReadPrec ExperimentConfig
readList :: ReadS [ExperimentConfig]
$creadList :: ReadS [ExperimentConfig]
readsPrec :: Int -> ReadS ExperimentConfig
$creadsPrec :: Int -> ReadS ExperimentConfig
Prelude.Read, Int -> ExperimentConfig -> ShowS
[ExperimentConfig] -> ShowS
ExperimentConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExperimentConfig] -> ShowS
$cshowList :: [ExperimentConfig] -> ShowS
show :: ExperimentConfig -> String
$cshow :: ExperimentConfig -> String
showsPrec :: Int -> ExperimentConfig -> ShowS
$cshowsPrec :: Int -> ExperimentConfig -> ShowS
Prelude.Show, forall x. Rep ExperimentConfig x -> ExperimentConfig
forall x. ExperimentConfig -> Rep ExperimentConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExperimentConfig x -> ExperimentConfig
$cfrom :: forall x. ExperimentConfig -> Rep ExperimentConfig x
Prelude.Generic)

-- |
-- Create a value of 'ExperimentConfig' 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:
--
-- 'experimentName', 'experimentConfig_experimentName' - The name of an existing experiment to associate with the trial
-- component.
--
-- 'runName', 'experimentConfig_runName' - The name of the experiment run to associate with the trial component.
--
-- 'trialComponentDisplayName', 'experimentConfig_trialComponentDisplayName' - The display name for the trial component. If this key isn\'t specified,
-- the display name is the trial component name.
--
-- 'trialName', 'experimentConfig_trialName' - The name of an existing trial to associate the trial component with. If
-- not specified, a new trial is created.
newExperimentConfig ::
  ExperimentConfig
newExperimentConfig :: ExperimentConfig
newExperimentConfig =
  ExperimentConfig'
    { $sel:experimentName:ExperimentConfig' :: Maybe Text
experimentName = forall a. Maybe a
Prelude.Nothing,
      $sel:runName:ExperimentConfig' :: Maybe Text
runName = forall a. Maybe a
Prelude.Nothing,
      $sel:trialComponentDisplayName:ExperimentConfig' :: Maybe Text
trialComponentDisplayName = forall a. Maybe a
Prelude.Nothing,
      $sel:trialName:ExperimentConfig' :: Maybe Text
trialName = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of an existing experiment to associate with the trial
-- component.
experimentConfig_experimentName :: Lens.Lens' ExperimentConfig (Prelude.Maybe Prelude.Text)
experimentConfig_experimentName :: Lens' ExperimentConfig (Maybe Text)
experimentConfig_experimentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExperimentConfig' {Maybe Text
experimentName :: Maybe Text
$sel:experimentName:ExperimentConfig' :: ExperimentConfig -> Maybe Text
experimentName} -> Maybe Text
experimentName) (\s :: ExperimentConfig
s@ExperimentConfig' {} Maybe Text
a -> ExperimentConfig
s {$sel:experimentName:ExperimentConfig' :: Maybe Text
experimentName = Maybe Text
a} :: ExperimentConfig)

-- | The name of the experiment run to associate with the trial component.
experimentConfig_runName :: Lens.Lens' ExperimentConfig (Prelude.Maybe Prelude.Text)
experimentConfig_runName :: Lens' ExperimentConfig (Maybe Text)
experimentConfig_runName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExperimentConfig' {Maybe Text
runName :: Maybe Text
$sel:runName:ExperimentConfig' :: ExperimentConfig -> Maybe Text
runName} -> Maybe Text
runName) (\s :: ExperimentConfig
s@ExperimentConfig' {} Maybe Text
a -> ExperimentConfig
s {$sel:runName:ExperimentConfig' :: Maybe Text
runName = Maybe Text
a} :: ExperimentConfig)

-- | The display name for the trial component. If this key isn\'t specified,
-- the display name is the trial component name.
experimentConfig_trialComponentDisplayName :: Lens.Lens' ExperimentConfig (Prelude.Maybe Prelude.Text)
experimentConfig_trialComponentDisplayName :: Lens' ExperimentConfig (Maybe Text)
experimentConfig_trialComponentDisplayName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExperimentConfig' {Maybe Text
trialComponentDisplayName :: Maybe Text
$sel:trialComponentDisplayName:ExperimentConfig' :: ExperimentConfig -> Maybe Text
trialComponentDisplayName} -> Maybe Text
trialComponentDisplayName) (\s :: ExperimentConfig
s@ExperimentConfig' {} Maybe Text
a -> ExperimentConfig
s {$sel:trialComponentDisplayName:ExperimentConfig' :: Maybe Text
trialComponentDisplayName = Maybe Text
a} :: ExperimentConfig)

-- | The name of an existing trial to associate the trial component with. If
-- not specified, a new trial is created.
experimentConfig_trialName :: Lens.Lens' ExperimentConfig (Prelude.Maybe Prelude.Text)
experimentConfig_trialName :: Lens' ExperimentConfig (Maybe Text)
experimentConfig_trialName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExperimentConfig' {Maybe Text
trialName :: Maybe Text
$sel:trialName:ExperimentConfig' :: ExperimentConfig -> Maybe Text
trialName} -> Maybe Text
trialName) (\s :: ExperimentConfig
s@ExperimentConfig' {} Maybe Text
a -> ExperimentConfig
s {$sel:trialName:ExperimentConfig' :: Maybe Text
trialName = Maybe Text
a} :: ExperimentConfig)

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

instance Prelude.Hashable ExperimentConfig where
  hashWithSalt :: Int -> ExperimentConfig -> Int
hashWithSalt Int
_salt ExperimentConfig' {Maybe Text
trialName :: Maybe Text
trialComponentDisplayName :: Maybe Text
runName :: Maybe Text
experimentName :: Maybe Text
$sel:trialName:ExperimentConfig' :: ExperimentConfig -> Maybe Text
$sel:trialComponentDisplayName:ExperimentConfig' :: ExperimentConfig -> Maybe Text
$sel:runName:ExperimentConfig' :: ExperimentConfig -> Maybe Text
$sel:experimentName:ExperimentConfig' :: ExperimentConfig -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
experimentName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
runName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
trialComponentDisplayName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
trialName

instance Prelude.NFData ExperimentConfig where
  rnf :: ExperimentConfig -> ()
rnf ExperimentConfig' {Maybe Text
trialName :: Maybe Text
trialComponentDisplayName :: Maybe Text
runName :: Maybe Text
experimentName :: Maybe Text
$sel:trialName:ExperimentConfig' :: ExperimentConfig -> Maybe Text
$sel:trialComponentDisplayName:ExperimentConfig' :: ExperimentConfig -> Maybe Text
$sel:runName:ExperimentConfig' :: ExperimentConfig -> Maybe Text
$sel:experimentName:ExperimentConfig' :: ExperimentConfig -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
experimentName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
runName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
trialComponentDisplayName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
trialName

instance Data.ToJSON ExperimentConfig where
  toJSON :: ExperimentConfig -> Value
toJSON ExperimentConfig' {Maybe Text
trialName :: Maybe Text
trialComponentDisplayName :: Maybe Text
runName :: Maybe Text
experimentName :: Maybe Text
$sel:trialName:ExperimentConfig' :: ExperimentConfig -> Maybe Text
$sel:trialComponentDisplayName:ExperimentConfig' :: ExperimentConfig -> Maybe Text
$sel:runName:ExperimentConfig' :: ExperimentConfig -> Maybe Text
$sel:experimentName:ExperimentConfig' :: ExperimentConfig -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ExperimentName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
experimentName,
            (Key
"RunName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
runName,
            (Key
"TrialComponentDisplayName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
trialComponentDisplayName,
            (Key
"TrialName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
trialName
          ]
      )