{-# 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.GetApnsVoipChannel
-- 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 APNs VoIP
-- channel for an application.
module Amazonka.Pinpoint.GetApnsVoipChannel
  ( -- * Creating a Request
    GetApnsVoipChannel (..),
    newGetApnsVoipChannel,

    -- * Request Lenses
    getApnsVoipChannel_applicationId,

    -- * Destructuring the Response
    GetApnsVoipChannelResponse (..),
    newGetApnsVoipChannelResponse,

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

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

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

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

instance Prelude.Hashable GetApnsVoipChannel

instance Prelude.NFData GetApnsVoipChannel

instance Core.ToHeaders GetApnsVoipChannel where
  toHeaders :: GetApnsVoipChannel -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetApnsVoipChannel -> 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 GetApnsVoipChannel where
  toPath :: GetApnsVoipChannel -> ByteString
toPath GetApnsVoipChannel' {Text
applicationId :: Text
$sel:applicationId:GetApnsVoipChannel' :: GetApnsVoipChannel -> 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/apns_voip"
      ]

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

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

-- |
-- Create a value of 'GetApnsVoipChannelResponse' 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', 'getApnsVoipChannelResponse_httpStatus' - The response's http status code.
--
-- 'aPNSVoipChannelResponse', 'getApnsVoipChannelResponse_aPNSVoipChannelResponse' - Undocumented member.
newGetApnsVoipChannelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'aPNSVoipChannelResponse'
  APNSVoipChannelResponse ->
  GetApnsVoipChannelResponse
newGetApnsVoipChannelResponse :: Int -> APNSVoipChannelResponse -> GetApnsVoipChannelResponse
newGetApnsVoipChannelResponse
  Int
pHttpStatus_
  APNSVoipChannelResponse
pAPNSVoipChannelResponse_ =
    GetApnsVoipChannelResponse' :: Int -> APNSVoipChannelResponse -> GetApnsVoipChannelResponse
GetApnsVoipChannelResponse'
      { $sel:httpStatus:GetApnsVoipChannelResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:aPNSVoipChannelResponse:GetApnsVoipChannelResponse' :: APNSVoipChannelResponse
aPNSVoipChannelResponse =
          APNSVoipChannelResponse
pAPNSVoipChannelResponse_
      }

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

-- | Undocumented member.
getApnsVoipChannelResponse_aPNSVoipChannelResponse :: Lens.Lens' GetApnsVoipChannelResponse APNSVoipChannelResponse
getApnsVoipChannelResponse_aPNSVoipChannelResponse :: (APNSVoipChannelResponse -> f APNSVoipChannelResponse)
-> GetApnsVoipChannelResponse -> f GetApnsVoipChannelResponse
getApnsVoipChannelResponse_aPNSVoipChannelResponse = (GetApnsVoipChannelResponse -> APNSVoipChannelResponse)
-> (GetApnsVoipChannelResponse
    -> APNSVoipChannelResponse -> GetApnsVoipChannelResponse)
-> Lens
     GetApnsVoipChannelResponse
     GetApnsVoipChannelResponse
     APNSVoipChannelResponse
     APNSVoipChannelResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApnsVoipChannelResponse' {APNSVoipChannelResponse
aPNSVoipChannelResponse :: APNSVoipChannelResponse
$sel:aPNSVoipChannelResponse:GetApnsVoipChannelResponse' :: GetApnsVoipChannelResponse -> APNSVoipChannelResponse
aPNSVoipChannelResponse} -> APNSVoipChannelResponse
aPNSVoipChannelResponse) (\s :: GetApnsVoipChannelResponse
s@GetApnsVoipChannelResponse' {} APNSVoipChannelResponse
a -> GetApnsVoipChannelResponse
s {$sel:aPNSVoipChannelResponse:GetApnsVoipChannelResponse' :: APNSVoipChannelResponse
aPNSVoipChannelResponse = APNSVoipChannelResponse
a} :: GetApnsVoipChannelResponse)

instance Prelude.NFData GetApnsVoipChannelResponse