{-# 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.DeleteApnsChannel
-- 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)
--
-- Disables the APNs channel for an application and deletes any existing
-- settings for the channel.
module Amazonka.Pinpoint.DeleteApnsChannel
  ( -- * Creating a Request
    DeleteApnsChannel (..),
    newDeleteApnsChannel,

    -- * Request Lenses
    deleteApnsChannel_applicationId,

    -- * Destructuring the Response
    DeleteApnsChannelResponse (..),
    newDeleteApnsChannelResponse,

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

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

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

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

instance Prelude.Hashable DeleteApnsChannel

instance Prelude.NFData DeleteApnsChannel

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

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

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

-- |
-- Create a value of 'DeleteApnsChannelResponse' 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', 'deleteApnsChannelResponse_httpStatus' - The response's http status code.
--
-- 'aPNSChannelResponse', 'deleteApnsChannelResponse_aPNSChannelResponse' - Undocumented member.
newDeleteApnsChannelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'aPNSChannelResponse'
  APNSChannelResponse ->
  DeleteApnsChannelResponse
newDeleteApnsChannelResponse :: Int -> APNSChannelResponse -> DeleteApnsChannelResponse
newDeleteApnsChannelResponse
  Int
pHttpStatus_
  APNSChannelResponse
pAPNSChannelResponse_ =
    DeleteApnsChannelResponse' :: Int -> APNSChannelResponse -> DeleteApnsChannelResponse
DeleteApnsChannelResponse'
      { $sel:httpStatus:DeleteApnsChannelResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:aPNSChannelResponse:DeleteApnsChannelResponse' :: APNSChannelResponse
aPNSChannelResponse = APNSChannelResponse
pAPNSChannelResponse_
      }

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

-- | Undocumented member.
deleteApnsChannelResponse_aPNSChannelResponse :: Lens.Lens' DeleteApnsChannelResponse APNSChannelResponse
deleteApnsChannelResponse_aPNSChannelResponse :: (APNSChannelResponse -> f APNSChannelResponse)
-> DeleteApnsChannelResponse -> f DeleteApnsChannelResponse
deleteApnsChannelResponse_aPNSChannelResponse = (DeleteApnsChannelResponse -> APNSChannelResponse)
-> (DeleteApnsChannelResponse
    -> APNSChannelResponse -> DeleteApnsChannelResponse)
-> Lens
     DeleteApnsChannelResponse
     DeleteApnsChannelResponse
     APNSChannelResponse
     APNSChannelResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteApnsChannelResponse' {APNSChannelResponse
aPNSChannelResponse :: APNSChannelResponse
$sel:aPNSChannelResponse:DeleteApnsChannelResponse' :: DeleteApnsChannelResponse -> APNSChannelResponse
aPNSChannelResponse} -> APNSChannelResponse
aPNSChannelResponse) (\s :: DeleteApnsChannelResponse
s@DeleteApnsChannelResponse' {} APNSChannelResponse
a -> DeleteApnsChannelResponse
s {$sel:aPNSChannelResponse:DeleteApnsChannelResponse' :: APNSChannelResponse
aPNSChannelResponse = APNSChannelResponse
a} :: DeleteApnsChannelResponse)

instance Prelude.NFData DeleteApnsChannelResponse