{-# 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.MediaConvert.GetQueue
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieve the JSON for a specific queue.
module Amazonka.MediaConvert.GetQueue
  ( -- * Creating a Request
    GetQueue (..),
    newGetQueue,

    -- * Request Lenses
    getQueue_name,

    -- * Destructuring the Response
    GetQueueResponse (..),
    newGetQueueResponse,

    -- * Response Lenses
    getQueueResponse_queue,
    getQueueResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetQueue' smart constructor.
data GetQueue = GetQueue'
  { -- | The name of the queue that you want information about.
    GetQueue -> Text
name :: Prelude.Text
  }
  deriving (GetQueue -> GetQueue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetQueue -> GetQueue -> Bool
$c/= :: GetQueue -> GetQueue -> Bool
== :: GetQueue -> GetQueue -> Bool
$c== :: GetQueue -> GetQueue -> Bool
Prelude.Eq, ReadPrec [GetQueue]
ReadPrec GetQueue
Int -> ReadS GetQueue
ReadS [GetQueue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetQueue]
$creadListPrec :: ReadPrec [GetQueue]
readPrec :: ReadPrec GetQueue
$creadPrec :: ReadPrec GetQueue
readList :: ReadS [GetQueue]
$creadList :: ReadS [GetQueue]
readsPrec :: Int -> ReadS GetQueue
$creadsPrec :: Int -> ReadS GetQueue
Prelude.Read, Int -> GetQueue -> ShowS
[GetQueue] -> ShowS
GetQueue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetQueue] -> ShowS
$cshowList :: [GetQueue] -> ShowS
show :: GetQueue -> String
$cshow :: GetQueue -> String
showsPrec :: Int -> GetQueue -> ShowS
$cshowsPrec :: Int -> GetQueue -> ShowS
Prelude.Show, forall x. Rep GetQueue x -> GetQueue
forall x. GetQueue -> Rep GetQueue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetQueue x -> GetQueue
$cfrom :: forall x. GetQueue -> Rep GetQueue x
Prelude.Generic)

-- |
-- Create a value of 'GetQueue' 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', 'getQueue_name' - The name of the queue that you want information about.
newGetQueue ::
  -- | 'name'
  Prelude.Text ->
  GetQueue
newGetQueue :: Text -> GetQueue
newGetQueue Text
pName_ = GetQueue' {$sel:name:GetQueue' :: Text
name = Text
pName_}

-- | The name of the queue that you want information about.
getQueue_name :: Lens.Lens' GetQueue Prelude.Text
getQueue_name :: Lens' GetQueue Text
getQueue_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetQueue' {Text
name :: Text
$sel:name:GetQueue' :: GetQueue -> Text
name} -> Text
name) (\s :: GetQueue
s@GetQueue' {} Text
a -> GetQueue
s {$sel:name:GetQueue' :: Text
name = Text
a} :: GetQueue)

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

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

instance Prelude.NFData GetQueue where
  rnf :: GetQueue -> ()
rnf GetQueue' {Text
name :: Text
$sel:name:GetQueue' :: GetQueue -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
name

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

instance Data.ToPath GetQueue where
  toPath :: GetQueue -> ByteString
toPath GetQueue' {Text
name :: Text
$sel:name:GetQueue' :: GetQueue -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/2017-08-29/queues/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
name]

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

-- | /See:/ 'newGetQueueResponse' smart constructor.
data GetQueueResponse = GetQueueResponse'
  { -- | You can use queues to manage the resources that are available to your
    -- AWS account for running multiple transcoding jobs at the same time. If
    -- you don\'t specify a queue, the service sends all jobs through the
    -- default queue. For more information, see
    -- https:\/\/docs.aws.amazon.com\/mediaconvert\/latest\/ug\/working-with-queues.html.
    GetQueueResponse -> Maybe Queue
queue :: Prelude.Maybe Queue,
    -- | The response's http status code.
    GetQueueResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetQueueResponse -> GetQueueResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetQueueResponse -> GetQueueResponse -> Bool
$c/= :: GetQueueResponse -> GetQueueResponse -> Bool
== :: GetQueueResponse -> GetQueueResponse -> Bool
$c== :: GetQueueResponse -> GetQueueResponse -> Bool
Prelude.Eq, ReadPrec [GetQueueResponse]
ReadPrec GetQueueResponse
Int -> ReadS GetQueueResponse
ReadS [GetQueueResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetQueueResponse]
$creadListPrec :: ReadPrec [GetQueueResponse]
readPrec :: ReadPrec GetQueueResponse
$creadPrec :: ReadPrec GetQueueResponse
readList :: ReadS [GetQueueResponse]
$creadList :: ReadS [GetQueueResponse]
readsPrec :: Int -> ReadS GetQueueResponse
$creadsPrec :: Int -> ReadS GetQueueResponse
Prelude.Read, Int -> GetQueueResponse -> ShowS
[GetQueueResponse] -> ShowS
GetQueueResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetQueueResponse] -> ShowS
$cshowList :: [GetQueueResponse] -> ShowS
show :: GetQueueResponse -> String
$cshow :: GetQueueResponse -> String
showsPrec :: Int -> GetQueueResponse -> ShowS
$cshowsPrec :: Int -> GetQueueResponse -> ShowS
Prelude.Show, forall x. Rep GetQueueResponse x -> GetQueueResponse
forall x. GetQueueResponse -> Rep GetQueueResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetQueueResponse x -> GetQueueResponse
$cfrom :: forall x. GetQueueResponse -> Rep GetQueueResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetQueueResponse' 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', 'getQueueResponse_queue' - You can use queues to manage the resources that are available to your
-- AWS account for running multiple transcoding jobs at the same time. If
-- you don\'t specify a queue, the service sends all jobs through the
-- default queue. For more information, see
-- https:\/\/docs.aws.amazon.com\/mediaconvert\/latest\/ug\/working-with-queues.html.
--
-- 'httpStatus', 'getQueueResponse_httpStatus' - The response's http status code.
newGetQueueResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetQueueResponse
newGetQueueResponse :: Int -> GetQueueResponse
newGetQueueResponse Int
pHttpStatus_ =
  GetQueueResponse'
    { $sel:queue:GetQueueResponse' :: Maybe Queue
queue = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetQueueResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | You can use queues to manage the resources that are available to your
-- AWS account for running multiple transcoding jobs at the same time. If
-- you don\'t specify a queue, the service sends all jobs through the
-- default queue. For more information, see
-- https:\/\/docs.aws.amazon.com\/mediaconvert\/latest\/ug\/working-with-queues.html.
getQueueResponse_queue :: Lens.Lens' GetQueueResponse (Prelude.Maybe Queue)
getQueueResponse_queue :: Lens' GetQueueResponse (Maybe Queue)
getQueueResponse_queue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetQueueResponse' {Maybe Queue
queue :: Maybe Queue
$sel:queue:GetQueueResponse' :: GetQueueResponse -> Maybe Queue
queue} -> Maybe Queue
queue) (\s :: GetQueueResponse
s@GetQueueResponse' {} Maybe Queue
a -> GetQueueResponse
s {$sel:queue:GetQueueResponse' :: Maybe Queue
queue = Maybe Queue
a} :: GetQueueResponse)

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

instance Prelude.NFData GetQueueResponse where
  rnf :: GetQueueResponse -> ()
rnf GetQueueResponse' {Int
Maybe Queue
httpStatus :: Int
queue :: Maybe Queue
$sel:httpStatus:GetQueueResponse' :: GetQueueResponse -> Int
$sel:queue:GetQueueResponse' :: GetQueueResponse -> Maybe Queue
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Queue
queue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus