{-# 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.ChimeSDKMessaging.Types.ChannelFlow
-- 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.ChimeSDKMessaging.Types.ChannelFlow where

import Amazonka.ChimeSDKMessaging.Types.Processor
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The details of a channel flow.
--
-- /See:/ 'newChannelFlow' smart constructor.
data ChannelFlow = ChannelFlow'
  { -- | Information about the processor Lambda functions.
    ChannelFlow -> Maybe (NonEmpty Processor)
processors :: Prelude.Maybe (Prelude.NonEmpty Processor),
    -- | The ARN of the channel flow.
    ChannelFlow -> Maybe Text
channelFlowArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the channel flow.
    ChannelFlow -> Maybe (Sensitive Text)
name :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The time at which the channel flow was created.
    ChannelFlow -> Maybe POSIX
createdTimestamp :: Prelude.Maybe Core.POSIX,
    -- | The time at which a channel flow was updated.
    ChannelFlow -> Maybe POSIX
lastUpdatedTimestamp :: Prelude.Maybe Core.POSIX
  }
  deriving (ChannelFlow -> ChannelFlow -> Bool
(ChannelFlow -> ChannelFlow -> Bool)
-> (ChannelFlow -> ChannelFlow -> Bool) -> Eq ChannelFlow
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelFlow -> ChannelFlow -> Bool
$c/= :: ChannelFlow -> ChannelFlow -> Bool
== :: ChannelFlow -> ChannelFlow -> Bool
$c== :: ChannelFlow -> ChannelFlow -> Bool
Prelude.Eq, Int -> ChannelFlow -> ShowS
[ChannelFlow] -> ShowS
ChannelFlow -> String
(Int -> ChannelFlow -> ShowS)
-> (ChannelFlow -> String)
-> ([ChannelFlow] -> ShowS)
-> Show ChannelFlow
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelFlow] -> ShowS
$cshowList :: [ChannelFlow] -> ShowS
show :: ChannelFlow -> String
$cshow :: ChannelFlow -> String
showsPrec :: Int -> ChannelFlow -> ShowS
$cshowsPrec :: Int -> ChannelFlow -> ShowS
Prelude.Show, (forall x. ChannelFlow -> Rep ChannelFlow x)
-> (forall x. Rep ChannelFlow x -> ChannelFlow)
-> Generic ChannelFlow
forall x. Rep ChannelFlow x -> ChannelFlow
forall x. ChannelFlow -> Rep ChannelFlow x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChannelFlow x -> ChannelFlow
$cfrom :: forall x. ChannelFlow -> Rep ChannelFlow x
Prelude.Generic)

-- |
-- Create a value of 'ChannelFlow' 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:
--
-- 'processors', 'channelFlow_processors' - Information about the processor Lambda functions.
--
-- 'channelFlowArn', 'channelFlow_channelFlowArn' - The ARN of the channel flow.
--
-- 'name', 'channelFlow_name' - The name of the channel flow.
--
-- 'createdTimestamp', 'channelFlow_createdTimestamp' - The time at which the channel flow was created.
--
-- 'lastUpdatedTimestamp', 'channelFlow_lastUpdatedTimestamp' - The time at which a channel flow was updated.
newChannelFlow ::
  ChannelFlow
