{-# 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.DocDbElastic.DeleteClusterSnapshot
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Delete a Elastic DocumentDB snapshot.
module Amazonka.DocDbElastic.DeleteClusterSnapshot
  ( -- * Creating a Request
    DeleteClusterSnapshot (..),
    newDeleteClusterSnapshot,

    -- * Request Lenses
    deleteClusterSnapshot_snapshotArn,

    -- * Destructuring the Response
    DeleteClusterSnapshotResponse (..),
    newDeleteClusterSnapshotResponse,

    -- * Response Lenses
    deleteClusterSnapshotResponse_httpStatus,
    deleteClusterSnapshotResponse_snapshot,
  )
where

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

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

-- |
-- Create a value of 'DeleteClusterSnapshot' 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:
--
-- 'snapshotArn', 'deleteClusterSnapshot_snapshotArn' - The arn of the Elastic DocumentDB snapshot that is to be deleted.
newDeleteClusterSnapshot ::
  -- | 'snapshotArn'
  Prelude.Text ->
  DeleteClusterSnapshot
newDeleteClusterSnapshot :: Text -> DeleteClusterSnapshot
newDeleteClusterSnapshot Text
pSnapshotArn_ =
  DeleteClusterSnapshot' {$sel:snapshotArn:DeleteClusterSnapshot' :: Text
snapshotArn = Text
pSnapshotArn_}

-- | The arn of the Elastic DocumentDB snapshot that is to be deleted.
deleteClusterSnapshot_snapshotArn :: Lens.Lens' DeleteClusterSnapshot Prelude.Text
deleteClusterSnapshot_snapshotArn :: Lens' DeleteClusterSnapshot Text
deleteClusterSnapshot_snapshotArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteClusterSnapshot' {Text
snapshotArn :: Text
$sel:snapshotArn:DeleteClusterSnapshot' :: DeleteClusterSnapshot -> Text
snapshotArn} -> Text
snapshotArn) (\s :: DeleteClusterSnapshot
s@DeleteClusterSnapshot' {} Text
a -> DeleteClusterSnapshot
s {$sel:snapshotArn:DeleteClusterSnapshot' :: Text
snapshotArn = Text
a} :: DeleteClusterSnapshot)

instance Core.AWSRequest DeleteClusterSnapshot where
  type
    AWSResponse DeleteClusterSnapshot =
      DeleteClusterSnapshotResponse
  request :: (Service -> Service)
-> DeleteClusterSnapshot -> Request DeleteClusterSnapshot
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteClusterSnapshot
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteClusterSnapshot)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> ClusterSnapshot -> DeleteClusterSnapshotResponse
DeleteClusterSnapshotResponse'
            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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"snapshot")
      )

instance Prelude.Hashable DeleteClusterSnapshot where
  hashWithSalt :: Int -> DeleteClusterSnapshot -> Int
hashWithSalt Int
_salt DeleteClusterSnapshot' {Text
snapshotArn :: Text
$sel:snapshotArn:DeleteClusterSnapshot' :: DeleteClusterSnapshot -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
snapshotArn

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

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

instance Data.ToPath DeleteClusterSnapshot where
  toPath :: DeleteClusterSnapshot -> ByteString
toPath DeleteClusterSnapshot' {Text
snapshotArn :: Text
$sel:snapshotArn:DeleteClusterSnapshot' :: DeleteClusterSnapshot -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/cluster-snapshot/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
snapshotArn]

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

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

-- |
-- Create a value of 'DeleteClusterSnapshotResponse' 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', 'deleteClusterSnapshotResponse_httpStatus' - The response's http status code.
--
-- 'snapshot', 'deleteClusterSnapshotResponse_snapshot' - Returns information about the newly deleted Elastic DocumentDB snapshot.
newDeleteClusterSnapshotResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'snapshot'
  ClusterSnapshot ->
  DeleteClusterSnapshotResponse
newDeleteClusterSnapshotResponse :: Int -> ClusterSnapshot -> DeleteClusterSnapshotResponse
newDeleteClusterSnapshotResponse
  Int
pHttpStatus_
  ClusterSnapshot
pSnapshot_ =
    DeleteClusterSnapshotResponse'
      { $sel:httpStatus:DeleteClusterSnapshotResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:snapshot:DeleteClusterSnapshotResponse' :: ClusterSnapshot
snapshot = ClusterSnapshot
pSnapshot_
      }

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

-- | Returns information about the newly deleted Elastic DocumentDB snapshot.
deleteClusterSnapshotResponse_snapshot :: Lens.Lens' DeleteClusterSnapshotResponse ClusterSnapshot
deleteClusterSnapshotResponse_snapshot :: Lens' DeleteClusterSnapshotResponse ClusterSnapshot
deleteClusterSnapshotResponse_snapshot = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteClusterSnapshotResponse' {ClusterSnapshot
snapshot :: ClusterSnapshot
$sel:snapshot:DeleteClusterSnapshotResponse' :: DeleteClusterSnapshotResponse -> ClusterSnapshot
snapshot} -> ClusterSnapshot
snapshot) (\s :: DeleteClusterSnapshotResponse
s@DeleteClusterSnapshotResponse' {} ClusterSnapshot
a -> DeleteClusterSnapshotResponse
s {$sel:snapshot:DeleteClusterSnapshotResponse' :: ClusterSnapshot
snapshot = ClusterSnapshot
a} :: DeleteClusterSnapshotResponse)

instance Prelude.NFData DeleteClusterSnapshotResponse where
  rnf :: DeleteClusterSnapshotResponse -> ()
rnf DeleteClusterSnapshotResponse' {Int
ClusterSnapshot
snapshot :: ClusterSnapshot
httpStatus :: Int
$sel:snapshot:DeleteClusterSnapshotResponse' :: DeleteClusterSnapshotResponse -> ClusterSnapshot
$sel:httpStatus:DeleteClusterSnapshotResponse' :: DeleteClusterSnapshotResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ClusterSnapshot
snapshot