{-# 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.Connect.UpdateQueueName
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- This API is in preview release for Amazon Connect and is subject to
-- change.
--
-- Updates the name and description of a queue. At least @Name@ or
-- @Description@ must be provided.
module Amazonka.Connect.UpdateQueueName
  ( -- * Creating a Request
    UpdateQueueName (..),
    newUpdateQueueName,

    -- * Request Lenses
    updateQueueName_description,
    updateQueueName_name,
    updateQueueName_instanceId,
    updateQueueName_queueId,

    -- * Destructuring the Response
    UpdateQueueNameResponse (..),
    newUpdateQueueNameResponse,
  )
where

import Amazonka.Connect.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

-- | /See:/ 'newUpdateQueueName' smart constructor.
data UpdateQueueName = UpdateQueueName'
  { -- | The description of the queue.
    UpdateQueueName -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The name of the queue.
    UpdateQueueName -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    UpdateQueueName -> Text
instanceId :: Prelude.Text,
    -- | The identifier for the queue.
    UpdateQueueName -> Text
queueId :: Prelude.Text
  }
  deriving (UpdateQueueName -> UpdateQueueName -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateQueueName -> UpdateQueueName -> Bool
$c/= :: UpdateQueueName -> UpdateQueueName -> Bool
== :: UpdateQueueName -> UpdateQueueName -> Bool
$c== :: UpdateQueueName -> UpdateQueueName -> Bool
Prelude.Eq, ReadPrec [UpdateQueueName]
ReadPrec UpdateQueueName
Int -> ReadS UpdateQueueName
ReadS [UpdateQueueName]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateQueueName]
$creadListPrec :: ReadPrec [UpdateQueueName]
readPrec :: ReadPrec UpdateQueueName
$creadPrec :: ReadPrec UpdateQueueName
readList :: ReadS [UpdateQueueName]
$creadList :: ReadS [UpdateQueueName]
readsPrec :: Int -> ReadS UpdateQueueName
$creadsPrec :: Int -> ReadS UpdateQueueName
Prelude.Read, Int -> UpdateQueueName -> ShowS
[UpdateQueueName] -> ShowS
UpdateQueueName -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateQueueName] -> ShowS
$cshowList :: [UpdateQueueName] -> ShowS
show :: UpdateQueueName -> String
$cshow :: UpdateQueueName -> String
showsPrec :: Int -> UpdateQueueName -> ShowS
$cshowsPrec :: Int -> UpdateQueueName -> ShowS
Prelude.Show, forall x. Rep UpdateQueueName x -> UpdateQueueName
forall x. UpdateQueueName -> Rep UpdateQueueName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateQueueName x -> UpdateQueueName
$cfrom :: forall x. UpdateQueueName -> Rep UpdateQueueName x
Prelude.Generic)

-- |
-- Create a value of 'UpdateQueueName' 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:
--
-- 'description', 'updateQueueName_description' - The description of the queue.
--
-- 'name', 'updateQueueName_name' - The name of the queue.
--
-- 'instanceId', 'updateQueueName_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'queueId', 'updateQueueName_queueId' - The identifier for the queue.
newUpdateQueueName ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'queueId'
  Prelude.Text ->
  UpdateQueueName
newUpdateQueueName :: Text -> Text -> UpdateQueueName
newUpdateQueueName Text
pInstanceId_ Text
pQueueId_ =
  UpdateQueueName'
    { $sel:description:UpdateQueueName' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:name:UpdateQueueName' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceId:UpdateQueueName' :: Text
instanceId = Text
pInstanceId_,
      $sel:queueId:UpdateQueueName' :: Text
queueId = Text
pQueueId_
    }

-- | The description of the queue.
updateQueueName_description :: Lens.Lens' UpdateQueueName (Prelude.Maybe Prelude.Text)
updateQueueName_description :: Lens' UpdateQueueName (Maybe Text)
updateQueueName_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateQueueName' {Maybe Text
description :: Maybe Text
$sel:description:UpdateQueueName' :: UpdateQueueName -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateQueueName
s@UpdateQueueName' {} Maybe Text
a -> UpdateQueueName
s {$sel:description:UpdateQueueName' :: Maybe Text
description = Maybe Text
a} :: UpdateQueueName)

