{-# 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.GetVoiceConnector
-- 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)
--
-- Retrieves details for the specified Amazon Chime Voice Connector, such
-- as timestamps,name, outbound host, and encryption requirements.
module Amazonka.Chime.GetVoiceConnector
  ( -- * Creating a Request
    GetVoiceConnector (..),
    newGetVoiceConnector,

    -- * Request Lenses
    getVoiceConnector_voiceConnectorId,

    -- * Destructuring the Response
    GetVoiceConnectorResponse (..),
    newGetVoiceConnectorResponse,

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

-- |
-- Create a value of 'GetVoiceConnector' 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', 'getVoiceConnector_voiceConnectorId' - The Amazon Chime Voice Connector ID.
newGetVoiceConnector ::
  -- | 'voiceConnectorId'
  Prelude.Text ->
  GetVoiceConnector
newGetVoiceConnector :: Text -> GetVoiceConnector
newGetVoiceConnector Text
pVoiceConnectorId_ =
  GetVoiceConnector' :: Text -> GetVoiceConnector
GetVoiceConnector'
    { $sel:voiceConnectorId:GetVoiceConnector' :: Text
voiceConnectorId =
        Text
pVoiceConnectorId_
    }

-- | The Amazon Chime Voice Connector ID.
getVoiceConnector_voiceConnectorId :: Lens.Lens' GetVoiceConnector Prelude.Text
getVoiceConnector_voiceConnectorId :: (Text -> f Text) -> GetVoiceConnector -> f GetVoiceConnector
getVoiceConnector_voiceConnectorId = (GetVoiceConnector -> Text)
-> (GetVoiceConnector -> Text -> GetVoiceConnector)
-> Lens GetVoiceConnector GetVoiceConnector Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVoiceConnector' {Text
voiceConnectorId :: Text
$sel:voiceConnectorId:GetVoiceConnector' :: GetVoiceConnector -> Text
voiceConnectorId} -> Text
voiceConnectorId) (\s :: GetVoiceConnector
s@GetVoiceConnector' {} Text
a -> GetVoiceConnector
s {$sel:voiceConnectorId:GetVoiceConnector' :: Text
voiceConnectorId = Text
a} :: GetVoiceConnector)

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

instance Prelude.NFData GetVoiceConnector

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

instance Core.ToPath GetVoiceConnector where
  toPath :: GetVoiceConnector -> ByteString
toPath GetVoiceConnector' {Text
voiceConnectorId :: Text
$sel:voiceConnectorId:GetVoiceConnector' :: GetVoiceConnector -> 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]

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

-- | /See:/ 'newGetVoiceConnectorResponse' smart constructor.
data GetVoiceConnectorResponse = GetVoiceConnectorResponse'
  { -- | The Amazon Chime Voice Connector details.
    GetVoiceConnectorResponse -> Maybe VoiceConnector
voiceConnector :: Prelude.Maybe VoiceConnector,
    -- | The response's http status code.
    GetVoiceConnectorResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetVoiceConnectorResponse -> GetVoiceConnectorResponse -> Bool
(GetVoiceConnectorResponse -> GetVoiceConnectorResponse -> Bool)
-> (GetVoiceConnectorResponse -> GetVoiceConnectorResponse -> Bool)
-> Eq GetVoiceConnectorResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetVoiceConnectorResponse -> GetVoiceConnectorResponse -> Bool
$c/= :: GetVoiceConnectorResponse -> GetVoiceConnectorResponse -> Bool
== :: GetVoiceConnectorResponse -> GetVoiceConnectorResponse -> Bool
$c== :: GetVoiceConnectorResponse -> GetVoiceConnectorResponse -> Bool
Prelude.Eq, ReadPrec [GetVoiceConnectorResponse]
ReadPrec GetVoiceConnectorResponse
Int -> ReadS GetVoiceConnectorResponse
ReadS [GetVoiceConnectorResponse]
(Int -> ReadS GetVoiceConnectorResponse)
-> ReadS [GetVoiceConnectorResponse]
-> ReadPrec GetVoiceConnectorResponse
-> ReadPrec [GetVoiceConnectorResponse]
-> Read GetVoiceConnectorResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetVoiceConnectorResponse]
$creadListPrec :: ReadPrec [GetVoiceConnectorResponse]
readPrec :: ReadPrec GetVoiceConnectorResponse
$creadPrec :: ReadPrec GetVoiceConnectorResponse
readList :: ReadS [GetVoiceConnectorResponse]
$creadList :: ReadS [GetVoiceConnectorResponse]
readsPrec :: Int -> ReadS GetVoiceConnectorResponse
$creadsPrec :: Int -> ReadS GetVoiceConnectorResponse
Prelude.Read, Int -> GetVoiceConnectorResponse -> ShowS
[GetVoiceConnectorResponse] -> ShowS
GetVoiceConnectorResponse -> String
(Int -> GetVoiceConnectorResponse -> ShowS)
-> (GetVoiceConnectorResponse -> String)
-> ([GetVoiceConnectorResponse] -> ShowS)
-> Show GetVoiceConnectorResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetVoiceConnectorResponse] -> ShowS
$cshowList :: [GetVoiceConnectorResponse] -> ShowS
show :: GetVoiceConnectorResponse -> String
$cshow :: GetVoiceConnectorResponse -> String
showsPrec :: Int -> GetVoiceConnectorResponse -> ShowS
$cshowsPrec :: Int -> GetVoiceConnectorResponse -> ShowS
Prelude.Show, (forall x.
 GetVoiceConnectorResponse -> Rep GetVoiceConnectorResponse x)
