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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Defines under what conditions SageMaker creates a human loop. Used
-- within . See for the required format of activation conditions.
--
-- /See:/ 'newHumanLoopActivationConditionsConfig' smart constructor.
data HumanLoopActivationConditionsConfig = HumanLoopActivationConditionsConfig'
  { -- | JSON expressing use-case specific conditions declaratively. If any
    -- condition is matched, atomic tasks are created against the configured
    -- work team. The set of conditions is different for Rekognition and
    -- Textract. For more information about how to structure the JSON, see
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/a2i-human-fallback-conditions-json-schema.html JSON Schema for Human Loop Activation Conditions in Amazon Augmented AI>
    -- in the /Amazon SageMaker Developer Guide/.
    HumanLoopActivationConditionsConfig -> Text
humanLoopActivationConditions :: Prelude.Text
  }
  deriving (HumanLoopActivationConditionsConfig
-> HumanLoopActivationConditionsConfig -> Bool
(HumanLoopActivationConditionsConfig
 -> HumanLoopActivationConditionsConfig -> Bool)
-> (HumanLoopActivationConditionsConfig
    -> HumanLoopActivationConditionsConfig -> Bool)
-> Eq HumanLoopActivationConditionsConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HumanLoopActivationConditionsConfig
-> HumanLoopActivationConditionsConfig -> Bool
$c/= :: HumanLoopActivationConditionsConfig
-> HumanLoopActivationConditionsConfig -> Bool
== :: HumanLoopActivationConditionsConfig
-> HumanLoopActivationConditionsConfig -> Bool
$c== :: HumanLoopActivationConditionsConfig
-> HumanLoopActivationConditionsConfig -> Bool
Prelude.Eq, ReadPrec [HumanLoopActivationConditionsConfig]
ReadPrec HumanLoopActivationConditionsConfig
Int -> ReadS HumanLoopActivationConditionsConfig
ReadS [HumanLoopActivationConditionsConfig]
(Int -> ReadS HumanLoopActivationConditionsConfig)
-> ReadS [HumanLoopActivationConditionsConfig]
-> ReadPrec HumanLoopActivationConditionsConfig
-> ReadPrec [HumanLoopActivationConditionsConfig]
-> Read HumanLoopActivationConditionsConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HumanLoopActivationConditionsConfig]
$creadListPrec :: ReadPrec [HumanLoopActivationConditionsConfig]
readPrec :: ReadPrec HumanLoopActivationConditionsConfig
$creadPrec :: ReadPrec HumanLoopActivationConditionsConfig
readList :: ReadS [HumanLoopActivationConditionsConfig]
$creadList :: ReadS [HumanLoopActivationConditionsConfig]
readsPrec :: Int -> ReadS HumanLoopActivationConditionsConfig
$creadsPrec :: Int -> ReadS HumanLoopActivationConditionsConfig
Prelude.Read, Int -> HumanLoopActivationConditionsConfig -> ShowS
[HumanLoopActivationConditionsConfig] -> ShowS
HumanLoopActivationConditionsConfig -> String
(Int -> HumanLoopActivationConditionsConfig -> ShowS)
-> (HumanLoopActivationConditionsConfig -> String)
-> ([HumanLoopActivationConditionsConfig] -> ShowS)
-> Show HumanLoopActivationConditionsConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HumanLoopActivationConditionsConfig] -> ShowS
$cshowList :: [HumanLoopActivationConditionsConfig] -> ShowS
show :: HumanLoopActivationConditionsConfig -> String
$cshow :: HumanLoopActivationConditionsConfig -> String
showsPrec :: Int -> HumanLoopActivationConditionsConfig -> ShowS
$cshowsPrec :: Int -> HumanLoopActivationConditionsConfig -> ShowS
Prelude.Show, (forall x.
 HumanLoopActivationConditionsConfig
 -> Rep HumanLoopActivationConditionsConfig x)
-> (forall x.
    Rep HumanLoopActivationConditionsConfig x
    -> HumanLoopActivationConditionsConfig)
