{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IAM.Types
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
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]
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
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. 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'
    { $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 :: Lens' DeactivateMFADevice Text
deactivateMFADevice_userName = 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 :: Lens' DeactivateMFADevice Text
deactivateMFADevice_serialNumber = 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 :: (Service -> Service)
-> DeactivateMFADevice -> Request DeactivateMFADevice
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeactivateMFADevice
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeactivateMFADevice)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull DeactivateMFADeviceResponse
DeactivateMFADeviceResponse'

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

instance Prelude.NFData DeactivateMFADevice where
  rnf :: DeactivateMFADevice -> ()
rnf DeactivateMFADevice' {Text
serialNumber :: Text
userName :: Text
$sel:serialNumber:DeactivateMFADevice' :: DeactivateMFADevice -> Text
$sel:userName:DeactivateMFADevice' :: DeactivateMFADevice -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
userName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
serialNumber

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

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

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

-- | /See:/ 'newDeactivateMFADeviceResponse' smart constructor.
data DeactivateMFADeviceResponse = DeactivateMFADeviceResponse'
  {
  }
  deriving (DeactivateMFADeviceResponse -> DeactivateMFADeviceResponse -> Bool
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]
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
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.
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 where
  rnf :: DeactivateMFADeviceResponse -> ()
rnf DeactivateMFADeviceResponse
_ = ()