{-# 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.GetMessagingSessionEndpoint
-- 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)
--
-- The details of the endpoint for the messaging session.
module Amazonka.ChimeSDKMessaging.GetMessagingSessionEndpoint
  ( -- * Creating a Request
    GetMessagingSessionEndpoint (..),
    newGetMessagingSessionEndpoint,

    -- * Destructuring the Response
    GetMessagingSessionEndpointResponse (..),
    newGetMessagingSessionEndpointResponse,

    -- * Response Lenses
    getMessagingSessionEndpointResponse_endpoint,
    getMessagingSessionEndpointResponse_httpStatus,
  )
where

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

-- |
-- Create a value of 'GetMessagingSessionEndpoint' 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.
newGetMessagingSessionEndpoint ::
  GetMessagingSessionEndpoint
newGetMessagingSessionEndpoint :: GetMessagingSessionEndpoint
newGetMessagingSessionEndpoint =
  GetMessagingSessionEndpoint
GetMessagingSessionEndpoint'

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

instance Prelude.NFData GetMessagingSessionEndpoint

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

instance Core.ToPath GetMessagingSessionEndpoint where
  toPath :: GetMessagingSessionEndpoint -> ByteString
toPath = ByteString -> GetMessagingSessionEndpoint -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/endpoints/messaging-session"

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

-- | /See:/ 'newGetMessagingSessionEndpointResponse' smart constructor.
data GetMessagingSessionEndpointResponse = GetMessagingSessionEndpointResponse'
  { -- | The endpoint returned in the response.
    GetMessagingSessionEndpointResponse
-> Maybe MessagingSessionEndpoint
endpoint :: Prelude.Maybe MessagingSessionEndpoint,
    -- | The response's http status code.
    GetMessagingSessionEndpointResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetMessagingSessionEndpointResponse
-> GetMessagingSessionEndpointResponse -> Bool
(GetMessagingSessionEndpointResponse
 -> GetMessagingSessionEndpointResponse -> Bool)
-> (GetMessagingSessionEndpointResponse
    -> GetMessagingSessionEndpointResponse -> Bool)
-> Eq GetMessagingSessionEndpointResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMessagingSessionEndpointResponse
-> GetMessagingSessionEndpointResponse -> Bool
$c/= :: GetMessagingSessionEndpointResponse
-> GetMessagingSessionEndpointResponse -> Bool
== :: GetMessagingSessionEndpointResponse
-> GetMessagingSessionEndpointResponse -> Bool
$c== :: GetMessagingSessionEndpointResponse
-> GetMessagingSessionEndpointResponse -> Bool
Prelude.Eq, ReadPrec [GetMessagingSessionEndpointResponse]
ReadPrec GetMessagingSessionEndpointResponse
Int -> ReadS GetMessagingSessionEndpointResponse
ReadS [GetMessagingSessionEndpointResponse]
(Int -> ReadS GetMessagingSessionEndpointResponse)
-> ReadS [GetMessagingSessionEndpointResponse]
-> ReadPrec GetMessagingSessionEndpointResponse
-> ReadPrec [GetMessagingSessionEndpointResponse]
-> Read GetMessagingSessionEndpointResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMessagingSessionEndpointResponse]
$creadListPrec :: ReadPrec [GetMessagingSessionEndpointResponse]
readPrec :: ReadPrec GetMessagingSessionEndpointResponse
$creadPrec :: ReadPrec GetMessagingSessionEndpointResponse
readList :: ReadS [GetMessagingSessionEndpointResponse]
$creadList :: ReadS [GetMessagingSessionEndpointResponse]
readsPrec :: Int -> ReadS GetMessagingSessionEndpointResponse
$creadsPrec :: Int -> ReadS GetMessagingSessionEndpointResponse
Prelude.Read, Int -> GetMessagingSessionEndpointResponse -> ShowS
[GetMessagingSessionEndpointResponse] -> ShowS
GetMessagingSessionEndpointResponse -> String
(Int -> GetMessagingSessionEndpointResponse -> ShowS)
-> (GetMessagingSessionEndpointResponse -> String)
-> ([GetMessagingSessionEndpointResponse] -> ShowS)
-> Show GetMessagingSessionEndpointResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMessagingSessionEndpointResponse] -> ShowS
$cshowList :: [GetMessagingSessionEndpointResponse] -> ShowS
show :: GetMessagingSessionEndpointResponse -> String
$cshow :: GetMessagingSessionEndpointResponse -> String
showsPrec :: Int -> GetMessagingSessionEndpointResponse -> ShowS
$cshowsPrec :: Int -> GetMessagingSessionEndpointResponse -> ShowS
Prelude.Show, (forall x.
 GetMessagingSessionEndpointResponse
 -> Rep GetMessagingSessionEndpointResponse x)
