{-# 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.Athena.DeletePreparedStatement
-- 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 prepared statement with the specified name from the
-- specified workgroup.
module Amazonka.Athena.DeletePreparedStatement
  ( -- * Creating a Request
    DeletePreparedStatement (..),
    newDeletePreparedStatement,

    -- * Request Lenses
    deletePreparedStatement_statementName,
    deletePreparedStatement_workGroup,

    -- * Destructuring the Response
    DeletePreparedStatementResponse (..),
    newDeletePreparedStatementResponse,

    -- * Response Lenses
    deletePreparedStatementResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeletePreparedStatement' smart constructor.
data DeletePreparedStatement = DeletePreparedStatement'
  { -- | The name of the prepared statement to delete.
    DeletePreparedStatement -> Text
statementName :: Prelude.Text,
    -- | The workgroup to which the statement to be deleted belongs.
    DeletePreparedStatement -> Text
workGroup :: Prelude.Text
  }
  deriving (DeletePreparedStatement -> DeletePreparedStatement -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePreparedStatement -> DeletePreparedStatement -> Bool
$c/= :: DeletePreparedStatement -> DeletePreparedStatement -> Bool
== :: DeletePreparedStatement -> DeletePreparedStatement -> Bool
$c== :: DeletePreparedStatement -> DeletePreparedStatement -> Bool
Prelude.Eq, ReadPrec [DeletePreparedStatement]
ReadPrec DeletePreparedStatement
Int -> ReadS DeletePreparedStatement
ReadS [DeletePreparedStatement]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePreparedStatement]
$creadListPrec :: ReadPrec [DeletePreparedStatement]
readPrec :: ReadPrec DeletePreparedStatement
$creadPrec :: ReadPrec DeletePreparedStatement
readList :: ReadS [DeletePreparedStatement]
$creadList :: ReadS [DeletePreparedStatement]
readsPrec :: Int -> ReadS DeletePreparedStatement
$creadsPrec :: Int -> ReadS DeletePreparedStatement
Prelude.Read, Int -> DeletePreparedStatement -> ShowS
[DeletePreparedStatement] -> ShowS
DeletePreparedStatement -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePreparedStatement] -> ShowS
$cshowList :: [DeletePreparedStatement] -> ShowS
show :: DeletePreparedStatement -> String
$cshow :: DeletePreparedStatement -> String
showsPrec :: Int -> DeletePreparedStatement -> ShowS
$cshowsPrec :: Int -> DeletePreparedStatement -> ShowS
Prelude.Show, forall x. Rep DeletePreparedStatement x -> DeletePreparedStatement
forall x. DeletePreparedStatement -> Rep DeletePreparedStatement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeletePreparedStatement x -> DeletePreparedStatement
$cfrom :: forall x. DeletePreparedStatement -> Rep DeletePreparedStatement x
Prelude.Generic)

-- |
-- Create a value of 'DeletePreparedStatement' 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:
--
-- 'statementName', 'deletePreparedStatement_statementName' - The name of the prepared statement to delete.
--
-- 'workGroup', 'deletePreparedStatement_workGroup' - The workgroup to which the statement to be deleted belongs.
newDeletePreparedStatement ::
  -- | 'statementName'
  Prelude.Text ->
  -- | 'workGroup'
  Prelude.Text ->
  DeletePreparedStatement
newDeletePreparedStatement :: Text -> Text -> DeletePreparedStatement
newDeletePreparedStatement
  Text
pStatementName_
  Text
pWorkGroup_ =
    DeletePreparedStatement'
      { $sel:statementName:DeletePreparedStatement' :: Text
statementName =
          Text
pStatementName_,
        $sel:workGroup:DeletePreparedStatement' :: Text
workGroup = Text
pWorkGroup_
      }

-- | The name of the prepared statement to delete.
deletePreparedStatement_statementName :: Lens.Lens' DeletePreparedStatement Prelude.Text
deletePreparedStatement_statementName :: Lens' DeletePreparedStatement Text
deletePreparedStatement_statementName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePreparedStatement' {Text
statementName :: Text
$sel:statementName:DeletePreparedStatement' :: DeletePreparedStatement -> Text
statementName} -> Text
statementName) (\s :: DeletePreparedStatement
s@DeletePreparedStatement' {} Text
a -> DeletePreparedStatement
s {$sel:statementName:DeletePreparedStatement' :: Text
statementName = Text
a} :: DeletePreparedStatement)

-- | The workgroup to which the statement to be deleted belongs.
deletePreparedStatement_workGroup :: Lens.Lens' DeletePreparedStatement Prelude.Text
deletePreparedStatement_workGroup :: Lens' DeletePreparedStatement Text
deletePreparedStatement_workGroup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePreparedStatement' {Text
workGroup :: Text
$sel:workGroup:DeletePreparedStatement' :: DeletePreparedStatement -> Text
workGroup} -> Text
workGroup) (\s :: DeletePreparedStatement
s@DeletePreparedStatement' {} Text
a -> DeletePreparedStatement
s {$sel:workGroup:DeletePreparedStatement' :: Text
workGroup = Text
a} :: DeletePreparedStatement)

instance Core.AWSRequest DeletePreparedStatement where
  type
    AWSResponse DeletePreparedStatement =
      DeletePreparedStatementResponse
  request :: (Service -> Service)
-> DeletePreparedStatement -> Request DeletePreparedStatement
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 DeletePreparedStatement
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePreparedStatement)))
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 -> DeletePreparedStatementResponse
DeletePreparedStatementResponse'
            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 DeletePreparedStatement where
  hashWithSalt :: Int -> DeletePreparedStatement -> Int
hashWithSalt Int
_salt DeletePreparedStatement' {Text
workGroup :: Text
statementName :: Text
$sel:workGroup:DeletePreparedStatement' :: DeletePreparedStatement -> Text
$sel:statementName:DeletePreparedStatement' :: DeletePreparedStatement -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
statementName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workGroup

instance Prelude.NFData DeletePreparedStatement where
  rnf :: DeletePreparedStatement -> ()
rnf DeletePreparedStatement' {Text
workGroup :: Text
statementName :: Text
$sel:workGroup:DeletePreparedStatement' :: DeletePreparedStatement -> Text
$sel:statementName:DeletePreparedStatement' :: DeletePreparedStatement -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
statementName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
workGroup

instance Data.ToHeaders DeletePreparedStatement where
  toHeaders :: DeletePreparedStatement -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AmazonAthena.DeletePreparedStatement" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeletePreparedStatement where
  toJSON :: DeletePreparedStatement -> Value
toJSON DeletePreparedStatement' {Text
workGroup :: Text
statementName :: Text
$sel:workGroup:DeletePreparedStatement' :: DeletePreparedStatement -> Text
$sel:statementName:DeletePreparedStatement' :: DeletePreparedStatement -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"StatementName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
statementName),
            forall a. a -> Maybe a
Prelude.Just (Key
"WorkGroup" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
workGroup)
          ]
      )

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

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

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

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

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

instance
  Prelude.NFData
    DeletePreparedStatementResponse
  where
  rnf :: DeletePreparedStatementResponse -> ()
rnf DeletePreparedStatementResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeletePreparedStatementResponse' :: DeletePreparedStatementResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus