{-# 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.KeySpaces.DeleteKeyspace
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- The @DeleteKeyspace@ operation deletes a keyspace and all of its tables.
module Amazonka.KeySpaces.DeleteKeyspace
  ( -- * Creating a Request
    DeleteKeyspace (..),
    newDeleteKeyspace,

    -- * Request Lenses
    deleteKeyspace_keyspaceName,

    -- * Destructuring the Response
    DeleteKeyspaceResponse (..),
    newDeleteKeyspaceResponse,

    -- * Response Lenses
    deleteKeyspaceResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.KeySpaces.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

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

-- |
-- Create a value of 'DeleteKeyspace' 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:
--
-- 'keyspaceName', 'deleteKeyspace_keyspaceName' - The name of the keyspace to be deleted.
newDeleteKeyspace ::
  -- | 'keyspaceName'
  Prelude.Text ->
  DeleteKeyspace
newDeleteKeyspace :: Text -> DeleteKeyspace
newDeleteKeyspace Text
pKeyspaceName_ =
  DeleteKeyspace' {$sel:keyspaceName:DeleteKeyspace' :: Text
keyspaceName = Text
pKeyspaceName_}

-- | The name of the keyspace to be deleted.
deleteKeyspace_keyspaceName :: Lens.Lens' DeleteKeyspace Prelude.Text
deleteKeyspace_keyspaceName :: Lens' DeleteKeyspace Text
deleteKeyspace_keyspaceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteKeyspace' {Text
keyspaceName :: Text
$sel:keyspaceName:DeleteKeyspace' :: DeleteKeyspace -> Text
keyspaceName} -> Text
keyspaceName) (\s :: DeleteKeyspace
s@DeleteKeyspace' {} Text
a -> DeleteKeyspace
s {$sel:keyspaceName:DeleteKeyspace' :: Text
keyspaceName = Text
a} :: DeleteKeyspace)

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

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

instance Data.ToHeaders DeleteKeyspace where
  toHeaders :: DeleteKeyspace -> 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
"KeyspacesService.DeleteKeyspace" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

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

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

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

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

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

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

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