{-# 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.DocumentDB.DeleteDBClusterSnapshot
-- 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 a cluster snapshot. If the snapshot is being copied, the copy
-- operation is terminated.
--
-- The cluster snapshot must be in the @available@ state to be deleted.
module Amazonka.DocumentDB.DeleteDBClusterSnapshot
  ( -- * Creating a Request
    DeleteDBClusterSnapshot (..),
    newDeleteDBClusterSnapshot,

    -- * Request Lenses
    deleteDBClusterSnapshot_dbClusterSnapshotIdentifier,

    -- * Destructuring the Response
    DeleteDBClusterSnapshotResponse (..),
    newDeleteDBClusterSnapshotResponse,

    -- * Response Lenses
    deleteDBClusterSnapshotResponse_dbClusterSnapshot,
    deleteDBClusterSnapshotResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DocumentDB.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Represents the input to DeleteDBClusterSnapshot.
--
-- /See:/ 'newDeleteDBClusterSnapshot' smart constructor.
data DeleteDBClusterSnapshot = DeleteDBClusterSnapshot'
  { -- | The identifier of the cluster snapshot to delete.
    --
    -- Constraints: Must be the name of an existing cluster snapshot in the
    -- @available@ state.
    DeleteDBClusterSnapshot -> Text
dbClusterSnapshotIdentifier :: Prelude.Text
  }
  deriving (DeleteDBClusterSnapshot -> DeleteDBClusterSnapshot -> Bool
(DeleteDBClusterSnapshot -> DeleteDBClusterSnapshot -> Bool)
-> (DeleteDBClusterSnapshot -> DeleteDBClusterSnapshot -> Bool)
-> Eq DeleteDBClusterSnapshot
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDBClusterSnapshot -> DeleteDBClusterSnapshot -> Bool
$c/= :: DeleteDBClusterSnapshot -> DeleteDBClusterSnapshot -> Bool
== :: DeleteDBClusterSnapshot -> DeleteDBClusterSnapshot -> Bool
$c== :: DeleteDBClusterSnapshot -> DeleteDBClusterSnapshot -> Bool
Prelude.Eq, ReadPrec [DeleteDBClusterSnapshot]
ReadPrec DeleteDBClusterSnapshot
Int -> ReadS DeleteDBClusterSnapshot
ReadS [DeleteDBClusterSnapshot]
(Int -> ReadS DeleteDBClusterSnapshot)
-> ReadS [DeleteDBClusterSnapshot]
-> ReadPrec DeleteDBClusterSnapshot
-> ReadPrec [DeleteDBClusterSnapshot]
-> Read DeleteDBClusterSnapshot
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDBClusterSnapshot]
$creadListPrec :: ReadPrec [DeleteDBClusterSnapshot]
readPrec :: ReadPrec DeleteDBClusterSnapshot
$creadPrec :: ReadPrec DeleteDBClusterSnapshot
readList :: ReadS [DeleteDBClusterSnapshot]
$creadList :: ReadS [DeleteDBClusterSnapshot]
readsPrec :: Int -> ReadS DeleteDBClusterSnapshot
$creadsPrec :: Int -> ReadS DeleteDBClusterSnapshot
Prelude.Read, Int -> DeleteDBClusterSnapshot -> ShowS
[DeleteDBClusterSnapshot] -> ShowS
DeleteDBClusterSnapshot -> String
(Int -> DeleteDBClusterSnapshot -> ShowS)
-> (DeleteDBClusterSnapshot -> String)
-> ([DeleteDBClusterSnapshot] -> ShowS)
-> Show DeleteDBClusterSnapshot
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDBClusterSnapshot] -> ShowS
$cshowList :: [DeleteDBClusterSnapshot] -> ShowS
show :: DeleteDBClusterSnapshot -> String
$cshow :: DeleteDBClusterSnapshot -> String
showsPrec :: Int -> DeleteDBClusterSnapshot -> ShowS
$cshowsPrec :: Int -> DeleteDBClusterSnapshot -> ShowS
Prelude.Show, (forall x.
 DeleteDBClusterSnapshot -> Rep DeleteDBClusterSnapshot x)
-> (forall x.
    Rep DeleteDBClusterSnapshot x -> DeleteDBClusterSnapshot)
-> Generic DeleteDBClusterSnapshot
forall x. Rep DeleteDBClusterSnapshot x -> DeleteDBClusterSnapshot
forall x. DeleteDBClusterSnapshot -> Rep DeleteDBClusterSnapshot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDBClusterSnapshot x -> DeleteDBClusterSnapshot
$cfrom :: forall x. DeleteDBClusterSnapshot -> Rep DeleteDBClusterSnapshot x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDBClusterSnapshot' 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:
--
-- 'dbClusterSnapshotIdentifier', 'deleteDBClusterSnapshot_dbClusterSnapshotIdentifier' - The identifier of the cluster snapshot to delete.
--
-- Constraints: Must be the name of an existing cluster snapshot in the
-- @available@ state.
newDeleteDBClusterSnapshot ::
  -- | 'dbClusterSnapshotIdentifier'
  Prelude.Text ->
  DeleteDBClusterSnapshot
newDeleteDBClusterSnapshot :: Text -> DeleteDBClusterSnapshot
newDeleteDBClusterSnapshot
  Text
pDBClusterSnapshotIdentifier_ =
    DeleteDBClusterSnapshot' :: Text -> DeleteDBClusterSnapshot
DeleteDBClusterSnapshot'
      { $sel:dbClusterSnapshotIdentifier:DeleteDBClusterSnapshot' :: Text
dbClusterSnapshotIdentifier =
          Text
pDBClusterSnapshotIdentifier_
      }

-- | The identifier of the cluster snapshot to delete.
--
-- Constraints: Must be the name of an existing cluster snapshot in the
-- @available@ state.
deleteDBClusterSnapshot_dbClusterSnapshotIdentifier :: Lens.Lens' DeleteDBClusterSnapshot Prelude.Text
deleteDBClusterSnapshot_dbClusterSnapshotIdentifier :: (Text -> f Text)
-> DeleteDBClusterSnapshot -> f DeleteDBClusterSnapshot
deleteDBClusterSnapshot_dbClusterSnapshotIdentifier = (DeleteDBClusterSnapshot -> Text)
-> (DeleteDBClusterSnapshot -> Text -> DeleteDBClusterSnapshot)
-> Lens DeleteDBClusterSnapshot DeleteDBClusterSnapshot Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDBClusterSnapshot' {Text
dbClusterSnapshotIdentifier :: Text
$sel:dbClusterSnapshotIdentifier:DeleteDBClusterSnapshot' :: DeleteDBClusterSnapshot -> Text
dbClusterSnapshotIdentifier} -> Text
dbClusterSnapshotIdentifier) (\s :: DeleteDBClusterSnapshot
s@DeleteDBClusterSnapshot' {} Text
a -> DeleteDBClusterSnapshot
s {$sel:dbClusterSnapshotIdentifier:DeleteDBClusterSnapshot' :: Text
dbClusterSnapshotIdentifier = Text
a} :: DeleteDBClusterSnapshot)

