{-# 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.DeleteCampaign
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a campaign from an application.
module Amazonka.Pinpoint.DeleteCampaign
  ( -- * Creating a Request
    DeleteCampaign (..),
    newDeleteCampaign,

    -- * Request Lenses
    deleteCampaign_campaignId,
    deleteCampaign_applicationId,

    -- * Destructuring the Response
    DeleteCampaignResponse (..),
    newDeleteCampaignResponse,

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

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

-- | The unique identifier for the campaign.
deleteCampaign_campaignId :: Lens.Lens' DeleteCampaign Prelude.Text
deleteCampaign_campaignId :: Lens' DeleteCampaign Text
deleteCampaign_campaignId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCampaign' {Text
campaignId :: Text
$sel:campaignId:DeleteCampaign' :: DeleteCampaign -> Text
campaignId} -> Text
campaignId) (\s :: DeleteCampaign
s@DeleteCampaign' {} Text
a -> DeleteCampaign
s {$sel:campaignId:DeleteCampaign' :: Text
campaignId = Text
a} :: DeleteCampaign)

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

instance Core.AWSRequest DeleteCampaign where
  type
    AWSResponse DeleteCampaign =
      DeleteCampaignResponse
  request :: (Service -> Service) -> DeleteCampaign -> Request DeleteCampaign
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 DeleteCampaign
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteCampaign)))
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 -> CampaignResponse -> DeleteCampaignResponse
DeleteCampaignResponse'
            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 DeleteCampaign where
  hashWithSalt :: Int -> DeleteCampaign -> Int
hashWithSalt Int
_salt DeleteCampaign' {Text
applicationId :: Text
campaignId :: Text
$sel:applicationId:DeleteCampaign' :: DeleteCampaign -> Text
$sel:campaignId:DeleteCampaign' :: DeleteCampaign -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
campaignId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
applicationId

instance Prelude.NFData DeleteCampaign where
  rnf :: DeleteCampaign -> ()
rnf DeleteCampaign' {Text
applicationId :: Text
campaignId :: Text
$sel:applicationId:DeleteCampaign' :: DeleteCampaign -> Text
$sel:campaignId:DeleteCampaign' :: DeleteCampaign -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
campaignId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
applicationId

instance Data.ToHeaders DeleteCampaign where
  toHeaders :: DeleteCampaign -> 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 DeleteCampaign where
  toPath :: DeleteCampaign -> ByteString
toPath DeleteCampaign' {Text
applicationId :: Text
campaignId :: Text
$sel:applicationId:DeleteCampaign' :: DeleteCampaign -> Text
$sel:campaignId:DeleteCampaign' :: DeleteCampaign -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/apps/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
applicationId,
        ByteString
"/campaigns/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
campaignId
      ]

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

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

-- |
-- Create a value of 'DeleteCampaignResponse' 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', 'deleteCampaignResponse_httpStatus' - The response's http status code.
--
-- 'campaignResponse', 'deleteCampaignResponse_campaignResponse' - Undocumented member.
newDeleteCampaignResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'campaignResponse'
  CampaignResponse ->
  DeleteCampaignResponse
newDeleteCampaignResponse :: Int -> CampaignResponse -> DeleteCampaignResponse
newDeleteCampaignResponse
  Int
pHttpStatus_
  CampaignResponse
pCampaignResponse_ =
    DeleteCampaignResponse'
      { $sel:httpStatus:DeleteCampaignResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:campaignResponse:DeleteCampaignResponse' :: CampaignResponse
campaignResponse = CampaignResponse
pCampaignResponse_
      }

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

-- | Undocumented member.
deleteCampaignResponse_campaignResponse :: Lens.Lens' DeleteCampaignResponse CampaignResponse
deleteCampaignResponse_campaignResponse :: Lens' DeleteCampaignResponse CampaignResponse
deleteCampaignResponse_campaignResponse = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCampaignResponse' {CampaignResponse
campaignResponse :: CampaignResponse
$sel:campaignResponse:DeleteCampaignResponse' :: DeleteCampaignResponse -> CampaignResponse
campaignResponse} -> CampaignResponse
campaignResponse) (\s :: DeleteCampaignResponse
s@DeleteCampaignResponse' {} CampaignResponse
a -> DeleteCampaignResponse
s {$sel:campaignResponse:DeleteCampaignResponse' :: CampaignResponse
campaignResponse = CampaignResponse
a} :: DeleteCampaignResponse)

instance Prelude.NFData DeleteCampaignResponse where
  rnf :: DeleteCampaignResponse -> ()
rnf DeleteCampaignResponse' {Int
CampaignResponse
campaignResponse :: CampaignResponse
httpStatus :: Int
$sel:campaignResponse:DeleteCampaignResponse' :: DeleteCampaignResponse -> CampaignResponse
$sel:httpStatus:DeleteCampaignResponse' :: DeleteCampaignResponse -> 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 CampaignResponse
campaignResponse