{-# 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.Chime.DescribeChannelModerator
-- 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 full details of a single ChannelModerator.
--
-- The @x-amz-chime-bearer@ request header is mandatory. Use the
-- @AppInstanceUserArn@ of the user that makes the API call as the value in
-- the header.
module Amazonka.Chime.DescribeChannelModerator
  ( -- * Creating a Request
    DescribeChannelModerator (..),
    newDescribeChannelModerator,

    -- * Request Lenses
    describeChannelModerator_chimeBearer,
    describeChannelModerator_channelArn,
    describeChannelModerator_channelModeratorArn,

    -- * Destructuring the Response
    DescribeChannelModeratorResponse (..),
    newDescribeChannelModeratorResponse,

    -- * Response Lenses
    describeChannelModeratorResponse_channelModerator,
    describeChannelModeratorResponse_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

-- | /See:/ 'newDescribeChannelModerator' smart constructor.
data DescribeChannelModerator = DescribeChannelModerator'
  { -- | The @AppInstanceUserArn@ of the user that makes the API call.
    DescribeChannelModerator -> Maybe Text
chimeBearer :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the channel.
    DescribeChannelModerator -> Text
channelArn :: Prelude.Text,
    -- | The ARN of the channel moderator.
    DescribeChannelModerator -> Text
channelModeratorArn :: Prelude.Text
  }
  deriving (DescribeChannelModerator -> DescribeChannelModerator -> Bool
(DescribeChannelModerator -> DescribeChannelModerator -> Bool)
-> (DescribeChannelModerator -> DescribeChannelModerator -> Bool)
-> Eq DescribeChannelModerator
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeChannelModerator -> DescribeChannelModerator -> Bool
$c/= :: DescribeChannelModerator -> DescribeChannelModerator -> Bool
== :: DescribeChannelModerator -> DescribeChannelModerator -> Bool
$c== :: DescribeChannelModerator -> DescribeChannelModerator -> Bool
Prelude.Eq, ReadPrec [DescribeChannelModerator]
ReadPrec DescribeChannelModerator
Int -> ReadS DescribeChannelModerator
ReadS [DescribeChannelModerator]
(Int -> ReadS DescribeChannelModerator)
-> ReadS [DescribeChannelModerator]
-> ReadPrec DescribeChannelModerator
-> ReadPrec [DescribeChannelModerator]
-> Read DescribeChannelModerator
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeChannelModerator]
$creadListPrec :: ReadPrec [DescribeChannelModerator]
readPrec :: ReadPrec DescribeChannelModerator
$creadPrec :: ReadPrec DescribeChannelModerator
readList :: ReadS [DescribeChannelModerator]
$creadList :: ReadS [DescribeChannelModerator]
readsPrec :: Int -> ReadS DescribeChannelModerator
$creadsPrec :: Int -> ReadS DescribeChannelModerator
Prelude.Read, Int -> DescribeChannelModerator -> ShowS
[DescribeChannelModerator] -> ShowS
DescribeChannelModerator -> String
(Int -> DescribeChannelModerator -> ShowS)
-> (DescribeChannelModerator -> String)
-> ([DescribeChannelModerator] -> ShowS)
-> Show DescribeChannelModerator
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeChannelModerator] -> ShowS
$cshowList :: [DescribeChannelModerator] -> ShowS
show :: DescribeChannelModerator -> String
$cshow :: DescribeChannelModerator -> String
showsPrec :: Int -> DescribeChannelModerator -> ShowS
$cshowsPrec :: Int -> DescribeChannelModerator -> ShowS
Prelude.Show, (forall x.
 DescribeChannelModerator -> Rep DescribeChannelModerator x)
-> (forall x.
    Rep DescribeChannelModerator x -> DescribeChannelModerator)
-> Generic DescribeChannelModerator
forall x.
Rep DescribeChannelModerator x -> DescribeChannelModerator
forall x.
DescribeChannelModerator -> Rep DescribeChannelModerator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeChannelModerator x -> DescribeChannelModerator
$cfrom :: forall x.
DescribeChannelModerator -> Rep DescribeChannelModerator x
Prelude.Generic)

