{-# 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.UntagRole
-- 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 role. 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.UntagRole
  ( -- * Creating a Request
    UntagRole (..),
    newUntagRole,

    -- * Request Lenses
    untagRole_roleName,
    untagRole_tagKeys,

    -- * Destructuring the Response
    UntagRoleResponse (..),
    newUntagRoleResponse,
  )
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:/ 'newUntagRole' smart constructor.
data UntagRole = UntagRole'
  { -- | The name of the IAM role from which you want to remove tags.
    --
    -- This parameter accepts (through its
    -- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
    -- that consist of upper and lowercase alphanumeric characters with no
    -- spaces. You can also include any of the following characters: _+=,.\@-
    UntagRole -> Text
roleName :: Prelude.Text,
    -- | A list of key names as a simple array of strings. The tags with matching
    -- keys are removed from the specified role.
    UntagRole -> [Text]
tagKeys :: [Prelude.Text]
  }
  deriving (UntagRole -> UntagRole -> Bool
(UntagRole -> UntagRole -> Bool)
-> (UntagRole -> UntagRole -> Bool) -> Eq UntagRole
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UntagRole -> UntagRole -> Bool
$c/= :: UntagRole -> UntagRole -> Bool
== :: UntagRole -> UntagRole -> Bool
$c== :: UntagRole -> UntagRole -> Bool
Prelude.Eq, ReadPrec [UntagRole]
ReadPrec UntagRole
Int -> ReadS UntagRole
ReadS [UntagRole]
(Int -> ReadS UntagRole)
-> ReadS [UntagRole]
-> ReadPrec UntagRole
-> ReadPrec [UntagRole]
-> Read UntagRole
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UntagRole]
$creadListPrec :: ReadPrec [UntagRole]
readPrec :: ReadPrec UntagRole
$creadPrec :: ReadPrec UntagRole
readList :: ReadS [UntagRole]
$creadList :: ReadS [UntagRole]
readsPrec :: Int -> ReadS UntagRole
$creadsPrec :: Int -> ReadS UntagRole
Prelude.Read, Int -> UntagRole -> ShowS
[UntagRole] -> ShowS
UntagRole -> String
(Int -> UntagRole -> ShowS)
-> (UntagRole -> String)
-> ([UntagRole] -> ShowS)
-> Show UntagRole
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UntagRole] -> ShowS
$cshowList :: [UntagRole] -> ShowS
show :: UntagRole -> String
$cshow :: UntagRole -> String
showsPrec :: Int -> UntagRole -> ShowS
$cshowsPrec :: Int -> UntagRole -> ShowS
Prelude.Show, (forall x. UntagRole -> Rep UntagRole x)
-> (forall x. Rep UntagRole x -> UntagRole) -> Generic UntagRole
forall x. Rep UntagRole x -> UntagRole
forall x. UntagRole -> Rep UntagRole x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UntagRole x -> UntagRole
$cfrom :: forall x. UntagRole -> Rep UntagRole x
Prelude.Generic)

-- |
-- Create a value of 'UntagRole' 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:
--
-- 'roleName', 'untagRole_roleName' - The name of the IAM role from which you want to remove tags.
--
-- This parameter accepts (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- that consist of upper and lowercase alphanumeric characters with no
-- spaces. You can also include any of the following characters: _+=,.\@-
--
-- 'tagKeys', 'untagRole_tagKeys' - A list of key names as a simple array of strings. The tags with matching
-- keys are removed from the specified role.
newUntagRole ::
  -- | 'roleName'
  Prelude.Text ->
  UntagRole
newUntagRole :: Text -> UntagRole
newUntagRole Text
pRoleName_ =
  UntagRole' :: Text -> [Text] -> UntagRole
UntagRole'
    { $sel:roleName:UntagRole' :: Text
roleName = Text
pRoleName_,
      $sel:tagKeys:UntagRole' :: [Text]
tagKeys = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The name of the IAM role from which you want to remove tags.
--
-- This parameter accepts (through its
-- <http://wikipedia.org/wiki/regex regex pattern>) a string of characters
-- that consist of upper and lowercase alphanumeric characters with no
-- spaces. You can also include any of the following characters: _+=,.\@-
untagRole_roleName :: Lens.Lens' UntagRole Prelude.Text
untagRole_roleName :: (Text -> f Text) -> UntagRole -> f UntagRole
untagRole_roleName = (UntagRole -> Text)
-> (UntagRole -> Text -> UntagRole)
-> Lens UntagRole UntagRole Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagRole' {Text
roleName :: Text
$sel:roleName:UntagRole' :: UntagRole -> Text
roleName} -> Text
roleName) (\s :: UntagRole
s@UntagRole' {} Text
a -> UntagRole
s {$sel:roleName:UntagRole' :: Text
roleName = Text
a} :: UntagRole)

-- | A list of key names as a simple array of strings. The tags with matching
-- keys are removed from the specified role.
untagRole_tagKeys :: Lens.Lens' UntagRole [Prelude.Text]
untagRole_tagKeys :: ([Text] -> f [Text]) -> UntagRole -> f UntagRole
untagRole_tagKeys = (UntagRole -> [Text])
-> (UntagRole -> [Text] -> UntagRole)
-> Lens UntagRole UntagRole [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagRole' {[Text]
tagKeys :: [Text]
$sel:tagKeys:UntagRole' :: UntagRole -> [Text]
tagKeys} -> [Text]
tagKeys) (\s :: UntagRole
s@UntagRole' {} [Text]
a -> UntagRole
s {$sel:tagKeys:UntagRole' :: [Text]
tagKeys = [Text]
a} :: UntagRole) (([Text] -> f [Text]) -> UntagRole -> f UntagRole)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> UntagRole
-> f UntagRole
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 UntagRole where
  type AWSResponse UntagRole = UntagRoleResponse
  request :: UntagRole -> Request UntagRole