instance Core.AWSRequest DeleteDBClusterSnapshot where
  type
    AWSResponse DeleteDBClusterSnapshot =
      DeleteDBClusterSnapshotResponse
  request :: DeleteDBClusterSnapshot -> Request DeleteDBClusterSnapshot
request = Service
-> DeleteDBClusterSnapshot -> Request DeleteDBClusterSnapshot
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteDBClusterSnapshot
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDBClusterSnapshot)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DeleteDBClusterSnapshot))
-> Logger
-> Service
-> Proxy DeleteDBClusterSnapshot
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteDBClusterSnapshot)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DeleteDBClusterSnapshotResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe DBClusterSnapshot -> Int -> DeleteDBClusterSnapshotResponse
DeleteDBClusterSnapshotResponse'
            (Maybe DBClusterSnapshot -> Int -> DeleteDBClusterSnapshotResponse)
-> Either String (Maybe DBClusterSnapshot)
-> Either String (Int -> DeleteDBClusterSnapshotResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe DBClusterSnapshot)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DBClusterSnapshot")
            Either String (Int -> DeleteDBClusterSnapshotResponse)
-> Either String Int
-> Either String DeleteDBClusterSnapshotResponse
forall (f :: * -> *) a b. Applicative f => 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 DeleteDBClusterSnapshot

