{-# 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.ChimeSdkVoice.GetProxySession
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- -- | Undocumented operation.
module Amazonka.ChimeSdkVoice.GetProxySession
  ( -- * Creating a Request
    GetProxySession (..),
    newGetProxySession,

    -- * Request Lenses
    getProxySession_voiceConnectorId,
    getProxySession_proxySessionId,

    -- * Destructuring the Response
    GetProxySessionResponse (..),
    newGetProxySessionResponse,

    -- * Response Lenses
    getProxySessionResponse_proxySession,
    getProxySessionResponse_httpStatus,
  )
where

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

-- |
-- Create a value of 'GetProxySession' 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:
--
-- 'voiceConnectorId', 'getProxySession_voiceConnectorId' - Undocumented member.
--
-- 'proxySessionId', 'getProxySession_proxySessionId' - Undocumented member.
newGetProxySession ::
  -- | 'voiceConnectorId'
  Prelude.Text ->
  -- | 'proxySessionId'
  Prelude.Text ->
  GetProxySession
newGetProxySession :: Text -> Text -> GetProxySession
newGetProxySession
  Text
pVoiceConnectorId_
  Text
pProxySessionId_ =
    GetProxySession'
      { $sel:voiceConnectorId:GetProxySession' :: Text
voiceConnectorId =
          Text
pVoiceConnectorId_,
        $sel:proxySessionId:GetProxySession' :: Text
proxySessionId = Text
pProxySessionId_
      }

-- | Undocumented member.
getProxySession_voiceConnectorId :: Lens.Lens' GetProxySession Prelude.Text
getProxySession_voiceConnectorId :: Lens' GetProxySession Text
getProxySession_voiceConnectorId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProxySession' {Text
voiceConnectorId :: Text
$sel:voiceConnectorId:GetProxySession' :: GetProxySession -> Text
voiceConnectorId} -> Text
voiceConnectorId) (\s :: GetProxySession
s@GetProxySession' {} Text
a -> GetProxySession
s {$sel:voiceConnectorId:GetProxySession' :: Text
voiceConnectorId = Text
a} :: GetProxySession)

-- | Undocumented member.
getProxySession_proxySessionId :: Lens.Lens' GetProxySession Prelude.Text
getProxySession_proxySessionId :: Lens' GetProxySession Text
getProxySession_proxySessionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProxySession' {Text
proxySessionId :: Text
$sel:proxySessionId:GetProxySession' :: GetProxySession -> Text
proxySessionId} -> Text
proxySessionId) (\s :: GetProxySession
s@GetProxySession' {} Text
a -> GetProxySession
s {$sel:proxySessionId:GetProxySession' :: Text
proxySessionId = Text
a} :: GetProxySession)

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

instance Prelude.NFData GetProxySession where
  rnf :: GetProxySession -> ()
rnf GetProxySession' {Text
proxySessionId :: Text
voiceConnectorId :: Text
$sel:proxySessionId:GetProxySession' :: GetProxySession -> Text
$sel:voiceConnectorId:GetProxySession' :: GetProxySession -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
voiceConnectorId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
proxySessionId

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

instance Data.ToPath GetProxySession where
  toPath :: GetProxySession -> ByteString
toPath GetProxySession' {Text
proxySessionId :: Text
voiceConnectorId :: Text
$sel:proxySessionId:GetProxySession' :: GetProxySession -> Text
$sel:voiceConnectorId:GetProxySession' :: GetProxySession -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/voice-connectors/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
voiceConnectorId,
        ByteString
"/proxy-sessions/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
proxySessionId
      ]

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

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

-- |
-- Create a value of 'GetProxySessionResponse' 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:
--
-- 'proxySession', 'getProxySessionResponse_proxySession' - Undocumented member.
--
-- 'httpStatus', 'getProxySessionResponse_httpStatus' - The response's http status code.
newGetProxySessionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetProxySessionResponse
newGetProxySessionResponse :: Int -> GetProxySessionResponse
newGetProxySessionResponse Int
pHttpStatus_ =
  GetProxySessionResponse'
    { $sel:proxySession:GetProxySessionResponse' :: Maybe ProxySession
proxySession =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetProxySessionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
getProxySessionResponse_proxySession :: Lens.Lens' GetProxySessionResponse (Prelude.Maybe ProxySession)
getProxySessionResponse_proxySession :: Lens' GetProxySessionResponse (Maybe ProxySession)
getProxySessionResponse_proxySession = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProxySessionResponse' {Maybe ProxySession
proxySession :: Maybe ProxySession
$sel:proxySession:GetProxySessionResponse' :: GetProxySessionResponse -> Maybe ProxySession
proxySession} -> Maybe ProxySession
proxySession) (\s :: GetProxySessionResponse
s@GetProxySessionResponse' {} Maybe ProxySession
a -> GetProxySessionResponse
s {$sel:proxySession:GetProxySessionResponse' :: Maybe ProxySession
proxySession = Maybe ProxySession
a} :: GetProxySessionResponse)

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

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