{-# 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.KinesisVideo.Types.ChannelInfo
-- 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.KinesisVideo.Types.ChannelInfo where

import qualified Amazonka.Core as Core
import Amazonka.KinesisVideo.Types.ChannelType
import Amazonka.KinesisVideo.Types.SingleMasterConfiguration
import Amazonka.KinesisVideo.Types.StreamStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A structure that encapsulates a signaling channel\'s metadata and
-- properties.
--
-- /See:/ 'newChannelInfo' smart constructor.
data ChannelInfo = ChannelInfo'
  { -- | The time at which the signaling channel was created.
    ChannelInfo -> Maybe POSIX
creationTime :: Prelude.Maybe Core.POSIX,
    -- | Current status of the signaling channel.
    ChannelInfo -> Maybe StreamStatus
channelStatus :: Prelude.Maybe StreamStatus,
    -- | The Amazon Resource Name (ARN) of the signaling channel.
    ChannelInfo -> Maybe Text
channelARN :: Prelude.Maybe Prelude.Text,
    -- | A structure that contains the configuration for the @SINGLE_MASTER@
    -- channel type.
    ChannelInfo -> Maybe SingleMasterConfiguration
singleMasterConfiguration :: Prelude.Maybe SingleMasterConfiguration,
    -- | The name of the signaling channel.
    ChannelInfo -> Maybe Text
channelName :: Prelude.Maybe Prelude.Text,
    -- | The current version of the signaling channel.
    ChannelInfo -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
    -- | The type of the signaling channel.
    ChannelInfo -> Maybe ChannelType
channelType :: Prelude.Maybe ChannelType
  }
  deriving (ChannelInfo -> ChannelInfo -> Bool
(ChannelInfo -> ChannelInfo -> Bool)
-> (ChannelInfo -> ChannelInfo -> Bool) -> Eq ChannelInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChannelInfo -> ChannelInfo -> Bool
$c/= :: ChannelInfo -> ChannelInfo -> Bool
== :: ChannelInfo -> ChannelInfo -> Bool
$c== :: ChannelInfo -> ChannelInfo -> Bool
Prelude.Eq, ReadPrec [ChannelInfo]
ReadPrec ChannelInfo
Int -> ReadS ChannelInfo
ReadS [ChannelInfo]
(Int -> ReadS ChannelInfo)
-> ReadS [ChannelInfo]
-> ReadPrec ChannelInfo
-> ReadPrec [ChannelInfo]
-> Read ChannelInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChannelInfo]
$creadListPrec :: ReadPrec [ChannelInfo]
readPrec :: ReadPrec ChannelInfo
$creadPrec :: ReadPrec ChannelInfo
readList :: ReadS [ChannelInfo]
$creadList :: ReadS [ChannelInfo]
readsPrec :: Int -> ReadS ChannelInfo
$creadsPrec :: Int -> ReadS ChannelInfo
Prelude.Read, Int -> ChannelInfo -> ShowS
[ChannelInfo] -> ShowS
ChannelInfo -> String
(Int -> ChannelInfo -> ShowS)
-> (ChannelInfo -> String)
-> ([ChannelInfo] -> ShowS)
-> Show ChannelInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChannelInfo] -> ShowS
$cshowList :: [ChannelInfo] -> ShowS
show :: ChannelInfo -> String
$cshow :: ChannelInfo -> String
showsPrec :: Int -> ChannelInfo -> ShowS
$cshowsPrec :: Int -> ChannelInfo -> ShowS
Prelude.Show, (forall x. ChannelInfo -> Rep ChannelInfo x)
-> (forall x. Rep ChannelInfo x -> ChannelInfo)
-> Generic ChannelInfo
forall x. Rep ChannelInfo x -> ChannelInfo
forall x. ChannelInfo -> Rep ChannelInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChannelInfo x -> ChannelInfo
$cfrom :: forall x. ChannelInfo -> Rep ChannelInfo x
Prelude.Generic)