-> (forall x.
    Rep GetVoiceConnectorResponse x -> GetVoiceConnectorResponse)
-> Generic GetVoiceConnectorResponse
forall x.
Rep GetVoiceConnectorResponse x -> GetVoiceConnectorResponse
forall x.
GetVoiceConnectorResponse -> Rep GetVoiceConnectorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetVoiceConnectorResponse x -> GetVoiceConnectorResponse
$cfrom :: forall x.
GetVoiceConnectorResponse -> Rep GetVoiceConnectorResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetVoiceConnectorResponse' 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:
--
-- 'voiceConnector', 'getVoiceConnectorResponse_voiceConnector' - The Amazon Chime Voice Connector details.
--
-- 'httpStatus', 'getVoiceConnectorResponse_httpStatus' - The response's http status code.
newGetVoiceConnectorResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetVoiceConnectorResponse
newGetVoiceConnectorResponse :: Int -> GetVoiceConnectorResponse
newGetVoiceConnectorResponse Int
pHttpStatus_ =
  GetVoiceConnectorResponse' :: Maybe VoiceConnector -> Int -> GetVoiceConnectorResponse
GetVoiceConnectorResponse'
    { $sel:voiceConnector:GetVoiceConnectorResponse' :: Maybe VoiceConnector
voiceConnector =
        Maybe VoiceConnector
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetVoiceConnectorResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Chime Voice Connector details.
getVoiceConnectorResponse_voiceConnector :: Lens.Lens' GetVoiceConnectorResponse (Prelude.Maybe VoiceConnector)
getVoiceConnectorResponse_voiceConnector :: (Maybe VoiceConnector -> f (Maybe VoiceConnector))
-> GetVoiceConnectorResponse -> f GetVoiceConnectorResponse
getVoiceConnectorResponse_voiceConnector = (GetVoiceConnectorResponse -> Maybe VoiceConnector)
-> (GetVoiceConnectorResponse
    -> Maybe VoiceConnector -> GetVoiceConnectorResponse)
-> Lens
     GetVoiceConnectorResponse
     GetVoiceConnectorResponse
     (Maybe VoiceConnector)
     (Maybe VoiceConnector)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVoiceConnectorResponse' {Maybe VoiceConnector
voiceConnector :: Maybe VoiceConnector
$sel:voiceConnector:GetVoiceConnectorResponse' :: GetVoiceConnectorResponse -> Maybe VoiceConnector
voiceConnector} -> Maybe VoiceConnector
voiceConnector) (\s :: GetVoiceConnectorResponse
s@GetVoiceConnectorResponse' {} Maybe VoiceConnector
a -> GetVoiceConnectorResponse
s {$sel:voiceConnector:GetVoiceConnectorResponse' :: Maybe VoiceConnector
voiceConnector = Maybe VoiceConnector
a} :: GetVoiceConnectorResponse)

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

instance Prelude.NFData GetVoiceConnectorResponse