{-# 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.DeactivateMFADevice
-- 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)
--
-- Deactivates the specified MFA device and removes it from association
-- with the user name for which it was originally enabled.
--
-- For more information about creating and working with virtual MFA
-- devices, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_VirtualMFA.html Enabling a virtual multi-factor authentication (MFA) device>
-- in the /IAM User Guide/.
module Amazonka.IAM.DeactivateMFADevice
  ( -- * Creating a Request
    DeactivateMFADevice (..),
    newDeactivateMFADevice,

    -- * Request Lenses
    deactivateMFADevice_userName,
    deactivateMFADevice_serialNumber,

    -- * Destructuring the Response
    DeactivateMFADeviceResponse (..),
    newDeactivateMFADeviceResponse,
  )
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:/ 'newDeactivateMFADevice' smart constructor.
data DeactivateMFADevice = DeactivateMFADevice'
  { -- | The name of the user whose MFA device you want to deactivate.
    --
    -- 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: _+=,.\@-
    DeactivateMFADevice -> Text
userName :: Prelude.Text,
    -- | The serial number that uniquely identifies the MFA device. For virtual
    -- MFA devices, the serial number is the device 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: =,.\@:\/-
    DeactivateMFADevice -> Text
serialNumber :: Prelude.Text
  }
  deriving (DeactivateMFADevice -> DeactivateMFADevice -> Bool
(DeactivateMFADevice -> DeactivateMFADevice -> Bool)
-> (DeactivateMFADevice -> DeactivateMFADevice -> Bool)
-> Eq DeactivateMFADevice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeactivateMFADevice -> DeactivateMFADevice -> Bool
$c/= :: DeactivateMFADevice -> DeactivateMFADevice -> Bool
== :: DeactivateMFADevice -> DeactivateMFADevice -> Bool
$c== :: DeactivateMFADevice -> DeactivateMFADevice -> Bool
Prelude.Eq, ReadPrec [DeactivateMFADevice]
ReadPrec DeactivateMFADevice
Int -> ReadS DeactivateMFADevice
ReadS [DeactivateMFADevice]
(Int -> ReadS DeactivateMFADevice)
-> ReadS [DeactivateMFADevice]
-> ReadPrec DeactivateMFADevice
-> ReadPrec [DeactivateMFADevice]
-> Read DeactivateMFADevice
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeactivateMFADevice]
$creadListPrec :: ReadPrec [DeactivateMFADevice]
readPrec :: ReadPrec DeactivateMFADevice
$creadPrec :: ReadPrec DeactivateMFADevice
readList :: ReadS [DeactivateMFADevice]
$creadList :: ReadS [DeactivateMFADevice]
readsPrec :: Int -> ReadS DeactivateMFADevice
$creadsPrec :: Int -> ReadS DeactivateMFADevice
Prelude.Read, Int -> DeactivateMFADevice -> ShowS
[DeactivateMFADevice] -> ShowS
DeactivateMFADevice -> String
(Int -> DeactivateMFADevice -> ShowS)
-> (DeactivateMFADevice -> String)
-> ([DeactivateMFADevice] -> ShowS)
-> Show DeactivateMFADevice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeactivateMFADevice] -> ShowS
$cshowList :: [DeactivateMFADevice] -> ShowS
show :: DeactivateMFADevice -> String
$cshow :: DeactivateMFADevice -> String
showsPrec :: Int -> DeactivateMFADevice -> ShowS
$cshowsPrec :: Int -> DeactivateMFADevice -> ShowS
Prelude.Show, (forall x. DeactivateMFADevice -> Rep DeactivateMFADevice x)
-> (forall x. Rep DeactivateMFADevice x -> DeactivateMFADevice)
-> Generic DeactivateMFADevice
forall x. Rep DeactivateMFADevice x -> DeactivateMFADevice
forall x. DeactivateMFADevice -> Rep DeactivateMFADevice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeactivateMFADevice x -> DeactivateMFADevice
$cfrom :: forall x. DeactivateMFADevice -> Rep DeactivateMFADevice x
Prelude.Generic)

