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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(HumanLoopActivationConfig -> HumanLoopActivationConfig -> Bool)
-> (HumanLoopActivationConfig -> HumanLoopActivationConfig -> Bool)
-> Eq HumanLoopActivationConfig
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]
(Int -> ReadS HumanLoopActivationConfig)
-> ReadS [HumanLoopActivationConfig]
-> ReadPrec HumanLoopActivationConfig
-> ReadPrec [HumanLoopActivationConfig]
-> Read 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
(Int -> HumanLoopActivationConfig -> ShowS)
-> (HumanLoopActivationConfig -> String)
-> ([HumanLoopActivationConfig] -> ShowS)
-> Show HumanLoopActivationConfig
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.
 HumanLoopActivationConfig -> Rep HumanLoopActivationConfig x)
-> (forall x.
    Rep HumanLoopActivationConfig x -> HumanLoopActivationConfig)
-> Generic HumanLoopActivationConfig
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' :: HumanLoopActivationConditionsConfig -> HumanLoopActivationConfig
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 :: (HumanLoopActivationConditionsConfig
 -> f HumanLoopActivationConditionsConfig)
-> HumanLoopActivationConfig -> f HumanLoopActivationConfig
humanLoopActivationConfig_humanLoopActivationConditionsConfig = (HumanLoopActivationConfig -> HumanLoopActivationConditionsConfig)
-> (HumanLoopActivationConfig
    -> HumanLoopActivationConditionsConfig
    -> HumanLoopActivationConfig)
-> Lens
     HumanLoopActivationConfig
     HumanLoopActivationConfig
     HumanLoopActivationConditionsConfig
     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 Core.FromJSON HumanLoopActivationConfig where
  parseJSON :: Value -> Parser HumanLoopActivationConfig
parseJSON =
    String
-> (Object -> Parser HumanLoopActivationConfig)
-> Value
-> Parser HumanLoopActivationConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HumanLoopActivationConfig"
      ( \Object
x ->
          HumanLoopActivationConditionsConfig -> HumanLoopActivationConfig
HumanLoopActivationConfig'
            (HumanLoopActivationConditionsConfig -> HumanLoopActivationConfig)
-> Parser HumanLoopActivationConditionsConfig
-> Parser HumanLoopActivationConfig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser HumanLoopActivationConditionsConfig
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"HumanLoopActivationConditionsConfig")
      )

instance Prelude.Hashable HumanLoopActivationConfig

instance Prelude.NFData HumanLoopActivationConfig

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