-- |
-- Create a value of 'ChannelInfo' 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', 'channelInfo_creationTime' - The time at which the signaling channel was created.
--
-- 'channelStatus', 'channelInfo_channelStatus' - Current status of the signaling channel.
--
-- 'channelARN', 'channelInfo_channelARN' - The Amazon Resource Name (ARN) of the signaling channel.
--
-- 'singleMasterConfiguration', 'channelInfo_singleMasterConfiguration' - A structure that contains the configuration for the @SINGLE_MASTER@
-- channel type.
--
-- 'channelName', 'channelInfo_channelName' - The name of the signaling channel.
--
-- 'version', 'channelInfo_version' - The current version of the signaling channel.
--
-- 'channelType', 'channelInfo_channelType' - The type of the signaling channel.
newChannelInfo ::
  ChannelInfo
newChannelInfo :: ChannelInfo
newChannelInfo =
  ChannelInfo' :: Maybe POSIX
-> Maybe StreamStatus
-> Maybe Text
-> Maybe SingleMasterConfiguration
-> Maybe Text
-> Maybe Text
-> Maybe ChannelType
-> ChannelInfo
ChannelInfo'
    { $sel:creationTime:ChannelInfo' :: Maybe POSIX
creationTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:channelStatus:ChannelInfo' :: Maybe StreamStatus
channelStatus = Maybe StreamStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:channelARN:ChannelInfo' :: Maybe Text
channelARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:singleMasterConfiguration:ChannelInfo' :: Maybe SingleMasterConfiguration
singleMasterConfiguration = Maybe SingleMasterConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:channelName:ChannelInfo' :: Maybe Text
channelName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:version:ChannelInfo' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:channelType:ChannelInfo' :: Maybe ChannelType
channelType = Maybe ChannelType
forall a. Maybe a
Prelude.Nothing
    }

-- | The time at which the signaling channel was created.
channelInfo_creationTime :: Lens.Lens' ChannelInfo (Prelude.Maybe Prelude.UTCTime)
channelInfo_creationTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ChannelInfo -> f ChannelInfo
channelInfo_creationTime = (ChannelInfo -> Maybe POSIX)
-> (ChannelInfo -> Maybe POSIX -> ChannelInfo)
-> Lens ChannelInfo ChannelInfo (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelInfo' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:ChannelInfo' :: ChannelInfo -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: ChannelInfo
s@ChannelInfo' {} Maybe POSIX
a -> ChannelInfo
s {$sel:creationTime:ChannelInfo' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: ChannelInfo) ((Maybe POSIX -> f (Maybe POSIX)) -> ChannelInfo -> f ChannelInfo)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ChannelInfo
-> f ChannelInfo
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

-- | Current status of the signaling channel.
channelInfo_channelStatus :: Lens.Lens' ChannelInfo (Prelude.Maybe StreamStatus)
channelInfo_channelStatus :: (Maybe StreamStatus -> f (Maybe StreamStatus))
-> ChannelInfo -> f ChannelInfo
channelInfo_channelStatus = (ChannelInfo -> Maybe StreamStatus)
-> (ChannelInfo -> Maybe StreamStatus -> ChannelInfo)
-> Lens
     ChannelInfo ChannelInfo (Maybe StreamStatus) (Maybe StreamStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelInfo' {Maybe StreamStatus
channelStatus :: Maybe StreamStatus
$sel:channelStatus:ChannelInfo' :: ChannelInfo -> Maybe StreamStatus
channelStatus} -> Maybe StreamStatus
channelStatus) (\s :: ChannelInfo
s@ChannelInfo' {} Maybe StreamStatus
a -> ChannelInfo
s {$sel:channelStatus:ChannelInfo' :: Maybe StreamStatus
channelStatus = Maybe StreamStatus
a} :: ChannelInfo)

-- | The Amazon Resource Name (ARN) of the signaling channel.
channelInfo_channelARN :: Lens.Lens' ChannelInfo (Prelude.Maybe Prelude.Text)
channelInfo_channelARN :: (Maybe Text -> f (Maybe Text)) -> ChannelInfo -> f ChannelInfo
channelInfo_channelARN = (ChannelInfo -> Maybe Text)
-> (ChannelInfo -> Maybe Text -> ChannelInfo)
-> Lens ChannelInfo ChannelInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelInfo' {Maybe Text
channelARN :: Maybe Text
$sel:channelARN:ChannelInfo' :: ChannelInfo -> Maybe Text
channelARN} -> Maybe Text
channelARN) (\s :: ChannelInfo
s@ChannelInfo' {} Maybe Text
a -> ChannelInfo
s {$sel:channelARN:ChannelInfo' :: Maybe Text
channelARN = Maybe Text
a} :: ChannelInfo)