newChannelFlow :: ChannelFlow
newChannelFlow =
  ChannelFlow' :: Maybe (NonEmpty Processor)
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe POSIX
-> Maybe POSIX
-> ChannelFlow
ChannelFlow'
    { $sel:processors:ChannelFlow' :: Maybe (NonEmpty Processor)
processors = Maybe (NonEmpty Processor)
forall a. Maybe a
Prelude.Nothing,
      $sel:channelFlowArn:ChannelFlow' :: Maybe Text
channelFlowArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ChannelFlow' :: Maybe (Sensitive Text)
name = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTimestamp:ChannelFlow' :: Maybe POSIX
createdTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTimestamp:ChannelFlow' :: Maybe POSIX
lastUpdatedTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | Information about the processor Lambda functions.
channelFlow_processors :: Lens.Lens' ChannelFlow (Prelude.Maybe (Prelude.NonEmpty Processor))
channelFlow_processors :: (Maybe (NonEmpty Processor) -> f (Maybe (NonEmpty Processor)))
-> ChannelFlow -> f ChannelFlow
channelFlow_processors = (ChannelFlow -> Maybe (NonEmpty Processor))
-> (ChannelFlow -> Maybe (NonEmpty Processor) -> ChannelFlow)
-> Lens
     ChannelFlow
     ChannelFlow
     (Maybe (NonEmpty Processor))
     (Maybe (NonEmpty Processor))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelFlow' {Maybe (NonEmpty Processor)
processors :: Maybe (NonEmpty Processor)
$sel:processors:ChannelFlow' :: ChannelFlow -> Maybe (NonEmpty Processor)
processors} -> Maybe (NonEmpty Processor)
processors) (\s :: ChannelFlow
s@ChannelFlow' {} Maybe (NonEmpty Processor)
a -> ChannelFlow
s {$sel:processors:ChannelFlow' :: Maybe (NonEmpty Processor)
processors = Maybe (NonEmpty Processor)
a} :: ChannelFlow) ((Maybe (NonEmpty Processor) -> f (Maybe (NonEmpty Processor)))
 -> ChannelFlow -> f ChannelFlow)
-> ((Maybe (NonEmpty Processor) -> f (Maybe (NonEmpty Processor)))
    -> Maybe (NonEmpty Processor) -> f (Maybe (NonEmpty Processor)))
-> (Maybe (NonEmpty Processor) -> f (Maybe (NonEmpty Processor)))
-> ChannelFlow
-> f ChannelFlow
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Processor)
  (NonEmpty Processor)
  (NonEmpty Processor)
  (NonEmpty Processor)
-> Iso
     (Maybe (NonEmpty Processor))
     (Maybe (NonEmpty Processor))
     (Maybe (NonEmpty Processor))
     (Maybe (NonEmpty Processor))
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
  (NonEmpty Processor)
  (NonEmpty Processor)
  (NonEmpty Processor)
  (NonEmpty Processor)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ARN of the channel flow.
channelFlow_channelFlowArn :: Lens.Lens' ChannelFlow (Prelude.Maybe Prelude.Text)
channelFlow_channelFlowArn :: (Maybe Text -> f (Maybe Text)) -> ChannelFlow -> f ChannelFlow
channelFlow_channelFlowArn = (ChannelFlow -> Maybe Text)
-> (ChannelFlow -> Maybe Text -> ChannelFlow)
-> Lens ChannelFlow ChannelFlow (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelFlow' {Maybe Text
channelFlowArn :: Maybe Text
$sel:channelFlowArn:ChannelFlow' :: ChannelFlow -> Maybe Text
channelFlowArn} -> Maybe Text
channelFlowArn) (\s :: ChannelFlow
s@ChannelFlow' {} Maybe Text
a -> ChannelFlow
s {$sel:channelFlowArn:ChannelFlow' :: Maybe Text
channelFlowArn = Maybe Text
a} :: ChannelFlow)

