{-# 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.GetVoiceConnectorTermination
-- 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 termination setting details for the specified Amazon Chime
-- Voice Connector.
module Amazonka.Chime.GetVoiceConnectorTermination
  ( -- * Creating a Request
    GetVoiceConnectorTermination (..),
    newGetVoiceConnectorTermination,

    -- * Request Lenses
    getVoiceConnectorTermination_voiceConnectorId,

    -- * Destructuring the Response
    GetVoiceConnectorTerminationResponse (..),
    newGetVoiceConnectorTerminationResponse,

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

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

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

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

instance Prelude.NFData GetVoiceConnectorTermination

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

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

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

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

-- |
-- Create a value of 'GetVoiceConnectorTerminationResponse' 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:
--
-- 'termination', 'getVoiceConnectorTerminationResponse_termination' - The termination setting details.
--
-- 'httpStatus', 'getVoiceConnectorTerminationResponse_httpStatus' - The response's http status code.
newGetVoiceConnectorTerminationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetVoiceConnectorTerminationResponse
newGetVoiceConnectorTerminationResponse :: Int -> GetVoiceConnectorTerminationResponse
newGetVoiceConnectorTerminationResponse Int
pHttpStatus_ =
  GetVoiceConnectorTerminationResponse' :: Maybe Termination -> Int -> GetVoiceConnectorTerminationResponse
GetVoiceConnectorTerminationResponse'
    { $sel:termination:GetVoiceConnectorTerminationResponse' :: Maybe Termination
termination =
        Maybe Termination
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetVoiceConnectorTerminationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The termination setting details.
getVoiceConnectorTerminationResponse_termination :: Lens.Lens' GetVoiceConnectorTerminationResponse (Prelude.Maybe Termination)
getVoiceConnectorTerminationResponse_termination :: (Maybe Termination -> f (Maybe Termination))
-> GetVoiceConnectorTerminationResponse
-> f GetVoiceConnectorTerminationResponse
getVoiceConnectorTerminationResponse_termination = (GetVoiceConnectorTerminationResponse -> Maybe Termination)
-> (GetVoiceConnectorTerminationResponse
    -> Maybe Termination -> GetVoiceConnectorTerminationResponse)
-> Lens
     GetVoiceConnectorTerminationResponse
     GetVoiceConnectorTerminationResponse
     (Maybe Termination)
     (Maybe Termination)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVoiceConnectorTerminationResponse' {Maybe Termination
termination :: Maybe Termination
$sel:termination:GetVoiceConnectorTerminationResponse' :: GetVoiceConnectorTerminationResponse -> Maybe Termination
termination} -> Maybe Termination
termination) (\s :: GetVoiceConnectorTerminationResponse
s@GetVoiceConnectorTerminationResponse' {} Maybe Termination
a -> GetVoiceConnectorTerminationResponse
s {$sel:termination:GetVoiceConnectorTerminationResponse' :: Maybe Termination
termination = Maybe Termination
a} :: GetVoiceConnectorTerminationResponse)

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

instance
  Prelude.NFData
    GetVoiceConnectorTerminationResponse