{-# 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.GetProxySession
-- 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 specified proxy session details for the specified Amazon Chime
-- Voice Connector.
module Amazonka.Chime.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.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:/ 'newGetProxySession' smart constructor.
data GetProxySession = GetProxySession'
  { -- | The Amazon Chime voice connector ID.
    GetProxySession -> Text
voiceConnectorId :: Prelude.Text,
    -- | The proxy session ID.
    GetProxySession -> Text
proxySessionId :: Prelude.Text
  }
  deriving (GetProxySession -> GetProxySession -> Bool
(GetProxySession -> GetProxySession -> Bool)
-> (GetProxySession -> GetProxySession -> Bool)
-> Eq GetProxySession
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]
(Int -> ReadS GetProxySession)
-> ReadS [GetProxySession]
-> ReadPrec GetProxySession
-> ReadPrec [GetProxySession]
-> Read 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
(Int -> GetProxySession -> ShowS)
-> (GetProxySession -> String)
-> ([GetProxySession] -> ShowS)
-> Show GetProxySession
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. GetProxySession -> Rep GetProxySession x)
-> (forall x. Rep GetProxySession x -> GetProxySession)
-> Generic GetProxySession
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' - The Amazon Chime voice connector ID.
--
-- 'proxySessionId', 'getProxySession_proxySessionId' - The proxy session ID.
newGetProxySession ::
  -- | 'voiceConnectorId'
  Prelude.Text ->
  -- | 'proxySessionId'
  Prelude.Text ->
  GetProxySession
newGetProxySession :: Text -> Text -> GetProxySession
newGetProxySession
  Text
pVoiceConnectorId_
  Text
pProxySessionId_ =
    GetProxySession' :: Text -> Text -> GetProxySession
GetProxySession'
      { $sel:voiceConnectorId:GetProxySession' :: Text
voiceConnectorId =
          Text
pVoiceConnectorId_,
        $sel:proxySessionId:GetProxySession' :: Text
proxySessionId = Text
pProxySessionId_
      }

-- | The Amazon Chime voice connector ID.
getProxySession_voiceConnectorId :: Lens.Lens' GetProxySession Prelude.Text
getProxySession_voiceConnectorId :: (Text -> f Text) -> GetProxySession -> f GetProxySession
getProxySession_voiceConnectorId = (GetProxySession -> Text)
-> (GetProxySession -> Text -> GetProxySession)
-> Lens GetProxySession GetProxySession Text Text
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)

-- | The proxy session ID.
getProxySession_proxySessionId :: Lens.Lens' GetProxySession Prelude.Text
getProxySession_proxySessionId :: (Text -> f Text) -> GetProxySession -> f GetProxySession
getProxySession_proxySessionId = (GetProxySession -> Text)
-> (GetProxySession -> Text -> GetProxySession)
-> Lens GetProxySession GetProxySession Text Text
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 :: GetProxySession -> Request GetProxySession
request = Service -> GetProxySession -> Request GetProxySession
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetProxySession
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetProxySession)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetProxySession))
-> Logger
-> Service
-> Proxy GetProxySession
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetProxySession)))
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 ProxySession -> Int -> GetProxySessionResponse
GetProxySessionResponse'
            (Maybe ProxySession -> Int -> GetProxySessionResponse)
-> Either String (Maybe ProxySession)
-> Either String (Int -> GetProxySessionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ProxySession)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ProxySession")
            Either String (Int -> GetProxySessionResponse)
-> Either String Int -> Either String GetProxySessionResponse
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 GetProxySession

instance Prelude.NFData GetProxySession

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

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

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

-- | /See:/ 'newGetProxySessionResponse' smart constructor.
data GetProxySessionResponse = GetProxySessionResponse'
  { -- | The proxy session details.
    GetProxySessionResponse -> Maybe ProxySession
proxySession :: Prelude.Maybe ProxySession,
    -- | The response's http status code.
    GetProxySessionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetProxySessionResponse -> GetProxySessionResponse -> Bool
(GetProxySessionResponse -> GetProxySessionResponse -> Bool)
-> (GetProxySessionResponse -> GetProxySessionResponse -> Bool)
-> Eq GetProxySessionResponse
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
(Int -> GetProxySessionResponse -> ShowS)
-> (GetProxySessionResponse -> String)
-> ([GetProxySessionResponse] -> ShowS)
-> Show GetProxySessionResponse
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.
 GetProxySessionResponse -> Rep GetProxySessionResponse x)
-> (forall x.
    Rep GetProxySessionResponse x -> GetProxySessionResponse)
-> Generic GetProxySessionResponse
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' - The proxy session details.
--
-- 'httpStatus', 'getProxySessionResponse_httpStatus' - The response's http status code.
newGetProxySessionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetProxySessionResponse
newGetProxySessionResponse :: Int -> GetProxySessionResponse
newGetProxySessionResponse Int
pHttpStatus_ =
  GetProxySessionResponse' :: Maybe ProxySession -> Int -> GetProxySessionResponse
GetProxySessionResponse'
    { $sel:proxySession:GetProxySessionResponse' :: Maybe ProxySession
proxySession =
        Maybe ProxySession
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetProxySessionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The proxy session details.
getProxySessionResponse_proxySession :: Lens.Lens' GetProxySessionResponse (Prelude.Maybe ProxySession)
getProxySessionResponse_proxySession :: (Maybe ProxySession -> f (Maybe ProxySession))
-> GetProxySessionResponse -> f GetProxySessionResponse
getProxySessionResponse_proxySession = (GetProxySessionResponse -> Maybe ProxySession)
-> (GetProxySessionResponse
    -> Maybe ProxySession -> GetProxySessionResponse)
-> Lens
     GetProxySessionResponse
     GetProxySessionResponse
     (Maybe ProxySession)
     (Maybe 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 :: (Int -> f Int)
-> GetProxySessionResponse -> f GetProxySessionResponse
getProxySessionResponse_httpStatus = (GetProxySessionResponse -> Int)
-> (GetProxySessionResponse -> Int -> GetProxySessionResponse)
-> Lens GetProxySessionResponse GetProxySessionResponse Int Int
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