{-# 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.Personalize.DeleteCampaign
-- 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)
--
-- Removes a campaign by deleting the solution deployment. The solution
-- that the campaign is based on is not deleted and can be redeployed when
-- needed. A deleted campaign can no longer be specified in a
-- <https://docs.aws.amazon.com/personalize/latest/dg/API_RS_GetRecommendations.html GetRecommendations>
-- request. For more information on campaigns, see CreateCampaign.
module Amazonka.Personalize.DeleteCampaign
  ( -- * Creating a Request
    DeleteCampaign (..),
    newDeleteCampaign,

    -- * Request Lenses
    deleteCampaign_campaignArn,

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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Personalize.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 Amazon Resource Name (ARN) of the campaign to delete.
    DeleteCampaign -> Text
campaignArn :: Prelude.Text
  }
  deriving (DeleteCampaign -> DeleteCampaign -> Bool
(DeleteCampaign -> DeleteCampaign -> Bool)
-> (DeleteCampaign -> DeleteCampaign -> Bool) -> Eq DeleteCampaign
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]
(Int -> ReadS DeleteCampaign)
-> ReadS [DeleteCampaign]
-> ReadPrec DeleteCampaign
-> ReadPrec [DeleteCampaign]
-> Read 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
(Int -> DeleteCampaign -> ShowS)
-> (DeleteCampaign -> String)
-> ([DeleteCampaign] -> ShowS)
-> Show DeleteCampaign
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. DeleteCampaign -> Rep DeleteCampaign x)
-> (forall x. Rep DeleteCampaign x -> DeleteCampaign)
-> Generic DeleteCampaign
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:
--
-- 'campaignArn', 'deleteCampaign_campaignArn' - The Amazon Resource Name (ARN) of the campaign to delete.
newDeleteCampaign ::
  -- | 'campaignArn'
  Prelude.Text ->
  DeleteCampaign
newDeleteCampaign :: Text -> DeleteCampaign
newDeleteCampaign Text
pCampaignArn_ =
  DeleteCampaign' :: Text -> DeleteCampaign
DeleteCampaign' {$sel:campaignArn:DeleteCampaign' :: Text
campaignArn = Text
pCampaignArn_}

-- | The Amazon Resource Name (ARN) of the campaign to delete.
deleteCampaign_campaignArn :: Lens.Lens' DeleteCampaign Prelude.Text
deleteCampaign_campaignArn :: (Text -> f Text) -> DeleteCampaign -> f DeleteCampaign
deleteCampaign_campaignArn = (DeleteCampaign -> Text)
-> (DeleteCampaign -> Text -> DeleteCampaign)
-> Lens DeleteCampaign DeleteCampaign Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCampaign' {Text
campaignArn :: Text
$sel:campaignArn:DeleteCampaign' :: DeleteCampaign -> Text
campaignArn} -> Text
campaignArn) (\s :: DeleteCampaign
s@DeleteCampaign' {} Text
a -> DeleteCampaign
s {$sel:campaignArn:DeleteCampaign' :: Text
campaignArn = Text
a} :: DeleteCampaign)

instance Core.AWSRequest DeleteCampaign where
  type
    AWSResponse DeleteCampaign =
      DeleteCampaignResponse
  request :: DeleteCampaign -> Request DeleteCampaign
request = Service -> DeleteCampaign -> Request DeleteCampaign
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteCampaign
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteCampaign)))
response =
    AWSResponse DeleteCampaign
-> Logger
-> Service
-> Proxy DeleteCampaign
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteCampaign)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteCampaign
DeleteCampaignResponse
DeleteCampaignResponse'

instance Prelude.Hashable DeleteCampaign

instance Prelude.NFData DeleteCampaign

instance Core.ToHeaders DeleteCampaign where
  toHeaders :: DeleteCampaign -> [Header]
toHeaders =
    [Header] -> DeleteCampaign -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"AmazonPersonalize.DeleteCampaign" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DeleteCampaign where
  toJSON :: DeleteCampaign -> Value
toJSON DeleteCampaign' {Text
campaignArn :: Text
$sel:campaignArn:DeleteCampaign' :: DeleteCampaign -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"campaignArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
campaignArn)]
      )

instance Core.ToPath DeleteCampaign where
  toPath :: DeleteCampaign -> ByteString
toPath = ByteString -> DeleteCampaign -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newDeleteCampaignResponse' smart constructor.
data DeleteCampaignResponse = DeleteCampaignResponse'
  {
  }
  deriving (DeleteCampaignResponse -> DeleteCampaignResponse -> Bool
(DeleteCampaignResponse -> DeleteCampaignResponse -> Bool)
-> (DeleteCampaignResponse -> DeleteCampaignResponse -> Bool)
-> Eq DeleteCampaignResponse
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]
(Int -> ReadS DeleteCampaignResponse)
-> ReadS [DeleteCampaignResponse]
-> ReadPrec DeleteCampaignResponse
-> ReadPrec [DeleteCampaignResponse]
-> Read 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
(Int -> DeleteCampaignResponse -> ShowS)
-> (DeleteCampaignResponse -> String)
-> ([DeleteCampaignResponse] -> ShowS)
-> Show DeleteCampaignResponse
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. DeleteCampaignResponse -> Rep DeleteCampaignResponse x)
-> (forall x.
    Rep DeleteCampaignResponse x -> DeleteCampaignResponse)
-> Generic DeleteCampaignResponse
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.
newDeleteCampaignResponse ::
  DeleteCampaignResponse
newDeleteCampaignResponse :: DeleteCampaignResponse
newDeleteCampaignResponse = DeleteCampaignResponse
DeleteCampaignResponse'

instance Prelude.NFData DeleteCampaignResponse