{-# 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.Pinpoint.GetVoiceChannel
-- 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 status and settings of the voice channel
-- for an application.
module Amazonka.Pinpoint.GetVoiceChannel
  ( -- * Creating a Request
    GetVoiceChannel (..),
    newGetVoiceChannel,

    -- * Request Lenses
    getVoiceChannel_applicationId,

    -- * Destructuring the Response
    GetVoiceChannelResponse (..),
    newGetVoiceChannelResponse,

    -- * Response Lenses
    getVoiceChannelResponse_httpStatus,
    getVoiceChannelResponse_voiceChannelResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetVoiceChannel' smart constructor.
data GetVoiceChannel = GetVoiceChannel'
  { -- | The unique identifier for the application. This identifier is displayed
    -- as the __Project ID__ on the Amazon Pinpoint console.
    GetVoiceChannel -> Text
applicationId :: Prelude.Text
  }
  deriving (GetVoiceChannel -> GetVoiceChannel -> Bool
(GetVoiceChannel -> GetVoiceChannel -> Bool)
-> (GetVoiceChannel -> GetVoiceChannel -> Bool)
-> Eq GetVoiceChannel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetVoiceChannel -> GetVoiceChannel -> Bool
$c/= :: GetVoiceChannel -> GetVoiceChannel -> Bool
== :: GetVoiceChannel -> GetVoiceChannel -> Bool
$c== :: GetVoiceChannel -> GetVoiceChannel -> Bool
Prelude.Eq, ReadPrec [GetVoiceChannel]
ReadPrec GetVoiceChannel
Int -> ReadS GetVoiceChannel
ReadS [GetVoiceChannel]
(Int -> ReadS GetVoiceChannel)
-> ReadS [GetVoiceChannel]
-> ReadPrec GetVoiceChannel
-> ReadPrec [GetVoiceChannel]
-> Read GetVoiceChannel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetVoiceChannel]
$creadListPrec :: ReadPrec [GetVoiceChannel]
readPrec :: ReadPrec GetVoiceChannel
$creadPrec :: ReadPrec GetVoiceChannel
readList :: ReadS [GetVoiceChannel]
$creadList :: ReadS [GetVoiceChannel]
readsPrec :: Int -> ReadS GetVoiceChannel
$creadsPrec :: Int -> ReadS GetVoiceChannel
Prelude.Read, Int -> GetVoiceChannel -> ShowS
[GetVoiceChannel] -> ShowS
GetVoiceChannel -> String
(Int -> GetVoiceChannel -> ShowS)
-> (GetVoiceChannel -> String)
-> ([GetVoiceChannel] -> ShowS)
-> Show GetVoiceChannel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetVoiceChannel] -> ShowS
$cshowList :: [GetVoiceChannel] -> ShowS
show :: GetVoiceChannel -> String
$cshow :: GetVoiceChannel -> String
showsPrec :: Int -> GetVoiceChannel -> ShowS
$cshowsPrec :: Int -> GetVoiceChannel -> ShowS
Prelude.Show, (forall x. GetVoiceChannel -> Rep GetVoiceChannel x)
-> (forall x. Rep GetVoiceChannel x -> GetVoiceChannel)
-> Generic GetVoiceChannel
forall x. Rep GetVoiceChannel x -> GetVoiceChannel
forall x. GetVoiceChannel -> Rep GetVoiceChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetVoiceChannel x -> GetVoiceChannel
$cfrom :: forall x. GetVoiceChannel -> Rep GetVoiceChannel x
Prelude.Generic)

-- |
-- Create a value of 'GetVoiceChannel' 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:
--
-- 'applicationId', 'getVoiceChannel_applicationId' - The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
newGetVoiceChannel ::
  -- | 'applicationId'
  Prelude.Text ->
  GetVoiceChannel
newGetVoiceChannel :: Text -> GetVoiceChannel
newGetVoiceChannel Text
pApplicationId_ =
  GetVoiceChannel' :: Text -> GetVoiceChannel
GetVoiceChannel' {$sel:applicationId:GetVoiceChannel' :: Text
applicationId = Text
pApplicationId_}

-- | The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
getVoiceChannel_applicationId :: Lens.Lens' GetVoiceChannel Prelude.Text
getVoiceChannel_applicationId :: (Text -> f Text) -> GetVoiceChannel -> f GetVoiceChannel
getVoiceChannel_applicationId = (GetVoiceChannel -> Text)
-> (GetVoiceChannel -> Text -> GetVoiceChannel)
-> Lens GetVoiceChannel GetVoiceChannel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVoiceChannel' {Text
applicationId :: Text
$sel:applicationId:GetVoiceChannel' :: GetVoiceChannel -> Text
applicationId} -> Text
applicationId) (\s :: GetVoiceChannel
s@GetVoiceChannel' {} Text
a -> GetVoiceChannel
s {$sel:applicationId:GetVoiceChannel' :: Text
applicationId = Text
a} :: GetVoiceChannel)