-- | A structure that contains the configuration for the @SINGLE_MASTER@
-- channel type.
channelInfo_singleMasterConfiguration :: Lens.Lens' ChannelInfo (Prelude.Maybe SingleMasterConfiguration)
channelInfo_singleMasterConfiguration :: (Maybe SingleMasterConfiguration
 -> f (Maybe SingleMasterConfiguration))
-> ChannelInfo -> f ChannelInfo
channelInfo_singleMasterConfiguration = (ChannelInfo -> Maybe SingleMasterConfiguration)
-> (ChannelInfo -> Maybe SingleMasterConfiguration -> ChannelInfo)
-> Lens
     ChannelInfo
     ChannelInfo
     (Maybe SingleMasterConfiguration)
     (Maybe SingleMasterConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelInfo' {Maybe SingleMasterConfiguration
singleMasterConfiguration :: Maybe SingleMasterConfiguration
$sel:singleMasterConfiguration:ChannelInfo' :: ChannelInfo -> Maybe SingleMasterConfiguration
singleMasterConfiguration} -> Maybe SingleMasterConfiguration
singleMasterConfiguration) (\s :: ChannelInfo
s@ChannelInfo' {} Maybe SingleMasterConfiguration
a -> ChannelInfo
s {$sel:singleMasterConfiguration:ChannelInfo' :: Maybe SingleMasterConfiguration
singleMasterConfiguration = Maybe SingleMasterConfiguration
a} :: ChannelInfo)

-- | The name of the signaling channel.
channelInfo_channelName :: Lens.Lens' ChannelInfo (Prelude.Maybe Prelude.Text)
channelInfo_channelName :: (Maybe Text -> f (Maybe Text)) -> ChannelInfo -> f ChannelInfo
channelInfo_channelName = (ChannelInfo -> Maybe Text)
-> (ChannelInfo -> Maybe Text -> ChannelInfo)
-> Lens ChannelInfo ChannelInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelInfo' {Maybe Text
channelName :: Maybe Text
$sel:channelName:ChannelInfo' :: ChannelInfo -> Maybe Text
channelName} -> Maybe Text
channelName) (\s :: ChannelInfo
s@ChannelInfo' {} Maybe Text
a -> ChannelInfo
s {$sel:channelName:ChannelInfo' :: Maybe Text
channelName = Maybe Text
a} :: ChannelInfo)

-- | The current version of the signaling channel.
channelInfo_version :: Lens.Lens' ChannelInfo (Prelude.Maybe Prelude.Text)
channelInfo_version :: (Maybe Text -> f (Maybe Text)) -> ChannelInfo -> f ChannelInfo
channelInfo_version = (ChannelInfo -> Maybe Text)
-> (ChannelInfo -> Maybe Text -> ChannelInfo)
-> Lens ChannelInfo ChannelInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelInfo' {Maybe Text
version :: Maybe Text
$sel:version:ChannelInfo' :: ChannelInfo -> Maybe Text
version} -> Maybe Text
version) (\s :: ChannelInfo
s@ChannelInfo' {} Maybe Text
a -> ChannelInfo
s {$sel:version:ChannelInfo' :: Maybe Text
version = Maybe Text
a} :: ChannelInfo)

