{-# 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.RDS.RemoveRoleFromDBInstance
-- 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)
--
-- Disassociates an Amazon Web Services Identity and Access Management
-- (IAM) role from a DB instance.
module Amazonka.RDS.RemoveRoleFromDBInstance
  ( -- * Creating a Request
    RemoveRoleFromDBInstance (..),
    newRemoveRoleFromDBInstance,

    -- * Request Lenses
    removeRoleFromDBInstance_dbInstanceIdentifier,
    removeRoleFromDBInstance_roleArn,
    removeRoleFromDBInstance_featureName,

    -- * Destructuring the Response
    RemoveRoleFromDBInstanceResponse (..),
    newRemoveRoleFromDBInstanceResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.RDS.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newRemoveRoleFromDBInstance' smart constructor.
data RemoveRoleFromDBInstance = RemoveRoleFromDBInstance'
  { -- | The name of the DB instance to disassociate the IAM role from.
    RemoveRoleFromDBInstance -> Text
dbInstanceIdentifier :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the IAM role to disassociate from the
    -- DB instance, for example, @arn:aws:iam::123456789012:role\/AccessRole@.
    RemoveRoleFromDBInstance -> Text
roleArn :: Prelude.Text,
    -- | The name of the feature for the DB instance that the IAM role is to be
    -- disassociated from. For the list of supported feature names, see
    -- @DBEngineVersion@.
    RemoveRoleFromDBInstance -> Text
featureName :: Prelude.Text
  }
  deriving (RemoveRoleFromDBInstance -> RemoveRoleFromDBInstance -> Bool
(RemoveRoleFromDBInstance -> RemoveRoleFromDBInstance -> Bool)
-> (RemoveRoleFromDBInstance -> RemoveRoleFromDBInstance -> Bool)
-> Eq RemoveRoleFromDBInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RemoveRoleFromDBInstance -> RemoveRoleFromDBInstance -> Bool
$c/= :: RemoveRoleFromDBInstance -> RemoveRoleFromDBInstance -> Bool
== :: RemoveRoleFromDBInstance -> RemoveRoleFromDBInstance -> Bool
$c== :: RemoveRoleFromDBInstance -> RemoveRoleFromDBInstance -> Bool
Prelude.Eq, ReadPrec [RemoveRoleFromDBInstance]
ReadPrec RemoveRoleFromDBInstance
Int -> ReadS RemoveRoleFromDBInstance
ReadS [RemoveRoleFromDBInstance]
(Int -> ReadS RemoveRoleFromDBInstance)
-> ReadS [RemoveRoleFromDBInstance]
-> ReadPrec RemoveRoleFromDBInstance
-> ReadPrec [RemoveRoleFromDBInstance]
-> Read RemoveRoleFromDBInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RemoveRoleFromDBInstance]
$creadListPrec :: ReadPrec [RemoveRoleFromDBInstance]
readPrec :: ReadPrec RemoveRoleFromDBInstance
$creadPrec :: ReadPrec RemoveRoleFromDBInstance
readList :: ReadS [RemoveRoleFromDBInstance]
$creadList :: ReadS [RemoveRoleFromDBInstance]
readsPrec :: Int -> ReadS RemoveRoleFromDBInstance
$creadsPrec :: Int -> ReadS RemoveRoleFromDBInstance
Prelude.Read, Int -> RemoveRoleFromDBInstance -> ShowS
[RemoveRoleFromDBInstance] -> ShowS
RemoveRoleFromDBInstance -> String
(Int -> RemoveRoleFromDBInstance -> ShowS)
-> (RemoveRoleFromDBInstance -> String)
-> ([RemoveRoleFromDBInstance] -> ShowS)
-> Show RemoveRoleFromDBInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RemoveRoleFromDBInstance] -> ShowS
$cshowList :: [RemoveRoleFromDBInstance] -> ShowS
show :: RemoveRoleFromDBInstance -> String
$cshow :: RemoveRoleFromDBInstance -> String
showsPrec :: Int -> RemoveRoleFromDBInstance -> ShowS
$cshowsPrec :: Int -> RemoveRoleFromDBInstance -> ShowS
Prelude.Show, (forall x.
 RemoveRoleFromDBInstance -> Rep RemoveRoleFromDBInstance x)
-> (forall x.
    Rep RemoveRoleFromDBInstance x -> RemoveRoleFromDBInstance)
-> Generic RemoveRoleFromDBInstance
forall x.
Rep RemoveRoleFromDBInstance x -> RemoveRoleFromDBInstance
forall x.
RemoveRoleFromDBInstance -> Rep RemoveRoleFromDBInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RemoveRoleFromDBInstance x -> RemoveRoleFromDBInstance
$cfrom :: forall x.
RemoveRoleFromDBInstance -> Rep RemoveRoleFromDBInstance x
Prelude.Generic)

-- |
-- Create a value of 'RemoveRoleFromDBInstance' 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:
--
-- 'dbInstanceIdentifier', 'removeRoleFromDBInstance_dbInstanceIdentifier' - The name of the DB instance to disassociate the IAM role from.
--
-- 'roleArn', 'removeRoleFromDBInstance_roleArn' - The Amazon Resource Name (ARN) of the IAM role to disassociate from the
-- DB instance, for example, @arn:aws:iam::123456789012:role\/AccessRole@.
--
-- 'featureName', 'removeRoleFromDBInstance_featureName' - The name of the feature for the DB instance that the IAM role is to be
-- disassociated from. For the list of supported feature names, see
-- @DBEngineVersion@.
newRemoveRoleFromDBInstance ::
  -- | 'dbInstanceIdentifier'
  Prelude.Text ->
  -- | 'roleArn'
  Prelude.Text ->
  -- | 'featureName'
  Prelude.Text ->
  RemoveRoleFromDBInstance
