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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.AutoMLJobCompletionCriteria
import Amazonka.SageMaker.Types.AutoMLSecurityConfig

-- | A collection of settings used for an AutoML job.
--
-- /See:/ 'newAutoMLJobConfig' smart constructor.
data AutoMLJobConfig = AutoMLJobConfig'
  { -- | The security configuration for traffic encryption or Amazon VPC
    -- settings.
    AutoMLJobConfig -> Maybe AutoMLSecurityConfig
securityConfig :: Prelude.Maybe AutoMLSecurityConfig,
    -- | How long an AutoML job is allowed to run, or how many candidates a job
    -- is allowed to generate.
    AutoMLJobConfig -> Maybe AutoMLJobCompletionCriteria
completionCriteria :: Prelude.Maybe AutoMLJobCompletionCriteria
  }
  deriving (AutoMLJobConfig -> AutoMLJobConfig -> Bool
(AutoMLJobConfig -> AutoMLJobConfig -> Bool)
-> (AutoMLJobConfig -> AutoMLJobConfig -> Bool)
-> Eq AutoMLJobConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoMLJobConfig -> AutoMLJobConfig -> Bool
$c/= :: AutoMLJobConfig -> AutoMLJobConfig -> Bool
== :: AutoMLJobConfig -> AutoMLJobConfig -> Bool
$c== :: AutoMLJobConfig -> AutoMLJobConfig -> Bool
Prelude.Eq, ReadPrec [AutoMLJobConfig]
ReadPrec AutoMLJobConfig
Int -> ReadS AutoMLJobConfig
ReadS [AutoMLJobConfig]
(Int -> ReadS AutoMLJobConfig)
-> ReadS [AutoMLJobConfig]
-> ReadPrec AutoMLJobConfig
-> ReadPrec [AutoMLJobConfig]
-> Read AutoMLJobConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoMLJobConfig]
$creadListPrec :: ReadPrec [AutoMLJobConfig]
readPrec :: ReadPrec AutoMLJobConfig
$creadPrec :: ReadPrec AutoMLJobConfig
readList :: ReadS [AutoMLJobConfig]
$creadList :: ReadS [AutoMLJobConfig]
readsPrec :: Int -> ReadS AutoMLJobConfig
$creadsPrec :: Int -> ReadS AutoMLJobConfig
Prelude.Read, Int -> AutoMLJobConfig -> ShowS
[AutoMLJobConfig] -> ShowS
AutoMLJobConfig -> String
(Int -> AutoMLJobConfig -> ShowS)
-> (AutoMLJobConfig -> String)
-> ([AutoMLJobConfig] -> ShowS)
-> Show AutoMLJobConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoMLJobConfig] -> ShowS
$cshowList :: [AutoMLJobConfig] -> ShowS
show :: AutoMLJobConfig -> String
$cshow :: AutoMLJobConfig -> String
showsPrec :: Int -> AutoMLJobConfig -> ShowS
$cshowsPrec :: Int -> AutoMLJobConfig -> ShowS
Prelude.Show, (forall x. AutoMLJobConfig -> Rep AutoMLJobConfig x)
-> (forall x. Rep AutoMLJobConfig x -> AutoMLJobConfig)
-> Generic AutoMLJobConfig
forall x. Rep AutoMLJobConfig x -> AutoMLJobConfig
forall x. AutoMLJobConfig -> Rep AutoMLJobConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AutoMLJobConfig x -> AutoMLJobConfig
$cfrom :: forall x. AutoMLJobConfig -> Rep AutoMLJobConfig x
Prelude.Generic)

-- |
-- Create a value of 'AutoMLJobConfig' 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:
--
-- 'securityConfig', 'autoMLJobConfig_securityConfig' - The security configuration for traffic encryption or Amazon VPC
-- settings.
--
-- 'completionCriteria', 'autoMLJobConfig_completionCriteria' - How long an AutoML job is allowed to run, or how many candidates a job
-- is allowed to generate.
newAutoMLJobConfig ::
  AutoMLJobConfig
newAutoMLJobConfig :: AutoMLJobConfig
newAutoMLJobConfig =
  AutoMLJobConfig' :: Maybe AutoMLSecurityConfig
-> Maybe AutoMLJobCompletionCriteria -> AutoMLJobConfig
AutoMLJobConfig'
    { $sel:securityConfig:AutoMLJobConfig' :: Maybe AutoMLSecurityConfig
securityConfig = Maybe AutoMLSecurityConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:completionCriteria:AutoMLJobConfig' :: Maybe AutoMLJobCompletionCriteria
completionCriteria = Maybe AutoMLJobCompletionCriteria
forall a. Maybe a
Prelude.Nothing
    }

-- | The security configuration for traffic encryption or Amazon VPC
-- settings.
autoMLJobConfig_securityConfig :: Lens.Lens' AutoMLJobConfig (Prelude.Maybe AutoMLSecurityConfig)
autoMLJobConfig_securityConfig :: (Maybe AutoMLSecurityConfig -> f (Maybe AutoMLSecurityConfig))
-> AutoMLJobConfig -> f AutoMLJobConfig
autoMLJobConfig_securityConfig = (AutoMLJobConfig -> Maybe AutoMLSecurityConfig)
-> (AutoMLJobConfig
    -> Maybe AutoMLSecurityConfig -> AutoMLJobConfig)
