{-# 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.GetMeeting
-- 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)
--
-- 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.Chime.GetMeeting
  ( -- * Creating a Request
    GetMeeting (..),
    newGetMeeting,

    -- * Request Lenses
    getMeeting_meetingId,

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

    -- * Response Lenses
    getMeetingResponse_meeting,
    getMeetingResponse_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:/ 'newGetMeeting' smart constructor.
data GetMeeting = GetMeeting'
  { -- | The Amazon Chime SDK meeting ID.
    GetMeeting -> Text
meetingId :: Prelude.Text
  }
  deriving (GetMeeting -> GetMeeting -> Bool
(GetMeeting -> GetMeeting -> Bool)
-> (GetMeeting -> GetMeeting -> Bool) -> Eq GetMeeting
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]
(Int -> ReadS GetMeeting)
-> ReadS [GetMeeting]
-> ReadPrec GetMeeting
-> ReadPrec [GetMeeting]
-> Read 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
(Int -> GetMeeting -> ShowS)
-> (GetMeeting -> String)
-> ([GetMeeting] -> ShowS)
-> Show GetMeeting
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. GetMeeting -> Rep GetMeeting x)
-> (forall x. Rep GetMeeting x -> GetMeeting) -> Generic GetMeeting
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' :: Text -> GetMeeting
GetMeeting' {$sel:meetingId:GetMeeting' :: Text
meetingId = Text
pMeetingId_}

-- | The Amazon Chime SDK meeting ID.
getMeeting_meetingId :: Lens.Lens' GetMeeting Prelude.Text
getMeeting_meetingId :: (Text -> f Text) -> GetMeeting -> f GetMeeting
getMeeting_meetingId = (GetMeeting -> Text)
-> (GetMeeting -> Text -> GetMeeting)
-> Lens GetMeeting GetMeeting Text Text
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 :: GetMeeting -> Request GetMeeting
request = Service -> GetMeeting -> Request GetMeeting
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetMeeting
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMeeting)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetMeeting))
-> Logger
-> Service
-> Proxy GetMeeting
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMeeting)))
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 Meeting -> Int -> GetMeetingResponse
GetMeetingResponse'
            (Maybe Meeting -> Int -> GetMeetingResponse)
-> Either String (Maybe Meeting)
-> Either String (Int -> GetMeetingResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Meeting)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Meeting")
            Either String (Int -> GetMeetingResponse)
-> Either String Int -> Either String GetMeetingResponse
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 GetMeeting

instance Prelude.NFData GetMeeting

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

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

instance Core.ToQuery GetMeeting where
  toQuery :: GetMeeting -> QueryString
toQuery = QueryString -> GetMeeting -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetMeetingResponse -> GetMeetingResponse -> Bool)
-> (GetMeetingResponse -> GetMeetingResponse -> Bool)
-> Eq GetMeetingResponse
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
(Int -> GetMeetingResponse -> ShowS)
-> (GetMeetingResponse -> String)
-> ([GetMeetingResponse] -> ShowS)
-> Show GetMeetingResponse
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. GetMeetingResponse -> Rep GetMeetingResponse x)
-> (forall x. Rep GetMeetingResponse x -> GetMeetingResponse)
-> Generic GetMeetingResponse
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' :: Maybe Meeting -> Int -> GetMeetingResponse
GetMeetingResponse'
    { $sel:meeting:GetMeetingResponse' :: Maybe Meeting
meeting = Maybe 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 :: (Maybe Meeting -> f (Maybe Meeting))
-> GetMeetingResponse -> f GetMeetingResponse
getMeetingResponse_meeting = (GetMeetingResponse -> Maybe Meeting)
-> (GetMeetingResponse -> Maybe Meeting -> GetMeetingResponse)
-> Lens
     GetMeetingResponse
     GetMeetingResponse
     (Maybe Meeting)
     (Maybe 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 :: (Int -> f Int) -> GetMeetingResponse -> f GetMeetingResponse
getMeetingResponse_httpStatus = (GetMeetingResponse -> Int)
-> (GetMeetingResponse -> Int -> GetMeetingResponse)
-> Lens GetMeetingResponse GetMeetingResponse Int Int
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