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

    -- * Request Lenses
    deleteGcmChannel_applicationId,

    -- * Destructuring the Response
    DeleteGcmChannelResponse (..),
    newDeleteGcmChannelResponse,

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

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

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

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

instance Prelude.Hashable DeleteGcmChannel

instance Prelude.NFData DeleteGcmChannel

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

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

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

-- |
-- Create a value of 'DeleteGcmChannelResponse' 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', 'deleteGcmChannelResponse_httpStatus' - The response's http status code.
--
-- 'gCMChannelResponse', 'deleteGcmChannelResponse_gCMChannelResponse' - Undocumented member.
newDeleteGcmChannelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'gCMChannelResponse'
  GCMChannelResponse ->
  DeleteGcmChannelResponse
newDeleteGcmChannelResponse :: Int -> GCMChannelResponse -> DeleteGcmChannelResponse
newDeleteGcmChannelResponse
  Int
pHttpStatus_
  GCMChannelResponse
pGCMChannelResponse_ =
    DeleteGcmChannelResponse' :: Int -> GCMChannelResponse -> DeleteGcmChannelResponse
DeleteGcmChannelResponse'
      { $sel:httpStatus:DeleteGcmChannelResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:gCMChannelResponse:DeleteGcmChannelResponse' :: GCMChannelResponse
gCMChannelResponse = GCMChannelResponse
pGCMChannelResponse_
      }

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

-- | Undocumented member.
deleteGcmChannelResponse_gCMChannelResponse :: Lens.Lens' DeleteGcmChannelResponse GCMChannelResponse
deleteGcmChannelResponse_gCMChannelResponse :: (GCMChannelResponse -> f GCMChannelResponse)
-> DeleteGcmChannelResponse -> f DeleteGcmChannelResponse
deleteGcmChannelResponse_gCMChannelResponse = (DeleteGcmChannelResponse -> GCMChannelResponse)
-> (DeleteGcmChannelResponse
    -> GCMChannelResponse -> DeleteGcmChannelResponse)
-> Lens
     DeleteGcmChannelResponse
     DeleteGcmChannelResponse
     GCMChannelResponse
     GCMChannelResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteGcmChannelResponse' {GCMChannelResponse
gCMChannelResponse :: GCMChannelResponse
$sel:gCMChannelResponse:DeleteGcmChannelResponse' :: DeleteGcmChannelResponse -> GCMChannelResponse
gCMChannelResponse} -> GCMChannelResponse
gCMChannelResponse) (\s :: DeleteGcmChannelResponse
s@DeleteGcmChannelResponse' {} GCMChannelResponse
a -> DeleteGcmChannelResponse
s {$sel:gCMChannelResponse:DeleteGcmChannelResponse' :: GCMChannelResponse
gCMChannelResponse = GCMChannelResponse
a} :: DeleteGcmChannelResponse)

instance Prelude.NFData DeleteGcmChannelResponse