-- |
-- Create a value of 'DeactivateMFADevice' 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:
--
-- 'userName', 'deactivateMFADevice_userName' - The name of the user whose MFA device you want to deactivate.
--
-- 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: _+=,.\@-
--
-- 'serialNumber', 'deactivateMFADevice_serialNumber' - The serial number that uniquely identifies the MFA device. For virtual
-- MFA devices, the serial number is the device 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: =,.\@:\/-
newDeactivateMFADevice ::
  -- | 'userName'
  Prelude.Text ->
  -- | 'serialNumber'
  Prelude.Text ->
  DeactivateMFADevice
newDeactivateMFADevice :: Text -> Text -> DeactivateMFADevice
newDeactivateMFADevice Text
pUserName_ Text
pSerialNumber_ =
  DeactivateMFADevice' :: Text -> Text -> DeactivateMFADevice
DeactivateMFADevice'
    { $sel:userName:DeactivateMFADevice' :: Text
userName = Text
pUserName_,
      $sel:serialNumber:DeactivateMFADevice' :: Text
serialNumber = Text
pSerialNumber_
    }

-- | The name of the user whose MFA device you want to deactivate.
--
-- 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: _+=,.\@-
deactivateMFADevice_userName :: Lens.Lens' DeactivateMFADevice Prelude.Text
deactivateMFADevice_userName :: (Text -> f Text) -> DeactivateMFADevice -> f DeactivateMFADevice
deactivateMFADevice_userName = (DeactivateMFADevice -> Text)
-> (DeactivateMFADevice -> Text -> DeactivateMFADevice)
-> Lens DeactivateMFADevice DeactivateMFADevice Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeactivateMFADevice' {Text
userName :: Text
$sel:userName:DeactivateMFADevice' :: DeactivateMFADevice -> Text
userName} -> Text
userName) (\s :: DeactivateMFADevice
s@DeactivateMFADevice' {} Text
a -> DeactivateMFADevice
s {$sel:userName:DeactivateMFADevice' :: Text
userName = Text
a} :: DeactivateMFADevice)

-- | The serial number that uniquely identifies the MFA device. For virtual
-- MFA devices, the serial number is the device 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: =,.\@:\/-
deactivateMFADevice_serialNumber :: Lens.Lens' DeactivateMFADevice Prelude.Text
deactivateMFADevice_serialNumber :: (Text -> f Text) -> DeactivateMFADevice -> f DeactivateMFADevice
deactivateMFADevice_serialNumber = (DeactivateMFADevice -> Text)
-> (DeactivateMFADevice -> Text -> DeactivateMFADevice)
-> Lens DeactivateMFADevice DeactivateMFADevice Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeactivateMFADevice' {Text
serialNumber :: Text
$sel:serialNumber:DeactivateMFADevice' :: DeactivateMFADevice -> Text
serialNumber} -> Text
serialNumber) (\s :: DeactivateMFADevice
s@DeactivateMFADevice' {} Text
a -> DeactivateMFADevice
s {$sel:serialNumber:DeactivateMFADevice' :: Text
serialNumber = Text
a} :: DeactivateMFADevice)

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

instance Prelude.Hashable DeactivateMFADevice

instance Prelude.NFData DeactivateMFADevice

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

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

instance Core.ToQuery DeactivateMFADevice where
  toQuery :: DeactivateMFADevice -> QueryString
toQuery DeactivateMFADevice' {Text
serialNumber :: Text
userName :: Text
$sel:serialNumber:DeactivateMFADevice' :: DeactivateMFADevice -> Text
$sel:userName:DeactivateMFADevice' :: DeactivateMFADevice -> 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
"DeactivateMFADevice" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
        ByteString
"UserName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
userName,
        ByteString
"SerialNumber" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
serialNumber
      ]

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

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

instance Prelude.NFData DeactivateMFADeviceResponse