{-# 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.DescribeQueue
-- 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.
--
-- Describes the specified queue.
module Amazonka.Connect.DescribeQueue
  ( -- * Creating a Request
    DescribeQueue (..),
    newDescribeQueue,

    -- * Request Lenses
    describeQueue_instanceId,
    describeQueue_queueId,

    -- * Destructuring the Response
    DescribeQueueResponse (..),
    newDescribeQueueResponse,

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

-- |
-- Create a value of 'DescribeQueue' 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', 'describeQueue_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'queueId', 'describeQueue_queueId' - The identifier for the queue.
newDescribeQueue ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'queueId'
  Prelude.Text ->
  DescribeQueue
newDescribeQueue :: Text -> Text -> DescribeQueue
newDescribeQueue Text
pInstanceId_ Text
pQueueId_ =
  DescribeQueue' :: Text -> Text -> DescribeQueue
DescribeQueue'
    { $sel:instanceId:DescribeQueue' :: Text
instanceId = Text
pInstanceId_,
      $sel:queueId:DescribeQueue' :: Text
queueId = Text
pQueueId_
    }

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

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

instance Core.AWSRequest DescribeQueue where
  type
    AWSResponse DescribeQueue =
      DescribeQueueResponse
  request :: DescribeQueue -> Request DescribeQueue
request = Service -> DescribeQueue -> Request DescribeQueue
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeQueue
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeQueue)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeQueue))
-> Logger
-> Service
-> Proxy DescribeQueue
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeQueue)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Queue -> Int -> DescribeQueueResponse
DescribeQueueResponse'
            (Maybe Queue -> Int -> DescribeQueueResponse)
-> Either String (Maybe Queue)
-> Either String (Int -> DescribeQueueResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Queue)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Queue")
            Either String (Int -> DescribeQueueResponse)
-> Either String Int -> Either String DescribeQueueResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeQueue

instance Prelude.NFData DescribeQueue

instance Core.ToHeaders DescribeQueue where
  toHeaders :: DescribeQueue -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeQueue -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

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

-- | /See:/ 'newDescribeQueueResponse' smart constructor.
data DescribeQueueResponse = DescribeQueueResponse'
  { -- | The name of the queue.
    DescribeQueueResponse -> Maybe Queue
queue :: Prelude.Maybe Queue,
    -- | The response's http status code.
    DescribeQueueResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeQueueResponse -> DescribeQueueResponse -> Bool
(DescribeQueueResponse -> DescribeQueueResponse -> Bool)
-> (DescribeQueueResponse -> DescribeQueueResponse -> Bool)
-> Eq DescribeQueueResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeQueueResponse -> DescribeQueueResponse -> Bool
$c/= :: DescribeQueueResponse -> DescribeQueueResponse -> Bool
== :: DescribeQueueResponse -> DescribeQueueResponse -> Bool
$c== :: DescribeQueueResponse -> DescribeQueueResponse -> Bool
Prelude.Eq, ReadPrec [DescribeQueueResponse]
ReadPrec DescribeQueueResponse
Int -> ReadS DescribeQueueResponse
ReadS [DescribeQueueResponse]
(Int -> ReadS DescribeQueueResponse)
-> ReadS [DescribeQueueResponse]
-> ReadPrec DescribeQueueResponse
-> ReadPrec [DescribeQueueResponse]
-> Read DescribeQueueResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeQueueResponse]
$creadListPrec :: ReadPrec [DescribeQueueResponse]
readPrec :: ReadPrec DescribeQueueResponse
$creadPrec :: ReadPrec DescribeQueueResponse
readList :: ReadS [DescribeQueueResponse]
$creadList :: ReadS [DescribeQueueResponse]
readsPrec :: Int -> ReadS DescribeQueueResponse
$creadsPrec :: Int -> ReadS DescribeQueueResponse
Prelude.Read, Int -> DescribeQueueResponse -> ShowS
[DescribeQueueResponse] -> ShowS
DescribeQueueResponse -> String
(Int -> DescribeQueueResponse -> ShowS)
-> (DescribeQueueResponse -> String)
-> ([DescribeQueueResponse] -> ShowS)
-> Show DescribeQueueResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeQueueResponse] -> ShowS
$cshowList :: [DescribeQueueResponse] -> ShowS
show :: DescribeQueueResponse -> String
$cshow :: DescribeQueueResponse -> String
showsPrec :: Int -> DescribeQueueResponse -> ShowS
$cshowsPrec :: Int -> DescribeQueueResponse -> ShowS
Prelude.Show, (forall x. DescribeQueueResponse -> Rep DescribeQueueResponse x)
-> (forall x. Rep DescribeQueueResponse x -> DescribeQueueResponse)
-> Generic DescribeQueueResponse
forall x. Rep DescribeQueueResponse x -> DescribeQueueResponse
forall x. DescribeQueueResponse -> Rep DescribeQueueResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeQueueResponse x -> DescribeQueueResponse
$cfrom :: forall x. DescribeQueueResponse -> Rep DescribeQueueResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeQueueResponse' 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:
--
-- 'queue', 'describeQueueResponse_queue' - The name of the queue.
--
-- 'httpStatus', 'describeQueueResponse_httpStatus' - The response's http status code.
newDescribeQueueResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeQueueResponse
newDescribeQueueResponse :: Int -> DescribeQueueResponse
newDescribeQueueResponse Int
pHttpStatus_ =
  DescribeQueueResponse' :: Maybe Queue -> Int -> DescribeQueueResponse
DescribeQueueResponse'
    { $sel:queue:DescribeQueueResponse' :: Maybe Queue
queue = Maybe Queue
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeQueueResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | The response's http status code.
describeQueueResponse_httpStatus :: Lens.Lens' DescribeQueueResponse Prelude.Int
describeQueueResponse_httpStatus :: (Int -> f Int) -> DescribeQueueResponse -> f DescribeQueueResponse
describeQueueResponse_httpStatus = (DescribeQueueResponse -> Int)
-> (DescribeQueueResponse -> Int -> DescribeQueueResponse)
-> Lens DescribeQueueResponse DescribeQueueResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeQueueResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeQueueResponse' :: DescribeQueueResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeQueueResponse
s@DescribeQueueResponse' {} Int
a -> DescribeQueueResponse
s {$sel:httpStatus:DescribeQueueResponse' :: Int
httpStatus = Int
a} :: DescribeQueueResponse)

instance Prelude.NFData DescribeQueueResponse