{-# 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 #-}
module Amazonka.Chime.DescribeChannel
(
DescribeChannel (..),
newDescribeChannel,
describeChannel_chimeBearer,
describeChannel_channelArn,
DescribeChannelResponse (..),
newDescribeChannelResponse,
describeChannelResponse_channel,
describeChannelResponse_httpStatus,
)
where
import Amazonka.Chime.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data DescribeChannel = DescribeChannel'
{
DescribeChannel -> Maybe Text
chimeBearer :: Prelude.Maybe Prelude.Text,
DescribeChannel -> Text
channelArn :: Prelude.Text
}
deriving (DescribeChannel -> DescribeChannel -> Bool
(DescribeChannel -> DescribeChannel -> Bool)
-> (DescribeChannel -> DescribeChannel -> Bool)
-> Eq DescribeChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeChannel -> DescribeChannel -> Bool
$c/= :: DescribeChannel -> DescribeChannel -> Bool
== :: DescribeChannel -> DescribeChannel -> Bool
$c== :: DescribeChannel -> DescribeChannel -> Bool
Prelude.Eq, ReadPrec [DescribeChannel]
ReadPrec DescribeChannel
Int -> ReadS DescribeChannel
ReadS [DescribeChannel]
(Int -> ReadS DescribeChannel)
-> ReadS [DescribeChannel]
-> ReadPrec DescribeChannel
-> ReadPrec [DescribeChannel]
-> Read DescribeChannel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeChannel]
$creadListPrec :: ReadPrec [DescribeChannel]
readPrec :: ReadPrec DescribeChannel
$creadPrec :: ReadPrec DescribeChannel
readList :: ReadS [DescribeChannel]
$creadList :: ReadS [DescribeChannel]
readsPrec :: Int -> ReadS DescribeChannel
$creadsPrec :: Int -> ReadS DescribeChannel
Prelude.Read, Int -> DescribeChannel -> ShowS
[DescribeChannel] -> ShowS
DescribeChannel -> String
(Int -> DescribeChannel -> ShowS)
-> (DescribeChannel -> String)
-> ([DescribeChannel] -> ShowS)
-> Show DescribeChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeChannel] -> ShowS
$cshowList :: [DescribeChannel] -> ShowS
show :: DescribeChannel -> String
$cshow :: DescribeChannel -> String
showsPrec :: Int -> DescribeChannel -> ShowS
$cshowsPrec :: Int -> DescribeChannel -> ShowS
Prelude.Show, (forall x. DescribeChannel -> Rep DescribeChannel x)
-> (forall x. Rep DescribeChannel x -> DescribeChannel)
-> Generic DescribeChannel
forall x. Rep DescribeChannel x -> DescribeChannel
forall x. DescribeChannel -> Rep DescribeChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeChannel x -> DescribeChannel
$cfrom :: forall x. DescribeChannel -> Rep DescribeChannel x
Prelude.Generic)
newDescribeChannel ::
Prelude.Text ->
DescribeChannel
newDescribeChannel :: Text -> DescribeChannel
newDescribeChannel Text
pChannelArn_ =
DescribeChannel' :: Maybe Text -> Text -> DescribeChannel
DescribeChannel'
{ $sel:chimeBearer:DescribeChannel' :: Maybe Text
chimeBearer = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:channelArn:DescribeChannel' :: Text
channelArn = Text
pChannelArn_
}
describeChannel_chimeBearer :: Lens.Lens' DescribeChannel (Prelude.Maybe Prelude.Text)
describeChannel_chimeBearer :: (Maybe Text -> f (Maybe Text))
-> DescribeChannel -> f DescribeChannel
describeChannel_chimeBearer = (DescribeChannel -> Maybe Text)
-> (DescribeChannel -> Maybe Text -> DescribeChannel)
-> Lens DescribeChannel DescribeChannel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeChannel' {Maybe Text
chimeBearer :: Maybe Text
$sel:chimeBearer:DescribeChannel' :: DescribeChannel -> Maybe Text
chimeBearer} -> Maybe Text
chimeBearer) (\s :: DescribeChannel
s@DescribeChannel' {} Maybe Text
a -> DescribeChannel
s {$sel:chimeBearer:DescribeChannel' :: Maybe Text
chimeBearer = Maybe Text
a} :: DescribeChannel)
describeChannel_channelArn :: Lens.Lens' DescribeChannel Prelude.Text
describeChannel_channelArn :: (Text -> f Text) -> DescribeChannel -> f DescribeChannel
describeChannel_channelArn = (DescribeChannel -> Text)
-> (DescribeChannel -> Text -> DescribeChannel)
-> Lens DescribeChannel DescribeChannel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeChannel' {Text
channelArn :: Text
$sel:channelArn:DescribeChannel' :: DescribeChannel -> Text
channelArn} -> Text
channelArn) (\s :: DescribeChannel
s@DescribeChannel' {} Text
a -> DescribeChannel
s {$sel:channelArn:DescribeChannel' :: Text
channelArn = Text
a} :: DescribeChannel)
instance Core.AWSRequest DescribeChannel where
type
AWSResponse DescribeChannel =
DescribeChannelResponse
request :: DescribeChannel -> Request DescribeChannel
request = Service -> DescribeChannel -> Request DescribeChannel
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeChannel)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeChannel))
-> Logger
-> Service
-> Proxy DescribeChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeChannel)))
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 Channel -> Int -> DescribeChannelResponse
DescribeChannelResponse'
(Maybe Channel -> Int -> DescribeChannelResponse)
-> Either String (Maybe Channel)
-> Either String (Int -> DescribeChannelResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Channel)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Channel")
Either String (Int -> DescribeChannelResponse)
-> Either String Int -> Either String DescribeChannelResponse
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 DescribeChannel
instance Prelude.NFData DescribeChannel
instance Core.ToHeaders DescribeChannel where
toHeaders :: DescribeChannel -> ResponseHeaders
toHeaders DescribeChannel' {Maybe Text
Text
channelArn :: Text
chimeBearer :: Maybe Text
$sel:channelArn:DescribeChannel' :: DescribeChannel -> Text
$sel:chimeBearer:DescribeChannel' :: DescribeChannel -> Maybe Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[HeaderName
"x-amz-chime-bearer" HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
chimeBearer]
instance Core.ToPath DescribeChannel where
toPath :: DescribeChannel -> ByteString
toPath DescribeChannel' {Maybe Text
Text
channelArn :: Text
chimeBearer :: Maybe Text
$sel:channelArn:DescribeChannel' :: DescribeChannel -> Text
$sel:chimeBearer:DescribeChannel' :: DescribeChannel -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/channels/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
channelArn]
instance Core.ToQuery DescribeChannel where
toQuery :: DescribeChannel -> QueryString
toQuery = QueryString -> DescribeChannel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeChannelResponse = DescribeChannelResponse'
{
DescribeChannelResponse -> Maybe Channel
channel :: Prelude.Maybe Channel,
DescribeChannelResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeChannelResponse -> DescribeChannelResponse -> Bool
(DescribeChannelResponse -> DescribeChannelResponse -> Bool)
-> (DescribeChannelResponse -> DescribeChannelResponse -> Bool)
-> Eq DescribeChannelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeChannelResponse -> DescribeChannelResponse -> Bool
$c/= :: DescribeChannelResponse -> DescribeChannelResponse -> Bool
== :: DescribeChannelResponse -> DescribeChannelResponse -> Bool
$c== :: DescribeChannelResponse -> DescribeChannelResponse -> Bool
Prelude.Eq, Int -> DescribeChannelResponse -> ShowS
[DescribeChannelResponse] -> ShowS
DescribeChannelResponse -> String
(Int -> DescribeChannelResponse -> ShowS)
-> (DescribeChannelResponse -> String)
-> ([DescribeChannelResponse] -> ShowS)
-> Show DescribeChannelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeChannelResponse] -> ShowS
$cshowList :: [DescribeChannelResponse] -> ShowS
show :: DescribeChannelResponse -> String
$cshow :: DescribeChannelResponse -> String
showsPrec :: Int -> DescribeChannelResponse -> ShowS
$cshowsPrec :: Int -> DescribeChannelResponse -> ShowS
Prelude.Show, (forall x.
DescribeChannelResponse -> Rep DescribeChannelResponse x)
-> (forall x.
Rep DescribeChannelResponse x -> DescribeChannelResponse)
-> Generic DescribeChannelResponse
forall x. Rep DescribeChannelResponse x -> DescribeChannelResponse
forall x. DescribeChannelResponse -> Rep DescribeChannelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeChannelResponse x -> DescribeChannelResponse
$cfrom :: forall x. DescribeChannelResponse -> Rep DescribeChannelResponse x
Prelude.Generic)
newDescribeChannelResponse ::
Prelude.Int ->
DescribeChannelResponse
newDescribeChannelResponse :: Int -> DescribeChannelResponse
newDescribeChannelResponse Int
pHttpStatus_ =
DescribeChannelResponse' :: Maybe Channel -> Int -> DescribeChannelResponse
DescribeChannelResponse'
{ $sel:channel:DescribeChannelResponse' :: Maybe Channel
channel = Maybe Channel
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeChannelResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeChannelResponse_channel :: Lens.Lens' DescribeChannelResponse (Prelude.Maybe Channel)
describeChannelResponse_channel :: (Maybe Channel -> f (Maybe Channel))
-> DescribeChannelResponse -> f DescribeChannelResponse
describeChannelResponse_channel = (DescribeChannelResponse -> Maybe Channel)
-> (DescribeChannelResponse
-> Maybe Channel -> DescribeChannelResponse)
-> Lens
DescribeChannelResponse
DescribeChannelResponse
(Maybe Channel)
(Maybe Channel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeChannelResponse' {Maybe Channel
channel :: Maybe Channel
$sel:channel:DescribeChannelResponse' :: DescribeChannelResponse -> Maybe Channel
channel} -> Maybe Channel
channel) (\s :: DescribeChannelResponse
s@DescribeChannelResponse' {} Maybe Channel
a -> DescribeChannelResponse
s {$sel:channel:DescribeChannelResponse' :: Maybe Channel
channel = Maybe Channel
a} :: DescribeChannelResponse)
describeChannelResponse_httpStatus :: Lens.Lens' DescribeChannelResponse Prelude.Int
describeChannelResponse_httpStatus :: (Int -> f Int)
-> DescribeChannelResponse -> f DescribeChannelResponse
describeChannelResponse_httpStatus = (DescribeChannelResponse -> Int)
-> (DescribeChannelResponse -> Int -> DescribeChannelResponse)
-> Lens DescribeChannelResponse DescribeChannelResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeChannelResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeChannelResponse' :: DescribeChannelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeChannelResponse
s@DescribeChannelResponse' {} Int
a -> DescribeChannelResponse
s {$sel:httpStatus:DescribeChannelResponse' :: Int
httpStatus = Int
a} :: DescribeChannelResponse)
instance Prelude.NFData DescribeChannelResponse