{-# 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.GetApnsSandboxChannel
-- 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 sandbox
-- channel for an application.
module Amazonka.Pinpoint.GetApnsSandboxChannel
  ( -- * Creating a Request
    GetApnsSandboxChannel (..),
    newGetApnsSandboxChannel,

    -- * Request Lenses
    getApnsSandboxChannel_applicationId,

    -- * Destructuring the Response
    GetApnsSandboxChannelResponse (..),
    newGetApnsSandboxChannelResponse,

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

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

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

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

instance Prelude.Hashable GetApnsSandboxChannel

instance Prelude.NFData GetApnsSandboxChannel

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

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

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

-- |
-- Create a value of 'GetApnsSandboxChannelResponse' 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', 'getApnsSandboxChannelResponse_httpStatus' - The response's http status code.
--
-- 'aPNSSandboxChannelResponse', 'getApnsSandboxChannelResponse_aPNSSandboxChannelResponse' - Undocumented member.
newGetApnsSandboxChannelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'aPNSSandboxChannelResponse'
  APNSSandboxChannelResponse ->
  GetApnsSandboxChannelResponse
newGetApnsSandboxChannelResponse :: Int -> APNSSandboxChannelResponse -> GetApnsSandboxChannelResponse
newGetApnsSandboxChannelResponse
  Int
pHttpStatus_
  APNSSandboxChannelResponse
pAPNSSandboxChannelResponse_ =
    GetApnsSandboxChannelResponse' :: Int -> APNSSandboxChannelResponse -> GetApnsSandboxChannelResponse
GetApnsSandboxChannelResponse'
      { $sel:httpStatus:GetApnsSandboxChannelResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:aPNSSandboxChannelResponse:GetApnsSandboxChannelResponse' :: APNSSandboxChannelResponse
aPNSSandboxChannelResponse =
          APNSSandboxChannelResponse
pAPNSSandboxChannelResponse_
      }

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

-- | Undocumented member.
getApnsSandboxChannelResponse_aPNSSandboxChannelResponse :: Lens.Lens' GetApnsSandboxChannelResponse APNSSandboxChannelResponse
getApnsSandboxChannelResponse_aPNSSandboxChannelResponse :: (APNSSandboxChannelResponse -> f APNSSandboxChannelResponse)
-> GetApnsSandboxChannelResponse -> f GetApnsSandboxChannelResponse
getApnsSandboxChannelResponse_aPNSSandboxChannelResponse = (GetApnsSandboxChannelResponse -> APNSSandboxChannelResponse)
-> (GetApnsSandboxChannelResponse
    -> APNSSandboxChannelResponse -> GetApnsSandboxChannelResponse)
-> Lens
     GetApnsSandboxChannelResponse
     GetApnsSandboxChannelResponse
     APNSSandboxChannelResponse
     APNSSandboxChannelResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApnsSandboxChannelResponse' {APNSSandboxChannelResponse
aPNSSandboxChannelResponse :: APNSSandboxChannelResponse
$sel:aPNSSandboxChannelResponse:GetApnsSandboxChannelResponse' :: GetApnsSandboxChannelResponse -> APNSSandboxChannelResponse
aPNSSandboxChannelResponse} -> APNSSandboxChannelResponse
aPNSSandboxChannelResponse) (\s :: GetApnsSandboxChannelResponse
s@GetApnsSandboxChannelResponse' {} APNSSandboxChannelResponse
a -> GetApnsSandboxChannelResponse
s {$sel:aPNSSandboxChannelResponse:GetApnsSandboxChannelResponse' :: APNSSandboxChannelResponse
aPNSSandboxChannelResponse = APNSSandboxChannelResponse
a} :: GetApnsSandboxChannelResponse)

instance Prelude.NFData GetApnsSandboxChannelResponse