{-# 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.Neptune.AddRoleToDBCluster
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Associates an Identity and Access Management (IAM) role with an Neptune
-- DB cluster.
module Amazonka.Neptune.AddRoleToDBCluster
  ( -- * Creating a Request
    AddRoleToDBCluster (..),
    newAddRoleToDBCluster,

    -- * Request Lenses
    addRoleToDBCluster_featureName,
    addRoleToDBCluster_dbClusterIdentifier,
    addRoleToDBCluster_roleArn,

    -- * Destructuring the Response
    AddRoleToDBClusterResponse (..),
    newAddRoleToDBClusterResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Neptune.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newAddRoleToDBCluster' smart constructor.
data AddRoleToDBCluster = AddRoleToDBCluster'
  { -- | The name of the feature for the Neptune DB cluster that the IAM role is
    -- to be associated with. For the list of supported feature names, see
    -- <neptune/latest/userguide/api-other-apis.html#DBEngineVersion DBEngineVersion>.
    AddRoleToDBCluster -> Maybe Text
featureName :: Prelude.Maybe Prelude.Text,
    -- | The name of the DB cluster to associate the IAM role with.
    AddRoleToDBCluster -> Text
dbClusterIdentifier :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the IAM role to associate with the
    -- Neptune DB cluster, for example
    -- @arn:aws:iam::123456789012:role\/NeptuneAccessRole@.
    AddRoleToDBCluster -> Text
roleArn :: Prelude.Text
  }
  deriving (AddRoleToDBCluster -> AddRoleToDBCluster -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddRoleToDBCluster -> AddRoleToDBCluster -> Bool
$c/= :: AddRoleToDBCluster -> AddRoleToDBCluster -> Bool
== :: AddRoleToDBCluster -> AddRoleToDBCluster -> Bool
$c== :: AddRoleToDBCluster -> AddRoleToDBCluster -> Bool
Prelude.Eq, ReadPrec [AddRoleToDBCluster]
ReadPrec AddRoleToDBCluster
Int -> ReadS AddRoleToDBCluster
ReadS [AddRoleToDBCluster]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddRoleToDBCluster]
$creadListPrec :: ReadPrec [AddRoleToDBCluster]
readPrec :: ReadPrec AddRoleToDBCluster
$creadPrec :: ReadPrec AddRoleToDBCluster
readList :: ReadS [AddRoleToDBCluster]
$creadList :: ReadS [AddRoleToDBCluster]
readsPrec :: Int -> ReadS AddRoleToDBCluster
$creadsPrec :: Int -> ReadS AddRoleToDBCluster
Prelude.Read, Int -> AddRoleToDBCluster -> ShowS
[AddRoleToDBCluster] -> ShowS
AddRoleToDBCluster -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddRoleToDBCluster] -> ShowS
$cshowList :: [AddRoleToDBCluster] -> ShowS
show :: AddRoleToDBCluster -> String
$cshow :: AddRoleToDBCluster -> String
showsPrec :: Int -> AddRoleToDBCluster -> ShowS
$cshowsPrec :: Int -> AddRoleToDBCluster -> ShowS
Prelude.Show, forall x. Rep AddRoleToDBCluster x -> AddRoleToDBCluster
forall x. AddRoleToDBCluster -> Rep AddRoleToDBCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddRoleToDBCluster x -> AddRoleToDBCluster
$cfrom :: forall x. AddRoleToDBCluster -> Rep AddRoleToDBCluster x
Prelude.Generic)

-- |
-- Create a value of 'AddRoleToDBCluster' 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:
--
-- 'featureName', 'addRoleToDBCluster_featureName' - The name of the feature for the Neptune DB cluster that the IAM role is
-- to be associated with. For the list of supported feature names, see
-- <neptune/latest/userguide/api-other-apis.html#DBEngineVersion DBEngineVersion>.
--
-- 'dbClusterIdentifier', 'addRoleToDBCluster_dbClusterIdentifier' - The name of the DB cluster to associate the IAM role with.
--
-- 'roleArn', 'addRoleToDBCluster_roleArn' - The Amazon Resource Name (ARN) of the IAM role to associate with the
-- Neptune DB cluster, for example
-- @arn:aws:iam::123456789012:role\/NeptuneAccessRole@.
newAddRoleToDBCluster ::
  -- | 'dbClusterIdentifier'
  Prelude.Text ->
  -- | 'roleArn'
  Prelude.Text ->
  AddRoleToDBCluster
newAddRoleToDBCluster :: Text -> Text -> AddRoleToDBCluster
newAddRoleToDBCluster Text
pDBClusterIdentifier_ Text
pRoleArn_ =
  AddRoleToDBCluster'
    { $sel:featureName:AddRoleToDBCluster' :: Maybe Text
featureName = forall a. Maybe a
Prelude.Nothing,
      $sel:dbClusterIdentifier:AddRoleToDBCluster' :: Text
dbClusterIdentifier = Text
pDBClusterIdentifier_,
      $sel:roleArn:AddRoleToDBCluster' :: Text
roleArn = Text
pRoleArn_
    }

-- | The name of the feature for the Neptune DB cluster that the IAM role is
-- to be associated with. For the list of supported feature names, see
-- <neptune/latest/userguide/api-other-apis.html#DBEngineVersion DBEngineVersion>.
addRoleToDBCluster_featureName :: Lens.Lens' AddRoleToDBCluster (Prelude.Maybe Prelude.Text)
addRoleToDBCluster_featureName :: Lens' AddRoleToDBCluster (Maybe Text)
addRoleToDBCluster_featureName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddRoleToDBCluster' {Maybe Text
featureName :: Maybe Text
$sel:featureName:AddRoleToDBCluster' :: AddRoleToDBCluster -> Maybe Text
featureName} -> Maybe Text
featureName) (\s :: AddRoleToDBCluster
s@AddRoleToDBCluster' {} Maybe Text
a -> AddRoleToDBCluster
s {$sel:featureName:AddRoleToDBCluster' :: Maybe Text
featureName = Maybe Text
a} :: AddRoleToDBCluster)

-- | The name of the DB cluster to associate the IAM role with.
addRoleToDBCluster_dbClusterIdentifier :: Lens.Lens' AddRoleToDBCluster Prelude.Text
addRoleToDBCluster_dbClusterIdentifier :: Lens' AddRoleToDBCluster Text
addRoleToDBCluster_dbClusterIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddRoleToDBCluster' {Text
dbClusterIdentifier :: Text
$sel:dbClusterIdentifier:AddRoleToDBCluster' :: AddRoleToDBCluster -> Text
dbClusterIdentifier} -> Text
dbClusterIdentifier) (\s :: AddRoleToDBCluster
s@AddRoleToDBCluster' {} Text
a -> AddRoleToDBCluster
s {$sel:dbClusterIdentifier:AddRoleToDBCluster' :: Text
dbClusterIdentifier = Text
a} :: AddRoleToDBCluster)

-- | The Amazon Resource Name (ARN) of the IAM role to associate with the
-- Neptune DB cluster, for example
-- @arn:aws:iam::123456789012:role\/NeptuneAccessRole@.
addRoleToDBCluster_roleArn :: Lens.Lens' AddRoleToDBCluster Prelude.Text
addRoleToDBCluster_roleArn :: Lens' AddRoleToDBCluster Text
addRoleToDBCluster_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddRoleToDBCluster' {Text
roleArn :: Text
$sel:roleArn:AddRoleToDBCluster' :: AddRoleToDBCluster -> Text
roleArn} -> Text
roleArn) (\s :: AddRoleToDBCluster
s@AddRoleToDBCluster' {} Text
a -> AddRoleToDBCluster
s {$sel:roleArn:AddRoleToDBCluster' :: Text
roleArn = Text
a} :: AddRoleToDBCluster)

instance Core.AWSRequest AddRoleToDBCluster where
  type
    AWSResponse AddRoleToDBCluster =
      AddRoleToDBClusterResponse
  request :: (Service -> Service)
-> AddRoleToDBCluster -> Request AddRoleToDBCluster
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 AddRoleToDBCluster
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse AddRoleToDBCluster)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AddRoleToDBClusterResponse
AddRoleToDBClusterResponse'

instance Prelude.Hashable AddRoleToDBCluster where
  hashWithSalt :: Int -> AddRoleToDBCluster -> Int
hashWithSalt Int
_salt AddRoleToDBCluster' {Maybe Text
Text
roleArn :: Text
dbClusterIdentifier :: Text
featureName :: Maybe Text
$sel:roleArn:AddRoleToDBCluster' :: AddRoleToDBCluster -> Text
$sel:dbClusterIdentifier:AddRoleToDBCluster' :: AddRoleToDBCluster -> Text
$sel:featureName:AddRoleToDBCluster' :: AddRoleToDBCluster -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
featureName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
dbClusterIdentifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
roleArn

instance Prelude.NFData AddRoleToDBCluster where
  rnf :: AddRoleToDBCluster -> ()
rnf AddRoleToDBCluster' {Maybe Text
Text
roleArn :: Text
dbClusterIdentifier :: Text
featureName :: Maybe Text
$sel:roleArn:AddRoleToDBCluster' :: AddRoleToDBCluster -> Text
$sel:dbClusterIdentifier:AddRoleToDBCluster' :: AddRoleToDBCluster -> Text
$sel:featureName:AddRoleToDBCluster' :: AddRoleToDBCluster -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
featureName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
dbClusterIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
roleArn

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

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

instance Data.ToQuery AddRoleToDBCluster where
  toQuery :: AddRoleToDBCluster -> QueryString
toQuery AddRoleToDBCluster' {Maybe Text
Text
roleArn :: Text
dbClusterIdentifier :: Text
featureName :: Maybe Text
$sel:roleArn:AddRoleToDBCluster' :: AddRoleToDBCluster -> Text
$sel:dbClusterIdentifier:AddRoleToDBCluster' :: AddRoleToDBCluster -> Text
$sel:featureName:AddRoleToDBCluster' :: AddRoleToDBCluster -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"AddRoleToDBCluster" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"FeatureName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
featureName,
        ByteString
"DBClusterIdentifier" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
dbClusterIdentifier,
        ByteString
"RoleArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
roleArn
      ]

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

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

instance Prelude.NFData AddRoleToDBClusterResponse where
  rnf :: AddRoleToDBClusterResponse -> ()
rnf AddRoleToDBClusterResponse
_ = ()