{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.DescribeSignalingChannel
-- 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)
--
-- Returns the most current information about the signaling channel. You
-- must specify either the name or the Amazon Resource Name (ARN) of the
-- channel that you want to describe.
module Amazonka.KinesisVideo.DescribeSignalingChannel
  ( -- * Creating a Request
    DescribeSignalingChannel (..),
    newDescribeSignalingChannel,

    -- * Request Lenses
    describeSignalingChannel_channelARN,
    describeSignalingChannel_channelName,

    -- * Destructuring the Response
    DescribeSignalingChannelResponse (..),
    newDescribeSignalingChannelResponse,

    -- * Response Lenses
    describeSignalingChannelResponse_channelInfo,
    describeSignalingChannelResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.KinesisVideo.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeSignalingChannel' smart constructor.
data DescribeSignalingChannel = DescribeSignalingChannel'
  { -- | The ARN of the signaling channel that you want to describe.
    DescribeSignalingChannel -> Maybe Text
channelARN :: Prelude.Maybe Prelude.Text,
    -- | The name of the signaling channel that you want to describe.
    DescribeSignalingChannel -> Maybe Text
channelName :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeSignalingChannel -> DescribeSignalingChannel -> Bool
(DescribeSignalingChannel -> DescribeSignalingChannel -> Bool)
-> (DescribeSignalingChannel -> DescribeSignalingChannel -> Bool)
-> Eq DescribeSignalingChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeSignalingChannel -> DescribeSignalingChannel -> Bool
$c/= :: DescribeSignalingChannel -> DescribeSignalingChannel -> Bool
== :: DescribeSignalingChannel -> DescribeSignalingChannel -> Bool
$c== :: DescribeSignalingChannel -> DescribeSignalingChannel -> Bool
Prelude.Eq, ReadPrec [DescribeSignalingChannel]
ReadPrec DescribeSignalingChannel
Int -> ReadS DescribeSignalingChannel
ReadS [DescribeSignalingChannel]
(Int -> ReadS DescribeSignalingChannel)
-> ReadS [DescribeSignalingChannel]
-> ReadPrec DescribeSignalingChannel
-> ReadPrec [DescribeSignalingChannel]
-> Read DescribeSignalingChannel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeSignalingChannel]
$creadListPrec :: ReadPrec [DescribeSignalingChannel]
readPrec :: ReadPrec DescribeSignalingChannel
$creadPrec :: ReadPrec DescribeSignalingChannel
readList :: ReadS [DescribeSignalingChannel]
$creadList :: ReadS [DescribeSignalingChannel]
readsPrec :: Int -> ReadS DescribeSignalingChannel
$creadsPrec :: Int -> ReadS DescribeSignalingChannel
Prelude.Read, Int -> DescribeSignalingChannel -> ShowS
[DescribeSignalingChannel] -> ShowS
DescribeSignalingChannel -> String
(Int -> DescribeSignalingChannel -> ShowS)
-> (DescribeSignalingChannel -> String)
-> ([DescribeSignalingChannel] -> ShowS)
-> Show DescribeSignalingChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeSignalingChannel] -> ShowS
$cshowList :: [DescribeSignalingChannel] -> ShowS
show :: DescribeSignalingChannel -> String
$cshow :: DescribeSignalingChannel -> String
showsPrec :: Int -> DescribeSignalingChannel -> ShowS
$cshowsPrec :: Int -> DescribeSignalingChannel -> ShowS
Prelude.Show, (forall x.
 DescribeSignalingChannel -> Rep DescribeSignalingChannel x)
-> (forall x.
    Rep DescribeSignalingChannel x -> DescribeSignalingChannel)
-> Generic DescribeSignalingChannel
forall x.
Rep DescribeSignalingChannel x -> DescribeSignalingChannel
forall x.
DescribeSignalingChannel -> Rep DescribeSignalingChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeSignalingChannel x -> DescribeSignalingChannel
$cfrom :: forall x.
DescribeSignalingChannel -> Rep DescribeSignalingChannel x
Prelude.Generic)

