{-# 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-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)
--
-- 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.Lens as Lens
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
(GetQueue -> GetQueue -> Bool)
-> (GetQueue -> GetQueue -> Bool) -> Eq GetQueue
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]
(Int -> ReadS GetQueue)
-> ReadS [GetQueue]
-> ReadPrec GetQueue
-> ReadPrec [GetQueue]
-> Read 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
(Int -> GetQueue -> ShowS)
-> (GetQueue -> String) -> ([GetQueue] -> ShowS) -> Show GetQueue
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. GetQueue -> Rep GetQueue x)
-> (forall x. Rep GetQueue x -> GetQueue) -> Generic GetQueue
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' :: Text -> GetQueue
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 :: (Text -> f Text) -> GetQueue -> f GetQueue
getQueue_name = (GetQueue -> Text)
-> (GetQueue -> Text -> GetQueue)
-> Lens GetQueue GetQueue Text Text
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 :: GetQueue -> Request GetQueue
request = Service -> GetQueue -> Request GetQueue
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetQueue
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetQueue)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetQueue))
-> Logger
-> Service
-> Proxy GetQueue
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetQueue)))
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 -> GetQueueResponse
GetQueueResponse'
            (Maybe Queue -> Int -> GetQueueResponse)
-> Either String (Maybe Queue)
-> Either String (Int -> GetQueueResponse)
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 -> GetQueueResponse)
-> Either String Int -> Either String GetQueueResponse
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 GetQueue

instance Prelude.NFData GetQueue

instance Core.ToHeaders GetQueue where
  toHeaders :: GetQueue -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetQueue -> 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 GetQueue where
  toPath :: GetQueue -> ByteString
toPath GetQueue' {Text
name :: Text
$sel:name:GetQueue' :: GetQueue -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/2017-08-29/queues/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
name]

instance Core.ToQuery GetQueue where
  toQuery :: GetQueue -> QueryString
toQuery = QueryString -> GetQueue -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetQueueResponse -> GetQueueResponse -> Bool)
-> (GetQueueResponse -> GetQueueResponse -> Bool)
-> Eq GetQueueResponse
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]
(Int -> ReadS GetQueueResponse)
-> ReadS [GetQueueResponse]
-> ReadPrec GetQueueResponse
-> ReadPrec [GetQueueResponse]
-> Read 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
(Int -> GetQueueResponse -> ShowS)
-> (GetQueueResponse -> String)
-> ([GetQueueResponse] -> ShowS)
-> Show GetQueueResponse
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. GetQueueResponse -> Rep GetQueueResponse x)
-> (forall x. Rep GetQueueResponse x -> GetQueueResponse)
-> Generic GetQueueResponse
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' :: Maybe Queue -> Int -> GetQueueResponse
GetQueueResponse'
    { $sel:queue:GetQueueResponse' :: Maybe Queue
queue = Maybe 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 :: (Maybe Queue -> f (Maybe Queue))
-> GetQueueResponse -> f GetQueueResponse
getQueueResponse_queue = (GetQueueResponse -> Maybe Queue)
-> (GetQueueResponse -> Maybe Queue -> GetQueueResponse)
-> Lens
     GetQueueResponse GetQueueResponse (Maybe Queue) (Maybe 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 :: (Int -> f Int) -> GetQueueResponse -> f GetQueueResponse
getQueueResponse_httpStatus = (GetQueueResponse -> Int)
-> (GetQueueResponse -> Int -> GetQueueResponse)
-> Lens GetQueueResponse GetQueueResponse Int Int
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