-- |
-- Create a value of 'DescribeChannelModerator' 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:
--
-- 'chimeBearer', 'describeChannelModerator_chimeBearer' - The @AppInstanceUserArn@ of the user that makes the API call.
--
-- 'channelArn', 'describeChannelModerator_channelArn' - The ARN of the channel.
--
-- 'channelModeratorArn', 'describeChannelModerator_channelModeratorArn' - The ARN of the channel moderator.
newDescribeChannelModerator ::
  -- | 'channelArn'
  Prelude.Text ->
  -- | 'channelModeratorArn'
  Prelude.Text ->
  DescribeChannelModerator
newDescribeChannelModerator :: Text -> Text -> DescribeChannelModerator
newDescribeChannelModerator
  Text
pChannelArn_
  Text
pChannelModeratorArn_ =
    DescribeChannelModerator' :: Maybe Text -> Text -> Text -> DescribeChannelModerator
DescribeChannelModerator'
      { $sel:chimeBearer:DescribeChannelModerator' :: Maybe Text
chimeBearer =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:channelArn:DescribeChannelModerator' :: Text
channelArn = Text
pChannelArn_,
        $sel:channelModeratorArn:DescribeChannelModerator' :: Text
channelModeratorArn = Text
pChannelModeratorArn_
      }

-- | The @AppInstanceUserArn@ of the user that makes the API call.
describeChannelModerator_chimeBearer :: Lens.Lens' DescribeChannelModerator (Prelude.Maybe Prelude.Text)
describeChannelModerator_chimeBearer :: (Maybe Text -> f (Maybe Text))
-> DescribeChannelModerator -> f DescribeChannelModerator
describeChannelModerator_chimeBearer = (DescribeChannelModerator -> Maybe Text)
-> (DescribeChannelModerator
    -> Maybe Text -> DescribeChannelModerator)
-> Lens
     DescribeChannelModerator
     DescribeChannelModerator
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeChannelModerator' {Maybe Text
chimeBearer :: Maybe Text
$sel:chimeBearer:DescribeChannelModerator' :: DescribeChannelModerator -> Maybe Text
chimeBearer} -> Maybe Text
chimeBearer) (\s :: DescribeChannelModerator
s@DescribeChannelModerator' {} Maybe Text
a -> DescribeChannelModerator
s {$sel:chimeBearer:DescribeChannelModerator' :: Maybe Text
chimeBearer = Maybe Text
a} :: DescribeChannelModerator)

-- | The ARN of the channel.
describeChannelModerator_channelArn :: Lens.Lens' DescribeChannelModerator Prelude.Text
describeChannelModerator_channelArn :: (Text -> f Text)
-> DescribeChannelModerator -> f DescribeChannelModerator
describeChannelModerator_channelArn = (DescribeChannelModerator -> Text)
-> (DescribeChannelModerator -> Text -> DescribeChannelModerator)
-> Lens DescribeChannelModerator DescribeChannelModerator Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeChannelModerator' {Text
channelArn :: Text
$sel:channelArn:DescribeChannelModerator' :: DescribeChannelModerator -> Text
channelArn} -> Text
channelArn) (\s :: DescribeChannelModerator
s@DescribeChannelModerator' {} Text
a -> DescribeChannelModerator
s {$sel:channelArn:DescribeChannelModerator' :: Text
channelArn = Text
a} :: DescribeChannelModerator)