-- |
-- Create a value of 'DescribeSignalingChannel' 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', 'describeSignalingChannel_channelARN' - The ARN of the signaling channel that you want to describe.
--
-- 'channelName', 'describeSignalingChannel_channelName' - The name of the signaling channel that you want to describe.
newDescribeSignalingChannel ::
  DescribeSignalingChannel
newDescribeSignalingChannel :: DescribeSignalingChannel
newDescribeSignalingChannel =
  DescribeSignalingChannel' :: Maybe Text -> Maybe Text -> DescribeSignalingChannel
DescribeSignalingChannel'
    { $sel:channelARN:DescribeSignalingChannel' :: Maybe Text
channelARN =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:channelName:DescribeSignalingChannel' :: Maybe Text
channelName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the signaling channel that you want to describe.
describeSignalingChannel_channelARN :: Lens.Lens' DescribeSignalingChannel (Prelude.Maybe Prelude.Text)
describeSignalingChannel_channelARN :: (Maybe Text -> f (Maybe Text))
-> DescribeSignalingChannel -> f DescribeSignalingChannel
describeSignalingChannel_channelARN = (DescribeSignalingChannel -> Maybe Text)
-> (DescribeSignalingChannel
    -> Maybe Text -> DescribeSignalingChannel)
-> Lens
     DescribeSignalingChannel
     DescribeSignalingChannel
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSignalingChannel' {Maybe Text
channelARN :: Maybe Text
$sel:channelARN:DescribeSignalingChannel' :: DescribeSignalingChannel -> Maybe Text
channelARN} -> Maybe Text
channelARN) (\s :: DescribeSignalingChannel
s@DescribeSignalingChannel' {} Maybe Text
a -> DescribeSignalingChannel
s {$sel:channelARN:DescribeSignalingChannel' :: Maybe Text
channelARN = Maybe Text
a} :: DescribeSignalingChannel)

-- | The name of the signaling channel that you want to describe.
describeSignalingChannel_channelName :: Lens.Lens' DescribeSignalingChannel (Prelude.Maybe Prelude.Text)
describeSignalingChannel_channelName :: (Maybe Text -> f (Maybe Text))
-> DescribeSignalingChannel -> f DescribeSignalingChannel
describeSignalingChannel_channelName = (DescribeSignalingChannel -> Maybe Text)
-> (DescribeSignalingChannel
    -> Maybe Text -> DescribeSignalingChannel)
-> Lens
     DescribeSignalingChannel
     DescribeSignalingChannel
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSignalingChannel' {Maybe Text
channelName :: Maybe Text
$sel:channelName:DescribeSignalingChannel' :: DescribeSignalingChannel -> Maybe Text
channelName} -> Maybe Text
channelName) (\s :: DescribeSignalingChannel
s@DescribeSignalingChannel' {} Maybe Text
a -> DescribeSignalingChannel
s {$sel:channelName:DescribeSignalingChannel' :: Maybe Text
channelName = Maybe Text
a} :: DescribeSignalingChannel)

instance Core.AWSRequest DescribeSignalingChannel where
  type
    AWSResponse DescribeSignalingChannel =
      DescribeSignalingChannelResponse
  request :: DescribeSignalingChannel -> Request DescribeSignalingChannel
request = Service
-> DescribeSignalingChannel -> Request DescribeSignalingChannel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeSignalingChannel
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeSignalingChannel)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeSignalingChannel))
-> Logger
-> Service
-> Proxy DescribeSignalingChannel
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeSignalingChannel)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe ChannelInfo -> Int -> DescribeSignalingChannelResponse
DescribeSignalingChannelResponse'
            (Maybe ChannelInfo -> Int -> DescribeSignalingChannelResponse)
-> Either String (Maybe ChannelInfo)
-> Either String (Int -> DescribeSignalingChannelResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ChannelInfo)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ChannelInfo")
            Either String (Int -> DescribeSignalingChannelResponse)
-> Either String Int
-> Either String DescribeSignalingChannelResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeSignalingChannel

instance Prelude.NFData DescribeSignalingChannel

