{-# 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.SageMakerA2IRuntime.Types.HumanLoopSummary
-- 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.SageMakerA2IRuntime.Types.HumanLoopSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMakerA2IRuntime.Types.HumanLoopStatus

-- | Summary information about the human loop.
--
-- /See:/ 'newHumanLoopSummary' smart constructor.
data HumanLoopSummary = HumanLoopSummary'
  { -- | When Amazon Augmented AI created the human loop.
    HumanLoopSummary -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
    -- | The reason why the human loop failed. A failure reason is returned when
    -- the status of the human loop is @Failed@.
    HumanLoopSummary -> Maybe Text
failureReason :: Prelude.Maybe Prelude.Text,
    -- | The status of the human loop.
    HumanLoopSummary -> Maybe HumanLoopStatus
humanLoopStatus :: Prelude.Maybe HumanLoopStatus,
    -- | The name of the human loop.
    HumanLoopSummary -> Maybe Text
humanLoopName :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the flow definition used to configure
    -- the human loop.
    HumanLoopSummary -> Maybe Text
flowDefinitionArn :: Prelude.Maybe Prelude.Text
  }
  deriving (HumanLoopSummary -> HumanLoopSummary -> Bool
(HumanLoopSummary -> HumanLoopSummary -> Bool)
-> (HumanLoopSummary -> HumanLoopSummary -> Bool)
-> Eq HumanLoopSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HumanLoopSummary -> HumanLoopSummary -> Bool
$c/= :: HumanLoopSummary -> HumanLoopSummary -> Bool
== :: HumanLoopSummary -> HumanLoopSummary -> Bool
$c== :: HumanLoopSummary -> HumanLoopSummary -> Bool
Prelude.Eq, ReadPrec [HumanLoopSummary]
ReadPrec HumanLoopSummary
Int -> ReadS HumanLoopSummary
ReadS [HumanLoopSummary]
(Int -> ReadS HumanLoopSummary)
-> ReadS [HumanLoopSummary]
-> ReadPrec HumanLoopSummary
-> ReadPrec [HumanLoopSummary]
-> Read HumanLoopSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HumanLoopSummary]
$creadListPrec :: ReadPrec [HumanLoopSummary]
readPrec :: ReadPrec HumanLoopSummary
$creadPrec :: ReadPrec HumanLoopSummary
readList :: ReadS [HumanLoopSummary]
$creadList :: ReadS [HumanLoopSummary]
readsPrec :: Int -> ReadS HumanLoopSummary
$creadsPrec :: Int -> ReadS HumanLoopSummary
Prelude.Read, Int -> HumanLoopSummary -> ShowS
[HumanLoopSummary] -> ShowS
HumanLoopSummary -> String
(Int -> HumanLoopSummary -> ShowS)
-> (HumanLoopSummary -> String)
-> ([HumanLoopSummary] -> ShowS)
-> Show HumanLoopSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HumanLoopSummary] -> ShowS
$cshowList :: [HumanLoopSummary] -> ShowS
show :: HumanLoopSummary -> String
$cshow :: HumanLoopSummary -> String
showsPrec :: Int -> HumanLoopSummary -> ShowS
$cshowsPrec :: Int -> HumanLoopSummary -> ShowS
Prelude.Show, (forall x. HumanLoopSummary -> Rep HumanLoopSummary x)
-> (forall x. Rep HumanLoopSummary x -> HumanLoopSummary)
-> Generic HumanLoopSummary
forall x. Rep HumanLoopSummary x -> HumanLoopSummary
forall x. HumanLoopSummary -> Rep HumanLoopSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HumanLoopSummary x -> HumanLoopSummary
$cfrom :: forall x. HumanLoopSummary -> Rep HumanLoopSummary x
Prelude.Generic)

-- |
-- Create a value of 'HumanLoopSummary' 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:
--
-- 'creationTime', 'humanLoopSummary_creationTime' - When Amazon Augmented AI created the human loop.
--
-- 'failureReason', 'humanLoopSummary_failureReason' - The reason why the human loop failed. A failure reason is returned when
-- the status of the human loop is @Failed@.
--
-- 'humanLoopStatus', 'humanLoopSummary_humanLoopStatus' - The status of the human loop.
--
-- 'humanLoopName', 'humanLoopSummary_humanLoopName' - The name of the human loop.
--
-- 'flowDefinitionArn', 'humanLoopSummary_flowDefinitionArn' - The Amazon Resource Name (ARN) of the flow definition used to configure
-- the human loop.
newHumanLoopSummary ::
  HumanLoopSummary
