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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.FlowDefinitionStatus

-- | Contains summary information about the flow definition.
--
-- /See:/ 'newFlowDefinitionSummary' smart constructor.
data FlowDefinitionSummary = FlowDefinitionSummary'
  { -- | The reason why the flow definition creation failed. A failure reason is
    -- returned only when the flow definition status is @Failed@.
    FlowDefinitionSummary -> Maybe Text
failureReason :: Prelude.Maybe Prelude.Text,
    -- | The name of the flow definition.
    FlowDefinitionSummary -> Text
flowDefinitionName :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the flow definition.
    FlowDefinitionSummary -> Text
flowDefinitionArn :: Prelude.Text,
    -- | The status of the flow definition. Valid values:
    FlowDefinitionSummary -> FlowDefinitionStatus
flowDefinitionStatus :: FlowDefinitionStatus,
    -- | The timestamp when SageMaker created the flow definition.
    FlowDefinitionSummary -> POSIX
creationTime :: Core.POSIX
  }
  deriving (FlowDefinitionSummary -> FlowDefinitionSummary -> Bool
(FlowDefinitionSummary -> FlowDefinitionSummary -> Bool)
-> (FlowDefinitionSummary -> FlowDefinitionSummary -> Bool)
-> Eq FlowDefinitionSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FlowDefinitionSummary -> FlowDefinitionSummary -> Bool
$c/= :: FlowDefinitionSummary -> FlowDefinitionSummary -> Bool
== :: FlowDefinitionSummary -> FlowDefinitionSummary -> Bool
$c== :: FlowDefinitionSummary -> FlowDefinitionSummary -> Bool
Prelude.Eq, ReadPrec [FlowDefinitionSummary]
ReadPrec FlowDefinitionSummary
Int -> ReadS FlowDefinitionSummary
ReadS [FlowDefinitionSummary]
(Int -> ReadS FlowDefinitionSummary)
-> ReadS [FlowDefinitionSummary]
-> ReadPrec FlowDefinitionSummary
-> ReadPrec [FlowDefinitionSummary]
-> Read FlowDefinitionSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FlowDefinitionSummary]
$creadListPrec :: ReadPrec [FlowDefinitionSummary]
readPrec :: ReadPrec FlowDefinitionSummary
$creadPrec :: ReadPrec FlowDefinitionSummary
readList :: ReadS [FlowDefinitionSummary]
$creadList :: ReadS [FlowDefinitionSummary]
readsPrec :: Int -> ReadS FlowDefinitionSummary
$creadsPrec :: Int -> ReadS FlowDefinitionSummary
Prelude.Read, Int -> FlowDefinitionSummary -> ShowS
[FlowDefinitionSummary] -> ShowS
FlowDefinitionSummary -> String
(Int -> FlowDefinitionSummary -> ShowS)
-> (FlowDefinitionSummary -> String)
-> ([FlowDefinitionSummary] -> ShowS)
-> Show FlowDefinitionSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FlowDefinitionSummary] -> ShowS
$cshowList :: [FlowDefinitionSummary] -> ShowS
show :: FlowDefinitionSummary -> String
$cshow :: FlowDefinitionSummary -> String
showsPrec :: Int -> FlowDefinitionSummary -> ShowS
$cshowsPrec :: Int -> FlowDefinitionSummary -> ShowS
Prelude.Show, (forall x. FlowDefinitionSummary -> Rep FlowDefinitionSummary x)
-> (forall x. Rep FlowDefinitionSummary x -> FlowDefinitionSummary)
-> Generic FlowDefinitionSummary
forall x. Rep FlowDefinitionSummary x -> FlowDefinitionSummary
forall x. FlowDefinitionSummary -> Rep FlowDefinitionSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FlowDefinitionSummary x -> FlowDefinitionSummary
$cfrom :: forall x. FlowDefinitionSummary -> Rep FlowDefinitionSummary x
Prelude.Generic)

-- |
-- Create a value of 'FlowDefinitionSummary' 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:
--
-- 'failureReason', 'flowDefinitionSummary_failureReason' - The reason why the flow definition creation failed. A failure reason is
-- returned only when the flow definition status is @Failed@.
--
-- 'flowDefinitionName', 'flowDefinitionSummary_flowDefinitionName' - The name of the flow definition.
--
-- 'flowDefinitionArn', 'flowDefinitionSummary_flowDefinitionArn' - The Amazon Resource Name (ARN) of the flow definition.
--
-- 'flowDefinitionStatus', 'flowDefinitionSummary_flowDefinitionStatus' - The status of the flow definition. Valid values:
--
-- 'creationTime', 'flowDefinitionSummary_creationTime' - The timestamp when SageMaker created the flow definition.
newFlowDefinitionSummary ::
  -- | 'flowDefinitionName'
  Prelude.Text ->
  -- | 'flowDefinitionArn'
  Prelude.Text ->
  -- | 'flowDefinitionStatus'
  FlowDefinitionStatus ->
  -- | 'creationTime'
  Prelude.UTCTime ->
  FlowDefinitionSummary