instance Core.ToHeaders DescribeSignalingChannel where
  toHeaders :: DescribeSignalingChannel -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeSignalingChannel -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON DescribeSignalingChannel where
  toJSON :: DescribeSignalingChannel -> Value
toJSON DescribeSignalingChannel' {Maybe Text
channelName :: Maybe Text
channelARN :: Maybe Text
$sel:channelName:DescribeSignalingChannel' :: DescribeSignalingChannel -> Maybe Text
$sel:channelARN:DescribeSignalingChannel' :: DescribeSignalingChannel -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ChannelARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
channelARN,
            (Text
"ChannelName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
channelName
          ]
      )

instance Core.ToPath DescribeSignalingChannel where
  toPath :: DescribeSignalingChannel -> ByteString
toPath = ByteString -> DescribeSignalingChannel -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/describeSignalingChannel"

instance Core.ToQuery DescribeSignalingChannel where
  toQuery :: DescribeSignalingChannel -> QueryString
toQuery = QueryString -> DescribeSignalingChannel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDescribeSignalingChannelResponse' smart constructor.
data DescribeSignalingChannelResponse = DescribeSignalingChannelResponse'
  { -- | A structure that encapsulates the specified signaling channel\'s
    -- metadata and properties.
    DescribeSignalingChannelResponse -> Maybe ChannelInfo
channelInfo :: Prelude.Maybe ChannelInfo,
    -- | The response's http status code.
    DescribeSignalingChannelResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeSignalingChannelResponse
-> DescribeSignalingChannelResponse -> Bool
(DescribeSignalingChannelResponse
 -> DescribeSignalingChannelResponse -> Bool)
-> (DescribeSignalingChannelResponse
    -> DescribeSignalingChannelResponse -> Bool)
-> Eq DescribeSignalingChannelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeSignalingChannelResponse
-> DescribeSignalingChannelResponse -> Bool
$c/= :: DescribeSignalingChannelResponse
-> DescribeSignalingChannelResponse -> Bool
== :: DescribeSignalingChannelResponse
-> DescribeSignalingChannelResponse -> Bool
$c== :: DescribeSignalingChannelResponse
-> DescribeSignalingChannelResponse -> Bool
Prelude.Eq, ReadPrec [DescribeSignalingChannelResponse]
ReadPrec DescribeSignalingChannelResponse
Int -> ReadS DescribeSignalingChannelResponse
ReadS [DescribeSignalingChannelResponse]
(Int -> ReadS DescribeSignalingChannelResponse)
-> ReadS [DescribeSignalingChannelResponse]
-> ReadPrec DescribeSignalingChannelResponse
-> ReadPrec [DescribeSignalingChannelResponse]
-> Read DescribeSignalingChannelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeSignalingChannelResponse]
$creadListPrec :: ReadPrec [DescribeSignalingChannelResponse]
readPrec :: ReadPrec DescribeSignalingChannelResponse
$creadPrec :: ReadPrec DescribeSignalingChannelResponse
readList :: ReadS [DescribeSignalingChannelResponse]
$creadList :: ReadS [DescribeSignalingChannelResponse]
readsPrec :: Int -> ReadS DescribeSignalingChannelResponse
$creadsPrec :: Int -> ReadS DescribeSignalingChannelResponse
Prelude.Read, Int -> DescribeSignalingChannelResponse -> ShowS
[DescribeSignalingChannelResponse] -> ShowS
DescribeSignalingChannelResponse -> String
(Int -> DescribeSignalingChannelResponse -> ShowS)
-> (DescribeSignalingChannelResponse -> String)
-> ([DescribeSignalingChannelResponse] -> ShowS)
-> Show DescribeSignalingChannelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeSignalingChannelResponse] -> ShowS
$cshowList :: [DescribeSignalingChannelResponse] -> ShowS
show :: DescribeSignalingChannelResponse -> String
$cshow :: DescribeSignalingChannelResponse -> String
showsPrec :: Int -> DescribeSignalingChannelResponse -> ShowS
$cshowsPrec :: Int -> DescribeSignalingChannelResponse -> ShowS
Prelude.Show, (forall x.
 DescribeSignalingChannelResponse
 -> Rep DescribeSignalingChannelResponse x)
