{-# 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.UpdateQueueStatus
-- 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 status of the queue.
module Amazonka.Connect.UpdateQueueStatus
  ( -- * Creating a Request
    UpdateQueueStatus (..),
    newUpdateQueueStatus,

    -- * Request Lenses
    updateQueueStatus_instanceId,
    updateQueueStatus_queueId,
    updateQueueStatus_status,

    -- * Destructuring the Response
    UpdateQueueStatusResponse (..),
    newUpdateQueueStatusResponse,
  )
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:/ 'newUpdateQueueStatus' smart constructor.
data UpdateQueueStatus = UpdateQueueStatus'
  { -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    UpdateQueueStatus -> Text
instanceId :: Prelude.Text,
    -- | The identifier for the queue.
    UpdateQueueStatus -> Text
queueId :: Prelude.Text,
    -- | The status of the queue.
    UpdateQueueStatus -> QueueStatus
status :: QueueStatus
  }
  deriving (UpdateQueueStatus -> UpdateQueueStatus -> Bool
(UpdateQueueStatus -> UpdateQueueStatus -> Bool)
-> (UpdateQueueStatus -> UpdateQueueStatus -> Bool)
-> Eq UpdateQueueStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateQueueStatus -> UpdateQueueStatus -> Bool
$c/= :: UpdateQueueStatus -> UpdateQueueStatus -> Bool
== :: UpdateQueueStatus -> UpdateQueueStatus -> Bool
$c== :: UpdateQueueStatus -> UpdateQueueStatus -> Bool
Prelude.Eq, ReadPrec [UpdateQueueStatus]
ReadPrec UpdateQueueStatus
Int -> ReadS UpdateQueueStatus
ReadS [UpdateQueueStatus]
(Int -> ReadS UpdateQueueStatus)
-> ReadS [UpdateQueueStatus]
-> ReadPrec UpdateQueueStatus
-> ReadPrec [UpdateQueueStatus]
-> Read UpdateQueueStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateQueueStatus]
$creadListPrec :: ReadPrec [UpdateQueueStatus]
readPrec :: ReadPrec UpdateQueueStatus
$creadPrec :: ReadPrec UpdateQueueStatus
readList :: ReadS [UpdateQueueStatus]
$creadList :: ReadS [UpdateQueueStatus]
readsPrec :: Int -> ReadS UpdateQueueStatus
$creadsPrec :: Int -> ReadS UpdateQueueStatus
Prelude.Read, Int -> UpdateQueueStatus -> ShowS
[UpdateQueueStatus] -> ShowS
UpdateQueueStatus -> String
(Int -> UpdateQueueStatus -> ShowS)
-> (UpdateQueueStatus -> String)
-> ([UpdateQueueStatus] -> ShowS)
-> Show UpdateQueueStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateQueueStatus] -> ShowS
$cshowList :: [UpdateQueueStatus] -> ShowS
show :: UpdateQueueStatus -> String
$cshow :: UpdateQueueStatus -> String
showsPrec :: Int -> UpdateQueueStatus -> ShowS
$cshowsPrec :: Int -> UpdateQueueStatus -> ShowS
Prelude.Show, (forall x. UpdateQueueStatus -> Rep UpdateQueueStatus x)
-> (forall x. Rep UpdateQueueStatus x -> UpdateQueueStatus)
-> Generic UpdateQueueStatus
forall x. Rep UpdateQueueStatus x -> UpdateQueueStatus
forall x. UpdateQueueStatus -> Rep UpdateQueueStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateQueueStatus x -> UpdateQueueStatus
$cfrom :: forall x. UpdateQueueStatus -> Rep UpdateQueueStatus x
Prelude.Generic)

-- |
-- Create a value of 'UpdateQueueStatus' 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:
--
-- 'instanceId', 'updateQueueStatus_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'queueId', 'updateQueueStatus_queueId' - The identifier for the queue.
--
-- 'status', 'updateQueueStatus_status' - The status of the queue.
newUpdateQueueStatus ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'queueId'
  Prelude.Text ->
  -- | 'status'
  QueueStatus ->
  UpdateQueueStatus
newUpdateQueueStatus :: Text -> Text -> QueueStatus -> UpdateQueueStatus
newUpdateQueueStatus Text
pInstanceId_ Text
pQueueId_ QueueStatus
pStatus_ =
  UpdateQueueStatus' :: Text -> Text -> QueueStatus -> UpdateQueueStatus
UpdateQueueStatus'
    { $sel:instanceId:UpdateQueueStatus' :: Text
instanceId = Text
pInstanceId_,
      $sel:queueId:UpdateQueueStatus' :: Text
queueId = Text
pQueueId_,
      $sel:status:UpdateQueueStatus' :: QueueStatus
status = QueueStatus
pStatus_
    }

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

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

-- | The status of the queue.
updateQueueStatus_status :: Lens.Lens' UpdateQueueStatus QueueStatus
updateQueueStatus_status :: (QueueStatus -> f QueueStatus)
-> UpdateQueueStatus -> f UpdateQueueStatus
updateQueueStatus_status = (UpdateQueueStatus -> QueueStatus)
-> (UpdateQueueStatus -> QueueStatus -> UpdateQueueStatus)
-> Lens UpdateQueueStatus UpdateQueueStatus QueueStatus QueueStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateQueueStatus' {QueueStatus
status :: QueueStatus
$sel:status:UpdateQueueStatus' :: UpdateQueueStatus -> QueueStatus
status} -> QueueStatus
status) (\s :: UpdateQueueStatus
s@UpdateQueueStatus' {} QueueStatus
a -> UpdateQueueStatus
s {$sel:status:UpdateQueueStatus' :: QueueStatus
status = QueueStatus
a} :: UpdateQueueStatus)

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

instance Prelude.Hashable UpdateQueueStatus

instance Prelude.NFData UpdateQueueStatus

instance Core.ToHeaders UpdateQueueStatus where
  toHeaders :: UpdateQueueStatus -> [Header]
toHeaders =
    [Header] -> UpdateQueueStatus -> [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 UpdateQueueStatus where
  toJSON :: UpdateQueueStatus -> Value
toJSON UpdateQueueStatus' {Text
QueueStatus
status :: QueueStatus
queueId :: Text
instanceId :: Text
$sel:status:UpdateQueueStatus' :: UpdateQueueStatus -> QueueStatus
$sel:queueId:UpdateQueueStatus' :: UpdateQueueStatus -> Text
$sel:instanceId:UpdateQueueStatus' :: UpdateQueueStatus -> 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
"Status" Text -> QueueStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= QueueStatus
status)]
      )

instance Core.ToPath UpdateQueueStatus where
  toPath :: UpdateQueueStatus -> ByteString
toPath UpdateQueueStatus' {Text
QueueStatus
status :: QueueStatus
queueId :: Text
instanceId :: Text
$sel:status:UpdateQueueStatus' :: UpdateQueueStatus -> QueueStatus
$sel:queueId:UpdateQueueStatus' :: UpdateQueueStatus -> Text
$sel:instanceId:UpdateQueueStatus' :: UpdateQueueStatus -> 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
"/status"
      ]

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

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

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

instance Prelude.NFData UpdateQueueStatusResponse