{-# 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.ConnectCampaigns.UpdateCampaignName
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates the name of a campaign. This API is idempotent.
module Amazonka.ConnectCampaigns.UpdateCampaignName
  ( -- * Creating a Request
    UpdateCampaignName (..),
    newUpdateCampaignName,

    -- * Request Lenses
    updateCampaignName_id,
    updateCampaignName_name,

    -- * Destructuring the Response
    UpdateCampaignNameResponse (..),
    newUpdateCampaignNameResponse,
  )
where

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

-- | UpdateCampaignNameRequest
--
-- /See:/ 'newUpdateCampaignName' smart constructor.
data UpdateCampaignName = UpdateCampaignName'
  { UpdateCampaignName -> Text
id :: Prelude.Text,
    UpdateCampaignName -> Text
name :: Prelude.Text
  }
  deriving (UpdateCampaignName -> UpdateCampaignName -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateCampaignName -> UpdateCampaignName -> Bool
$c/= :: UpdateCampaignName -> UpdateCampaignName -> Bool
== :: UpdateCampaignName -> UpdateCampaignName -> Bool
$c== :: UpdateCampaignName -> UpdateCampaignName -> Bool
Prelude.Eq, ReadPrec [UpdateCampaignName]
ReadPrec UpdateCampaignName
Int -> ReadS UpdateCampaignName
ReadS [UpdateCampaignName]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateCampaignName]
$creadListPrec :: ReadPrec [UpdateCampaignName]
readPrec :: ReadPrec UpdateCampaignName
$creadPrec :: ReadPrec UpdateCampaignName
readList :: ReadS [UpdateCampaignName]
$creadList :: ReadS [UpdateCampaignName]
readsPrec :: Int -> ReadS UpdateCampaignName
$creadsPrec :: Int -> ReadS UpdateCampaignName
Prelude.Read, Int -> UpdateCampaignName -> ShowS
[UpdateCampaignName] -> ShowS
UpdateCampaignName -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateCampaignName] -> ShowS
$cshowList :: [UpdateCampaignName] -> ShowS
show :: UpdateCampaignName -> String
$cshow :: UpdateCampaignName -> String
showsPrec :: Int -> UpdateCampaignName -> ShowS
$cshowsPrec :: Int -> UpdateCampaignName -> ShowS
Prelude.Show, forall x. Rep UpdateCampaignName x -> UpdateCampaignName
forall x. UpdateCampaignName -> Rep UpdateCampaignName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateCampaignName x -> UpdateCampaignName
$cfrom :: forall x. UpdateCampaignName -> Rep UpdateCampaignName x
Prelude.Generic)

-- |
-- Create a value of 'UpdateCampaignName' 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:
--
-- 'id', 'updateCampaignName_id' - Undocumented member.
--
-- 'name', 'updateCampaignName_name' - Undocumented member.
newUpdateCampaignName ::
  -- | 'id'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  UpdateCampaignName
newUpdateCampaignName :: Text -> Text -> UpdateCampaignName
newUpdateCampaignName Text
pId_ Text
pName_ =
  UpdateCampaignName' {$sel:id:UpdateCampaignName' :: Text
id = Text
pId_, $sel:name:UpdateCampaignName' :: Text
name = Text
pName_}

-- | Undocumented member.
updateCampaignName_id :: Lens.Lens' UpdateCampaignName Prelude.Text
updateCampaignName_id :: Lens' UpdateCampaignName Text
updateCampaignName_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCampaignName' {Text
id :: Text
$sel:id:UpdateCampaignName' :: UpdateCampaignName -> Text
id} -> Text
id) (\s :: UpdateCampaignName
s@UpdateCampaignName' {} Text
a -> UpdateCampaignName
s {$sel:id:UpdateCampaignName' :: Text
id = Text
a} :: UpdateCampaignName)

-- | Undocumented member.
updateCampaignName_name :: Lens.Lens' UpdateCampaignName Prelude.Text
updateCampaignName_name :: Lens' UpdateCampaignName Text
updateCampaignName_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCampaignName' {Text
name :: Text
$sel:name:UpdateCampaignName' :: UpdateCampaignName -> Text
name} -> Text
name) (\s :: UpdateCampaignName
s@UpdateCampaignName' {} Text
a -> UpdateCampaignName
s {$sel:name:UpdateCampaignName' :: Text
name = Text
a} :: UpdateCampaignName)

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

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

instance Prelude.NFData UpdateCampaignName where
  rnf :: UpdateCampaignName -> ()
rnf UpdateCampaignName' {Text
name :: Text
id :: Text
$sel:name:UpdateCampaignName' :: UpdateCampaignName -> Text
$sel:id:UpdateCampaignName' :: UpdateCampaignName -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
id seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name

instance Data.ToHeaders UpdateCampaignName where
  toHeaders :: UpdateCampaignName -> [Header]
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 -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

instance Data.ToPath UpdateCampaignName where
  toPath :: UpdateCampaignName -> ByteString
toPath UpdateCampaignName' {Text
name :: Text
id :: Text
$sel:name:UpdateCampaignName' :: UpdateCampaignName -> Text
$sel:id:UpdateCampaignName' :: UpdateCampaignName -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/campaigns/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
id, ByteString
"/name"]

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

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

-- |
-- Create a value of 'UpdateCampaignNameResponse' 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.
newUpdateCampaignNameResponse ::
  UpdateCampaignNameResponse
newUpdateCampaignNameResponse :: UpdateCampaignNameResponse
newUpdateCampaignNameResponse =
  UpdateCampaignNameResponse
UpdateCampaignNameResponse'

instance Prelude.NFData UpdateCampaignNameResponse where
  rnf :: UpdateCampaignNameResponse -> ()
rnf UpdateCampaignNameResponse
_ = ()