-> (forall x.
    Rep GetMessagingSessionEndpointResponse x
    -> GetMessagingSessionEndpointResponse)
-> Generic GetMessagingSessionEndpointResponse
forall x.
Rep GetMessagingSessionEndpointResponse x
-> GetMessagingSessionEndpointResponse
forall x.
GetMessagingSessionEndpointResponse
-> Rep GetMessagingSessionEndpointResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetMessagingSessionEndpointResponse x
-> GetMessagingSessionEndpointResponse
$cfrom :: forall x.
GetMessagingSessionEndpointResponse
-> Rep GetMessagingSessionEndpointResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetMessagingSessionEndpointResponse' 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:
--
-- 'endpoint', 'getMessagingSessionEndpointResponse_endpoint' - The endpoint returned in the response.
--
-- 'httpStatus', 'getMessagingSessionEndpointResponse_httpStatus' - The response's http status code.
newGetMessagingSessionEndpointResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetMessagingSessionEndpointResponse
newGetMessagingSessionEndpointResponse :: Int -> GetMessagingSessionEndpointResponse
newGetMessagingSessionEndpointResponse Int
pHttpStatus_ =
  GetMessagingSessionEndpointResponse' :: Maybe MessagingSessionEndpoint
-> Int -> GetMessagingSessionEndpointResponse
GetMessagingSessionEndpointResponse'
    { $sel:endpoint:GetMessagingSessionEndpointResponse' :: Maybe MessagingSessionEndpoint
endpoint =
        Maybe MessagingSessionEndpoint
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetMessagingSessionEndpointResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The endpoint returned in the response.
getMessagingSessionEndpointResponse_endpoint :: Lens.Lens' GetMessagingSessionEndpointResponse (Prelude.Maybe MessagingSessionEndpoint)
getMessagingSessionEndpointResponse_endpoint :: (Maybe MessagingSessionEndpoint
 -> f (Maybe MessagingSessionEndpoint))
-> GetMessagingSessionEndpointResponse
-> f GetMessagingSessionEndpointResponse
getMessagingSessionEndpointResponse_endpoint = (GetMessagingSessionEndpointResponse
 -> Maybe MessagingSessionEndpoint)
-> (GetMessagingSessionEndpointResponse
    -> Maybe MessagingSessionEndpoint
    -> GetMessagingSessionEndpointResponse)
-> Lens
     GetMessagingSessionEndpointResponse
     GetMessagingSessionEndpointResponse
     (Maybe MessagingSessionEndpoint)
     (Maybe MessagingSessionEndpoint)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMessagingSessionEndpointResponse' {Maybe MessagingSessionEndpoint
endpoint :: Maybe MessagingSessionEndpoint
$sel:endpoint:GetMessagingSessionEndpointResponse' :: GetMessagingSessionEndpointResponse
-> Maybe MessagingSessionEndpoint
endpoint} -> Maybe MessagingSessionEndpoint
endpoint) (\s :: GetMessagingSessionEndpointResponse
s@GetMessagingSessionEndpointResponse' {} Maybe MessagingSessionEndpoint
a -> GetMessagingSessionEndpointResponse
s {$sel:endpoint:GetMessagingSessionEndpointResponse' :: Maybe MessagingSessionEndpoint
endpoint = Maybe MessagingSessionEndpoint
a} :: GetMessagingSessionEndpointResponse)

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

instance
  Prelude.NFData
    GetMessagingSessionEndpointResponse