-- | The ARN of the channel moderator.
describeChannelModerator_channelModeratorArn :: Lens.Lens' DescribeChannelModerator Prelude.Text
describeChannelModerator_channelModeratorArn :: (Text -> f Text)
-> DescribeChannelModerator -> f DescribeChannelModerator
describeChannelModerator_channelModeratorArn = (DescribeChannelModerator -> Text)
-> (DescribeChannelModerator -> Text -> DescribeChannelModerator)
-> Lens DescribeChannelModerator DescribeChannelModerator Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeChannelModerator' {Text
channelModeratorArn :: Text
$sel:channelModeratorArn:DescribeChannelModerator' :: DescribeChannelModerator -> Text
channelModeratorArn} -> Text
channelModeratorArn) (\s :: DescribeChannelModerator
s@DescribeChannelModerator' {} Text
a -> DescribeChannelModerator
s {$sel:channelModeratorArn:DescribeChannelModerator' :: Text
channelModeratorArn = Text
a} :: DescribeChannelModerator)

instance Core.AWSRequest DescribeChannelModerator where
  type
    AWSResponse DescribeChannelModerator =
      DescribeChannelModeratorResponse
  request :: DescribeChannelModerator -> Request DescribeChannelModerator
request = Service
-> DescribeChannelModerator -> Request DescribeChannelModerator
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeChannelModerator
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeChannelModerator)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeChannelModerator))
-> Logger
-> Service
-> Proxy DescribeChannelModerator
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeChannelModerator)))
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 ChannelModerator -> Int -> DescribeChannelModeratorResponse
DescribeChannelModeratorResponse'
            (Maybe ChannelModerator -> Int -> DescribeChannelModeratorResponse)
-> Either String (Maybe ChannelModerator)
-> Either String (Int -> DescribeChannelModeratorResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ChannelModerator)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ChannelModerator")
            Either String (Int -> DescribeChannelModeratorResponse)
-> Either String Int
-> Either String DescribeChannelModeratorResponse
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 DescribeChannelModerator

instance Prelude.NFData DescribeChannelModerator

instance Core.ToHeaders DescribeChannelModerator where
  toHeaders :: DescribeChannelModerator -> ResponseHeaders
toHeaders DescribeChannelModerator' {Maybe Text
Text
channelModeratorArn :: Text
channelArn :: Text
chimeBearer :: Maybe Text
$sel:channelModeratorArn:DescribeChannelModerator' :: DescribeChannelModerator -> Text
$sel:channelArn:DescribeChannelModerator' :: DescribeChannelModerator -> Text
$sel:chimeBearer:DescribeChannelModerator' :: DescribeChannelModerator -> 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 DescribeChannelModerator where
  toPath :: DescribeChannelModerator -> ByteString
toPath DescribeChannelModerator' {Maybe Text
Text
channelModeratorArn :: Text
channelArn :: Text
chimeBearer :: Maybe Text
$sel:channelModeratorArn:DescribeChannelModerator' :: DescribeChannelModerator -> Text
$sel:channelArn:DescribeChannelModerator' :: DescribeChannelModerator -> Text
$sel:chimeBearer:DescribeChannelModerator' :: DescribeChannelModerator -> 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,
        ByteString
"/moderators/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
channelModeratorArn
      ]

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

-- | /See:/ 'newDescribeChannelModeratorResponse' smart constructor.
data DescribeChannelModeratorResponse = DescribeChannelModeratorResponse'
  { -- | The details of the channel moderator.
    DescribeChannelModeratorResponse -> Maybe ChannelModerator
channelModerator :: Prelude.Maybe ChannelModerator,
    -- | The response's http status code.
    DescribeChannelModeratorResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeChannelModeratorResponse
-> DescribeChannelModeratorResponse -> Bool
(DescribeChannelModeratorResponse
 -> DescribeChannelModeratorResponse -> Bool)
-> (DescribeChannelModeratorResponse
    -> DescribeChannelModeratorResponse -> Bool)
-> Eq DescribeChannelModeratorResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeChannelModeratorResponse
-> DescribeChannelModeratorResponse -> Bool
$c/= :: DescribeChannelModeratorResponse
-> DescribeChannelModeratorResponse -> Bool
== :: DescribeChannelModeratorResponse
-> DescribeChannelModeratorResponse -> Bool
$c== :: DescribeChannelModeratorResponse
-> DescribeChannelModeratorResponse -> Bool
Prelude.Eq, Int -> DescribeChannelModeratorResponse -> ShowS
[DescribeChannelModeratorResponse] -> ShowS
DescribeChannelModeratorResponse -> String
(Int -> DescribeChannelModeratorResponse -> ShowS)
-> (DescribeChannelModeratorResponse -> String)
-> ([DescribeChannelModeratorResponse] -> ShowS)
-> Show DescribeChannelModeratorResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeChannelModeratorResponse] -> ShowS
$cshowList :: [DescribeChannelModeratorResponse] -> ShowS
show :: DescribeChannelModeratorResponse -> String
$cshow :: DescribeChannelModeratorResponse -> String
showsPrec :: Int -> DescribeChannelModeratorResponse -> ShowS
$cshowsPrec :: Int -> DescribeChannelModeratorResponse -> ShowS
Prelude.Show, (forall x.
 DescribeChannelModeratorResponse
 -> Rep DescribeChannelModeratorResponse x)
