{-# 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.Personalize.Types.HPOResourceConfig
-- 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.Personalize.Types.HPOResourceConfig 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

-- | Describes the resource configuration for hyperparameter optimization
-- (HPO).
--
-- /See:/ 'newHPOResourceConfig' smart constructor.
data HPOResourceConfig = HPOResourceConfig'
  { -- | The maximum number of training jobs when you create a solution version.
    -- The maximum value for @maxNumberOfTrainingJobs@ is @40@.
    HPOResourceConfig -> Maybe Text
maxNumberOfTrainingJobs :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of parallel training jobs when you create a solution
    -- version. The maximum value for @maxParallelTrainingJobs@ is @10@.
    HPOResourceConfig -> Maybe Text
maxParallelTrainingJobs :: Prelude.Maybe Prelude.Text
  }
  deriving (HPOResourceConfig -> HPOResourceConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HPOResourceConfig -> HPOResourceConfig -> Bool
$c/= :: HPOResourceConfig -> HPOResourceConfig -> Bool
== :: HPOResourceConfig -> HPOResourceConfig -> Bool
$c== :: HPOResourceConfig -> HPOResourceConfig -> Bool
Prelude.Eq, ReadPrec [HPOResourceConfig]
ReadPrec HPOResourceConfig
Int -> ReadS HPOResourceConfig
ReadS [HPOResourceConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HPOResourceConfig]
$creadListPrec :: ReadPrec [HPOResourceConfig]
readPrec :: ReadPrec HPOResourceConfig
$creadPrec :: ReadPrec HPOResourceConfig
readList :: ReadS [HPOResourceConfig]
$creadList :: ReadS [HPOResourceConfig]
readsPrec :: Int -> ReadS HPOResourceConfig
$creadsPrec :: Int -> ReadS HPOResourceConfig
Prelude.Read, Int -> HPOResourceConfig -> ShowS
[HPOResourceConfig] -> ShowS
HPOResourceConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HPOResourceConfig] -> ShowS
$cshowList :: [HPOResourceConfig] -> ShowS
show :: HPOResourceConfig -> String
$cshow :: HPOResourceConfig -> String
showsPrec :: Int -> HPOResourceConfig -> ShowS
$cshowsPrec :: Int -> HPOResourceConfig -> ShowS
Prelude.Show, forall x. Rep HPOResourceConfig x -> HPOResourceConfig
forall x. HPOResourceConfig -> Rep HPOResourceConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HPOResourceConfig x -> HPOResourceConfig
$cfrom :: forall x. HPOResourceConfig -> Rep HPOResourceConfig x
Prelude.Generic)

-- |
-- Create a value of 'HPOResourceConfig' 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:
--
-- 'maxNumberOfTrainingJobs', 'hPOResourceConfig_maxNumberOfTrainingJobs' - The maximum number of training jobs when you create a solution version.
-- The maximum value for @maxNumberOfTrainingJobs@ is @40@.
--
-- 'maxParallelTrainingJobs', 'hPOResourceConfig_maxParallelTrainingJobs' - The maximum number of parallel training jobs when you create a solution
-- version. The maximum value for @maxParallelTrainingJobs@ is @10@.
newHPOResourceConfig ::
  HPOResourceConfig
newHPOResourceConfig :: HPOResourceConfig
newHPOResourceConfig =
  HPOResourceConfig'
    { $sel:maxNumberOfTrainingJobs:HPOResourceConfig' :: Maybe Text
maxNumberOfTrainingJobs =
        forall a. Maybe a
Prelude.Nothing,
      $sel:maxParallelTrainingJobs:HPOResourceConfig' :: Maybe Text
maxParallelTrainingJobs = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum number of training jobs when you create a solution version.
-- The maximum value for @maxNumberOfTrainingJobs@ is @40@.
hPOResourceConfig_maxNumberOfTrainingJobs :: Lens.Lens' HPOResourceConfig (Prelude.Maybe Prelude.Text)
hPOResourceConfig_maxNumberOfTrainingJobs :: Lens' HPOResourceConfig (Maybe Text)
hPOResourceConfig_maxNumberOfTrainingJobs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HPOResourceConfig' {Maybe Text
maxNumberOfTrainingJobs :: Maybe Text
$sel:maxNumberOfTrainingJobs:HPOResourceConfig' :: HPOResourceConfig -> Maybe Text
maxNumberOfTrainingJobs} -> Maybe Text
maxNumberOfTrainingJobs) (\s :: HPOResourceConfig
s@HPOResourceConfig' {} Maybe Text
a -> HPOResourceConfig
s {$sel:maxNumberOfTrainingJobs:HPOResourceConfig' :: Maybe Text
maxNumberOfTrainingJobs = Maybe Text
a} :: HPOResourceConfig)

-- | The maximum number of parallel training jobs when you create a solution
-- version. The maximum value for @maxParallelTrainingJobs@ is @10@.
hPOResourceConfig_maxParallelTrainingJobs :: Lens.Lens' HPOResourceConfig (Prelude.Maybe Prelude.Text)
hPOResourceConfig_maxParallelTrainingJobs :: Lens' HPOResourceConfig (Maybe Text)
hPOResourceConfig_maxParallelTrainingJobs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HPOResourceConfig' {Maybe Text
maxParallelTrainingJobs :: Maybe Text
$sel:maxParallelTrainingJobs:HPOResourceConfig' :: HPOResourceConfig -> Maybe Text
maxParallelTrainingJobs} -> Maybe Text
maxParallelTrainingJobs) (\s :: HPOResourceConfig
s@HPOResourceConfig' {} Maybe Text
a -> HPOResourceConfig
s {$sel:maxParallelTrainingJobs:HPOResourceConfig' :: Maybe Text
maxParallelTrainingJobs = Maybe Text
a} :: HPOResourceConfig)

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

instance Prelude.Hashable HPOResourceConfig where
  hashWithSalt :: Int -> HPOResourceConfig -> Int
hashWithSalt Int
_salt HPOResourceConfig' {Maybe Text
maxParallelTrainingJobs :: Maybe Text
maxNumberOfTrainingJobs :: Maybe Text
$sel:maxParallelTrainingJobs:HPOResourceConfig' :: HPOResourceConfig -> Maybe Text
$sel:maxNumberOfTrainingJobs:HPOResourceConfig' :: HPOResourceConfig -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
maxNumberOfTrainingJobs
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
maxParallelTrainingJobs

instance Prelude.NFData HPOResourceConfig where
  rnf :: HPOResourceConfig -> ()
rnf HPOResourceConfig' {Maybe Text
maxParallelTrainingJobs :: Maybe Text
maxNumberOfTrainingJobs :: Maybe Text
$sel:maxParallelTrainingJobs:HPOResourceConfig' :: HPOResourceConfig -> Maybe Text
$sel:maxNumberOfTrainingJobs:HPOResourceConfig' :: HPOResourceConfig -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
maxNumberOfTrainingJobs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
maxParallelTrainingJobs

instance Data.ToJSON HPOResourceConfig where
  toJSON :: HPOResourceConfig -> Value
toJSON HPOResourceConfig' {Maybe Text
maxParallelTrainingJobs :: Maybe Text
maxNumberOfTrainingJobs :: Maybe Text
$sel:maxParallelTrainingJobs:HPOResourceConfig' :: HPOResourceConfig -> Maybe Text
$sel:maxNumberOfTrainingJobs:HPOResourceConfig' :: HPOResourceConfig -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"maxNumberOfTrainingJobs" 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
maxNumberOfTrainingJobs,
            (Key
"maxParallelTrainingJobs" 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
maxParallelTrainingJobs
          ]
      )