{-# 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.UntagMFADevice
-- 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)
--
-- Removes the specified tags from the IAM virtual multi-factor
-- authentication (MFA) device. For more information about tagging, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html Tagging IAM resources>
-- in the /IAM User Guide/.
module Amazonka.IAM.UntagMFADevice
  ( -- * Creating a Request
    UntagMFADevice (..),
    newUntagMFADevice,

    -- * Request Lenses
    untagMFADevice_serialNumber,
    untagMFADevice_tagKeys,

    -- * Destructuring the Response
    UntagMFADeviceResponse (..),
    newUntagMFADeviceResponse,
  )
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:/ 'newUntagMFADevice' smart constructor.
data UntagMFADevice = UntagMFADevice'
  { -- | The unique identifier for the IAM virtual MFA device from which you want
    -- to remove tags. 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: _+=,.\@-
    UntagMFADevice -> Text
serialNumber :: Prelude.Text,
    -- | A list of key names as a simple array of strings. The tags with matching
    -- keys are removed from the specified instance profile.
    UntagMFADevice -> [Text]
tagKeys :: [Prelude.Text]
  }
  deriving (UntagMFADevice -> UntagMFADevice -> Bool
(UntagMFADevice -> UntagMFADevice -> Bool)
-> (UntagMFADevice -> UntagMFADevice -> Bool) -> Eq UntagMFADevice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UntagMFADevice -> UntagMFADevice -> Bool
$c/= :: UntagMFADevice -> UntagMFADevice -> Bool
== :: UntagMFADevice -> UntagMFADevice -> Bool
$c== :: UntagMFADevice -> UntagMFADevice -> Bool
Prelude.Eq, ReadPrec [UntagMFADevice]
ReadPrec UntagMFADevice
Int -> ReadS UntagMFADevice
ReadS [UntagMFADevice]
(Int -> ReadS UntagMFADevice)
-> ReadS [UntagMFADevice]
-> ReadPrec UntagMFADevice
-> ReadPrec [UntagMFADevice]
-> Read UntagMFADevice
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UntagMFADevice]
$creadListPrec :: ReadPrec [UntagMFADevice]
readPrec :: ReadPrec UntagMFADevice
$creadPrec :: ReadPrec UntagMFADevice
readList :: ReadS [UntagMFADevice]
$creadList :: ReadS [UntagMFADevice]
readsPrec :: Int -> ReadS UntagMFADevice
$creadsPrec :: Int -> ReadS UntagMFADevice
Prelude.Read, Int -> UntagMFADevice -> ShowS
[UntagMFADevice] -> ShowS
UntagMFADevice -> String
(Int -> UntagMFADevice -> ShowS)
-> (UntagMFADevice -> String)
-> ([UntagMFADevice] -> ShowS)
-> Show UntagMFADevice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UntagMFADevice] -> ShowS
$cshowList :: [UntagMFADevice] -> ShowS
show :: UntagMFADevice -> String
$cshow :: UntagMFADevice -> String
showsPrec :: Int -> UntagMFADevice -> ShowS
$cshowsPrec :: Int -> UntagMFADevice -> ShowS
Prelude.Show, (forall x. UntagMFADevice -> Rep UntagMFADevice x)
-> (forall x. Rep UntagMFADevice x -> UntagMFADevice)
-> Generic UntagMFADevice
forall x. Rep UntagMFADevice x -> UntagMFADevice
forall x. UntagMFADevice -> Rep UntagMFADevice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UntagMFADevice x -> UntagMFADevice
$cfrom :: forall x. UntagMFADevice -> Rep UntagMFADevice x
Prelude.Generic)

-- |
-- Create a value of 'UntagMFADevice' 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', 'untagMFADevice_serialNumber' - The unique identifier for the IAM virtual MFA device from which you want
-- to remove tags. 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: _+=,.\@-
--
-- 'tagKeys', 'untagMFADevice_tagKeys' - A list of key names as a simple array of strings. The tags with matching
-- keys are removed from the specified instance profile.
newUntagMFADevice ::
  -- | 'serialNumber'
  Prelude.Text ->
  UntagMFADevice
newUntagMFADevice :: Text -> UntagMFADevice
newUntagMFADevice Text
pSerialNumber_ =
  UntagMFADevice' :: Text -> [Text] -> UntagMFADevice
UntagMFADevice'
    { $sel:serialNumber:UntagMFADevice' :: Text
serialNumber = Text
pSerialNumber_,
      $sel:tagKeys:UntagMFADevice' :: [Text]
tagKeys = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The unique identifier for the IAM virtual MFA device from which you want
-- to remove tags. 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: _+=,.\@-
untagMFADevice_serialNumber :: Lens.Lens' UntagMFADevice Prelude.Text
untagMFADevice_serialNumber :: (Text -> f Text) -> UntagMFADevice -> f UntagMFADevice
untagMFADevice_serialNumber = (UntagMFADevice -> Text)
-> (UntagMFADevice -> Text -> UntagMFADevice)
-> Lens UntagMFADevice UntagMFADevice Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagMFADevice' {Text
serialNumber :: Text
$sel:serialNumber:UntagMFADevice' :: UntagMFADevice -> Text
serialNumber} -> Text
serialNumber) (\s :: UntagMFADevice
s@UntagMFADevice' {} Text
a -> UntagMFADevice
s {$sel:serialNumber:UntagMFADevice' :: Text
serialNumber = Text
a} :: UntagMFADevice)

-- | A list of key names as a simple array of strings. The tags with matching
-- keys are removed from the specified instance profile.
untagMFADevice_tagKeys :: Lens.Lens' UntagMFADevice [Prelude.Text]
untagMFADevice_tagKeys :: ([Text] -> f [Text]) -> UntagMFADevice -> f UntagMFADevice
untagMFADevice_tagKeys = (UntagMFADevice -> [Text])
-> (UntagMFADevice -> [Text] -> UntagMFADevice)
-> Lens UntagMFADevice UntagMFADevice [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagMFADevice' {[Text]
tagKeys :: [Text]
$sel:tagKeys:UntagMFADevice' :: UntagMFADevice -> [Text]
tagKeys} -> [Text]
tagKeys) (\s :: UntagMFADevice
s@UntagMFADevice' {} [Text]
a -> UntagMFADevice
s {$sel:tagKeys:UntagMFADevice' :: [Text]
tagKeys = [Text]
a} :: UntagMFADevice) (([Text] -> f [Text]) -> UntagMFADevice -> f UntagMFADevice)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> UntagMFADevice
-> f UntagMFADevice
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable UntagMFADevice

instance Prelude.NFData UntagMFADevice

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

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

instance Core.ToQuery UntagMFADevice where
  toQuery :: UntagMFADevice -> QueryString
toQuery UntagMFADevice' {[Text]
Text
tagKeys :: [Text]
serialNumber :: Text
$sel:tagKeys:UntagMFADevice' :: UntagMFADevice -> [Text]
$sel:serialNumber:UntagMFADevice' :: UntagMFADevice -> 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
"UntagMFADevice" :: 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,
        ByteString
"TagKeys" ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" [Text]
tagKeys
      ]

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

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

instance Prelude.NFData UntagMFADeviceResponse