{-# 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-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 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.Lens as Lens
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
(DeletePreparedStatement -> DeletePreparedStatement -> Bool)
-> (DeletePreparedStatement -> DeletePreparedStatement -> Bool)
-> Eq DeletePreparedStatement
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]
(Int -> ReadS DeletePreparedStatement)
-> ReadS [DeletePreparedStatement]
-> ReadPrec DeletePreparedStatement
-> ReadPrec [DeletePreparedStatement]
-> Read 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
(Int -> DeletePreparedStatement -> ShowS)
-> (DeletePreparedStatement -> String)
-> ([DeletePreparedStatement] -> ShowS)
-> Show DeletePreparedStatement
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.
 DeletePreparedStatement -> Rep DeletePreparedStatement x)
-> (forall x.
    Rep DeletePreparedStatement x -> DeletePreparedStatement)
-> Generic DeletePreparedStatement
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' :: Text -> Text -> DeletePreparedStatement
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 :: (Text -> f Text)
-> DeletePreparedStatement -> f DeletePreparedStatement
deletePreparedStatement_statementName = (DeletePreparedStatement -> Text)
-> (DeletePreparedStatement -> Text -> DeletePreparedStatement)
-> Lens DeletePreparedStatement DeletePreparedStatement Text Text
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 :: (Text -> f Text)
-> DeletePreparedStatement -> f DeletePreparedStatement
deletePreparedStatement_workGroup = (DeletePreparedStatement -> Text)
-> (DeletePreparedStatement -> Text -> DeletePreparedStatement)
-> Lens DeletePreparedStatement DeletePreparedStatement Text Text
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 :: DeletePreparedStatement -> Request DeletePreparedStatement
request = Service
-> DeletePreparedStatement -> Request DeletePreparedStatement
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeletePreparedStatement
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePreparedStatement)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeletePreparedStatement))
-> Logger
-> Service
-> Proxy DeletePreparedStatement
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeletePreparedStatement)))
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 -> DeletePreparedStatementResponse
DeletePreparedStatementResponse'
            (Int -> DeletePreparedStatementResponse)
-> Either String Int
-> Either String DeletePreparedStatementResponse
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 DeletePreparedStatement

instance Prelude.NFData DeletePreparedStatement

instance Core.ToHeaders DeletePreparedStatement where
  toHeaders :: DeletePreparedStatement -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeletePreparedStatement -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonAthena.DeletePreparedStatement" ::
                          Prelude.ByteString
                      ),
            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 DeletePreparedStatement where
  toJSON :: DeletePreparedStatement -> Value
toJSON DeletePreparedStatement' {Text
workGroup :: Text
statementName :: Text
$sel:workGroup:DeletePreparedStatement' :: DeletePreparedStatement -> Text
$sel:statementName:DeletePreparedStatement' :: DeletePreparedStatement -> 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
"StatementName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
statementName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"WorkGroup" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
workGroup)
          ]
      )

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

instance Core.ToQuery DeletePreparedStatement where
  toQuery :: DeletePreparedStatement -> QueryString
toQuery = QueryString -> DeletePreparedStatement -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeletePreparedStatementResponse
 -> DeletePreparedStatementResponse -> Bool)
-> (DeletePreparedStatementResponse
    -> DeletePreparedStatementResponse -> Bool)
-> Eq DeletePreparedStatementResponse
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]
(Int -> ReadS DeletePreparedStatementResponse)
-> ReadS [DeletePreparedStatementResponse]
-> ReadPrec DeletePreparedStatementResponse
-> ReadPrec [DeletePreparedStatementResponse]
-> Read 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
(Int -> DeletePreparedStatementResponse -> ShowS)
-> (DeletePreparedStatementResponse -> String)
-> ([DeletePreparedStatementResponse] -> ShowS)
-> Show DeletePreparedStatementResponse
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.
 DeletePreparedStatementResponse
 -> Rep DeletePreparedStatementResponse x)
-> (forall x.
    Rep DeletePreparedStatementResponse x
    -> DeletePreparedStatementResponse)
-> Generic DeletePreparedStatementResponse
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' :: Int -> DeletePreparedStatementResponse
DeletePreparedStatementResponse'
    { $sel:httpStatus:DeletePreparedStatementResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deletePreparedStatementResponse_httpStatus :: Lens.Lens' DeletePreparedStatementResponse Prelude.Int
deletePreparedStatementResponse_httpStatus :: (Int -> f Int)
-> DeletePreparedStatementResponse
-> f DeletePreparedStatementResponse
deletePreparedStatementResponse_httpStatus = (DeletePreparedStatementResponse -> Int)
-> (DeletePreparedStatementResponse
    -> Int -> DeletePreparedStatementResponse)
-> Lens
     DeletePreparedStatementResponse
     DeletePreparedStatementResponse
     Int
     Int
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