{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

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

-- | The ARN of the channel flow.
channelFlow_channelFlowArn :: Lens.Lens' ChannelFlow (Prelude.Maybe Prelude.Text)
channelFlow_channelFlowArn :: Lens' ChannelFlow (Maybe Text)
channelFlow_channelFlowArn = 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 time at which the channel flow was created.
channelFlow_createdTimestamp :: Lens.Lens' ChannelFlow (Prelude.Maybe Prelude.UTCTime)
channelFlow_createdTimestamp :: Lens' ChannelFlow (Maybe UTCTime)
channelFlow_createdTimestamp = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The time at which a channel flow was updated.
channelFlow_lastUpdatedTimestamp :: Lens.Lens' ChannelFlow (Prelude.Maybe Prelude.UTCTime)
channelFlow_lastUpdatedTimestamp :: Lens' ChannelFlow (Maybe UTCTime)
channelFlow_lastUpdatedTimestamp = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The name of the channel flow.
channelFlow_name :: Lens.Lens' ChannelFlow (Prelude.Maybe Prelude.Text)
channelFlow_name :: Lens' ChannelFlow (Maybe Text)
channelFlow_name = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | Information about the processor Lambda functions.
channelFlow_processors :: Lens.Lens' ChannelFlow (Prelude.Maybe (Prelude.NonEmpty Processor))
channelFlow_processors :: Lens' ChannelFlow (Maybe (NonEmpty Processor))
channelFlow_processors = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable ChannelFlow where
  hashWithSalt :: Int -> ChannelFlow -> Int
hashWithSalt Int
_salt ChannelFlow' {Maybe (NonEmpty Processor)
Maybe Text
Maybe (Sensitive Text)
Maybe POSIX
processors :: Maybe (NonEmpty Processor)
name :: Maybe (Sensitive Text)
lastUpdatedTimestamp :: Maybe POSIX
createdTimestamp :: Maybe POSIX
channelFlowArn :: Maybe Text
$sel:processors:ChannelFlow' :: ChannelFlow -> Maybe (NonEmpty Processor)
$sel:name:ChannelFlow' :: ChannelFlow -> Maybe (Sensitive Text)
$sel:lastUpdatedTimestamp:ChannelFlow' :: ChannelFlow -> Maybe POSIX
$sel:createdTimestamp:ChannelFlow' :: ChannelFlow -> Maybe POSIX
$sel:channelFlowArn:ChannelFlow' :: ChannelFlow -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
channelFlowArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Processor)
processors

instance Prelude.NFData ChannelFlow where
  rnf :: ChannelFlow -> ()
rnf ChannelFlow' {Maybe (NonEmpty Processor)
Maybe Text
Maybe (Sensitive Text)
Maybe POSIX
processors :: Maybe (NonEmpty Processor)
name :: Maybe (Sensitive Text)
lastUpdatedTimestamp :: Maybe POSIX
createdTimestamp :: Maybe POSIX
channelFlowArn :: Maybe Text
$sel:processors:ChannelFlow' :: ChannelFlow -> Maybe (NonEmpty Processor)
$sel:name:ChannelFlow' :: ChannelFlow -> Maybe (Sensitive Text)
$sel:lastUpdatedTimestamp:ChannelFlow' :: ChannelFlow -> Maybe POSIX
$sel:createdTimestamp:ChannelFlow' :: ChannelFlow -> Maybe POSIX
$sel:channelFlowArn:ChannelFlow' :: ChannelFlow -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
channelFlowArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Processor)
processors