instance Prelude.NFData DeleteDBClusterSnapshot

instance Core.ToHeaders DeleteDBClusterSnapshot where
  toHeaders :: DeleteDBClusterSnapshot -> ResponseHeaders
toHeaders = ResponseHeaders -> DeleteDBClusterSnapshot -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery DeleteDBClusterSnapshot where
  toQuery :: DeleteDBClusterSnapshot -> QueryString
toQuery DeleteDBClusterSnapshot' {Text
dbClusterSnapshotIdentifier :: Text
$sel:dbClusterSnapshotIdentifier:DeleteDBClusterSnapshot' :: DeleteDBClusterSnapshot -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DeleteDBClusterSnapshot" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"DBClusterSnapshotIdentifier"
          ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbClusterSnapshotIdentifier
      ]

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

-- |
-- Create a value of 'DeleteDBClusterSnapshotResponse' 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:
--
-- 'dbClusterSnapshot', 'deleteDBClusterSnapshotResponse_dbClusterSnapshot' - Undocumented member.
--
-- 'httpStatus', 'deleteDBClusterSnapshotResponse_httpStatus' - The response's http status code.
newDeleteDBClusterSnapshotResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteDBClusterSnapshotResponse
newDeleteDBClusterSnapshotResponse :: Int -> DeleteDBClusterSnapshotResponse
newDeleteDBClusterSnapshotResponse Int
pHttpStatus_ =
  DeleteDBClusterSnapshotResponse' :: Maybe DBClusterSnapshot -> Int -> DeleteDBClusterSnapshotResponse
DeleteDBClusterSnapshotResponse'
    { $sel:dbClusterSnapshot:DeleteDBClusterSnapshotResponse' :: Maybe DBClusterSnapshot
dbClusterSnapshot =
        Maybe DBClusterSnapshot
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteDBClusterSnapshotResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
deleteDBClusterSnapshotResponse_dbClusterSnapshot :: Lens.Lens' DeleteDBClusterSnapshotResponse (Prelude.Maybe DBClusterSnapshot)
deleteDBClusterSnapshotResponse_dbClusterSnapshot :: (Maybe DBClusterSnapshot -> f (Maybe DBClusterSnapshot))
-> DeleteDBClusterSnapshotResponse
-> f DeleteDBClusterSnapshotResponse
deleteDBClusterSnapshotResponse_dbClusterSnapshot = (DeleteDBClusterSnapshotResponse -> Maybe DBClusterSnapshot)
-> (DeleteDBClusterSnapshotResponse
    -> Maybe DBClusterSnapshot -> DeleteDBClusterSnapshotResponse)
-> Lens
     DeleteDBClusterSnapshotResponse
     DeleteDBClusterSnapshotResponse
     (Maybe DBClusterSnapshot)
     (Maybe DBClusterSnapshot)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDBClusterSnapshotResponse' {Maybe DBClusterSnapshot
dbClusterSnapshot :: Maybe DBClusterSnapshot
$sel:dbClusterSnapshot:DeleteDBClusterSnapshotResponse' :: DeleteDBClusterSnapshotResponse -> Maybe DBClusterSnapshot
dbClusterSnapshot} -> Maybe DBClusterSnapshot
dbClusterSnapshot) (\s :: DeleteDBClusterSnapshotResponse
s@DeleteDBClusterSnapshotResponse' {} Maybe DBClusterSnapshot
a -> DeleteDBClusterSnapshotResponse
s {$sel:dbClusterSnapshot:DeleteDBClusterSnapshotResponse' :: Maybe DBClusterSnapshot
dbClusterSnapshot = Maybe DBClusterSnapshot
a} :: DeleteDBClusterSnapshotResponse)

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

instance
  Prelude.NFData
    DeleteDBClusterSnapshotResponse