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

    -- * Request Lenses
    getVoiceConnectorOrigination_voiceConnectorId,

    -- * Destructuring the Response
    GetVoiceConnectorOriginationResponse (..),
    newGetVoiceConnectorOriginationResponse,

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

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

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

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

instance Prelude.NFData GetVoiceConnectorOrigination

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

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

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

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

-- |
-- Create a value of 'GetVoiceConnectorOriginationResponse' 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:
--
-- 'origination', 'getVoiceConnectorOriginationResponse_origination' - The origination setting details.
--
-- 'httpStatus', 'getVoiceConnectorOriginationResponse_httpStatus' - The response's http status code.
newGetVoiceConnectorOriginationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetVoiceConnectorOriginationResponse
newGetVoiceConnectorOriginationResponse :: Int -> GetVoiceConnectorOriginationResponse
newGetVoiceConnectorOriginationResponse Int
pHttpStatus_ =
  GetVoiceConnectorOriginationResponse' :: Maybe Origination -> Int -> GetVoiceConnectorOriginationResponse
GetVoiceConnectorOriginationResponse'
    { $sel:origination:GetVoiceConnectorOriginationResponse' :: Maybe Origination
origination =
        Maybe Origination
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetVoiceConnectorOriginationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The origination setting details.
getVoiceConnectorOriginationResponse_origination :: Lens.Lens' GetVoiceConnectorOriginationResponse (Prelude.Maybe Origination)
getVoiceConnectorOriginationResponse_origination :: (Maybe Origination -> f (Maybe Origination))
-> GetVoiceConnectorOriginationResponse
-> f GetVoiceConnectorOriginationResponse
getVoiceConnectorOriginationResponse_origination = (GetVoiceConnectorOriginationResponse -> Maybe Origination)
-> (GetVoiceConnectorOriginationResponse
    -> Maybe Origination -> GetVoiceConnectorOriginationResponse)
-> Lens
     GetVoiceConnectorOriginationResponse
     GetVoiceConnectorOriginationResponse
     (Maybe Origination)
     (Maybe Origination)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVoiceConnectorOriginationResponse' {Maybe Origination
origination :: Maybe Origination
$sel:origination:GetVoiceConnectorOriginationResponse' :: GetVoiceConnectorOriginationResponse -> Maybe Origination
origination} -> Maybe Origination
origination) (\s :: GetVoiceConnectorOriginationResponse
s@GetVoiceConnectorOriginationResponse' {} Maybe Origination
a -> GetVoiceConnectorOriginationResponse
s {$sel:origination:GetVoiceConnectorOriginationResponse' :: Maybe Origination
origination = Maybe Origination
a} :: GetVoiceConnectorOriginationResponse)

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

instance
  Prelude.NFData
    GetVoiceConnectorOriginationResponse