newFlowDefinitionSummary :: Text
-> Text -> FlowDefinitionStatus -> UTCTime -> FlowDefinitionSummary
newFlowDefinitionSummary
  Text
pFlowDefinitionName_
  Text
pFlowDefinitionArn_
  FlowDefinitionStatus
pFlowDefinitionStatus_
  UTCTime
pCreationTime_ =
    FlowDefinitionSummary' :: Maybe Text
-> Text
-> Text
-> FlowDefinitionStatus
-> POSIX
-> FlowDefinitionSummary
FlowDefinitionSummary'
      { $sel:failureReason:FlowDefinitionSummary' :: Maybe Text
failureReason =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:flowDefinitionName:FlowDefinitionSummary' :: Text
flowDefinitionName = Text
pFlowDefinitionName_,
        $sel:flowDefinitionArn:FlowDefinitionSummary' :: Text
flowDefinitionArn = Text
pFlowDefinitionArn_,
        $sel:flowDefinitionStatus:FlowDefinitionSummary' :: FlowDefinitionStatus
flowDefinitionStatus = FlowDefinitionStatus
pFlowDefinitionStatus_,
        $sel:creationTime:FlowDefinitionSummary' :: POSIX
creationTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationTime_
      }

-- | The reason why the flow definition creation failed. A failure reason is
-- returned only when the flow definition status is @Failed@.
flowDefinitionSummary_failureReason :: Lens.Lens' FlowDefinitionSummary (Prelude.Maybe Prelude.Text)
flowDefinitionSummary_failureReason :: (Maybe Text -> f (Maybe Text))
-> FlowDefinitionSummary -> f FlowDefinitionSummary
flowDefinitionSummary_failureReason = (FlowDefinitionSummary -> Maybe Text)
-> (FlowDefinitionSummary -> Maybe Text -> FlowDefinitionSummary)
-> Lens
     FlowDefinitionSummary
     FlowDefinitionSummary
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowDefinitionSummary' {Maybe Text
failureReason :: Maybe Text
$sel:failureReason:FlowDefinitionSummary' :: FlowDefinitionSummary -> Maybe Text
failureReason} -> Maybe Text
failureReason) (\s :: FlowDefinitionSummary
s@FlowDefinitionSummary' {} Maybe Text
a -> FlowDefinitionSummary
s {$sel:failureReason:FlowDefinitionSummary' :: Maybe Text
failureReason = Maybe Text
a} :: FlowDefinitionSummary)

-- | The name of the flow definition.
flowDefinitionSummary_flowDefinitionName :: Lens.Lens' FlowDefinitionSummary Prelude.Text
flowDefinitionSummary_flowDefinitionName :: (Text -> f Text)
-> FlowDefinitionSummary -> f FlowDefinitionSummary
flowDefinitionSummary_flowDefinitionName = (FlowDefinitionSummary -> Text)
-> (FlowDefinitionSummary -> Text -> FlowDefinitionSummary)
-> Lens FlowDefinitionSummary FlowDefinitionSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowDefinitionSummary' {Text
flowDefinitionName :: Text
$sel:flowDefinitionName:FlowDefinitionSummary' :: FlowDefinitionSummary -> Text
flowDefinitionName} -> Text
flowDefinitionName) (\s :: FlowDefinitionSummary
s@FlowDefinitionSummary' {} Text
a -> FlowDefinitionSummary
s {$sel:flowDefinitionName:FlowDefinitionSummary' :: Text
flowDefinitionName = Text
a} :: FlowDefinitionSummary)

-- | The Amazon Resource Name (ARN) of the flow definition.
flowDefinitionSummary_flowDefinitionArn :: Lens.Lens' FlowDefinitionSummary Prelude.Text
flowDefinitionSummary_flowDefinitionArn :: (Text -> f Text)
-> FlowDefinitionSummary -> f FlowDefinitionSummary
flowDefinitionSummary_flowDefinitionArn = (FlowDefinitionSummary -> Text)
-> (FlowDefinitionSummary -> Text -> FlowDefinitionSummary)
-> Lens FlowDefinitionSummary FlowDefinitionSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowDefinitionSummary' {Text
flowDefinitionArn :: Text
$sel:flowDefinitionArn:FlowDefinitionSummary' :: FlowDefinitionSummary -> Text
flowDefinitionArn} -> Text
flowDefinitionArn) (\s :: FlowDefinitionSummary
s@FlowDefinitionSummary' {} Text
a -> FlowDefinitionSummary
s {$sel:flowDefinitionArn:FlowDefinitionSummary' :: Text
flowDefinitionArn = Text
a} :: FlowDefinitionSummary)

