{-# 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.GetVoiceConnectorProxy
-- 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 proxy configuration details for the specified Amazon Chime
-- Voice Connector.
module Amazonka.Chime.GetVoiceConnectorProxy
  ( -- * Creating a Request
    GetVoiceConnectorProxy (..),
    newGetVoiceConnectorProxy,

    -- * Request Lenses
    getVoiceConnectorProxy_voiceConnectorId,

    -- * Destructuring the Response
    GetVoiceConnectorProxyResponse (..),
    newGetVoiceConnectorProxyResponse,

    -- * Response Lenses
    getVoiceConnectorProxyResponse_proxy,
    getVoiceConnectorProxyResponse_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:/ 'newGetVoiceConnectorProxy' smart constructor.
data GetVoiceConnectorProxy = GetVoiceConnectorProxy'
  { -- | The Amazon Chime voice connector ID.
    GetVoiceConnectorProxy -> Text
voiceConnectorId :: Prelude.Text
  }
  deriving (GetVoiceConnectorProxy -> GetVoiceConnectorProxy -> Bool
(GetVoiceConnectorProxy -> GetVoiceConnectorProxy -> Bool)
-> (GetVoiceConnectorProxy -> GetVoiceConnectorProxy -> Bool)
-> Eq GetVoiceConnectorProxy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetVoiceConnectorProxy -> GetVoiceConnectorProxy -> Bool
$c/= :: GetVoiceConnectorProxy -> GetVoiceConnectorProxy -> Bool
== :: GetVoiceConnectorProxy -> GetVoiceConnectorProxy -> Bool
$c== :: GetVoiceConnectorProxy -> GetVoiceConnectorProxy -> Bool
Prelude.Eq, ReadPrec [GetVoiceConnectorProxy]
ReadPrec GetVoiceConnectorProxy
Int -> ReadS GetVoiceConnectorProxy
ReadS [GetVoiceConnectorProxy]
(Int -> ReadS GetVoiceConnectorProxy)
-> ReadS [GetVoiceConnectorProxy]
-> ReadPrec GetVoiceConnectorProxy
-> ReadPrec [GetVoiceConnectorProxy]
-> Read GetVoiceConnectorProxy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetVoiceConnectorProxy]
$creadListPrec :: ReadPrec [GetVoiceConnectorProxy]
readPrec :: ReadPrec GetVoiceConnectorProxy
$creadPrec :: ReadPrec GetVoiceConnectorProxy
readList :: ReadS [GetVoiceConnectorProxy]
$creadList :: ReadS [GetVoiceConnectorProxy]
readsPrec :: Int -> ReadS GetVoiceConnectorProxy
$creadsPrec :: Int -> ReadS GetVoiceConnectorProxy
Prelude.Read, Int -> GetVoiceConnectorProxy -> ShowS
[GetVoiceConnectorProxy] -> ShowS
GetVoiceConnectorProxy -> String
(Int -> GetVoiceConnectorProxy -> ShowS)
-> (GetVoiceConnectorProxy -> String)
-> ([GetVoiceConnectorProxy] -> ShowS)
-> Show GetVoiceConnectorProxy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetVoiceConnectorProxy] -> ShowS
$cshowList :: [GetVoiceConnectorProxy] -> ShowS
show :: GetVoiceConnectorProxy -> String
$cshow :: GetVoiceConnectorProxy -> String
showsPrec :: Int -> GetVoiceConnectorProxy -> ShowS
$cshowsPrec :: Int -> GetVoiceConnectorProxy -> ShowS
Prelude.Show, (forall x. GetVoiceConnectorProxy -> Rep GetVoiceConnectorProxy x)
-> (forall x.
    Rep GetVoiceConnectorProxy x -> GetVoiceConnectorProxy)
-> Generic GetVoiceConnectorProxy
forall x. Rep GetVoiceConnectorProxy x -> GetVoiceConnectorProxy
forall x. GetVoiceConnectorProxy -> Rep GetVoiceConnectorProxy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetVoiceConnectorProxy x -> GetVoiceConnectorProxy
$cfrom :: forall x. GetVoiceConnectorProxy -> Rep GetVoiceConnectorProxy x
Prelude.Generic)

-- |
-- Create a value of 'GetVoiceConnectorProxy' 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', 'getVoiceConnectorProxy_voiceConnectorId' - The Amazon Chime voice connector ID.
newGetVoiceConnectorProxy ::
  -- | 'voiceConnectorId'
  Prelude.Text ->
  GetVoiceConnectorProxy