instance Core.AWSRequest GetVoiceChannel where
  type
    AWSResponse GetVoiceChannel =
      GetVoiceChannelResponse
  request :: GetVoiceChannel -> Request GetVoiceChannel
request = Service -> GetVoiceChannel -> Request GetVoiceChannel
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetVoiceChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetVoiceChannel)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetVoiceChannel))
-> Logger
-> Service
-> Proxy GetVoiceChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetVoiceChannel)))
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 ->
          Int -> VoiceChannelResponse -> GetVoiceChannelResponse
GetVoiceChannelResponse'
            (Int -> VoiceChannelResponse -> GetVoiceChannelResponse)
-> Either String Int
-> Either String (VoiceChannelResponse -> GetVoiceChannelResponse)
forall (f :: * -> *) a b. Functor 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))
            Either String (VoiceChannelResponse -> GetVoiceChannelResponse)
-> Either String VoiceChannelResponse
-> Either String GetVoiceChannelResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String VoiceChannelResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
      )

instance Prelude.Hashable GetVoiceChannel

instance Prelude.NFData GetVoiceChannel

instance Core.ToHeaders GetVoiceChannel where
  toHeaders :: GetVoiceChannel -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetVoiceChannel -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath GetVoiceChannel where
  toPath :: GetVoiceChannel -> ByteString
toPath GetVoiceChannel' {Text
applicationId :: Text
$sel:applicationId:GetVoiceChannel' :: GetVoiceChannel -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/apps/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
applicationId,
        ByteString
"/channels/voice"
      ]

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

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

-- |
-- Create a value of 'GetVoiceChannelResponse' 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:
--
-- 'httpStatus', 'getVoiceChannelResponse_httpStatus' - The response's http status code.
--
-- 'voiceChannelResponse', 'getVoiceChannelResponse_voiceChannelResponse' - Undocumented member.
newGetVoiceChannelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'voiceChannelResponse'
  VoiceChannelResponse ->
  GetVoiceChannelResponse
newGetVoiceChannelResponse :: Int -> VoiceChannelResponse -> GetVoiceChannelResponse
newGetVoiceChannelResponse
  Int
pHttpStatus_
  VoiceChannelResponse
pVoiceChannelResponse_ =
    GetVoiceChannelResponse' :: Int -> VoiceChannelResponse -> GetVoiceChannelResponse
GetVoiceChannelResponse'
      { $sel:httpStatus:GetVoiceChannelResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:voiceChannelResponse:GetVoiceChannelResponse' :: VoiceChannelResponse
voiceChannelResponse = VoiceChannelResponse
pVoiceChannelResponse_
      }

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

-- | Undocumented member.
getVoiceChannelResponse_voiceChannelResponse :: Lens.Lens' GetVoiceChannelResponse VoiceChannelResponse
getVoiceChannelResponse_voiceChannelResponse :: (VoiceChannelResponse -> f VoiceChannelResponse)
-> GetVoiceChannelResponse -> f GetVoiceChannelResponse
getVoiceChannelResponse_voiceChannelResponse = (GetVoiceChannelResponse -> VoiceChannelResponse)
-> (GetVoiceChannelResponse
    -> VoiceChannelResponse -> GetVoiceChannelResponse)
-> Lens
     GetVoiceChannelResponse
     GetVoiceChannelResponse
     VoiceChannelResponse
     VoiceChannelResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVoiceChannelResponse' {VoiceChannelResponse
voiceChannelResponse :: VoiceChannelResponse
$sel:voiceChannelResponse:GetVoiceChannelResponse' :: GetVoiceChannelResponse -> VoiceChannelResponse
voiceChannelResponse} -> VoiceChannelResponse
voiceChannelResponse) (\s :: GetVoiceChannelResponse
s@GetVoiceChannelResponse' {} VoiceChannelResponse
a -> GetVoiceChannelResponse
s {$sel:voiceChannelResponse:GetVoiceChannelResponse' :: VoiceChannelResponse
voiceChannelResponse = VoiceChannelResponse
a} :: GetVoiceChannelResponse)

instance Prelude.NFData GetVoiceChannelResponse