{-# 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.MemoryDb.DeleteSnapshot -- 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 an existing snapshot. When you receive a successful response -- from this operation, MemoryDB immediately begins deleting the snapshot; -- you cannot cancel or revert this operation. module Amazonka.MemoryDb.DeleteSnapshot ( -- * Creating a Request DeleteSnapshot (..), newDeleteSnapshot, -- * Request Lenses deleteSnapshot_snapshotName, -- * Destructuring the Response DeleteSnapshotResponse (..), newDeleteSnapshotResponse, -- * Response Lenses deleteSnapshotResponse_snapshot, deleteSnapshotResponse_httpStatus, ) where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import Amazonka.MemoryDb.Types import qualified Amazonka.Prelude as Prelude import qualified Amazonka.Request as Request import qualified Amazonka.Response as Response -- | /See:/ 'newDeleteSnapshot' smart constructor. data DeleteSnapshot = DeleteSnapshot' { -- | The name of the snapshot to delete snapshotName :: Prelude.Text } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'DeleteSnapshot' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'snapshotName', 'deleteSnapshot_snapshotName' - The name of the snapshot to delete newDeleteSnapshot :: -- | 'snapshotName' Prelude.Text -> DeleteSnapshot newDeleteSnapshot pSnapshotName_ = DeleteSnapshot' {snapshotName = pSnapshotName_} -- | The name of the snapshot to delete deleteSnapshot_snapshotName :: Lens.Lens' DeleteSnapshot Prelude.Text deleteSnapshot_snapshotName = Lens.lens (\DeleteSnapshot' {snapshotName} -> snapshotName) (\s@DeleteSnapshot' {} a -> s {snapshotName = a} :: DeleteSnapshot) instance Core.AWSRequest DeleteSnapshot where type AWSResponse DeleteSnapshot = DeleteSnapshotResponse request overrides = Request.postJSON (overrides defaultService) response = Response.receiveJSON ( \s h x -> DeleteSnapshotResponse' Prelude.<$> (x Data..?> "Snapshot") Prelude.<*> (Prelude.pure (Prelude.fromEnum s)) ) instance Prelude.Hashable DeleteSnapshot where hashWithSalt _salt DeleteSnapshot' {..} = _salt `Prelude.hashWithSalt` snapshotName instance Prelude.NFData DeleteSnapshot where rnf DeleteSnapshot' {..} = Prelude.rnf snapshotName instance Data.ToHeaders DeleteSnapshot where toHeaders = Prelude.const ( Prelude.mconcat [ "X-Amz-Target" Data.=# ( "AmazonMemoryDB.DeleteSnapshot" :: Prelude.ByteString ), "Content-Type" Data.=# ( "application/x-amz-json-1.1" :: Prelude.ByteString ) ] ) instance Data.ToJSON DeleteSnapshot where toJSON DeleteSnapshot' {..} = Data.object ( Prelude.catMaybes [Prelude.Just ("SnapshotName" Data..= snapshotName)] ) instance Data.ToPath DeleteSnapshot where toPath = Prelude.const "/" instance Data.ToQuery DeleteSnapshot where toQuery = Prelude.const Prelude.mempty -- | /See:/ 'newDeleteSnapshotResponse' smart constructor. data DeleteSnapshotResponse = DeleteSnapshotResponse' { -- | The snapshot object that has been deleted. snapshot :: Prelude.Maybe Snapshot, -- | The response's http status code. httpStatus :: Prelude.Int } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'DeleteSnapshotResponse' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'snapshot', 'deleteSnapshotResponse_snapshot' - The snapshot object that has been deleted. -- -- 'httpStatus', 'deleteSnapshotResponse_httpStatus' - The response's http status code. newDeleteSnapshotResponse :: -- | 'httpStatus' Prelude.Int -> DeleteSnapshotResponse newDeleteSnapshotResponse pHttpStatus_ = DeleteSnapshotResponse' { snapshot = Prelude.Nothing, httpStatus = pHttpStatus_ } -- | The snapshot object that has been deleted. deleteSnapshotResponse_snapshot :: Lens.Lens' DeleteSnapshotResponse (Prelude.Maybe Snapshot) deleteSnapshotResponse_snapshot = Lens.lens (\DeleteSnapshotResponse' {snapshot} -> snapshot) (\s@DeleteSnapshotResponse' {} a -> s {snapshot = a} :: DeleteSnapshotResponse) -- | The response's http status code. deleteSnapshotResponse_httpStatus :: Lens.Lens' DeleteSnapshotResponse Prelude.Int deleteSnapshotResponse_httpStatus = Lens.lens (\DeleteSnapshotResponse' {httpStatus} -> httpStatus) (\s@DeleteSnapshotResponse' {} a -> s {httpStatus = a} :: DeleteSnapshotResponse) instance Prelude.NFData DeleteSnapshotResponse where rnf DeleteSnapshotResponse' {..} = Prelude.rnf snapshot `Prelude.seq` Prelude.rnf httpStatus