newHumanLoopSummary :: HumanLoopSummary
newHumanLoopSummary =
  HumanLoopSummary' :: Maybe POSIX
-> Maybe Text
-> Maybe HumanLoopStatus
-> Maybe Text
-> Maybe Text
-> HumanLoopSummary
HumanLoopSummary'
    { $sel:creationTime:HumanLoopSummary' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:failureReason:HumanLoopSummary' :: Maybe Text
failureReason = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:humanLoopStatus:HumanLoopSummary' :: Maybe HumanLoopStatus
humanLoopStatus = Maybe HumanLoopStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:humanLoopName:HumanLoopSummary' :: Maybe Text
humanLoopName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:flowDefinitionArn:HumanLoopSummary' :: Maybe Text
flowDefinitionArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | When Amazon Augmented AI created the human loop.
humanLoopSummary_creationTime :: Lens.Lens' HumanLoopSummary (Prelude.Maybe Prelude.UTCTime)
humanLoopSummary_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> HumanLoopSummary -> f HumanLoopSummary
humanLoopSummary_creationTime = (HumanLoopSummary -> Maybe POSIX)
-> (HumanLoopSummary -> Maybe POSIX -> HumanLoopSummary)
-> Lens
     HumanLoopSummary HumanLoopSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HumanLoopSummary' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:HumanLoopSummary' :: HumanLoopSummary -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: HumanLoopSummary
s@HumanLoopSummary' {} Maybe POSIX
a -> HumanLoopSummary
s {$sel:creationTime:HumanLoopSummary' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: HumanLoopSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> HumanLoopSummary -> f HumanLoopSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> HumanLoopSummary
-> f HumanLoopSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The reason why the human loop failed. A failure reason is returned when
-- the status of the human loop is @Failed@.
humanLoopSummary_failureReason :: Lens.Lens' HumanLoopSummary (Prelude.Maybe Prelude.Text)
humanLoopSummary_failureReason :: (Maybe Text -> f (Maybe Text))
-> HumanLoopSummary -> f HumanLoopSummary
humanLoopSummary_failureReason = (HumanLoopSummary -> Maybe Text)
-> (HumanLoopSummary -> Maybe Text -> HumanLoopSummary)
-> Lens HumanLoopSummary HumanLoopSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HumanLoopSummary' {Maybe Text
failureReason :: Maybe Text
$sel:failureReason:HumanLoopSummary' :: HumanLoopSummary -> Maybe Text
failureReason} -> Maybe Text
failureReason) (\s :: HumanLoopSummary
s@HumanLoopSummary' {} Maybe Text
a -> HumanLoopSummary
s {$sel:failureReason:HumanLoopSummary' :: Maybe Text
failureReason = Maybe Text
a} :: HumanLoopSummary)

-- | The status of the human loop.
humanLoopSummary_humanLoopStatus :: Lens.Lens' HumanLoopSummary (Prelude.Maybe HumanLoopStatus)
humanLoopSummary_humanLoopStatus :: (Maybe HumanLoopStatus -> f (Maybe HumanLoopStatus))
-> HumanLoopSummary -> f HumanLoopSummary
humanLoopSummary_humanLoopStatus = (HumanLoopSummary -> Maybe HumanLoopStatus)
-> (HumanLoopSummary -> Maybe HumanLoopStatus -> HumanLoopSummary)
-> Lens
     HumanLoopSummary
     HumanLoopSummary
     (Maybe HumanLoopStatus)
     (Maybe HumanLoopStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HumanLoopSummary' {Maybe HumanLoopStatus
humanLoopStatus :: Maybe HumanLoopStatus
$sel:humanLoopStatus:HumanLoopSummary' :: HumanLoopSummary -> Maybe HumanLoopStatus
humanLoopStatus} -> Maybe HumanLoopStatus
humanLoopStatus) (\s :: HumanLoopSummary
s@HumanLoopSummary' {} Maybe HumanLoopStatus
a -> HumanLoopSummary
s {$sel:humanLoopStatus:HumanLoopSummary' :: Maybe HumanLoopStatus
humanLoopStatus = Maybe HumanLoopStatus
a} :: HumanLoopSummary)