-- | The name of the channel flow.
channelFlow_name :: Lens.Lens' ChannelFlow (Prelude.Maybe Prelude.Text)
channelFlow_name :: (Maybe Text -> f (Maybe Text)) -> ChannelFlow -> f ChannelFlow
channelFlow_name = (ChannelFlow -> Maybe (Sensitive Text))
-> (ChannelFlow -> Maybe (Sensitive Text) -> ChannelFlow)
-> Lens
     ChannelFlow
     ChannelFlow
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelFlow' {Maybe (Sensitive Text)
name :: Maybe (Sensitive Text)
$sel:name:ChannelFlow' :: ChannelFlow -> Maybe (Sensitive Text)
name} -> Maybe (Sensitive Text)
name) (\s :: ChannelFlow
s@ChannelFlow' {} Maybe (Sensitive Text)
a -> ChannelFlow
s {$sel:name:ChannelFlow' :: Maybe (Sensitive Text)
name = Maybe (Sensitive Text)
a} :: ChannelFlow) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> ChannelFlow -> f ChannelFlow)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> ChannelFlow
-> f ChannelFlow
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The time at which the channel flow was created.
channelFlow_createdTimestamp :: Lens.Lens' ChannelFlow (Prelude.Maybe Prelude.UTCTime)
channelFlow_createdTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ChannelFlow -> f ChannelFlow
channelFlow_createdTimestamp = (ChannelFlow -> Maybe POSIX)
-> (ChannelFlow -> Maybe POSIX -> ChannelFlow)
-> Lens ChannelFlow ChannelFlow (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelFlow' {Maybe POSIX
createdTimestamp :: Maybe POSIX
$sel:createdTimestamp:ChannelFlow' :: ChannelFlow -> Maybe POSIX
createdTimestamp} -> Maybe POSIX
createdTimestamp) (\s :: ChannelFlow
s@ChannelFlow' {} Maybe POSIX
a -> ChannelFlow
s {$sel:createdTimestamp:ChannelFlow' :: Maybe POSIX
createdTimestamp = Maybe POSIX
a} :: ChannelFlow) ((Maybe POSIX -> f (Maybe POSIX)) -> ChannelFlow -> f ChannelFlow)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ChannelFlow
-> f ChannelFlow
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 time at which a channel flow was updated.
channelFlow_lastUpdatedTimestamp :: Lens.Lens' ChannelFlow (Prelude.Maybe Prelude.UTCTime)
channelFlow_lastUpdatedTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ChannelFlow -> f ChannelFlow
channelFlow_lastUpdatedTimestamp = (ChannelFlow -> Maybe POSIX)
-> (ChannelFlow -> Maybe POSIX -> ChannelFlow)
-> Lens ChannelFlow ChannelFlow (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelFlow' {Maybe POSIX
lastUpdatedTimestamp :: Maybe POSIX
$sel:lastUpdatedTimestamp:ChannelFlow' :: ChannelFlow -> Maybe POSIX
lastUpdatedTimestamp} -> Maybe POSIX
lastUpdatedTimestamp) (\s :: ChannelFlow
s@ChannelFlow' {} Maybe POSIX
a -> ChannelFlow
s {$sel:lastUpdatedTimestamp:ChannelFlow' :: Maybe POSIX
lastUpdatedTimestamp = Maybe POSIX
a} :: ChannelFlow) ((Maybe POSIX -> f (Maybe POSIX)) -> ChannelFlow -> f ChannelFlow)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ChannelFlow
-> f ChannelFlow
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

instance Core.FromJSON ChannelFlow where
  parseJSON :: Value -> Parser ChannelFlow
parseJSON =
    String
-> (Object -> Parser ChannelFlow) -> Value -> Parser ChannelFlow
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ChannelFlow"
      ( \Object
x ->
          Maybe (NonEmpty Processor)
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe POSIX
-> Maybe POSIX
-> ChannelFlow
ChannelFlow'
            (Maybe (NonEmpty Processor)
 -> Maybe Text
 -> Maybe (Sensitive Text)
 -> Maybe POSIX
 -> Maybe POSIX
 -> ChannelFlow)
-> Parser (Maybe (NonEmpty Processor))
-> Parser
     (Maybe Text
      -> Maybe (Sensitive Text)
      -> Maybe POSIX
      -> Maybe POSIX
      -> ChannelFlow)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (NonEmpty Processor))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Processors")
            Parser
  (Maybe Text
   -> Maybe (Sensitive Text)
   -> Maybe POSIX
   -> Maybe POSIX
   -> ChannelFlow)
-> Parser (Maybe Text)
-> Parser
     (Maybe (Sensitive Text)
      -> Maybe POSIX -> Maybe POSIX -> ChannelFlow)
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
"ChannelFlowArn")
            Parser
  (Maybe (Sensitive Text)
   -> Maybe POSIX -> Maybe POSIX -> ChannelFlow)
-> Parser (Maybe (Sensitive Text))
-> Parser (Maybe POSIX -> Maybe POSIX -> ChannelFlow)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
            Parser (Maybe POSIX -> Maybe POSIX -> ChannelFlow)
-> Parser (Maybe POSIX) -> Parser (Maybe POSIX -> ChannelFlow)
forall (f :: * -> *) a b. Applicative f => 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
"CreatedTimestamp")
            Parser (Maybe POSIX -> ChannelFlow)
-> Parser (Maybe POSIX) -> Parser ChannelFlow
forall (f :: * -> *) a b. Applicative f => 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
"LastUpdatedTimestamp")
      )

instance Prelude.Hashable ChannelFlow

instance Prelude.NFData ChannelFlow