{-# 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.ChimeSdkMeetings.GetMeeting
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets the Amazon Chime SDK meeting details for the specified meeting ID.
-- For more information about the Amazon Chime SDK, see
-- <https://docs.aws.amazon.com/chime/latest/dg/meetings-sdk.html Using the Amazon Chime SDK>
-- in the /Amazon Chime Developer Guide/.
module Amazonka.ChimeSdkMeetings.GetMeeting
  ( -- * Creating a Request
    GetMeeting (..),
    newGetMeeting,

    -- * Request Lenses
    getMeeting_meetingId,

    -- * Destructuring the Response
    GetMeetingResponse (..),
    newGetMeetingResponse,

    -- * Response Lenses
    getMeetingResponse_meeting,
    getMeetingResponse_httpStatus,
  )
where

import Amazonka.ChimeSdkMeetings.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:/ 'newGetMeeting' smart constructor.
data GetMeeting = GetMeeting'
  { -- | The Amazon Chime SDK meeting ID.
    GetMeeting -> Text
meetingId :: Prelude.Text
  }
  deriving (GetMeeting -> GetMeeting -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMeeting -> GetMeeting -> Bool
$c/= :: GetMeeting -> GetMeeting -> Bool
== :: GetMeeting -> GetMeeting -> Bool
$c== :: GetMeeting -> GetMeeting -> Bool
Prelude.Eq, ReadPrec [GetMeeting]
ReadPrec GetMeeting
Int -> ReadS GetMeeting
ReadS [GetMeeting]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMeeting]
$creadListPrec :: ReadPrec [GetMeeting]
readPrec :: ReadPrec GetMeeting
$creadPrec :: ReadPrec GetMeeting
readList :: ReadS [GetMeeting]
$creadList :: ReadS [GetMeeting]
readsPrec :: Int -> ReadS GetMeeting
$creadsPrec :: Int -> ReadS GetMeeting
Prelude.Read, Int -> GetMeeting -> ShowS
[GetMeeting] -> ShowS
GetMeeting -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMeeting] -> ShowS
$cshowList :: [GetMeeting] -> ShowS
show :: GetMeeting -> String
$cshow :: GetMeeting -> String
showsPrec :: Int -> GetMeeting -> ShowS
$cshowsPrec :: Int -> GetMeeting -> ShowS
Prelude.Show, forall x. Rep GetMeeting x -> GetMeeting
forall x. GetMeeting -> Rep GetMeeting x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMeeting x -> GetMeeting
$cfrom :: forall x. GetMeeting -> Rep GetMeeting x
Prelude.Generic)

-- |
-- Create a value of 'GetMeeting' 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:
--
-- 'meetingId', 'getMeeting_meetingId' - The Amazon Chime SDK meeting ID.
newGetMeeting ::
  -- | 'meetingId'
  Prelude.Text ->
  GetMeeting
newGetMeeting :: Text -> GetMeeting
newGetMeeting Text
pMeetingId_ =
  GetMeeting' {$sel:meetingId:GetMeeting' :: Text
meetingId = Text
pMeetingId_}

-- | The Amazon Chime SDK meeting ID.
getMeeting_meetingId :: Lens.Lens' GetMeeting Prelude.Text
getMeeting_meetingId :: Lens' GetMeeting Text
getMeeting_meetingId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMeeting' {Text
meetingId :: Text
$sel:meetingId:GetMeeting' :: GetMeeting -> Text
meetingId} -> Text
meetingId) (\s :: GetMeeting
s@GetMeeting' {} Text
a -> GetMeeting
s {$sel:meetingId:GetMeeting' :: Text
meetingId = Text
a} :: GetMeeting)

instance Core.AWSRequest GetMeeting where
  type AWSResponse GetMeeting = GetMeetingResponse
  request :: (Service -> Service) -> GetMeeting -> Request GetMeeting
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 GetMeeting
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMeeting)))
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 Meeting -> Int -> GetMeetingResponse
GetMeetingResponse'
            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
