{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- 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 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 Amazonka.EFS.Types
import qualified Amazonka.Lens as Lens
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
(DeleteFileSystem -> DeleteFileSystem -> Bool)
-> (DeleteFileSystem -> DeleteFileSystem -> Bool)
-> Eq DeleteFileSystem
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]
(Int -> ReadS DeleteFileSystem)
-> ReadS [DeleteFileSystem]
-> ReadPrec DeleteFileSystem
-> ReadPrec [DeleteFileSystem]
-> Read 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
(Int -> DeleteFileSystem -> ShowS)
-> (DeleteFileSystem -> String)
-> ([DeleteFileSystem] -> ShowS)
-> Show DeleteFileSystem
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. DeleteFileSystem -> Rep DeleteFileSystem x)
-> (forall x. Rep DeleteFileSystem x -> DeleteFileSystem)
-> Generic DeleteFileSystem
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' :: Text -> DeleteFileSystem
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 :: (Text -> f Text) -> DeleteFileSystem -> f DeleteFileSystem
deleteFileSystem_fileSystemId = (DeleteFileSystem -> Text)
-> (DeleteFileSystem -> Text -> DeleteFileSystem)
-> Lens DeleteFileSystem DeleteFileSystem Text Text
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 :: DeleteFileSystem -> Request DeleteFileSystem
request = Service -> DeleteFileSystem -> Request DeleteFileSystem
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteFileSystem
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteFileSystem)))
response =
    AWSResponse DeleteFileSystem
-> Logger
-> Service
-> Proxy DeleteFileSystem
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteFileSystem)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteFileSystem
DeleteFileSystemResponse
DeleteFileSystemResponse'

instance Prelude.Hashable DeleteFileSystem

instance Prelude.NFData DeleteFileSystem

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

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

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

-- | /See:/ 'newDeleteFileSystemResponse' smart constructor.
data DeleteFileSystemResponse = DeleteFileSystemResponse'
  {
  }
  deriving (DeleteFileSystemResponse -> DeleteFileSystemResponse -> Bool
(DeleteFileSystemResponse -> DeleteFileSystemResponse -> Bool)
-> (DeleteFileSystemResponse -> DeleteFileSystemResponse -> Bool)
-> Eq DeleteFileSystemResponse
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]
(Int -> ReadS DeleteFileSystemResponse)
-> ReadS [DeleteFileSystemResponse]
-> ReadPrec DeleteFileSystemResponse
-> ReadPrec [DeleteFileSystemResponse]
-> Read 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
(Int -> DeleteFileSystemResponse -> ShowS)
-> (DeleteFileSystemResponse -> String)
-> ([DeleteFileSystemResponse] -> ShowS)
-> Show DeleteFileSystemResponse
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.
 DeleteFileSystemResponse -> Rep DeleteFileSystemResponse x)
-> (forall x.
    Rep DeleteFileSystemResponse x -> DeleteFileSystemResponse)
-> Generic DeleteFileSystemResponse
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