-- | The status of the flow definition. Valid values:
flowDefinitionSummary_flowDefinitionStatus :: Lens.Lens' FlowDefinitionSummary FlowDefinitionStatus
flowDefinitionSummary_flowDefinitionStatus :: (FlowDefinitionStatus -> f FlowDefinitionStatus)
-> FlowDefinitionSummary -> f FlowDefinitionSummary
flowDefinitionSummary_flowDefinitionStatus = (FlowDefinitionSummary -> FlowDefinitionStatus)
-> (FlowDefinitionSummary
    -> FlowDefinitionStatus -> FlowDefinitionSummary)
-> Lens
     FlowDefinitionSummary
     FlowDefinitionSummary
     FlowDefinitionStatus
     FlowDefinitionStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowDefinitionSummary' {FlowDefinitionStatus
flowDefinitionStatus :: FlowDefinitionStatus
$sel:flowDefinitionStatus:FlowDefinitionSummary' :: FlowDefinitionSummary -> FlowDefinitionStatus
flowDefinitionStatus} -> FlowDefinitionStatus
flowDefinitionStatus) (\s :: FlowDefinitionSummary
s@FlowDefinitionSummary' {} FlowDefinitionStatus
a -> FlowDefinitionSummary
s {$sel:flowDefinitionStatus:FlowDefinitionSummary' :: FlowDefinitionStatus
flowDefinitionStatus = FlowDefinitionStatus
a} :: FlowDefinitionSummary)

-- | The timestamp when SageMaker created the flow definition.
flowDefinitionSummary_creationTime :: Lens.Lens' FlowDefinitionSummary Prelude.UTCTime
flowDefinitionSummary_creationTime :: (UTCTime -> f UTCTime)
-> FlowDefinitionSummary -> f FlowDefinitionSummary
flowDefinitionSummary_creationTime = (FlowDefinitionSummary -> POSIX)
-> (FlowDefinitionSummary -> POSIX -> FlowDefinitionSummary)
-> Lens FlowDefinitionSummary FlowDefinitionSummary POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FlowDefinitionSummary' {POSIX
creationTime :: POSIX
$sel:creationTime:FlowDefinitionSummary' :: FlowDefinitionSummary -> POSIX
creationTime} -> POSIX
creationTime) (\s :: FlowDefinitionSummary
s@FlowDefinitionSummary' {} POSIX
a -> FlowDefinitionSummary
s {$sel:creationTime:FlowDefinitionSummary' :: POSIX
creationTime = POSIX
a} :: FlowDefinitionSummary) ((POSIX -> f POSIX)
 -> FlowDefinitionSummary -> f FlowDefinitionSummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> FlowDefinitionSummary
-> f FlowDefinitionSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON FlowDefinitionSummary where
  parseJSON :: Value -> Parser FlowDefinitionSummary
parseJSON =
    String
-> (Object -> Parser FlowDefinitionSummary)
-> Value
-> Parser FlowDefinitionSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FlowDefinitionSummary"
      ( \Object
x ->
          Maybe Text
-> Text
-> Text
-> FlowDefinitionStatus
-> POSIX
-> FlowDefinitionSummary
FlowDefinitionSummary'
            (Maybe Text
 -> Text
 -> Text
 -> FlowDefinitionStatus
 -> POSIX
 -> FlowDefinitionSummary)
-> Parser (Maybe Text)
-> Parser
     (Text
      -> Text -> FlowDefinitionStatus -> POSIX -> FlowDefinitionSummary)
forall (f :: * -> *) a b. Functor 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
  (Text
   -> Text -> FlowDefinitionStatus -> POSIX -> FlowDefinitionSummary)
-> Parser Text
-> Parser
     (Text -> FlowDefinitionStatus -> POSIX -> FlowDefinitionSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"FlowDefinitionName")
            Parser
  (Text -> FlowDefinitionStatus -> POSIX -> FlowDefinitionSummary)
-> Parser Text
-> Parser (FlowDefinitionStatus -> POSIX -> FlowDefinitionSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"FlowDefinitionArn")
            Parser (FlowDefinitionStatus -> POSIX -> FlowDefinitionSummary)
-> Parser FlowDefinitionStatus
-> Parser (POSIX -> FlowDefinitionSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser FlowDefinitionStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"FlowDefinitionStatus")
            Parser (POSIX -> FlowDefinitionSummary)
-> Parser POSIX -> Parser FlowDefinitionSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"CreationTime")
      )

instance Prelude.Hashable FlowDefinitionSummary

instance Prelude.NFData FlowDefinitionSummary