newRemoveRoleFromDBInstance :: Text -> Text -> Text -> RemoveRoleFromDBInstance
newRemoveRoleFromDBInstance
  Text
pDBInstanceIdentifier_
  Text
pRoleArn_
  Text
pFeatureName_ =
    RemoveRoleFromDBInstance' :: Text -> Text -> Text -> RemoveRoleFromDBInstance
RemoveRoleFromDBInstance'
      { $sel:dbInstanceIdentifier:RemoveRoleFromDBInstance' :: Text
dbInstanceIdentifier =
          Text
pDBInstanceIdentifier_,
        $sel:roleArn:RemoveRoleFromDBInstance' :: Text
roleArn = Text
pRoleArn_,
        $sel:featureName:RemoveRoleFromDBInstance' :: Text
featureName = Text
pFeatureName_
      }

-- | The name of the DB instance to disassociate the IAM role from.
removeRoleFromDBInstance_dbInstanceIdentifier :: Lens.Lens' RemoveRoleFromDBInstance Prelude.Text
removeRoleFromDBInstance_dbInstanceIdentifier :: (Text -> f Text)
-> RemoveRoleFromDBInstance -> f RemoveRoleFromDBInstance
removeRoleFromDBInstance_dbInstanceIdentifier = (RemoveRoleFromDBInstance -> Text)
-> (RemoveRoleFromDBInstance -> Text -> RemoveRoleFromDBInstance)
-> Lens RemoveRoleFromDBInstance RemoveRoleFromDBInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveRoleFromDBInstance' {Text
dbInstanceIdentifier :: Text
$sel:dbInstanceIdentifier:RemoveRoleFromDBInstance' :: RemoveRoleFromDBInstance -> Text
dbInstanceIdentifier} -> Text
dbInstanceIdentifier) (\s :: RemoveRoleFromDBInstance
s@RemoveRoleFromDBInstance' {} Text
a -> RemoveRoleFromDBInstance
s {$sel:dbInstanceIdentifier:RemoveRoleFromDBInstance' :: Text
dbInstanceIdentifier = Text
a} :: RemoveRoleFromDBInstance)

-- | The Amazon Resource Name (ARN) of the IAM role to disassociate from the
-- DB instance, for example, @arn:aws:iam::123456789012:role\/AccessRole@.
removeRoleFromDBInstance_roleArn :: Lens.Lens' RemoveRoleFromDBInstance Prelude.Text
removeRoleFromDBInstance_roleArn :: (Text -> f Text)
-> RemoveRoleFromDBInstance -> f RemoveRoleFromDBInstance
removeRoleFromDBInstance_roleArn = (RemoveRoleFromDBInstance -> Text)
-> (RemoveRoleFromDBInstance -> Text -> RemoveRoleFromDBInstance)
-> Lens RemoveRoleFromDBInstance RemoveRoleFromDBInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveRoleFromDBInstance' {Text
roleArn :: Text
$sel:roleArn:RemoveRoleFromDBInstance' :: RemoveRoleFromDBInstance -> Text
roleArn} -> Text
roleArn) (\s :: RemoveRoleFromDBInstance
s@RemoveRoleFromDBInstance' {} Text
a -> RemoveRoleFromDBInstance
s {$sel:roleArn:RemoveRoleFromDBInstance' :: Text
roleArn = Text
a} :: RemoveRoleFromDBInstance)

-- | The name of the feature for the DB instance that the IAM role is to be
-- disassociated from. For the list of supported feature names, see
-- @DBEngineVersion@.
removeRoleFromDBInstance_featureName :: Lens.Lens' RemoveRoleFromDBInstance Prelude.Text
removeRoleFromDBInstance_featureName :: (Text -> f Text)
-> RemoveRoleFromDBInstance -> f RemoveRoleFromDBInstance
removeRoleFromDBInstance_featureName = (RemoveRoleFromDBInstance -> Text)
-> (RemoveRoleFromDBInstance -> Text -> RemoveRoleFromDBInstance)
-> Lens RemoveRoleFromDBInstance RemoveRoleFromDBInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RemoveRoleFromDBInstance' {Text
featureName :: Text
$sel:featureName:RemoveRoleFromDBInstance' :: RemoveRoleFromDBInstance -> Text
featureName} -> Text
featureName) (\s :: RemoveRoleFromDBInstance
s@RemoveRoleFromDBInstance' {} Text
a -> RemoveRoleFromDBInstance
s {$sel:featureName:RemoveRoleFromDBInstance' :: Text
featureName = Text
a} :: RemoveRoleFromDBInstance)

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

instance Prelude.Hashable RemoveRoleFromDBInstance

instance Prelude.NFData RemoveRoleFromDBInstance

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

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

instance Core.ToQuery RemoveRoleFromDBInstance where
  toQuery :: RemoveRoleFromDBInstance -> QueryString
toQuery RemoveRoleFromDBInstance' {Text
featureName :: Text
roleArn :: Text
dbInstanceIdentifier :: Text
$sel:featureName:RemoveRoleFromDBInstance' :: RemoveRoleFromDBInstance -> Text
$sel:roleArn:RemoveRoleFromDBInstance' :: RemoveRoleFromDBInstance -> Text
$sel:dbInstanceIdentifier:RemoveRoleFromDBInstance' :: RemoveRoleFromDBInstance -> 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
"RemoveRoleFromDBInstance" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"DBInstanceIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbInstanceIdentifier,
        ByteString
"RoleArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
roleArn,
        ByteString
"FeatureName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
featureName
      ]

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

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

instance
  Prelude.NFData
    RemoveRoleFromDBInstanceResponse