{-# 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.IAM.DeleteVirtualMFADevice
-- 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 virtual MFA device.
--
-- You must deactivate a user\'s virtual MFA device before you can delete
-- it. For information about deactivating MFA devices, see
-- DeactivateMFADevice.
module Amazonka.IAM.DeleteVirtualMFADevice
  ( -- * Creating a Request
    DeleteVirtualMFADevice (..),
    newDeleteVirtualMFADevice,

    -- * Request Lenses
    deleteVirtualMFADevice_serialNumber,

    -- * Destructuring the Response
    DeleteVirtualMFADeviceResponse (..),
    newDeleteVirtualMFADeviceResponse,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IAM.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:/ 'newDeleteVirtualMFADevice' smart constructor.
data DeleteVirtualMFADevice = DeleteVirtualMFADevice'
  { -- | The serial number that uniquely identifies the MFA device. For virtual
    -- MFA devices, the serial number is the same as the ARN.
    --
    -- This parameter allows (through its
    -- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
    -- consisting of upper and lowercase alphanumeric characters with no
    -- spaces. You can also include any of the following characters: =,.\@:\/-
    DeleteVirtualMFADevice -> Text
serialNumber :: Prelude.Text
  }
  deriving (DeleteVirtualMFADevice -> DeleteVirtualMFADevice -> Bool
(DeleteVirtualMFADevice -> DeleteVirtualMFADevice -> Bool)
-> (DeleteVirtualMFADevice -> DeleteVirtualMFADevice -> Bool)
-> Eq DeleteVirtualMFADevice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteVirtualMFADevice -> DeleteVirtualMFADevice -> Bool
$c/= :: DeleteVirtualMFADevice -> DeleteVirtualMFADevice -> Bool
== :: DeleteVirtualMFADevice -> DeleteVirtualMFADevice -> Bool
$c== :: DeleteVirtualMFADevice -> DeleteVirtualMFADevice -> Bool
Prelude.Eq, ReadPrec [DeleteVirtualMFADevice]
ReadPrec DeleteVirtualMFADevice
Int -> ReadS DeleteVirtualMFADevice
ReadS [DeleteVirtualMFADevice]
(Int -> ReadS DeleteVirtualMFADevice)
-> ReadS [DeleteVirtualMFADevice]
-> ReadPrec DeleteVirtualMFADevice
-> ReadPrec [DeleteVirtualMFADevice]
-> Read DeleteVirtualMFADevice
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteVirtualMFADevice]
$creadListPrec :: ReadPrec [DeleteVirtualMFADevice]
readPrec :: ReadPrec DeleteVirtualMFADevice
$creadPrec :: ReadPrec DeleteVirtualMFADevice
readList :: ReadS [DeleteVirtualMFADevice]
$creadList :: ReadS [DeleteVirtualMFADevice]
readsPrec :: Int -> ReadS DeleteVirtualMFADevice
$creadsPrec :: Int -> ReadS DeleteVirtualMFADevice
Prelude.Read, Int -> DeleteVirtualMFADevice -> ShowS
[DeleteVirtualMFADevice] -> ShowS
DeleteVirtualMFADevice -> String
(Int -> DeleteVirtualMFADevice -> ShowS)
-> (DeleteVirtualMFADevice -> String)
-> ([DeleteVirtualMFADevice] -> ShowS)
-> Show DeleteVirtualMFADevice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteVirtualMFADevice] -> ShowS
$cshowList :: [DeleteVirtualMFADevice] -> ShowS
show :: DeleteVirtualMFADevice -> String
$cshow :: DeleteVirtualMFADevice -> String
showsPrec :: Int -> DeleteVirtualMFADevice -> ShowS
$cshowsPrec :: Int -> DeleteVirtualMFADevice -> ShowS
Prelude.Show, (forall x. DeleteVirtualMFADevice -> Rep DeleteVirtualMFADevice x)
-> (forall x.
    Rep DeleteVirtualMFADevice x -> DeleteVirtualMFADevice)
-> Generic DeleteVirtualMFADevice
forall x. Rep DeleteVirtualMFADevice x -> DeleteVirtualMFADevice
forall x. DeleteVirtualMFADevice -> Rep DeleteVirtualMFADevice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteVirtualMFADevice x -> DeleteVirtualMFADevice
$cfrom :: forall x. DeleteVirtualMFADevice -> Rep DeleteVirtualMFADevice x
Prelude.Generic)

-- |
-- Create a value of 'DeleteVirtualMFADevice' 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:
--
-- 'serialNumber', 'deleteVirtualMFADevice_serialNumber' - The serial number that uniquely identifies the MFA device. For virtual
-- MFA devices, the serial number is the same as the ARN.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of upper and lowercase alphanumeric characters with no
-- spaces. You can also include any of the following characters: =,.\@:\/-
newDeleteVirtualMFADevice ::
  -- | 'serialNumber'
  Prelude.Text ->
  DeleteVirtualMFADevice
newDeleteVirtualMFADevice :: Text -> DeleteVirtualMFADevice
newDeleteVirtualMFADevice Text
pSerialNumber_ =
  DeleteVirtualMFADevice' :: Text -> DeleteVirtualMFADevice
DeleteVirtualMFADevice'
    { $sel:serialNumber:DeleteVirtualMFADevice' :: Text
serialNumber =
        Text
pSerialNumber_
    }

-- | The serial number that uniquely identifies the MFA device. For virtual
-- MFA devices, the serial number is the same as the ARN.
--
-- This parameter allows (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- consisting of upper and lowercase alphanumeric characters with no
-- spaces. You can also include any of the following characters: =,.\@:\/-
deleteVirtualMFADevice_serialNumber :: Lens.Lens' DeleteVirtualMFADevice Prelude.Text
deleteVirtualMFADevice_serialNumber :: (Text -> f Text)
-> DeleteVirtualMFADevice -> f DeleteVirtualMFADevice
deleteVirtualMFADevice_serialNumber = (DeleteVirtualMFADevice -> Text)
-> (DeleteVirtualMFADevice -> Text -> DeleteVirtualMFADevice)
-> Lens DeleteVirtualMFADevice DeleteVirtualMFADevice Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteVirtualMFADevice' {Text
serialNumber :: Text
$sel:serialNumber:DeleteVirtualMFADevice' :: DeleteVirtualMFADevice -> Text
serialNumber} -> Text
serialNumber) (\s :: DeleteVirtualMFADevice
s@DeleteVirtualMFADevice' {} Text
a -> DeleteVirtualMFADevice
s {$sel:serialNumber:DeleteVirtualMFADevice' :: Text
serialNumber = Text
a} :: DeleteVirtualMFADevice)

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

instance Prelude.Hashable DeleteVirtualMFADevice

instance Prelude.NFData DeleteVirtualMFADevice

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

instance Core.ToPath DeleteVirtualMFADevice where
  toPath :: DeleteVirtualMFADevice -> ByteString
toPath = ByteString -> DeleteVirtualMFADevice -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DeleteVirtualMFADevice where
  toQuery :: DeleteVirtualMFADevice -> QueryString
toQuery DeleteVirtualMFADevice' {Text
serialNumber :: Text
$sel:serialNumber:DeleteVirtualMFADevice' :: DeleteVirtualMFADevice -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DeleteVirtualMFADevice" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
        ByteString
"SerialNumber" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
serialNumber
      ]

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

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

instance
  Prelude.NFData
    DeleteVirtualMFADeviceResponse