{-# 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.GetVoiceConnectorTerminationHealth
-- 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 information about the last time a SIP @OPTIONS@ ping was
-- received from your SIP infrastructure for the specified Amazon Chime
-- Voice Connector.
module Amazonka.Chime.GetVoiceConnectorTerminationHealth
  ( -- * Creating a Request
    GetVoiceConnectorTerminationHealth (..),
    newGetVoiceConnectorTerminationHealth,

    -- * Request Lenses
    getVoiceConnectorTerminationHealth_voiceConnectorId,

    -- * Destructuring the Response
    GetVoiceConnectorTerminationHealthResponse (..),
    newGetVoiceConnectorTerminationHealthResponse,

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

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

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

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

instance
  Prelude.NFData
    GetVoiceConnectorTerminationHealth

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

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

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

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

-- |
-- Create a value of 'GetVoiceConnectorTerminationHealthResponse' 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:
--
-- 'terminationHealth', 'getVoiceConnectorTerminationHealthResponse_terminationHealth' - The termination health details.
--
-- 'httpStatus', 'getVoiceConnectorTerminationHealthResponse_httpStatus' - The response's http status code.
newGetVoiceConnectorTerminationHealthResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetVoiceConnectorTerminationHealthResponse
newGetVoiceConnectorTerminationHealthResponse :: Int -> GetVoiceConnectorTerminationHealthResponse
newGetVoiceConnectorTerminationHealthResponse
  Int
pHttpStatus_ =
    GetVoiceConnectorTerminationHealthResponse' :: Maybe TerminationHealth
-> Int -> GetVoiceConnectorTerminationHealthResponse
GetVoiceConnectorTerminationHealthResponse'
      { $sel:terminationHealth:GetVoiceConnectorTerminationHealthResponse' :: Maybe TerminationHealth
terminationHealth =
          Maybe TerminationHealth
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetVoiceConnectorTerminationHealthResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The termination health details.
getVoiceConnectorTerminationHealthResponse_terminationHealth :: Lens.Lens' GetVoiceConnectorTerminationHealthResponse (Prelude.Maybe TerminationHealth)
getVoiceConnectorTerminationHealthResponse_terminationHealth :: (Maybe TerminationHealth -> f (Maybe TerminationHealth))
-> GetVoiceConnectorTerminationHealthResponse
-> f GetVoiceConnectorTerminationHealthResponse
getVoiceConnectorTerminationHealthResponse_terminationHealth = (GetVoiceConnectorTerminationHealthResponse
 -> Maybe TerminationHealth)
-> (GetVoiceConnectorTerminationHealthResponse
    -> Maybe TerminationHealth
    -> GetVoiceConnectorTerminationHealthResponse)
-> Lens
     GetVoiceConnectorTerminationHealthResponse
     GetVoiceConnectorTerminationHealthResponse
     (Maybe TerminationHealth)
     (Maybe TerminationHealth)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVoiceConnectorTerminationHealthResponse' {Maybe TerminationHealth
terminationHealth :: Maybe TerminationHealth
$sel:terminationHealth:GetVoiceConnectorTerminationHealthResponse' :: GetVoiceConnectorTerminationHealthResponse
-> Maybe TerminationHealth
terminationHealth} -> Maybe TerminationHealth
terminationHealth) (\s :: GetVoiceConnectorTerminationHealthResponse
s@GetVoiceConnectorTerminationHealthResponse' {} Maybe TerminationHealth
a -> GetVoiceConnectorTerminationHealthResponse
s {$sel:terminationHealth:GetVoiceConnectorTerminationHealthResponse' :: Maybe TerminationHealth
terminationHealth = Maybe TerminationHealth
a} :: GetVoiceConnectorTerminationHealthResponse)

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

instance
  Prelude.NFData
    GetVoiceConnectorTerminationHealthResponse