-- | The type of the signaling channel.
channelInfo_channelType :: Lens.Lens' ChannelInfo (Prelude.Maybe ChannelType)
channelInfo_channelType :: (Maybe ChannelType -> f (Maybe ChannelType))
-> ChannelInfo -> f ChannelInfo
channelInfo_channelType = (ChannelInfo -> Maybe ChannelType)
-> (ChannelInfo -> Maybe ChannelType -> ChannelInfo)
-> Lens
     ChannelInfo ChannelInfo (Maybe ChannelType) (Maybe ChannelType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChannelInfo' {Maybe ChannelType
channelType :: Maybe ChannelType
$sel:channelType:ChannelInfo' :: ChannelInfo -> Maybe ChannelType
channelType} -> Maybe ChannelType
channelType) (\s :: ChannelInfo
s@ChannelInfo' {} Maybe ChannelType
a -> ChannelInfo
s {$sel:channelType:ChannelInfo' :: Maybe ChannelType
channelType = Maybe ChannelType
a} :: ChannelInfo)

instance Core.FromJSON ChannelInfo where
  parseJSON :: Value -> Parser ChannelInfo
parseJSON =
    String
-> (Object -> Parser ChannelInfo) -> Value -> Parser ChannelInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ChannelInfo"
      ( \Object
x ->
          Maybe POSIX
-> Maybe StreamStatus
-> Maybe Text
-> Maybe SingleMasterConfiguration
-> Maybe Text
-> Maybe Text
-> Maybe ChannelType
-> ChannelInfo
ChannelInfo'
            (Maybe POSIX
 -> Maybe StreamStatus
 -> Maybe Text
 -> Maybe SingleMasterConfiguration
 -> Maybe Text
 -> Maybe Text
 -> Maybe ChannelType
 -> ChannelInfo)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe StreamStatus
      -> Maybe Text
      -> Maybe SingleMasterConfiguration
      -> Maybe Text
      -> Maybe Text
      -> Maybe ChannelType
      -> ChannelInfo)
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 StreamStatus
   -> Maybe Text
   -> Maybe SingleMasterConfiguration
   -> Maybe Text
   -> Maybe Text
   -> Maybe ChannelType
   -> ChannelInfo)
-> Parser (Maybe StreamStatus)
-> Parser
     (Maybe Text
      -> Maybe SingleMasterConfiguration
      -> Maybe Text
      -> Maybe Text
      -> Maybe ChannelType
      -> ChannelInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe StreamStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ChannelStatus")
            Parser
  (Maybe Text
   -> Maybe SingleMasterConfiguration
   -> Maybe Text
   -> Maybe Text
   -> Maybe ChannelType
   -> ChannelInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe SingleMasterConfiguration
      -> Maybe Text -> Maybe Text -> Maybe ChannelType -> ChannelInfo)
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
"ChannelARN")
            Parser
  (Maybe SingleMasterConfiguration
   -> Maybe Text -> Maybe Text -> Maybe ChannelType -> ChannelInfo)
-> Parser (Maybe SingleMasterConfiguration)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe ChannelType -> ChannelInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SingleMasterConfiguration)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SingleMasterConfiguration")
            Parser
  (Maybe Text -> Maybe Text -> Maybe ChannelType -> ChannelInfo)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe ChannelType -> ChannelInfo)
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
"ChannelName")
            Parser (Maybe Text -> Maybe ChannelType -> ChannelInfo)
-> Parser (Maybe Text) -> Parser (Maybe ChannelType -> ChannelInfo)
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
"Version")
            Parser (Maybe ChannelType -> ChannelInfo)
-> Parser (Maybe ChannelType) -> Parser ChannelInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ChannelType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ChannelType")
      )

instance Prelude.Hashable ChannelInfo

instance Prelude.NFData ChannelInfo