-- | The name of the human loop.
humanLoopSummary_humanLoopName :: Lens.Lens' HumanLoopSummary (Prelude.Maybe Prelude.Text)
humanLoopSummary_humanLoopName :: (Maybe Text -> f (Maybe Text))
-> HumanLoopSummary -> f HumanLoopSummary
humanLoopSummary_humanLoopName = (HumanLoopSummary -> Maybe Text)
-> (HumanLoopSummary -> Maybe Text -> HumanLoopSummary)
-> Lens HumanLoopSummary HumanLoopSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HumanLoopSummary' {Maybe Text
humanLoopName :: Maybe Text
$sel:humanLoopName:HumanLoopSummary' :: HumanLoopSummary -> Maybe Text
humanLoopName} -> Maybe Text
humanLoopName) (\s :: HumanLoopSummary
s@HumanLoopSummary' {} Maybe Text
a -> HumanLoopSummary
s {$sel:humanLoopName:HumanLoopSummary' :: Maybe Text
humanLoopName = Maybe Text
a} :: HumanLoopSummary)

-- | The Amazon Resource Name (ARN) of the flow definition used to configure
-- the human loop.
humanLoopSummary_flowDefinitionArn :: Lens.Lens' HumanLoopSummary (Prelude.Maybe Prelude.Text)
humanLoopSummary_flowDefinitionArn :: (Maybe Text -> f (Maybe Text))
-> HumanLoopSummary -> f HumanLoopSummary
humanLoopSummary_flowDefinitionArn = (HumanLoopSummary -> Maybe Text)
-> (HumanLoopSummary -> Maybe Text -> HumanLoopSummary)
-> Lens HumanLoopSummary HumanLoopSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HumanLoopSummary' {Maybe Text
flowDefinitionArn :: Maybe Text
$sel:flowDefinitionArn:HumanLoopSummary' :: HumanLoopSummary -> Maybe Text
flowDefinitionArn} -> Maybe Text
flowDefinitionArn) (\s :: HumanLoopSummary
s@HumanLoopSummary' {} Maybe Text
a -> HumanLoopSummary
s {$sel:flowDefinitionArn:HumanLoopSummary' :: Maybe Text
flowDefinitionArn = Maybe Text
a} :: HumanLoopSummary)

instance Core.FromJSON HumanLoopSummary where
  parseJSON :: Value -> Parser HumanLoopSummary
parseJSON =
    String
-> (Object -> Parser HumanLoopSummary)
-> Value
-> Parser HumanLoopSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"HumanLoopSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe HumanLoopStatus
-> Maybe Text
-> Maybe Text
-> HumanLoopSummary
HumanLoopSummary'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe HumanLoopStatus
 -> Maybe Text
 -> Maybe Text
 -> HumanLoopSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe HumanLoopStatus
      -> Maybe Text
      -> Maybe Text
      -> HumanLoopSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreationTime")
            Parser
  (Maybe Text
   -> Maybe HumanLoopStatus
   -> Maybe Text
   -> Maybe Text
   -> HumanLoopSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe HumanLoopStatus
      -> Maybe Text -> Maybe Text -> HumanLoopSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FailureReason")
            Parser
  (Maybe HumanLoopStatus
   -> Maybe Text -> Maybe Text -> HumanLoopSummary)
-> Parser (Maybe HumanLoopStatus)
-> Parser (Maybe Text -> Maybe Text -> HumanLoopSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HumanLoopStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HumanLoopStatus")
            Parser (Maybe Text -> Maybe Text -> HumanLoopSummary)
-> Parser (Maybe Text) -> Parser (Maybe Text -> HumanLoopSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HumanLoopName")
            Parser (Maybe Text -> HumanLoopSummary)
-> Parser (Maybe Text) -> Parser HumanLoopSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FlowDefinitionArn")
      )

instance Prelude.Hashable HumanLoopSummary

instance Prelude.NFData HumanLoopSummary