{-# 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.EFS.DeleteFileSystem
-- 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 file system, permanently severing access to its contents. Upon
-- return, the file system no longer exists and you can\'t access any
-- contents of the deleted file system.
--
-- You need to manually delete mount targets attached to a file system
-- before you can delete an EFS file system. This step is performed for you
-- when you use the Amazon Web Services console to delete a file system.
--
-- You cannot delete a file system that is part of an EFS Replication
-- configuration. You need to delete the replication configuration first.
--
-- You can\'t delete a file system that is in use. That is, if the file
-- system has any mount targets, you must first delete them. For more
-- information, see DescribeMountTargets and DeleteMountTarget.
--
-- The @DeleteFileSystem@ call returns while the file system state is still
-- @deleting@. You can check the file system deletion status by calling the
-- DescribeFileSystems operation, which returns a list of file systems in
-- your account. If you pass file system ID or creation token for the
-- deleted file system, the DescribeFileSystems returns a
-- @404 FileSystemNotFound@ error.
--
-- This operation requires permissions for the
-- @elasticfilesystem:DeleteFileSystem@ action.
module Amazonka.EFS.DeleteFileSystem
  ( -- * Creating a Request
    DeleteFileSystem (..),
    newDeleteFileSystem,

    -- * Request Lenses
    deleteFileSystem_fileSystemId,

    -- * Destructuring the Response
    DeleteFileSystemResponse (..),
    newDeleteFileSystemResponse,
  )
where

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

-- |
--
-- /See:/ 'newDeleteFileSystem' smart constructor.
data DeleteFileSystem = DeleteFileSystem'
  { -- | The ID of the file system you want to delete.
    DeleteFileSystem -> Text
fileSystemId :: Prelude.Text
  }
  deriving (DeleteFileSystem -> DeleteFileSystem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteFileSystem -> DeleteFileSystem -> Bool
$c/= :: DeleteFileSystem -> DeleteFileSystem -> Bool
== :: DeleteFileSystem -> DeleteFileSystem -> Bool
$c== :: DeleteFileSystem -> DeleteFileSystem -> Bool
Prelude.Eq, ReadPrec [DeleteFileSystem]
ReadPrec DeleteFileSystem
Int -> ReadS DeleteFileSystem
ReadS [DeleteFileSystem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteFileSystem]
$creadListPrec :: ReadPrec [DeleteFileSystem]
readPrec :: ReadPrec DeleteFileSystem
$creadPrec :: ReadPrec DeleteFileSystem
readList :: ReadS [DeleteFileSystem]
$creadList :: ReadS [DeleteFileSystem]
readsPrec :: Int -> ReadS DeleteFileSystem
$creadsPrec :: Int -> ReadS DeleteFileSystem
Prelude.Read, Int -> DeleteFileSystem -> ShowS
[DeleteFileSystem] -> ShowS
DeleteFileSystem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteFileSystem] -> ShowS
$cshowList :: [DeleteFileSystem] -> ShowS
show :: DeleteFileSystem -> String
$cshow :: DeleteFileSystem -> String
showsPrec :: Int -> DeleteFileSystem -> ShowS
$cshowsPrec :: Int -> DeleteFileSystem -> ShowS
Prelude.Show, forall x. Rep DeleteFileSystem x -> DeleteFileSystem
forall x. DeleteFileSystem -> Rep DeleteFileSystem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteFileSystem x -> DeleteFileSystem
$cfrom :: forall x. DeleteFileSystem -> Rep DeleteFileSystem x
Prelude.Generic)

-- |
-- Create a value of 'DeleteFileSystem' 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:
--
-- 'fileSystemId', 'deleteFileSystem_fileSystemId' - The ID of the file system you want to delete.
newDeleteFileSystem ::
  -- | 'fileSystemId'
  Prelude.Text ->
  DeleteFileSystem
newDeleteFileSystem :: Text -> DeleteFileSystem
newDeleteFileSystem Text
pFileSystemId_ =
  DeleteFileSystem' {$sel:fileSystemId:DeleteFileSystem' :: Text
fileSystemId = Text
pFileSystemId_}

-- | The ID of the file system you want to delete.
deleteFileSystem_fileSystemId :: Lens.Lens' DeleteFileSystem Prelude.Text
deleteFileSystem_fileSystemId :: Lens' DeleteFileSystem Text
deleteFileSystem_fileSystemId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteFileSystem' {Text
fileSystemId :: Text
$sel:fileSystemId:DeleteFileSystem' :: DeleteFileSystem -> Text
fileSystemId} -> Text
fileSystemId) (\s :: DeleteFileSystem
s@DeleteFileSystem' {} Text
a -> DeleteFileSystem
s {$sel:fileSystemId:DeleteFileSystem' :: Text
fileSystemId = Text
a} :: DeleteFileSystem)

instance Core.AWSRequest DeleteFileSystem where
  type
    AWSResponse DeleteFileSystem =
      DeleteFileSystemResponse
  request :: (Service -> Service)
-> DeleteFileSystem -> Request DeleteFileSystem
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 DeleteFileSystem
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteFileSystem)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull DeleteFileSystemResponse
DeleteFileSystemResponse'

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

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

instance Data.ToHeaders DeleteFileSystem where
  toHeaders :: DeleteFileSystem -> [Header]
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath DeleteFileSystem where
  toPath :: DeleteFileSystem -> ByteString
toPath DeleteFileSystem' {Text
fileSystemId :: Text
$sel:fileSystemId:DeleteFileSystem' :: DeleteFileSystem -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/2015-02-01/file-systems/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
fileSystemId]

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

-- | /See:/ 'newDeleteFileSystemResponse' smart constructor.
data DeleteFileSystemResponse = DeleteFileSystemResponse'
  {
  }
  deriving (DeleteFileSystemResponse -> DeleteFileSystemResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteFileSystemResponse -> DeleteFileSystemResponse -> Bool
$c/= :: DeleteFileSystemResponse -> DeleteFileSystemResponse -> Bool
== :: DeleteFileSystemResponse -> DeleteFileSystemResponse -> Bool
$c== :: DeleteFileSystemResponse -> DeleteFileSystemResponse -> Bool
Prelude.Eq, ReadPrec [DeleteFileSystemResponse]
ReadPrec DeleteFileSystemResponse
Int -> ReadS DeleteFileSystemResponse
ReadS [DeleteFileSystemResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteFileSystemResponse]
$creadListPrec :: ReadPrec [DeleteFileSystemResponse]
readPrec :: ReadPrec DeleteFileSystemResponse
$creadPrec :: ReadPrec DeleteFileSystemResponse
readList :: ReadS [DeleteFileSystemResponse]
$creadList :: ReadS [DeleteFileSystemResponse]
readsPrec :: Int -> ReadS DeleteFileSystemResponse
$creadsPrec :: Int -> ReadS DeleteFileSystemResponse
Prelude.Read, Int -> DeleteFileSystemResponse -> ShowS
[DeleteFileSystemResponse] -> ShowS
DeleteFileSystemResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteFileSystemResponse] -> ShowS
$cshowList :: [DeleteFileSystemResponse] -> ShowS
show :: DeleteFileSystemResponse -> String
$cshow :: DeleteFileSystemResponse -> String
showsPrec :: Int -> DeleteFileSystemResponse -> ShowS
$cshowsPrec :: Int -> DeleteFileSystemResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteFileSystemResponse x -> DeleteFileSystemResponse
forall x.
DeleteFileSystemResponse -> Rep DeleteFileSystemResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteFileSystemResponse x -> DeleteFileSystemResponse
$cfrom :: forall x.
DeleteFileSystemResponse -> Rep DeleteFileSystemResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteFileSystemResponse' 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.
newDeleteFileSystemResponse ::
  DeleteFileSystemResponse
newDeleteFileSystemResponse :: DeleteFileSystemResponse
newDeleteFileSystemResponse =
  DeleteFileSystemResponse
DeleteFileSystemResponse'

instance Prelude.NFData DeleteFileSystemResponse where
  rnf :: DeleteFileSystemResponse -> ()
rnf DeleteFileSystemResponse
_ = ()