{-# 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.ChimeSDKMessaging.DescribeChannelModerator
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.ChimeSDKMessaging.DescribeChannelModerator
  ( -- * Creating a Request
    DescribeChannelModerator (..),
    newDescribeChannelModerator,

    -- * Request Lenses
    describeChannelModerator_channelArn,
    describeChannelModerator_channelModeratorArn,
    describeChannelModerator_chimeBearer,

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

    -- * Response Lenses
    describeChannelModeratorResponse_channelModerator,
    describeChannelModeratorResponse_httpStatus,
  )
where

import Amazonka.ChimeSDKMessaging.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 ARN of the channel.
    DescribeChannelModerator -> Text
channelArn :: Prelude.Text,
    -- | The @AppInstanceUserArn@ of the channel moderator.
    DescribeChannelModerator -> Text
channelModeratorArn :: Prelude.Text,
    -- | The @AppInstanceUserArn@ of the user that makes the API call.
    DescribeChannelModerator -> Text
chimeBearer :: Prelude.Text
  }
  deriving (DescribeChannelModerator -> DescribeChannelModerator -> Bool
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]
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
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.
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:
--
-- 'channelArn', 'describeChannelModerator_channelArn' - The ARN of the channel.
--
-- 'channelModeratorArn', 'describeChannelModerator_channelModeratorArn' - The @AppInstanceUserArn@ of the channel moderator.
--
-- 'chimeBearer', 'describeChannelModerator_chimeBearer' - The @AppInstanceUserArn@ of the user that makes the API call.
newDescribeChannelModerator ::
  -- | 'channelArn'
  Prelude.Text ->
  -- | 'channelModeratorArn'
  Prelude.Text ->
  -- | 'chimeBearer'
  Prelude.Text ->
  DescribeChannelModerator
newDescribeChannelModerator :: Text -> Text -> Text -> DescribeChannelModerator
newDescribeChannelModerator
  Text
pChannelArn_
  Text
pChannelModeratorArn_
  Text
pChimeBearer_ =
    DescribeChannelModerator'
      { $sel:channelArn:DescribeChannelModerator' :: Text
channelArn =
          Text
pChannelArn_,
        $sel:channelModeratorArn:DescribeChannelModerator' :: Text
channelModeratorArn = Text
pChannelModeratorArn_,
        $sel:chimeBearer:DescribeChannelModerator' :: Text
chimeBearer = Text
pChimeBearer_
      }

-- | The ARN of the channel.
describeChannelModerator_channelArn :: Lens.Lens' DescribeChannelModerator Prelude.Text
describeChannelModerator_channelArn :: Lens' DescribeChannelModerator Text
describeChannelModerator_channelArn = 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 @AppInstanceUserArn@ of the channel moderator.
describeChannelModerator_channelModeratorArn :: Lens.Lens' DescribeChannelModerator Prelude.Text
describeChannelModerator_channelModeratorArn :: Lens' DescribeChannelModerator Text
describeChannelModerator_channelModeratorArn = 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)

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

instance Core.AWSRequest DescribeChannelModerator where
  type
    AWSResponse DescribeChannelModerator =
      DescribeChannelModeratorResponse
  request :: (Service -> Service)
-> DescribeChannelModerator -> Request DescribeChannelModerator
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeChannelModerator
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeChannelModerator)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe ChannelModerator -> Int -> DescribeChannelModeratorResponse
DescribeChannelModeratorResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ChannelModerator")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeChannelModerator where
  hashWithSalt :: Int -> DescribeChannelModerator -> Int
hashWithSalt Int
_salt DescribeChannelModerator' {Text
chimeBearer :: Text
channelModeratorArn :: Text
channelArn :: Text
$sel:chimeBearer:DescribeChannelModerator' :: DescribeChannelModerator -> Text
$sel:channelModeratorArn:DescribeChannelModerator' :: DescribeChannelModerator -> Text
$sel:channelArn:DescribeChannelModerator' :: DescribeChannelModerator -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
channelArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
channelModeratorArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
chimeBearer

instance Prelude.NFData DescribeChannelModerator where
  rnf :: DescribeChannelModerator -> ()
rnf DescribeChannelModerator' {Text
chimeBearer :: Text
channelModeratorArn :: Text
channelArn :: Text
$sel:chimeBearer:DescribeChannelModerator' :: DescribeChannelModerator -> Text
$sel:channelModeratorArn:DescribeChannelModerator' :: DescribeChannelModerator -> Text
$sel:channelArn:DescribeChannelModerator' :: DescribeChannelModerator -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
channelArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
channelModeratorArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
chimeBearer

instance Data.ToHeaders DescribeChannelModerator where
  toHeaders :: DescribeChannelModerator -> ResponseHeaders
toHeaders DescribeChannelModerator' {Text
chimeBearer :: Text
channelModeratorArn :: Text
channelArn :: Text
$sel:chimeBearer:DescribeChannelModerator' :: DescribeChannelModerator -> Text
$sel:channelModeratorArn:DescribeChannelModerator' :: DescribeChannelModerator -> Text
$sel:channelArn:DescribeChannelModerator' :: DescribeChannelModerator -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [HeaderName
"x-amz-chime-bearer" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Text
chimeBearer]

instance Data.ToPath DescribeChannelModerator where
  toPath :: DescribeChannelModerator -> ByteString
toPath DescribeChannelModerator' {Text
chimeBearer :: Text
channelModeratorArn :: Text
channelArn :: Text
$sel:chimeBearer:DescribeChannelModerator' :: DescribeChannelModerator -> Text
$sel:channelModeratorArn:DescribeChannelModerator' :: DescribeChannelModerator -> Text
$sel:channelArn:DescribeChannelModerator' :: DescribeChannelModerator -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/channels/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
channelArn,
        ByteString
"/moderators/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
channelModeratorArn
      ]

instance Data.ToQuery DescribeChannelModerator where
  toQuery :: DescribeChannelModerator -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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
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.
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'
    { $sel:channelModerator:DescribeChannelModeratorResponse' :: Maybe ChannelModerator
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 :: Lens' DescribeChannelModeratorResponse (Maybe ChannelModerator)
describeChannelModeratorResponse_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 :: Lens' DescribeChannelModeratorResponse Int
describeChannelModeratorResponse_httpStatus = 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
  where
  rnf :: DescribeChannelModeratorResponse -> ()
rnf DescribeChannelModeratorResponse' {Int
Maybe ChannelModerator
httpStatus :: Int
channelModerator :: Maybe ChannelModerator
$sel:httpStatus:DescribeChannelModeratorResponse' :: DescribeChannelModeratorResponse -> Int
$sel:channelModerator:DescribeChannelModeratorResponse' :: DescribeChannelModeratorResponse -> Maybe ChannelModerator
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ChannelModerator
channelModerator
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus