{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.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:/ 'newGetMessagingSessionEndpoint' smart constructor.
data GetMessagingSessionEndpoint = GetMessagingSessionEndpoint'
  {
  }
  deriving (GetMessagingSessionEndpoint -> GetMessagingSessionEndpoint -> Bool
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]
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
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.
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 :: (Service -> Service)
-> GetMessagingSessionEndpoint
-> Request GetMessagingSessionEndpoint
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 GetMessagingSessionEndpoint
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetMessagingSessionEndpoint)))
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 MessagingSessionEndpoint
-> Int -> GetMessagingSessionEndpointResponse
GetMessagingSessionEndpointResponse'
            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
"Endpoint")
            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 GetMessagingSessionEndpoint where
  hashWithSalt :: Int -> GetMessagingSessionEndpoint -> Int
hashWithSalt Int
_salt GetMessagingSessionEndpoint
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

instance Prelude.NFData GetMessagingSessionEndpoint where
  rnf :: GetMessagingSessionEndpoint -> ()
rnf GetMessagingSessionEndpoint
_ = ()

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

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

instance Data.ToQuery GetMessagingSessionEndpoint where
  toQuery :: GetMessagingSessionEndpoint -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:endpoint:GetMessagingSessionEndpointResponse' :: Maybe MessagingSessionEndpoint
endpoint =
        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 :: Lens'
  GetMessagingSessionEndpointResponse
  (Maybe MessagingSessionEndpoint)
getMessagingSessionEndpointResponse_endpoint = 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 :: Lens' GetMessagingSessionEndpointResponse Int
getMessagingSessionEndpointResponse_httpStatus = 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
  where
  rnf :: GetMessagingSessionEndpointResponse -> ()
rnf GetMessagingSessionEndpointResponse' {Int
Maybe MessagingSessionEndpoint
httpStatus :: Int
endpoint :: Maybe MessagingSessionEndpoint
$sel:httpStatus:GetMessagingSessionEndpointResponse' :: GetMessagingSessionEndpointResponse -> Int
$sel:endpoint:GetMessagingSessionEndpointResponse' :: GetMessagingSessionEndpointResponse
-> Maybe MessagingSessionEndpoint
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe MessagingSessionEndpoint
endpoint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus