{-# 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.EC2.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 the specified snapshot. -- -- When you make periodic snapshots of a volume, the snapshots are -- incremental, and only the blocks on the device that have changed since -- your last snapshot are saved in the new snapshot. When you delete a -- snapshot, only the data not needed for any other snapshot is removed. So -- regardless of which prior snapshots have been deleted, all active -- snapshots will have access to all the information needed to restore the -- volume. -- -- You cannot delete a snapshot of the root device of an EBS volume used by -- a registered AMI. You must first de-register the AMI before you can -- delete the snapshot. -- -- For more information, see -- -- in the /Amazon Elastic Compute Cloud User Guide/. module Amazonka.EC2.DeleteSnapshot ( -- * Creating a Request DeleteSnapshot (..), newDeleteSnapshot, -- * Request Lenses deleteSnapshot_dryRun, deleteSnapshot_snapshotId, -- * Destructuring the Response DeleteSnapshotResponse (..), newDeleteSnapshotResponse, ) where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import Amazonka.EC2.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' { -- | Checks whether you have the required permissions for the action, without -- actually making the request, and provides an error response. If you have -- the required permissions, the error response is @DryRunOperation@. -- Otherwise, it is @UnauthorizedOperation@. dryRun :: Prelude.Maybe Prelude.Bool, -- | The ID of the EBS snapshot. snapshotId :: 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: -- -- 'dryRun', 'deleteSnapshot_dryRun' - Checks whether you have the required permissions for the action, without -- actually making the request, and provides an error response. If you have -- the required permissions, the error response is @DryRunOperation@. -- Otherwise, it is @UnauthorizedOperation@. -- -- 'snapshotId', 'deleteSnapshot_snapshotId' - The ID of the EBS snapshot. newDeleteSnapshot :: -- | 'snapshotId' Prelude.Text -> DeleteSnapshot newDeleteSnapshot pSnapshotId_ = DeleteSnapshot' { dryRun = Prelude.Nothing, snapshotId = pSnapshotId_ } -- | Checks whether you have the required permissions for the action, without -- actually making the request, and provides an error response. If you have -- the required permissions, the error response is @DryRunOperation@. -- Otherwise, it is @UnauthorizedOperation@. deleteSnapshot_dryRun :: Lens.Lens' DeleteSnapshot (Prelude.Maybe Prelude.Bool) deleteSnapshot_dryRun = Lens.lens (\DeleteSnapshot' {dryRun} -> dryRun) (\s@DeleteSnapshot' {} a -> s {dryRun = a} :: DeleteSnapshot) -- | The ID of the EBS snapshot. 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.postQuery (overrides defaultService) response = Response.receiveNull DeleteSnapshotResponse' instance Prelude.Hashable DeleteSnapshot where hashWithSalt _salt DeleteSnapshot' {..} = _salt `Prelude.hashWithSalt` dryRun `Prelude.hashWithSalt` snapshotId instance Prelude.NFData DeleteSnapshot where rnf DeleteSnapshot' {..} = Prelude.rnf dryRun `Prelude.seq` Prelude.rnf snapshotId instance Data.ToHeaders DeleteSnapshot where toHeaders = Prelude.const Prelude.mempty instance Data.ToPath DeleteSnapshot where toPath = Prelude.const "/" instance Data.ToQuery DeleteSnapshot where toQuery DeleteSnapshot' {..} = Prelude.mconcat [ "Action" Data.=: ("DeleteSnapshot" :: Prelude.ByteString), "Version" Data.=: ("2016-11-15" :: Prelude.ByteString), "DryRun" Data.=: dryRun, "SnapshotId" Data.=: snapshotId ] -- | /See:/ 'newDeleteSnapshotResponse' smart constructor. data DeleteSnapshotResponse = DeleteSnapshotResponse' { } 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. newDeleteSnapshotResponse :: DeleteSnapshotResponse newDeleteSnapshotResponse = DeleteSnapshotResponse' instance Prelude.NFData DeleteSnapshotResponse where rnf _ = ()