{-# 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.Batch.DeleteJobQueue
-- 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)
--
-- Deletes the specified job queue. You must first disable submissions for
-- a queue with the UpdateJobQueue operation. All jobs in the queue are
-- eventually terminated when you delete a job queue. The jobs are
-- terminated at a rate of about 16 jobs each second.
--
-- It\'s not necessary to disassociate compute environments from a queue
-- before submitting a @DeleteJobQueue@ request.
module Amazonka.Batch.DeleteJobQueue
  ( -- * Creating a Request
    DeleteJobQueue (..),
    newDeleteJobQueue,

    -- * Request Lenses
    deleteJobQueue_jobQueue,

    -- * Destructuring the Response
    DeleteJobQueueResponse (..),
    newDeleteJobQueueResponse,

    -- * Response Lenses
    deleteJobQueueResponse_httpStatus,
  )
where

import Amazonka.Batch.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

-- | Contains the parameters for @DeleteJobQueue@.
--
-- /See:/ 'newDeleteJobQueue' smart constructor.
data DeleteJobQueue = DeleteJobQueue'
  { -- | The short name or full Amazon Resource Name (ARN) of the queue to
    -- delete.
    DeleteJobQueue -> Text
jobQueue :: Prelude.Text
  }
  deriving (DeleteJobQueue -> DeleteJobQueue -> Bool
(DeleteJobQueue -> DeleteJobQueue -> Bool)
-> (DeleteJobQueue -> DeleteJobQueue -> Bool) -> Eq DeleteJobQueue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteJobQueue -> DeleteJobQueue -> Bool
$c/= :: DeleteJobQueue -> DeleteJobQueue -> Bool
== :: DeleteJobQueue -> DeleteJobQueue -> Bool
$c== :: DeleteJobQueue -> DeleteJobQueue -> Bool
Prelude.Eq, ReadPrec [DeleteJobQueue]
ReadPrec DeleteJobQueue
Int -> ReadS DeleteJobQueue
ReadS [DeleteJobQueue]
(Int -> ReadS DeleteJobQueue)
-> ReadS [DeleteJobQueue]
-> ReadPrec DeleteJobQueue
-> ReadPrec [DeleteJobQueue]
-> Read DeleteJobQueue
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteJobQueue]
$creadListPrec :: ReadPrec [DeleteJobQueue]
readPrec :: ReadPrec DeleteJobQueue
$creadPrec :: ReadPrec DeleteJobQueue
readList :: ReadS [DeleteJobQueue]
$creadList :: ReadS [DeleteJobQueue]
readsPrec :: Int -> ReadS DeleteJobQueue
$creadsPrec :: Int -> ReadS DeleteJobQueue
Prelude.Read, Int -> DeleteJobQueue -> ShowS
[DeleteJobQueue] -> ShowS
DeleteJobQueue -> String
(Int -> DeleteJobQueue -> ShowS)
-> (DeleteJobQueue -> String)
-> ([DeleteJobQueue] -> ShowS)
-> Show DeleteJobQueue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteJobQueue] -> ShowS
$cshowList :: [DeleteJobQueue] -> ShowS
show :: DeleteJobQueue -> String
$cshow :: DeleteJobQueue -> String
showsPrec :: Int -> DeleteJobQueue -> ShowS
$cshowsPrec :: Int -> DeleteJobQueue -> ShowS
Prelude.Show, (forall x. DeleteJobQueue -> Rep DeleteJobQueue x)
-> (forall x. Rep DeleteJobQueue x -> DeleteJobQueue)
-> Generic DeleteJobQueue
forall x. Rep DeleteJobQueue x -> DeleteJobQueue
forall x. DeleteJobQueue -> Rep DeleteJobQueue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteJobQueue x -> DeleteJobQueue
$cfrom :: forall x. DeleteJobQueue -> Rep DeleteJobQueue x
Prelude.Generic)

-- |
-- Create a value of 'DeleteJobQueue' 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:
--
-- 'jobQueue', 'deleteJobQueue_jobQueue' - The short name or full Amazon Resource Name (ARN) of the queue to
-- delete.
newDeleteJobQueue ::
  -- | 'jobQueue'
  Prelude.Text ->
  DeleteJobQueue
newDeleteJobQueue :: Text -> DeleteJobQueue
newDeleteJobQueue Text
pJobQueue_ =
  DeleteJobQueue' :: Text -> DeleteJobQueue
DeleteJobQueue' {$sel:jobQueue:DeleteJobQueue' :: Text
jobQueue = Text
pJobQueue_}

-- | The short name or full Amazon Resource Name (ARN) of the queue to
-- delete.
deleteJobQueue_jobQueue :: Lens.Lens' DeleteJobQueue Prelude.Text
deleteJobQueue_jobQueue :: (Text -> f Text) -> DeleteJobQueue -> f DeleteJobQueue
deleteJobQueue_jobQueue = (DeleteJobQueue -> Text)
-> (DeleteJobQueue -> Text -> DeleteJobQueue)
-> Lens DeleteJobQueue DeleteJobQueue Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteJobQueue' {Text
jobQueue :: Text
$sel:jobQueue:DeleteJobQueue' :: DeleteJobQueue -> Text
jobQueue} -> Text
jobQueue) (\s :: DeleteJobQueue
s@DeleteJobQueue' {} Text
a -> DeleteJobQueue
s {$sel:jobQueue:DeleteJobQueue' :: Text
jobQueue = Text
a} :: DeleteJobQueue)

instance Core.AWSRequest DeleteJobQueue where
  type
    AWSResponse DeleteJobQueue =
      DeleteJobQueueResponse
  request :: DeleteJobQueue -> Request DeleteJobQueue
request = Service -> DeleteJobQueue -> Request DeleteJobQueue
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteJobQueue
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteJobQueue)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteJobQueue))
-> Logger
-> Service
-> Proxy DeleteJobQueue
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteJobQueue)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteJobQueueResponse
DeleteJobQueueResponse'
            (Int -> DeleteJobQueueResponse)
-> Either String Int -> Either String DeleteJobQueueResponse
forall (f :: * -> *) a b. Functor 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 DeleteJobQueue

instance Prelude.NFData DeleteJobQueue

instance Core.ToHeaders DeleteJobQueue where
  toHeaders :: DeleteJobQueue -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteJobQueue -> 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.ToJSON DeleteJobQueue where
  toJSON :: DeleteJobQueue -> Value
toJSON DeleteJobQueue' {Text
jobQueue :: Text
$sel:jobQueue:DeleteJobQueue' :: DeleteJobQueue -> 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
"jobQueue" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
jobQueue)]
      )

instance Core.ToPath DeleteJobQueue where
  toPath :: DeleteJobQueue -> ByteString
toPath = ByteString -> DeleteJobQueue -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/deletejobqueue"

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

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

-- |
-- Create a value of 'DeleteJobQueueResponse' 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:
--
-- 'httpStatus', 'deleteJobQueueResponse_httpStatus' - The response's http status code.
newDeleteJobQueueResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteJobQueueResponse
newDeleteJobQueueResponse :: Int -> DeleteJobQueueResponse
newDeleteJobQueueResponse Int
pHttpStatus_ =
  DeleteJobQueueResponse' :: Int -> DeleteJobQueueResponse
DeleteJobQueueResponse' {$sel:httpStatus:DeleteJobQueueResponse' :: Int
httpStatus = Int
pHttpStatus_}

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

instance Prelude.NFData DeleteJobQueueResponse