-> (forall x.
    Rep DescribeChannelModeratorResponse x
    -> DescribeChannelModeratorResponse)
-> Generic DescribeChannelModeratorResponse
forall x.
Rep DescribeChannelModeratorResponse x
-> DescribeChannelModeratorResponse
forall x.
DescribeChannelModeratorResponse
-> Rep DescribeChannelModeratorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeChannelModeratorResponse x
-> DescribeChannelModeratorResponse
$cfrom :: forall x.
DescribeChannelModeratorResponse
-> Rep DescribeChannelModeratorResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeChannelModeratorResponse' 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:
--
-- 'channelModerator', 'describeChannelModeratorResponse_channelModerator' - The details of the channel moderator.
--
-- 'httpStatus', 'describeChannelModeratorResponse_httpStatus' - The response's http status code.
newDescribeChannelModeratorResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeChannelModeratorResponse
newDescribeChannelModeratorResponse :: Int -> DescribeChannelModeratorResponse
newDescribeChannelModeratorResponse Int
pHttpStatus_ =
  DescribeChannelModeratorResponse' :: Maybe ChannelModerator -> Int -> DescribeChannelModeratorResponse
DescribeChannelModeratorResponse'
    { $sel:channelModerator:DescribeChannelModeratorResponse' :: Maybe ChannelModerator
channelModerator =
        Maybe ChannelModerator
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeChannelModeratorResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The details of the channel moderator.
describeChannelModeratorResponse_channelModerator :: Lens.Lens' DescribeChannelModeratorResponse (Prelude.Maybe ChannelModerator)
describeChannelModeratorResponse_channelModerator :: (Maybe ChannelModerator -> f (Maybe ChannelModerator))
-> DescribeChannelModeratorResponse
-> f DescribeChannelModeratorResponse
describeChannelModeratorResponse_channelModerator = (DescribeChannelModeratorResponse -> Maybe ChannelModerator)
-> (DescribeChannelModeratorResponse
    -> Maybe ChannelModerator -> DescribeChannelModeratorResponse)
-> Lens
     DescribeChannelModeratorResponse
     DescribeChannelModeratorResponse
     (Maybe ChannelModerator)
     (Maybe ChannelModerator)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeChannelModeratorResponse' {Maybe ChannelModerator
channelModerator :: Maybe ChannelModerator
$sel:channelModerator:DescribeChannelModeratorResponse' :: DescribeChannelModeratorResponse -> Maybe ChannelModerator
channelModerator} -> Maybe ChannelModerator
channelModerator) (\s :: DescribeChannelModeratorResponse
s@DescribeChannelModeratorResponse' {} Maybe ChannelModerator
a -> DescribeChannelModeratorResponse
s {$sel:channelModerator:DescribeChannelModeratorResponse' :: Maybe ChannelModerator
channelModerator = Maybe ChannelModerator
a} :: DescribeChannelModeratorResponse)

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

instance
  Prelude.NFData
    DescribeChannelModeratorResponse