{-# 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.HumanLoopActivationConfig
-- 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.HumanLoopActivationConfig 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
import Amazonka.SageMaker.Types.HumanLoopActivationConditionsConfig

-- | Provides information about how and under what conditions SageMaker
-- creates a human loop. If @HumanLoopActivationConfig@ is not given, then
-- all requests go to humans.
--
-- /See:/ 'newHumanLoopActivationConfig' smart constructor.
data HumanLoopActivationConfig = HumanLoopActivationConfig'
  { -- | Container structure for defining under what conditions SageMaker creates
    -- a human loop.
    HumanLoopActivationConfig -> HumanLoopActivationConditionsConfig
humanLoopActivationConditionsConfig :: HumanLoopActivationConditionsConfig
  }
  deriving (HumanLoopActivationConfig -> HumanLoopActivationConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HumanLoopActivationConfig -> HumanLoopActivationConfig -> Bool
$c/= :: HumanLoopActivationConfig -> HumanLoopActivationConfig -> Bool
== :: HumanLoopActivationConfig -> HumanLoopActivationConfig -> Bool
$c== :: HumanLoopActivationConfig -> HumanLoopActivationConfig -> Bool
Prelude.Eq, ReadPrec [HumanLoopActivationConfig]
ReadPrec HumanLoopActivationConfig
Int -> ReadS HumanLoopActivationConfig
ReadS [HumanLoopActivationConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HumanLoopActivationConfig]
$creadListPrec :: ReadPrec [HumanLoopActivationConfig]
readPrec :: ReadPrec HumanLoopActivationConfig
$creadPrec :: ReadPrec HumanLoopActivationConfig
readList :: ReadS [HumanLoopActivationConfig]
$creadList :: ReadS [HumanLoopActivationConfig]
readsPrec :: Int -> ReadS HumanLoopActivationConfig
$creadsPrec :: Int -> ReadS HumanLoopActivationConfig
Prelude.Read, Int -> HumanLoopActivationConfig -> ShowS
[HumanLoopActivationConfig] -> ShowS
HumanLoopActivationConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HumanLoopActivationConfig] -> ShowS
$cshowList :: [HumanLoopActivationConfig] -> ShowS
show :: HumanLoopActivationConfig -> String
$cshow :: HumanLoopActivationConfig -> String
showsPrec :: Int -> HumanLoopActivationConfig -> ShowS
$cshowsPrec :: Int -> HumanLoopActivationConfig -> ShowS
Prelude.Show, forall x.
Rep HumanLoopActivationConfig x -> HumanLoopActivationConfig
forall x.
HumanLoopActivationConfig -> Rep HumanLoopActivationConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep HumanLoopActivationConfig x -> HumanLoopActivationConfig
$cfrom :: forall x.
HumanLoopActivationConfig -> Rep HumanLoopActivationConfig x
Prelude.Generic)

-- |
-- Create a value of 'HumanLoopActivationConfig' 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:
--
-- 'humanLoopActivationConditionsConfig', 'humanLoopActivationConfig_humanLoopActivationConditionsConfig' - Container structure for defining under what conditions SageMaker creates
-- a human loop.
newHumanLoopActivationConfig ::
  -- | 'humanLoopActivationConditionsConfig'
  HumanLoopActivationConditionsConfig ->
  HumanLoopActivationConfig
newHumanLoopActivationConfig :: HumanLoopActivationConditionsConfig -> HumanLoopActivationConfig
newHumanLoopActivationConfig
  HumanLoopActivationConditionsConfig
pHumanLoopActivationConditionsConfig_ =
    HumanLoopActivationConfig'
      { $sel:humanLoopActivationConditionsConfig:HumanLoopActivationConfig' :: HumanLoopActivationConditionsConfig
humanLoopActivationConditionsConfig =
          HumanLoopActivationConditionsConfig
pHumanLoopActivationConditionsConfig_
      }

-- | Container structure for defining under what conditions SageMaker creates
-- a human loop.
humanLoopActivationConfig_humanLoopActivationConditionsConfig :: Lens.Lens' HumanLoopActivationConfig HumanLoopActivationConditionsConfig
humanLoopActivationConfig_humanLoopActivationConditionsConfig :: Lens' HumanLoopActivationConfig HumanLoopActivationConditionsConfig
humanLoopActivationConfig_humanLoopActivationConditionsConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HumanLoopActivationConfig' {HumanLoopActivationConditionsConfig
humanLoopActivationConditionsConfig :: HumanLoopActivationConditionsConfig
$sel:humanLoopActivationConditionsConfig:HumanLoopActivationConfig' :: HumanLoopActivationConfig -> HumanLoopActivationConditionsConfig
humanLoopActivationConditionsConfig} -> HumanLoopActivationConditionsConfig
humanLoopActivationConditionsConfig) (\s :: HumanLoopActivationConfig
s@HumanLoopActivationConfig' {} HumanLoopActivationConditionsConfig
a -> HumanLoopActivationConfig
s {$sel:humanLoopActivationConditionsConfig:HumanLoopActivationConfig' :: HumanLoopActivationConditionsConfig
humanLoopActivationConditionsConfig = HumanLoopActivationConditionsConfig
a} :: HumanLoopActivationConfig)

instance Data.FromJSON HumanLoopActivationConfig where
  parseJSON :: Value -> Parser HumanLoopActivationConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"HumanLoopActivationConfig"
      ( \Object
x ->
          HumanLoopActivationConditionsConfig -> HumanLoopActivationConfig
HumanLoopActivationConfig'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"HumanLoopActivationConditionsConfig")
      )

instance Prelude.Hashable HumanLoopActivationConfig where
  hashWithSalt :: Int -> HumanLoopActivationConfig -> Int
hashWithSalt Int
_salt HumanLoopActivationConfig' {HumanLoopActivationConditionsConfig
humanLoopActivationConditionsConfig :: HumanLoopActivationConditionsConfig
$sel:humanLoopActivationConditionsConfig:HumanLoopActivationConfig' :: HumanLoopActivationConfig -> HumanLoopActivationConditionsConfig
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` HumanLoopActivationConditionsConfig
humanLoopActivationConditionsConfig

instance Prelude.NFData HumanLoopActivationConfig where
  rnf :: HumanLoopActivationConfig -> ()
rnf HumanLoopActivationConfig' {HumanLoopActivationConditionsConfig
humanLoopActivationConditionsConfig :: HumanLoopActivationConditionsConfig
$sel:humanLoopActivationConditionsConfig:HumanLoopActivationConfig' :: HumanLoopActivationConfig -> HumanLoopActivationConditionsConfig
..} =
    forall a. NFData a => a -> ()
Prelude.rnf HumanLoopActivationConditionsConfig
humanLoopActivationConditionsConfig

instance Data.ToJSON HumanLoopActivationConfig where
  toJSON :: HumanLoopActivationConfig -> Value
toJSON HumanLoopActivationConfig' {HumanLoopActivationConditionsConfig
humanLoopActivationConditionsConfig :: HumanLoopActivationConditionsConfig
$sel:humanLoopActivationConditionsConfig:HumanLoopActivationConfig' :: HumanLoopActivationConfig -> HumanLoopActivationConditionsConfig
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"HumanLoopActivationConditionsConfig"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= HumanLoopActivationConditionsConfig
humanLoopActivationConditionsConfig
              )
          ]
      )