{-# 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.DeleteAdmChannel
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Disables the ADM channel for an application and deletes any existing
-- settings for the channel.
module Amazonka.Pinpoint.DeleteAdmChannel
  ( -- * Creating a Request
    DeleteAdmChannel (..),
    newDeleteAdmChannel,

    -- * Request Lenses
    deleteAdmChannel_applicationId,

    -- * Destructuring the Response
    DeleteAdmChannelResponse (..),
    newDeleteAdmChannelResponse,

    -- * Response Lenses
    deleteAdmChannelResponse_httpStatus,
    deleteAdmChannelResponse_aDMChannelResponse,
  )
where

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

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

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

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

instance Core.AWSRequest DeleteAdmChannel where
  type
    AWSResponse DeleteAdmChannel =
      DeleteAdmChannelResponse
  request :: (Service -> Service)
-> DeleteAdmChannel -> Request DeleteAdmChannel
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteAdmChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteAdmChannel)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> ADMChannelResponse -> DeleteAdmChannelResponse
DeleteAdmChannelResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)
      )

instance Prelude.Hashable DeleteAdmChannel where
  hashWithSalt :: Int -> DeleteAdmChannel -> Int
hashWithSalt Int
_salt DeleteAdmChannel' {Text
applicationId :: Text
$sel:applicationId:DeleteAdmChannel' :: DeleteAdmChannel -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
applicationId

instance Prelude.NFData DeleteAdmChannel where
  rnf :: DeleteAdmChannel -> ()
rnf DeleteAdmChannel' {Text
applicationId :: Text
$sel:applicationId:DeleteAdmChannel' :: DeleteAdmChannel -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
applicationId

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

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

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

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

-- |
-- Create a value of 'DeleteAdmChannelResponse' 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', 'deleteAdmChannelResponse_httpStatus' - The response's http status code.
--
-- 'aDMChannelResponse', 'deleteAdmChannelResponse_aDMChannelResponse' - Undocumented member.
newDeleteAdmChannelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'aDMChannelResponse'
  ADMChannelResponse ->
  DeleteAdmChannelResponse
newDeleteAdmChannelResponse :: Int -> ADMChannelResponse -> DeleteAdmChannelResponse
newDeleteAdmChannelResponse
  Int
pHttpStatus_
  ADMChannelResponse
pADMChannelResponse_ =
    DeleteAdmChannelResponse'
      { $sel:httpStatus:DeleteAdmChannelResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:aDMChannelResponse:DeleteAdmChannelResponse' :: ADMChannelResponse
aDMChannelResponse = ADMChannelResponse
pADMChannelResponse_
      }

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

-- | Undocumented member.
deleteAdmChannelResponse_aDMChannelResponse :: Lens.Lens' DeleteAdmChannelResponse ADMChannelResponse
deleteAdmChannelResponse_aDMChannelResponse :: Lens' DeleteAdmChannelResponse ADMChannelResponse
deleteAdmChannelResponse_aDMChannelResponse = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAdmChannelResponse' {ADMChannelResponse
aDMChannelResponse :: ADMChannelResponse
$sel:aDMChannelResponse:DeleteAdmChannelResponse' :: DeleteAdmChannelResponse -> ADMChannelResponse
aDMChannelResponse} -> ADMChannelResponse
aDMChannelResponse) (\s :: DeleteAdmChannelResponse
s@DeleteAdmChannelResponse' {} ADMChannelResponse
a -> DeleteAdmChannelResponse
s {$sel:aDMChannelResponse:DeleteAdmChannelResponse' :: ADMChannelResponse
aDMChannelResponse = ADMChannelResponse
a} :: DeleteAdmChannelResponse)

instance Prelude.NFData DeleteAdmChannelResponse where
  rnf :: DeleteAdmChannelResponse -> ()
rnf DeleteAdmChannelResponse' {Int
ADMChannelResponse
aDMChannelResponse :: ADMChannelResponse
httpStatus :: Int
$sel:aDMChannelResponse:DeleteAdmChannelResponse' :: DeleteAdmChannelResponse -> ADMChannelResponse
$sel:httpStatus:DeleteAdmChannelResponse' :: DeleteAdmChannelResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ADMChannelResponse
aDMChannelResponse