-> Lens
     AutoMLJobConfig
     AutoMLJobConfig
     (Maybe AutoMLSecurityConfig)
     (Maybe AutoMLSecurityConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoMLJobConfig' {Maybe AutoMLSecurityConfig
securityConfig :: Maybe AutoMLSecurityConfig
$sel:securityConfig:AutoMLJobConfig' :: AutoMLJobConfig -> Maybe AutoMLSecurityConfig
securityConfig} -> Maybe AutoMLSecurityConfig
securityConfig) (\s :: AutoMLJobConfig
s@AutoMLJobConfig' {} Maybe AutoMLSecurityConfig
a -> AutoMLJobConfig
s {$sel:securityConfig:AutoMLJobConfig' :: Maybe AutoMLSecurityConfig
securityConfig = Maybe AutoMLSecurityConfig
a} :: AutoMLJobConfig)

-- | How long an AutoML job is allowed to run, or how many candidates a job
-- is allowed to generate.
autoMLJobConfig_completionCriteria :: Lens.Lens' AutoMLJobConfig (Prelude.Maybe AutoMLJobCompletionCriteria)
autoMLJobConfig_completionCriteria :: (Maybe AutoMLJobCompletionCriteria
 -> f (Maybe AutoMLJobCompletionCriteria))
-> AutoMLJobConfig -> f AutoMLJobConfig
autoMLJobConfig_completionCriteria = (AutoMLJobConfig -> Maybe AutoMLJobCompletionCriteria)
-> (AutoMLJobConfig
    -> Maybe AutoMLJobCompletionCriteria -> AutoMLJobConfig)
-> Lens
     AutoMLJobConfig
     AutoMLJobConfig
     (Maybe AutoMLJobCompletionCriteria)
     (Maybe AutoMLJobCompletionCriteria)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoMLJobConfig' {Maybe AutoMLJobCompletionCriteria
completionCriteria :: Maybe AutoMLJobCompletionCriteria
$sel:completionCriteria:AutoMLJobConfig' :: AutoMLJobConfig -> Maybe AutoMLJobCompletionCriteria
completionCriteria} -> Maybe AutoMLJobCompletionCriteria
completionCriteria) (\s :: AutoMLJobConfig
s@AutoMLJobConfig' {} Maybe AutoMLJobCompletionCriteria
a -> AutoMLJobConfig
s {$sel:completionCriteria:AutoMLJobConfig' :: Maybe AutoMLJobCompletionCriteria
completionCriteria = Maybe AutoMLJobCompletionCriteria
a} :: AutoMLJobConfig)

instance Core.FromJSON AutoMLJobConfig where
  parseJSON :: Value -> Parser AutoMLJobConfig
parseJSON =
    String
-> (Object -> Parser AutoMLJobConfig)
-> Value
-> Parser AutoMLJobConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AutoMLJobConfig"
      ( \Object
x ->
          Maybe AutoMLSecurityConfig
-> Maybe AutoMLJobCompletionCriteria -> AutoMLJobConfig
AutoMLJobConfig'
            (Maybe AutoMLSecurityConfig
 -> Maybe AutoMLJobCompletionCriteria -> AutoMLJobConfig)
-> Parser (Maybe AutoMLSecurityConfig)
-> Parser (Maybe AutoMLJobCompletionCriteria -> AutoMLJobConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe AutoMLSecurityConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SecurityConfig")
            Parser (Maybe AutoMLJobCompletionCriteria -> AutoMLJobConfig)
-> Parser (Maybe AutoMLJobCompletionCriteria)
-> Parser AutoMLJobConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe AutoMLJobCompletionCriteria)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CompletionCriteria")
      )

instance Prelude.Hashable AutoMLJobConfig

instance Prelude.NFData AutoMLJobConfig

instance Core.ToJSON AutoMLJobConfig where
  toJSON :: AutoMLJobConfig -> Value
toJSON AutoMLJobConfig' {Maybe AutoMLJobCompletionCriteria
Maybe AutoMLSecurityConfig
completionCriteria :: Maybe AutoMLJobCompletionCriteria
securityConfig :: Maybe AutoMLSecurityConfig
$sel:completionCriteria:AutoMLJobConfig' :: AutoMLJobConfig -> Maybe AutoMLJobCompletionCriteria
$sel:securityConfig:AutoMLJobConfig' :: AutoMLJobConfig -> Maybe AutoMLSecurityConfig
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SecurityConfig" Text -> AutoMLSecurityConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AutoMLSecurityConfig -> Pair)
-> Maybe AutoMLSecurityConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AutoMLSecurityConfig
securityConfig,
            (Text
"CompletionCriteria" Text -> AutoMLJobCompletionCriteria -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AutoMLJobCompletionCriteria -> Pair)
-> Maybe AutoMLJobCompletionCriteria -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AutoMLJobCompletionCriteria
completionCriteria
          ]
      )