"Meeting")
            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 GetMeeting where
  hashWithSalt :: Int -> GetMeeting -> Int
hashWithSalt Int
_salt GetMeeting' {Text
meetingId :: Text
$sel:meetingId:GetMeeting' :: GetMeeting -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
meetingId

instance Prelude.NFData GetMeeting where
  rnf :: GetMeeting -> ()
rnf GetMeeting' {Text
meetingId :: Text
$sel:meetingId:GetMeeting' :: GetMeeting -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
meetingId

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

instance Data.ToPath GetMeeting where
  toPath :: GetMeeting -> ByteString
toPath GetMeeting' {Text
meetingId :: Text
$sel:meetingId:GetMeeting' :: GetMeeting -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/meetings/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
meetingId]

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

-- | /See:/ 'newGetMeetingResponse' smart constructor.
data GetMeetingResponse = GetMeetingResponse'
  { -- | The Amazon Chime SDK meeting information.
    GetMeetingResponse -> Maybe Meeting
meeting :: Prelude.Maybe Meeting,
    -- | The response's http status code.
    GetMeetingResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetMeetingResponse -> GetMeetingResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMeetingResponse -> GetMeetingResponse -> Bool
$c/= :: GetMeetingResponse -> GetMeetingResponse -> Bool
== :: GetMeetingResponse -> GetMeetingResponse -> Bool
$c== :: GetMeetingResponse -> GetMeetingResponse -> Bool
Prelude.Eq, Int -> GetMeetingResponse -> ShowS
[GetMeetingResponse] -> ShowS
GetMeetingResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMeetingResponse] -> ShowS
$cshowList :: [GetMeetingResponse] -> ShowS
show :: GetMeetingResponse -> String
$cshow :: GetMeetingResponse -> String
showsPrec :: Int -> GetMeetingResponse -> ShowS
$cshowsPrec :: Int -> GetMeetingResponse -> ShowS
Prelude.Show, forall x. Rep GetMeetingResponse x -> GetMeetingResponse
forall x. GetMeetingResponse -> Rep GetMeetingResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMeetingResponse x -> GetMeetingResponse
$cfrom :: forall x. GetMeetingResponse -> Rep GetMeetingResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetMeetingResponse' 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:
--
-- 'meeting', 'getMeetingResponse_meeting' - The Amazon Chime SDK meeting information.
--
-- 'httpStatus', 'getMeetingResponse_httpStatus' - The response's http status code.
newGetMeetingResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetMeetingResponse
newGetMeetingResponse :: Int -> GetMeetingResponse
newGetMeetingResponse Int
pHttpStatus_ =
  GetMeetingResponse'
    { $sel:meeting:GetMeetingResponse' :: Maybe Meeting
meeting = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetMeetingResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Chime SDK meeting information.
getMeetingResponse_meeting :: Lens.Lens' GetMeetingResponse (Prelude.Maybe Meeting)
getMeetingResponse_meeting :: Lens' GetMeetingResponse (Maybe Meeting)
getMeetingResponse_meeting = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMeetingResponse' {Maybe Meeting
meeting :: Maybe Meeting
$sel:meeting:GetMeetingResponse' :: GetMeetingResponse -> Maybe Meeting
meeting} -> Maybe Meeting
meeting) (\s :: GetMeetingResponse
s@GetMeetingResponse' {} Maybe Meeting
a -> GetMeetingResponse
s {$sel:meeting:GetMeetingResponse' :: Maybe Meeting
meeting = Maybe Meeting
a} :: GetMeetingResponse)

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

instance Prelude.NFData GetMeetingResponse where
  rnf :: GetMeetingResponse -> ()
rnf GetMeetingResponse' {Int
Maybe Meeting
httpStatus :: Int
meeting :: Maybe Meeting
$sel:httpStatus:GetMeetingResponse' :: GetMeetingResponse -> Int
$sel:meeting:GetMeetingResponse' :: GetMeetingResponse -> Maybe Meeting
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Meeting
meeting
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus