{-# 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.DeleteQueue
-- 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)
--
-- Permanently delete a queue you have created.
module Amazonka.MediaConvert.DeleteQueue
  ( -- * Creating a Request
    DeleteQueue (..),
    newDeleteQueue,

    -- * Request Lenses
    deleteQueue_name,

    -- * Destructuring the Response
    DeleteQueueResponse (..),
    newDeleteQueueResponse,

    -- * Response Lenses
    deleteQueueResponse_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:/ 'newDeleteQueue' smart constructor.
data DeleteQueue = DeleteQueue'
  { -- | The name of the queue that you want to delete.
    DeleteQueue -> Text
name :: Prelude.Text
  }
  deriving (DeleteQueue -> DeleteQueue -> Bool
(DeleteQueue -> DeleteQueue -> Bool)
-> (DeleteQueue -> DeleteQueue -> Bool) -> Eq DeleteQueue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteQueue -> DeleteQueue -> Bool
$c/= :: DeleteQueue -> DeleteQueue -> Bool
== :: DeleteQueue -> DeleteQueue -> Bool
$c== :: DeleteQueue -> DeleteQueue -> Bool
Prelude.Eq, ReadPrec [DeleteQueue]
ReadPrec DeleteQueue
Int -> ReadS DeleteQueue
ReadS [DeleteQueue]
(Int -> ReadS DeleteQueue)
-> ReadS [DeleteQueue]
-> ReadPrec DeleteQueue
-> ReadPrec [DeleteQueue]
-> Read DeleteQueue
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteQueue]
$creadListPrec :: ReadPrec [DeleteQueue]
readPrec :: ReadPrec DeleteQueue
$creadPrec :: ReadPrec DeleteQueue
readList :: ReadS [DeleteQueue]
$creadList :: ReadS [DeleteQueue]
readsPrec :: Int -> ReadS DeleteQueue
$creadsPrec :: Int -> ReadS DeleteQueue
Prelude.Read, Int -> DeleteQueue -> ShowS
[DeleteQueue] -> ShowS
DeleteQueue -> String
(Int -> DeleteQueue -> ShowS)
-> (DeleteQueue -> String)
-> ([DeleteQueue] -> ShowS)
-> Show DeleteQueue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteQueue] -> ShowS
$cshowList :: [DeleteQueue] -> ShowS
show :: DeleteQueue -> String
$cshow :: DeleteQueue -> String
showsPrec :: Int -> DeleteQueue -> ShowS
$cshowsPrec :: Int -> DeleteQueue -> ShowS
Prelude.Show, (forall x. DeleteQueue -> Rep DeleteQueue x)
-> (forall x. Rep DeleteQueue x -> DeleteQueue)
-> Generic DeleteQueue
forall x. Rep DeleteQueue x -> DeleteQueue
forall x. DeleteQueue -> Rep DeleteQueue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteQueue x -> DeleteQueue
$cfrom :: forall x. DeleteQueue -> Rep DeleteQueue x
Prelude.Generic)

-- |
-- Create a value of 'DeleteQueue' 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', 'deleteQueue_name' - The name of the queue that you want to delete.
newDeleteQueue ::
  -- | 'name'
  Prelude.Text ->
  DeleteQueue
newDeleteQueue :: Text -> DeleteQueue
newDeleteQueue Text
pName_ = DeleteQueue' :: Text -> DeleteQueue
DeleteQueue' {$sel:name:DeleteQueue' :: Text
name = Text
pName_}

-- | The name of the queue that you want to delete.
deleteQueue_name :: Lens.Lens' DeleteQueue Prelude.Text
deleteQueue_name :: (Text -> f Text) -> DeleteQueue -> f DeleteQueue
deleteQueue_name = (DeleteQueue -> Text)
-> (DeleteQueue -> Text -> DeleteQueue)
-> Lens DeleteQueue DeleteQueue Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteQueue' {Text
name :: Text
$sel:name:DeleteQueue' :: DeleteQueue -> Text
name} -> Text
name) (\s :: DeleteQueue
s@DeleteQueue' {} Text
a -> DeleteQueue
s {$sel:name:DeleteQueue' :: Text
name = Text
a} :: DeleteQueue)

instance Core.AWSRequest DeleteQueue where
  type AWSResponse DeleteQueue = DeleteQueueResponse
  request :: DeleteQueue -> Request DeleteQueue
request = Service -> DeleteQueue -> Request DeleteQueue
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteQueue
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteQueue)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteQueue))
-> Logger
-> Service
-> Proxy DeleteQueue
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteQueue)))
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 -> DeleteQueueResponse
DeleteQueueResponse'
            (Int -> DeleteQueueResponse)
-> Either String Int -> Either String DeleteQueueResponse
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 DeleteQueue

instance Prelude.NFData DeleteQueue

instance Core.ToHeaders DeleteQueue where
  toHeaders :: DeleteQueue -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteQueue -> 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 DeleteQueue where
  toPath :: DeleteQueue -> ByteString
toPath DeleteQueue' {Text
name :: Text
$sel:name:DeleteQueue' :: DeleteQueue -> 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 DeleteQueue where
  toQuery :: DeleteQueue -> QueryString
toQuery = QueryString -> DeleteQueue -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

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

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

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

instance Prelude.NFData DeleteQueueResponse