newGetVoiceConnectorProxy :: Text -> GetVoiceConnectorProxy
newGetVoiceConnectorProxy Text
pVoiceConnectorId_ =
  GetVoiceConnectorProxy' :: Text -> GetVoiceConnectorProxy
GetVoiceConnectorProxy'
    { $sel:voiceConnectorId:GetVoiceConnectorProxy' :: Text
voiceConnectorId =
        Text
pVoiceConnectorId_
    }

-- | The Amazon Chime voice connector ID.
getVoiceConnectorProxy_voiceConnectorId :: Lens.Lens' GetVoiceConnectorProxy Prelude.Text
getVoiceConnectorProxy_voiceConnectorId :: (Text -> f Text)
-> GetVoiceConnectorProxy -> f GetVoiceConnectorProxy
getVoiceConnectorProxy_voiceConnectorId = (GetVoiceConnectorProxy -> Text)
-> (GetVoiceConnectorProxy -> Text -> GetVoiceConnectorProxy)
-> Lens GetVoiceConnectorProxy GetVoiceConnectorProxy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVoiceConnectorProxy' {Text
voiceConnectorId :: Text
$sel:voiceConnectorId:GetVoiceConnectorProxy' :: GetVoiceConnectorProxy -> Text
voiceConnectorId} -> Text
voiceConnectorId) (\s :: GetVoiceConnectorProxy
s@GetVoiceConnectorProxy' {} Text
a -> GetVoiceConnectorProxy
s {$sel:voiceConnectorId:GetVoiceConnectorProxy' :: Text
voiceConnectorId = Text
a} :: GetVoiceConnectorProxy)

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

instance Prelude.NFData GetVoiceConnectorProxy

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

instance Core.ToPath GetVoiceConnectorProxy where
  toPath :: GetVoiceConnectorProxy -> ByteString
toPath GetVoiceConnectorProxy' {Text
voiceConnectorId :: Text
$sel:voiceConnectorId:GetVoiceConnectorProxy' :: GetVoiceConnectorProxy -> 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
"/programmable-numbers/proxy"
      ]

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

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

-- |
-- Create a value of 'GetVoiceConnectorProxyResponse' 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:
--
-- 'proxy', 'getVoiceConnectorProxyResponse_proxy' - The proxy configuration details.
--
-- 'httpStatus', 'getVoiceConnectorProxyResponse_httpStatus' - The response's http status code.
newGetVoiceConnectorProxyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetVoiceConnectorProxyResponse
newGetVoiceConnectorProxyResponse :: Int -> GetVoiceConnectorProxyResponse
newGetVoiceConnectorProxyResponse Int
pHttpStatus_ =
  GetVoiceConnectorProxyResponse' :: Maybe Proxy -> Int -> GetVoiceConnectorProxyResponse
GetVoiceConnectorProxyResponse'
    { $sel:proxy:GetVoiceConnectorProxyResponse' :: Maybe Proxy
proxy =
        Maybe Proxy
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetVoiceConnectorProxyResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The proxy configuration details.
getVoiceConnectorProxyResponse_proxy :: Lens.Lens' GetVoiceConnectorProxyResponse (Prelude.Maybe Proxy)
getVoiceConnectorProxyResponse_proxy :: (Maybe Proxy -> f (Maybe Proxy))
-> GetVoiceConnectorProxyResponse
-> f GetVoiceConnectorProxyResponse
getVoiceConnectorProxyResponse_proxy = (GetVoiceConnectorProxyResponse -> Maybe Proxy)
-> (GetVoiceConnectorProxyResponse
    -> Maybe Proxy -> GetVoiceConnectorProxyResponse)
-> Lens
     GetVoiceConnectorProxyResponse
     GetVoiceConnectorProxyResponse
     (Maybe Proxy)
     (Maybe Proxy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVoiceConnectorProxyResponse' {Maybe Proxy
proxy :: Maybe Proxy
$sel:proxy:GetVoiceConnectorProxyResponse' :: GetVoiceConnectorProxyResponse -> Maybe Proxy
proxy} -> Maybe Proxy
proxy) (\s :: GetVoiceConnectorProxyResponse
s@GetVoiceConnectorProxyResponse' {} Maybe Proxy
a -> GetVoiceConnectorProxyResponse
s {$sel:proxy:GetVoiceConnectorProxyResponse' :: Maybe Proxy
proxy = Maybe Proxy
a} :: GetVoiceConnectorProxyResponse)

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

instance
  Prelude.NFData
    GetVoiceConnectorProxyResponse