{-# 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.DeleteMountTarget
-- 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 the specified mount target.
--
-- This operation forcibly breaks any mounts of the file system by using
-- the mount target that is being deleted, which might disrupt instances or
-- applications using those mounts. To avoid applications getting cut off
-- abruptly, you might consider unmounting any mounts of the mount target,
-- if feasible. The operation also deletes the associated network
-- interface. Uncommitted writes might be lost, but breaking a mount target
-- using this operation does not corrupt the file system itself. The file
-- system you created remains. You can mount an EC2 instance in your VPC by
-- using another mount target.
--
-- This operation requires permissions for the following action on the file
-- system:
--
-- -   @elasticfilesystem:DeleteMountTarget@
--
-- The @DeleteMountTarget@ call returns while the mount target state is
-- still @deleting@. You can check the mount target deletion by calling the
-- DescribeMountTargets operation, which returns a list of mount target
-- descriptions for the given file system.
--
-- The operation also requires permissions for the following Amazon EC2
-- action on the mount target\'s network interface:
--
-- -   @ec2:DeleteNetworkInterface@
module Amazonka.EFS.DeleteMountTarget
  ( -- * Creating a Request
    DeleteMountTarget (..),
    newDeleteMountTarget,

    -- * Request Lenses
    deleteMountTarget_mountTargetId,

    -- * Destructuring the Response
    DeleteMountTargetResponse (..),
    newDeleteMountTargetResponse,
  )
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:/ 'newDeleteMountTarget' smart constructor.
data DeleteMountTarget = DeleteMountTarget'
  { -- | The ID of the mount target to delete (String).
    DeleteMountTarget -> Text
mountTargetId :: Prelude.Text
  }
  deriving (DeleteMountTarget -> DeleteMountTarget -> Bool
(DeleteMountTarget -> DeleteMountTarget -> Bool)
-> (DeleteMountTarget -> DeleteMountTarget -> Bool)
-> Eq DeleteMountTarget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteMountTarget -> DeleteMountTarget -> Bool
$c/= :: DeleteMountTarget -> DeleteMountTarget -> Bool
== :: DeleteMountTarget -> DeleteMountTarget -> Bool
$c== :: DeleteMountTarget -> DeleteMountTarget -> Bool
Prelude.Eq, ReadPrec [DeleteMountTarget]
ReadPrec DeleteMountTarget
Int -> ReadS DeleteMountTarget
ReadS [DeleteMountTarget]
(Int -> ReadS DeleteMountTarget)
-> ReadS [DeleteMountTarget]
-> ReadPrec DeleteMountTarget
-> ReadPrec [DeleteMountTarget]
-> Read DeleteMountTarget
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteMountTarget]
$creadListPrec :: ReadPrec [DeleteMountTarget]
readPrec :: ReadPrec DeleteMountTarget
$creadPrec :: ReadPrec DeleteMountTarget
readList :: ReadS [DeleteMountTarget]
$creadList :: ReadS [DeleteMountTarget]
readsPrec :: Int -> ReadS DeleteMountTarget
$creadsPrec :: Int -> ReadS DeleteMountTarget
Prelude.Read, Int -> DeleteMountTarget -> ShowS
[DeleteMountTarget] -> ShowS
DeleteMountTarget -> String
(Int -> DeleteMountTarget -> ShowS)
-> (DeleteMountTarget -> String)
-> ([DeleteMountTarget] -> ShowS)
-> Show DeleteMountTarget
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteMountTarget] -> ShowS
$cshowList :: [DeleteMountTarget] -> ShowS
show :: DeleteMountTarget -> String
$cshow :: DeleteMountTarget -> String
showsPrec :: Int -> DeleteMountTarget -> ShowS
$cshowsPrec :: Int -> DeleteMountTarget -> ShowS
Prelude.Show, (forall x. DeleteMountTarget -> Rep DeleteMountTarget x)
-> (forall x. Rep DeleteMountTarget x -> DeleteMountTarget)
-> Generic DeleteMountTarget
forall x. Rep DeleteMountTarget x -> DeleteMountTarget
forall x. DeleteMountTarget -> Rep DeleteMountTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteMountTarget x -> DeleteMountTarget
$cfrom :: forall x. DeleteMountTarget -> Rep DeleteMountTarget x
Prelude.Generic)

-- |
-- Create a value of 'DeleteMountTarget' 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:
--
-- 'mountTargetId', 'deleteMountTarget_mountTargetId' - The ID of the mount target to delete (String).
newDeleteMountTarget ::
  -- | 'mountTargetId'
  Prelude.Text ->
  DeleteMountTarget
newDeleteMountTarget :: Text -> DeleteMountTarget
newDeleteMountTarget Text
pMountTargetId_ =
  DeleteMountTarget' :: Text -> DeleteMountTarget
DeleteMountTarget' {$sel:mountTargetId:DeleteMountTarget' :: Text
mountTargetId = Text
pMountTargetId_}

-- | The ID of the mount target to delete (String).
deleteMountTarget_mountTargetId :: Lens.Lens' DeleteMountTarget Prelude.Text
deleteMountTarget_mountTargetId :: (Text -> f Text) -> DeleteMountTarget -> f DeleteMountTarget
deleteMountTarget_mountTargetId = (DeleteMountTarget -> Text)
-> (DeleteMountTarget -> Text -> DeleteMountTarget)
-> Lens DeleteMountTarget DeleteMountTarget Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMountTarget' {Text
mountTargetId :: Text
$sel:mountTargetId:DeleteMountTarget' :: DeleteMountTarget -> Text
mountTargetId} -> Text
mountTargetId) (\s :: DeleteMountTarget
s@DeleteMountTarget' {} Text
a -> DeleteMountTarget
s {$sel:mountTargetId:DeleteMountTarget' :: Text
mountTargetId = Text
a} :: DeleteMountTarget)

instance Core.AWSRequest DeleteMountTarget where
  type
    AWSResponse DeleteMountTarget =
      DeleteMountTargetResponse
  request :: DeleteMountTarget -> Request DeleteMountTarget
request = Service -> DeleteMountTarget -> Request DeleteMountTarget
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteMountTarget
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteMountTarget)))
response =
    AWSResponse DeleteMountTarget
-> Logger
-> Service
-> Proxy DeleteMountTarget
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteMountTarget)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteMountTarget
DeleteMountTargetResponse
DeleteMountTargetResponse'

instance Prelude.Hashable DeleteMountTarget

instance Prelude.NFData DeleteMountTarget

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

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

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

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

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

instance Prelude.NFData DeleteMountTargetResponse