{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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' {$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 :: Lens' DeleteJobQueue Text
deleteJobQueue_jobQueue = 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 :: (Service -> Service) -> DeleteJobQueue -> Request DeleteJobQueue
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteJobQueue
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteJobQueue)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteJobQueueResponse
DeleteJobQueueResponse'
            forall (f :: * -> *) a b. Functor 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 DeleteJobQueue where
  hashWithSalt :: Int -> DeleteJobQueue -> Int
hashWithSalt Int
_salt DeleteJobQueue' {Text
jobQueue :: Text
$sel:jobQueue:DeleteJobQueue' :: DeleteJobQueue -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
jobQueue

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

instance Data.ToHeaders DeleteJobQueue where
  toHeaders :: DeleteJobQueue -> 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.ToJSON DeleteJobQueue where
  toJSON :: DeleteJobQueue -> Value
toJSON DeleteJobQueue' {Text
jobQueue :: Text
$sel:jobQueue:DeleteJobQueue' :: DeleteJobQueue -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"jobQueue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
jobQueue)]
      )

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

instance Data.ToQuery DeleteJobQueue where
  toQuery :: DeleteJobQueue -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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. 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' {$sel:httpStatus:DeleteJobQueueResponse' :: Int
httpStatus = Int
pHttpStatus_}

-- | The response's http status code.
deleteJobQueueResponse_httpStatus :: Lens.Lens' DeleteJobQueueResponse Prelude.Int
deleteJobQueueResponse_httpStatus :: Lens' DeleteJobQueueResponse Int
deleteJobQueueResponse_httpStatus = 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 where
  rnf :: DeleteJobQueueResponse -> ()
rnf DeleteJobQueueResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteJobQueueResponse' :: DeleteJobQueueResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus