amazonka-ds-2.0: gen/Amazonka/DirectoryService/DeleteSnapshot.hs
{-# 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.DirectoryService.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 a directory snapshot.
module Amazonka.DirectoryService.DeleteSnapshot
( -- * Creating a Request
DeleteSnapshot (..),
newDeleteSnapshot,
-- * Request Lenses
deleteSnapshot_snapshotId,
-- * Destructuring the Response
DeleteSnapshotResponse (..),
newDeleteSnapshotResponse,
-- * Response Lenses
deleteSnapshotResponse_snapshotId,
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.DirectoryService.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
-- | Contains the inputs for the DeleteSnapshot operation.
--
-- /See:/ 'newDeleteSnapshot' smart constructor.
data DeleteSnapshot = DeleteSnapshot'
{ -- | The identifier of the directory snapshot to be deleted.
snapshotId :: Prelude.Text
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)
-- |
-- Create a value of 'DeleteSnapshot' 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:
--
-- 'snapshotId', 'deleteSnapshot_snapshotId' - The identifier of the directory snapshot to be deleted.
newDeleteSnapshot ::
-- | 'snapshotId'
Prelude.Text ->
DeleteSnapshot
newDeleteSnapshot pSnapshotId_ =
DeleteSnapshot' {snapshotId = pSnapshotId_}
-- | The identifier of the directory snapshot to be deleted.
deleteSnapshot_snapshotId :: Lens.Lens' DeleteSnapshot Prelude.Text
deleteSnapshot_snapshotId = Lens.lens (\DeleteSnapshot' {snapshotId} -> snapshotId) (\s@DeleteSnapshot' {} a -> s {snapshotId = 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..?> "SnapshotId")
Prelude.<*> (Prelude.pure (Prelude.fromEnum s))
)
instance Prelude.Hashable DeleteSnapshot where
hashWithSalt _salt DeleteSnapshot' {..} =
_salt `Prelude.hashWithSalt` snapshotId
instance Prelude.NFData DeleteSnapshot where
rnf DeleteSnapshot' {..} = Prelude.rnf snapshotId
instance Data.ToHeaders DeleteSnapshot where
toHeaders =
Prelude.const
( Prelude.mconcat
[ "X-Amz-Target"
Data.=# ( "DirectoryService_20150416.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 ("SnapshotId" Data..= snapshotId)]
)
instance Data.ToPath DeleteSnapshot where
toPath = Prelude.const "/"
instance Data.ToQuery DeleteSnapshot where
toQuery = Prelude.const Prelude.mempty
-- | Contains the results of the DeleteSnapshot operation.
--
-- /See:/ 'newDeleteSnapshotResponse' smart constructor.
data DeleteSnapshotResponse = DeleteSnapshotResponse'
{ -- | The identifier of the directory snapshot that was deleted.
snapshotId :: Prelude.Maybe Prelude.Text,
-- | 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 <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:
--
-- 'snapshotId', 'deleteSnapshotResponse_snapshotId' - The identifier of the directory snapshot that was deleted.
--
-- 'httpStatus', 'deleteSnapshotResponse_httpStatus' - The response's http status code.
newDeleteSnapshotResponse ::
-- | 'httpStatus'
Prelude.Int ->
DeleteSnapshotResponse
newDeleteSnapshotResponse pHttpStatus_ =
DeleteSnapshotResponse'
{ snapshotId =
Prelude.Nothing,
httpStatus = pHttpStatus_
}
-- | The identifier of the directory snapshot that was deleted.
deleteSnapshotResponse_snapshotId :: Lens.Lens' DeleteSnapshotResponse (Prelude.Maybe Prelude.Text)
deleteSnapshotResponse_snapshotId = Lens.lens (\DeleteSnapshotResponse' {snapshotId} -> snapshotId) (\s@DeleteSnapshotResponse' {} a -> s {snapshotId = 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 snapshotId
`Prelude.seq` Prelude.rnf httpStatus