{-# 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.UntagInstanceProfile
-- 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 instance profile. 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.UntagInstanceProfile
  ( -- * Creating a Request
    UntagInstanceProfile (..),
    newUntagInstanceProfile,

    -- * Request Lenses
    untagInstanceProfile_instanceProfileName,
    untagInstanceProfile_tagKeys,

    -- * Destructuring the Response
    UntagInstanceProfileResponse (..),
    newUntagInstanceProfileResponse,
  )
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:/ 'newUntagInstanceProfile' smart constructor.
data UntagInstanceProfile = UntagInstanceProfile'
  { -- | The name of the IAM instance profile from which you want to remove tags.
    --
    -- 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: _+=,.\@-
    UntagInstanceProfile -> Text
instanceProfileName :: 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.
    UntagInstanceProfile -> [Text]
tagKeys :: [Prelude.Text]
  }
  deriving (UntagInstanceProfile -> UntagInstanceProfile -> Bool
(UntagInstanceProfile -> UntagInstanceProfile -> Bool)
-> (UntagInstanceProfile -> UntagInstanceProfile -> Bool)
-> Eq UntagInstanceProfile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UntagInstanceProfile -> UntagInstanceProfile -> Bool
$c/= :: UntagInstanceProfile -> UntagInstanceProfile -> Bool
== :: UntagInstanceProfile -> UntagInstanceProfile -> Bool
$c== :: UntagInstanceProfile -> UntagInstanceProfile -> Bool
Prelude.Eq, ReadPrec [UntagInstanceProfile]
ReadPrec UntagInstanceProfile
Int -> ReadS UntagInstanceProfile
ReadS [UntagInstanceProfile]
(Int -> ReadS UntagInstanceProfile)
-> ReadS [UntagInstanceProfile]
-> ReadPrec UntagInstanceProfile
-> ReadPrec [UntagInstanceProfile]
-> Read UntagInstanceProfile
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UntagInstanceProfile]
$creadListPrec :: ReadPrec [UntagInstanceProfile]
readPrec :: ReadPrec UntagInstanceProfile
$creadPrec :: ReadPrec UntagInstanceProfile
readList :: ReadS [UntagInstanceProfile]
$creadList :: ReadS [UntagInstanceProfile]
readsPrec :: Int -> ReadS UntagInstanceProfile
$creadsPrec :: Int -> ReadS UntagInstanceProfile
Prelude.Read, Int -> UntagInstanceProfile -> ShowS
[UntagInstanceProfile] -> ShowS
UntagInstanceProfile -> String
(Int -> UntagInstanceProfile -> ShowS)
-> (UntagInstanceProfile -> String)
-> ([UntagInstanceProfile] -> ShowS)
-> Show UntagInstanceProfile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UntagInstanceProfile] -> ShowS
$cshowList :: [UntagInstanceProfile] -> ShowS
show :: UntagInstanceProfile -> String
$cshow :: UntagInstanceProfile -> String
showsPrec :: Int -> UntagInstanceProfile -> ShowS
$cshowsPrec :: Int -> UntagInstanceProfile -> ShowS
Prelude.Show, (forall x. UntagInstanceProfile -> Rep UntagInstanceProfile x)
-> (forall x. Rep UntagInstanceProfile x -> UntagInstanceProfile)
-> Generic UntagInstanceProfile
forall x. Rep UntagInstanceProfile x -> UntagInstanceProfile
forall x. UntagInstanceProfile -> Rep UntagInstanceProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UntagInstanceProfile x -> UntagInstanceProfile
$cfrom :: forall x. UntagInstanceProfile -> Rep UntagInstanceProfile x
Prelude.Generic)

-- |
-- Create a value of 'UntagInstanceProfile' 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:
--
-- 'instanceProfileName', 'untagInstanceProfile_instanceProfileName' - The name of the IAM instance profile from which you want to remove tags.
--
-- 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', 'untagInstanceProfile_tagKeys' - A list of key names as a simple array of strings. The tags with matching
-- keys are removed from the specified instance profile.
newUntagInstanceProfile ::
  -- | 'instanceProfileName'
  Prelude.Text ->
  UntagInstanceProfile
newUntagInstanceProfile :: Text -> UntagInstanceProfile
newUntagInstanceProfile Text
pInstanceProfileName_ =
  UntagInstanceProfile' :: Text -> [Text] -> UntagInstanceProfile
UntagInstanceProfile'
    { $sel:instanceProfileName:UntagInstanceProfile' :: Text
instanceProfileName =
        Text
pInstanceProfileName_,
      $sel:tagKeys:UntagInstanceProfile' :: [Text]
tagKeys = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The name of the IAM instance profile from which you want to remove tags.
--
-- 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: _+=,.\@-
untagInstanceProfile_instanceProfileName :: Lens.Lens' UntagInstanceProfile Prelude.Text
untagInstanceProfile_instanceProfileName :: (Text -> f Text) -> UntagInstanceProfile -> f UntagInstanceProfile
untagInstanceProfile_instanceProfileName = (UntagInstanceProfile -> Text)
-> (UntagInstanceProfile -> Text -> UntagInstanceProfile)
-> Lens UntagInstanceProfile UntagInstanceProfile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UntagInstanceProfile' {Text
instanceProfileName :: Text
$sel:instanceProfileName:UntagInstanceProfile' :: UntagInstanceProfile -> Text
instanceProfileName} -> Text
instanceProfileName) (\s :: UntagInstanceProfile
s@UntagInstanceProfile' {} Text
a -> UntagInstanceProfile
s {$sel:instanceProfileName:UntagInstanceProfile' :: Text
instanceProfileName = Text
a} :: UntagInstanceProfile)

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

instance Prelude.Hashable UntagInstanceProfile

instance Prelude.NFData UntagInstanceProfile

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

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

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

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

instance Prelude.NFData UntagInstanceProfileResponse