{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.KinesisVideo.Types.ChannelInfo where

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

-- | The Amazon Resource Name (ARN) of the signaling channel.
channelInfo_channelARN :: Lens.Lens' ChannelInfo (Prelude.Maybe Prelude.Text)
channelInfo_channelARN :: Lens' ChannelInfo (Maybe Text)
channelInfo_channelARN = 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)

-- | The name of the signaling channel.
channelInfo_channelName :: Lens.Lens' ChannelInfo (Prelude.Maybe Prelude.Text)
channelInfo_channelName :: Lens' ChannelInfo (Maybe Text)
channelInfo_channelName = 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)

-- | Current status of the signaling channel.
channelInfo_channelStatus :: Lens.Lens' ChannelInfo (Prelude.Maybe StreamStatus)
channelInfo_channelStatus :: Lens' ChannelInfo (Maybe StreamStatus)
channelInfo_channelStatus = 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 type of the signaling channel.
channelInfo_channelType :: Lens.Lens' ChannelInfo (Prelude.Maybe ChannelType)
channelInfo_channelType :: Lens' ChannelInfo (Maybe ChannelType)
channelInfo_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)

-- | The time at which the signaling channel was created.
channelInfo_creationTime :: Lens.Lens' ChannelInfo (Prelude.Maybe Prelude.UTCTime)
channelInfo_creationTime :: Lens' ChannelInfo (Maybe UTCTime)
channelInfo_creationTime = 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) 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

-- | A structure that contains the configuration for the @SINGLE_MASTER@
-- channel type.
channelInfo_singleMasterConfiguration :: Lens.Lens' ChannelInfo (Prelude.Maybe SingleMasterConfiguration)
channelInfo_singleMasterConfiguration :: Lens' ChannelInfo (Maybe SingleMasterConfiguration)
channelInfo_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 current version of the signaling channel.
channelInfo_version :: Lens.Lens' ChannelInfo (Prelude.Maybe Prelude.Text)
channelInfo_version :: Lens' ChannelInfo (Maybe Text)
channelInfo_version = 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)

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

instance Prelude.Hashable ChannelInfo where
  hashWithSalt :: Int -> ChannelInfo -> Int
hashWithSalt Int
_salt ChannelInfo' {Maybe Text
Maybe POSIX
Maybe ChannelType
Maybe SingleMasterConfiguration
Maybe StreamStatus
version :: Maybe Text
singleMasterConfiguration :: Maybe SingleMasterConfiguration
creationTime :: Maybe POSIX
channelType :: Maybe ChannelType
channelStatus :: Maybe StreamStatus
channelName :: Maybe Text
channelARN :: Maybe Text
$sel:version:ChannelInfo' :: ChannelInfo -> Maybe Text
$sel:singleMasterConfiguration:ChannelInfo' :: ChannelInfo -> Maybe SingleMasterConfiguration
$sel:creationTime:ChannelInfo' :: ChannelInfo -> Maybe POSIX
$sel:channelType:ChannelInfo' :: ChannelInfo -> Maybe ChannelType
$sel:channelStatus:ChannelInfo' :: ChannelInfo -> Maybe StreamStatus
$sel:channelName:ChannelInfo' :: ChannelInfo -> Maybe Text
$sel:channelARN:ChannelInfo' :: ChannelInfo -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
channelARN
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
channelName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StreamStatus
channelStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ChannelType
channelType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SingleMasterConfiguration
singleMasterConfiguration
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
version

instance Prelude.NFData ChannelInfo where
  rnf :: ChannelInfo -> ()
rnf ChannelInfo' {Maybe Text
Maybe POSIX
Maybe ChannelType
Maybe SingleMasterConfiguration
Maybe StreamStatus
version :: Maybe Text
singleMasterConfiguration :: Maybe SingleMasterConfiguration
creationTime :: Maybe POSIX
channelType :: Maybe ChannelType
channelStatus :: Maybe StreamStatus
channelName :: Maybe Text
channelARN :: Maybe Text
$sel:version:ChannelInfo' :: ChannelInfo -> Maybe Text
$sel:singleMasterConfiguration:ChannelInfo' :: ChannelInfo -> Maybe SingleMasterConfiguration
$sel:creationTime:ChannelInfo' :: ChannelInfo -> Maybe POSIX
$sel:channelType:ChannelInfo' :: ChannelInfo -> Maybe ChannelType
$sel:channelStatus:ChannelInfo' :: ChannelInfo -> Maybe StreamStatus
$sel:channelName:ChannelInfo' :: ChannelInfo -> Maybe Text
$sel:channelARN:ChannelInfo' :: ChannelInfo -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
channelARN
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
channelName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StreamStatus
channelStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ChannelType
channelType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SingleMasterConfiguration
singleMasterConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
version