{-# 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-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)
--
-- 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_name,
    updateQueueName_description,
    updateQueueName_instanceId,
    updateQueueName_queueId,

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

import Amazonka.Connect.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 name of the queue.
    UpdateQueueName -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The description of the queue.
    UpdateQueueName -> Maybe Text
description :: 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
(UpdateQueueName -> UpdateQueueName -> Bool)
-> (UpdateQueueName -> UpdateQueueName -> Bool)
-> Eq UpdateQueueName
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]
(Int -> ReadS UpdateQueueName)
-> ReadS [UpdateQueueName]
-> ReadPrec UpdateQueueName
-> ReadPrec [UpdateQueueName]
-> Read 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
(Int -> UpdateQueueName -> ShowS)
-> (UpdateQueueName -> String)
-> ([UpdateQueueName] -> ShowS)
-> Show UpdateQueueName
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. UpdateQueueName -> Rep UpdateQueueName x)
-> (forall x. Rep UpdateQueueName x -> UpdateQueueName)
-> Generic UpdateQueueName
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:
--
-- 'name', 'updateQueueName_name' - The name of the queue.
--
-- 'description', 'updateQueueName_description' - The description 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' :: Maybe Text -> Maybe Text -> Text -> Text -> UpdateQueueName
UpdateQueueName'
    { $sel:name:UpdateQueueName' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:UpdateQueueName' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceId:UpdateQueueName' :: Text
instanceId = Text
pInstanceId_,
      $sel:queueId:UpdateQueueName' :: Text
queueId = Text
pQueueId_
    }

-- | The name of the queue.
updateQueueName_name :: Lens.Lens' UpdateQueueName (Prelude.Maybe Prelude.Text)
updateQueueName_name :: (Maybe Text -> f (Maybe Text))
-> UpdateQueueName -> f UpdateQueueName
updateQueueName_name = (UpdateQueueName -> Maybe Text)
-> (UpdateQueueName -> Maybe Text -> UpdateQueueName)
-> Lens UpdateQueueName UpdateQueueName (Maybe Text) (Maybe Text)
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 description of the queue.
updateQueueName_description :: Lens.Lens' UpdateQueueName (Prelude.Maybe Prelude.Text)
updateQueueName_description :: (Maybe Text -> f (Maybe Text))
-> UpdateQueueName -> f UpdateQueueName
updateQueueName_description = (UpdateQueueName -> Maybe Text)
-> (UpdateQueueName -> Maybe Text -> UpdateQueueName)
-> Lens UpdateQueueName UpdateQueueName (Maybe Text) (Maybe Text)
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 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 :: (Text -> f Text) -> UpdateQueueName -> f UpdateQueueName
updateQueueName_instanceId = (UpdateQueueName -> Text)
-> (UpdateQueueName -> Text -> UpdateQueueName)
-> Lens UpdateQueueName UpdateQueueName Text Text
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 :: (Text -> f Text) -> UpdateQueueName -> f UpdateQueueName
updateQueueName_queueId = (UpdateQueueName -> Text)
-> (UpdateQueueName -> Text -> UpdateQueueName)
-> Lens UpdateQueueName UpdateQueueName Text Text
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 :: UpdateQueueName -> Request UpdateQueueName
request = Service -> UpdateQueueName -> Request UpdateQueueName
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateQueueName
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateQueueName)))
response =
    AWSResponse UpdateQueueName
-> Logger
-> Service
-> Proxy UpdateQueueName
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateQueueName)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse UpdateQueueName
UpdateQueueNameResponse
UpdateQueueNameResponse'

instance Prelude.Hashable UpdateQueueName

instance Prelude.NFData UpdateQueueName

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

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

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

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