-> Generic HumanLoopActivationConditionsConfig
forall x.
Rep HumanLoopActivationConditionsConfig x
-> HumanLoopActivationConditionsConfig
forall x.
HumanLoopActivationConditionsConfig
-> Rep HumanLoopActivationConditionsConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep HumanLoopActivationConditionsConfig x
-> HumanLoopActivationConditionsConfig
$cfrom :: forall x.
HumanLoopActivationConditionsConfig
-> Rep HumanLoopActivationConditionsConfig x
Prelude.Generic)

-- |
-- Create a value of 'HumanLoopActivationConditionsConfig' 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:
--
-- 'humanLoopActivationConditions', 'humanLoopActivationConditionsConfig_humanLoopActivationConditions' - JSON expressing use-case specific conditions declaratively. If any
-- condition is matched, atomic tasks are created against the configured
-- work team. The set of conditions is different for Rekognition and
-- Textract. For more information about how to structure the JSON, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/a2i-human-fallback-conditions-json-schema.html JSON Schema for Human Loop Activation Conditions in Amazon Augmented AI>
-- in the /Amazon SageMaker Developer Guide/.
newHumanLoopActivationConditionsConfig ::
  -- | 'humanLoopActivationConditions'
  Prelude.Text ->
  HumanLoopActivationConditionsConfig
newHumanLoopActivationConditionsConfig :: Text -> HumanLoopActivationConditionsConfig
newHumanLoopActivationConditionsConfig
  Text
pHumanLoopActivationConditions_ =
    HumanLoopActivationConditionsConfig' :: Text -> HumanLoopActivationConditionsConfig
HumanLoopActivationConditionsConfig'
      { $sel:humanLoopActivationConditions:HumanLoopActivationConditionsConfig' :: Text
humanLoopActivationConditions =
          Text
pHumanLoopActivationConditions_
      }

-- | JSON expressing use-case specific conditions declaratively. If any
-- condition is matched, atomic tasks are created against the configured
-- work team. The set of conditions is different for Rekognition and
-- Textract. For more information about how to structure the JSON, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/a2i-human-fallback-conditions-json-schema.html JSON Schema for Human Loop Activation Conditions in Amazon Augmented AI>
-- in the /Amazon SageMaker Developer Guide/.
humanLoopActivationConditionsConfig_humanLoopActivationConditions :: Lens.Lens' HumanLoopActivationConditionsConfig Prelude.Text
humanLoopActivationConditionsConfig_humanLoopActivationConditions :: (Text -> f Text)
-> HumanLoopActivationConditionsConfig
-> f HumanLoopActivationConditionsConfig
humanLoopActivationConditionsConfig_humanLoopActivationConditions = (HumanLoopActivationConditionsConfig -> Text)
-> (HumanLoopActivationConditionsConfig
    -> Text -> HumanLoopActivationConditionsConfig)
-> Lens
     HumanLoopActivationConditionsConfig
     HumanLoopActivationConditionsConfig
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HumanLoopActivationConditionsConfig' {Text
humanLoopActivationConditions :: Text
$sel:humanLoopActivationConditions:HumanLoopActivationConditionsConfig' :: HumanLoopActivationConditionsConfig -> Text
humanLoopActivationConditions} -> Text
humanLoopActivationConditions) (\s :: HumanLoopActivationConditionsConfig
s@HumanLoopActivationConditionsConfig' {} Text
a -> HumanLoopActivationConditionsConfig
s {$sel:humanLoopActivationConditions:HumanLoopActivationConditionsConfig' :: Text
humanLoopActivationConditions = Text
a} :: HumanLoopActivationConditionsConfig)

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

instance
  Prelude.Hashable
    HumanLoopActivationConditionsConfig

instance
  Prelude.NFData
    HumanLoopActivationConditionsConfig

instance
  Core.ToJSON
    HumanLoopActivationConditionsConfig
  where
  toJSON :: HumanLoopActivationConditionsConfig -> Value
toJSON HumanLoopActivationConditionsConfig' {Text
humanLoopActivationConditions :: Text
$sel:humanLoopActivationConditions:HumanLoopActivationConditionsConfig' :: HumanLoopActivationConditionsConfig -> Text
..} =
    [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
"HumanLoopActivationConditions"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
humanLoopActivationConditions
              )
          ]
      )