-> (forall x.
    Rep DescribeSignalingChannelResponse x
    -> DescribeSignalingChannelResponse)
-> Generic DescribeSignalingChannelResponse
forall x.
Rep DescribeSignalingChannelResponse x
-> DescribeSignalingChannelResponse
forall x.
DescribeSignalingChannelResponse
-> Rep DescribeSignalingChannelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeSignalingChannelResponse x
-> DescribeSignalingChannelResponse
$cfrom :: forall x.
DescribeSignalingChannelResponse
-> Rep DescribeSignalingChannelResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeSignalingChannelResponse' 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:
--
-- 'channelInfo', 'describeSignalingChannelResponse_channelInfo' - A structure that encapsulates the specified signaling channel\'s
-- metadata and properties.
--
-- 'httpStatus', 'describeSignalingChannelResponse_httpStatus' - The response's http status code.
newDescribeSignalingChannelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeSignalingChannelResponse
newDescribeSignalingChannelResponse :: Int -> DescribeSignalingChannelResponse
newDescribeSignalingChannelResponse Int
pHttpStatus_ =
  DescribeSignalingChannelResponse' :: Maybe ChannelInfo -> Int -> DescribeSignalingChannelResponse
DescribeSignalingChannelResponse'
    { $sel:channelInfo:DescribeSignalingChannelResponse' :: Maybe ChannelInfo
channelInfo =
        Maybe ChannelInfo
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeSignalingChannelResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A structure that encapsulates the specified signaling channel\'s
-- metadata and properties.
describeSignalingChannelResponse_channelInfo :: Lens.Lens' DescribeSignalingChannelResponse (Prelude.Maybe ChannelInfo)
describeSignalingChannelResponse_channelInfo :: (Maybe ChannelInfo -> f (Maybe ChannelInfo))
-> DescribeSignalingChannelResponse
-> f DescribeSignalingChannelResponse
describeSignalingChannelResponse_channelInfo = (DescribeSignalingChannelResponse -> Maybe ChannelInfo)
-> (DescribeSignalingChannelResponse
    -> Maybe ChannelInfo -> DescribeSignalingChannelResponse)
-> Lens
     DescribeSignalingChannelResponse
     DescribeSignalingChannelResponse
     (Maybe ChannelInfo)
     (Maybe ChannelInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSignalingChannelResponse' {Maybe ChannelInfo
channelInfo :: Maybe ChannelInfo
$sel:channelInfo:DescribeSignalingChannelResponse' :: DescribeSignalingChannelResponse -> Maybe ChannelInfo
channelInfo} -> Maybe ChannelInfo
channelInfo) (\s :: DescribeSignalingChannelResponse
s@DescribeSignalingChannelResponse' {} Maybe ChannelInfo
a -> DescribeSignalingChannelResponse
s {$sel:channelInfo:DescribeSignalingChannelResponse' :: Maybe ChannelInfo
channelInfo = Maybe ChannelInfo
a} :: DescribeSignalingChannelResponse)

-- | The response's http status code.
describeSignalingChannelResponse_httpStatus :: Lens.Lens' DescribeSignalingChannelResponse Prelude.Int
describeSignalingChannelResponse_httpStatus :: (Int -> f Int)
-> DescribeSignalingChannelResponse
-> f DescribeSignalingChannelResponse
describeSignalingChannelResponse_httpStatus = (DescribeSignalingChannelResponse -> Int)
-> (DescribeSignalingChannelResponse
    -> Int -> DescribeSignalingChannelResponse)
-> Lens
     DescribeSignalingChannelResponse
     DescribeSignalingChannelResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSignalingChannelResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeSignalingChannelResponse' :: DescribeSignalingChannelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeSignalingChannelResponse
s@DescribeSignalingChannelResponse' {} Int
a -> DescribeSignalingChannelResponse
s {$sel:httpStatus:DescribeSignalingChannelResponse' :: Int
httpStatus = Int
a} :: DescribeSignalingChannelResponse)

instance
  Prelude.NFData
    DescribeSignalingChannelResponse