-- | The name of the queue.
updateQueueName_name :: Lens.Lens' UpdateQueueName (Prelude.Maybe Prelude.Text)
updateQueueName_name :: Lens' UpdateQueueName (Maybe Text)
updateQueueName_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateQueueName' {Maybe Text
name :: Maybe Text
$sel:name:UpdateQueueName' :: UpdateQueueName -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateQueueName
s@UpdateQueueName' {} Maybe Text
a -> UpdateQueueName
s {$sel:name:UpdateQueueName' :: Maybe Text
name = Maybe Text
a} :: UpdateQueueName)

-- | The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
updateQueueName_instanceId :: Lens.Lens' UpdateQueueName Prelude.Text
updateQueueName_instanceId :: Lens' UpdateQueueName Text
updateQueueName_instanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateQueueName' {Text
instanceId :: Text
$sel:instanceId:UpdateQueueName' :: UpdateQueueName -> Text
instanceId} -> Text
instanceId) (\s :: UpdateQueueName
s@UpdateQueueName' {} Text
a -> UpdateQueueName
s {$sel:instanceId:UpdateQueueName' :: Text
instanceId = Text
a} :: UpdateQueueName)

-- | The identifier for the queue.
updateQueueName_queueId :: Lens.Lens' UpdateQueueName Prelude.Text
updateQueueName_queueId :: Lens' UpdateQueueName Text
updateQueueName_queueId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateQueueName' {Text
queueId :: Text
$sel:queueId:UpdateQueueName' :: UpdateQueueName -> Text
queueId} -> Text
queueId) (\s :: UpdateQueueName
s@UpdateQueueName' {} Text
a -> UpdateQueueName
s {$sel:queueId:UpdateQueueName' :: Text
queueId = Text
a} :: UpdateQueueName)

instance Core.AWSRequest UpdateQueueName where
  type
    AWSResponse UpdateQueueName =
      UpdateQueueNameResponse
  request :: (Service -> Service) -> UpdateQueueName -> Request UpdateQueueName
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 UpdateQueueName
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateQueueName)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull UpdateQueueNameResponse
UpdateQueueNameResponse'

instance Prelude.Hashable UpdateQueueName where
  hashWithSalt :: Int -> UpdateQueueName -> Int
hashWithSalt Int
_salt UpdateQueueName' {Maybe Text
Text
queueId :: Text
instanceId :: Text
name :: Maybe Text
description :: Maybe Text
$sel:queueId:UpdateQueueName' :: UpdateQueueName -> Text
$sel:instanceId:UpdateQueueName' :: UpdateQueueName -> Text
$sel:name:UpdateQueueName' :: UpdateQueueName -> Maybe Text
$sel:description:UpdateQueueName' :: UpdateQueueName -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
queueId

instance Prelude.NFData UpdateQueueName where
  rnf :: UpdateQueueName -> ()
rnf UpdateQueueName' {Maybe Text
Text
queueId :: Text
instanceId :: Text
name :: Maybe Text
description :: Maybe Text
$sel:queueId:UpdateQueueName' :: UpdateQueueName -> Text
$sel:instanceId:UpdateQueueName' :: UpdateQueueName -> Text
$sel:name:UpdateQueueName' :: UpdateQueueName -> Maybe Text
$sel:description:UpdateQueueName' :: UpdateQueueName -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
instanceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
queueId

instance Data.ToHeaders UpdateQueueName where
  toHeaders :: UpdateQueueName -> [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 UpdateQueueName where
  toJSON :: UpdateQueueName -> Value
toJSON UpdateQueueName' {Maybe Text
Text
queueId :: Text
instanceId :: Text
name :: Maybe Text
description :: Maybe Text
$sel:queueId:UpdateQueueName' :: UpdateQueueName -> Text
$sel:instanceId:UpdateQueueName' :: UpdateQueueName -> Text
$sel:name:UpdateQueueName' :: UpdateQueueName -> Maybe Text
$sel:description:UpdateQueueName' :: UpdateQueueName -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name
          ]
      )

instance Data.ToPath UpdateQueueName where
  toPath :: UpdateQueueName -> ByteString
toPath UpdateQueueName' {Maybe Text
Text
queueId :: Text
instanceId :: Text
name :: Maybe Text
description :: Maybe Text
$sel:queueId:UpdateQueueName' :: UpdateQueueName -> Text
$sel:instanceId:UpdateQueueName' :: UpdateQueueName -> Text
$sel:name:UpdateQueueName' :: UpdateQueueName -> Maybe Text
$sel:description:UpdateQueueName' :: UpdateQueueName -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/queues/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
instanceId,
        ByteString
"/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
queueId,
        ByteString
"/name"
      ]

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

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

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

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