request = Service -> UntagRole -> Request UntagRole
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy UntagRole
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UntagRole)))
response = AWSResponse UntagRole
-> Logger
-> Service
-> Proxy UntagRole
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UntagRole)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse UntagRole
UntagRoleResponse
UntagRoleResponse'

instance Prelude.Hashable UntagRole

instance Prelude.NFData UntagRole

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

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

instance Core.ToQuery UntagRole where
  toQuery :: UntagRole -> QueryString
toQuery UntagRole' {[Text]
Text
tagKeys :: [Text]
roleName :: Text
$sel:tagKeys:UntagRole' :: UntagRole -> [Text]
$sel:roleName:UntagRole' :: UntagRole -> 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
"UntagRole" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-08" :: Prelude.ByteString),
        ByteString
"RoleName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
roleName,
        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:/ 'newUntagRoleResponse' smart constructor.
data UntagRoleResponse = UntagRoleResponse'
  {
  }
  deriving (UntagRoleResponse -> UntagRoleResponse -> Bool
(UntagRoleResponse -> UntagRoleResponse -> Bool)
-> (UntagRoleResponse -> UntagRoleResponse -> Bool)
-> Eq UntagRoleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UntagRoleResponse -> UntagRoleResponse -> Bool
$c/= :: UntagRoleResponse -> UntagRoleResponse -> Bool
== :: UntagRoleResponse -> UntagRoleResponse -> Bool
$c== :: UntagRoleResponse -> UntagRoleResponse -> Bool
Prelude.Eq, ReadPrec [UntagRoleResponse]
ReadPrec UntagRoleResponse
Int -> ReadS UntagRoleResponse
ReadS [UntagRoleResponse]
(Int -> ReadS UntagRoleResponse)
-> ReadS [UntagRoleResponse]
-> ReadPrec UntagRoleResponse
-> ReadPrec [UntagRoleResponse]
-> Read UntagRoleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UntagRoleResponse]
$creadListPrec :: ReadPrec [UntagRoleResponse]
readPrec :: ReadPrec UntagRoleResponse
$creadPrec :: ReadPrec UntagRoleResponse
readList :: ReadS [UntagRoleResponse]
$creadList :: ReadS [UntagRoleResponse]
readsPrec :: Int -> ReadS UntagRoleResponse
$creadsPrec :: Int -> ReadS UntagRoleResponse
Prelude.Read, Int -> UntagRoleResponse -> ShowS
[UntagRoleResponse] -> ShowS
UntagRoleResponse -> String
(Int -> UntagRoleResponse -> ShowS)
-> (UntagRoleResponse -> String)
-> ([UntagRoleResponse] -> ShowS)
-> Show UntagRoleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UntagRoleResponse] -> ShowS
$cshowList :: [UntagRoleResponse] -> ShowS
show :: UntagRoleResponse -> String
$cshow :: UntagRoleResponse -> String
showsPrec :: Int -> UntagRoleResponse -> ShowS
$cshowsPrec :: Int -> UntagRoleResponse -> ShowS
Prelude.Show, (forall x. UntagRoleResponse -> Rep UntagRoleResponse x)
-> (forall x. Rep UntagRoleResponse x -> UntagRoleResponse)
-> Generic UntagRoleResponse
forall x. Rep UntagRoleResponse x -> UntagRoleResponse
forall x. UntagRoleResponse -> Rep UntagRoleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UntagRoleResponse x -> UntagRoleResponse
$cfrom :: forall x. UntagRoleResponse -> Rep UntagRoleResponse x
Prelude.Generic)

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

instance Prelude.NFData UntagRoleResponse