{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.DBClusterRole
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Neptune.Types.DBClusterRole where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Describes an Amazon Identity and Access Management (IAM) role that is
-- associated with a DB cluster.
--
-- /See:/ 'newDBClusterRole' smart constructor.
data DBClusterRole = DBClusterRole'
  { -- | The name of the feature associated with the Amazon Identity and Access
    -- Management (IAM) role. For the list of supported feature names, see
    -- <https://docs.aws.amazon.com/neptune/latest/userguide/api-other-apis.html#DescribeDBEngineVersions DescribeDBEngineVersions>.
    DBClusterRole -> Maybe Text
featureName :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the IAM role that is associated with
    -- the DB cluster.
    DBClusterRole -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
    -- | Describes the state of association between the IAM role and the DB
    -- cluster. The Status property returns one of the following values:
    --
    -- -   @ACTIVE@ - the IAM role ARN is associated with the DB cluster and
    --     can be used to access other Amazon services on your behalf.
    --
    -- -   @PENDING@ - the IAM role ARN is being associated with the DB
    --     cluster.
    --
    -- -   @INVALID@ - the IAM role ARN is associated with the DB cluster, but
    --     the DB cluster is unable to assume the IAM role in order to access
    --     other Amazon services on your behalf.
    DBClusterRole -> Maybe Text
status :: Prelude.Maybe Prelude.Text
  }
  deriving (DBClusterRole -> DBClusterRole -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DBClusterRole -> DBClusterRole -> Bool
$c/= :: DBClusterRole -> DBClusterRole -> Bool
== :: DBClusterRole -> DBClusterRole -> Bool
$c== :: DBClusterRole -> DBClusterRole -> Bool
Prelude.Eq, ReadPrec [DBClusterRole]
ReadPrec DBClusterRole
Int -> ReadS DBClusterRole
ReadS [DBClusterRole]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DBClusterRole]
$creadListPrec :: ReadPrec [DBClusterRole]
readPrec :: ReadPrec DBClusterRole
$creadPrec :: ReadPrec DBClusterRole
readList :: ReadS [DBClusterRole]
$creadList :: ReadS [DBClusterRole]
readsPrec :: Int -> ReadS DBClusterRole
$creadsPrec :: Int -> ReadS DBClusterRole
Prelude.Read, Int -> DBClusterRole -> ShowS
[DBClusterRole] -> ShowS
DBClusterRole -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DBClusterRole] -> ShowS
$cshowList :: [DBClusterRole] -> ShowS
show :: DBClusterRole -> String
$cshow :: DBClusterRole -> String
showsPrec :: Int -> DBClusterRole -> ShowS
$cshowsPrec :: Int -> DBClusterRole -> ShowS
Prelude.Show, forall x. Rep DBClusterRole x -> DBClusterRole
forall x. DBClusterRole -> Rep DBClusterRole x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DBClusterRole x -> DBClusterRole
$cfrom :: forall x. DBClusterRole -> Rep DBClusterRole x
Prelude.Generic)

-- |
-- Create a value of 'DBClusterRole' 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', 'dbClusterRole_featureName' - The name of the feature associated with the Amazon Identity and Access
-- Management (IAM) role. For the list of supported feature names, see
-- <https://docs.aws.amazon.com/neptune/latest/userguide/api-other-apis.html#DescribeDBEngineVersions DescribeDBEngineVersions>.
--
-- 'roleArn', 'dbClusterRole_roleArn' - The Amazon Resource Name (ARN) of the IAM role that is associated with
-- the DB cluster.
--
-- 'status', 'dbClusterRole_status' - Describes the state of association between the IAM role and the DB
-- cluster. The Status property returns one of the following values:
--
-- -   @ACTIVE@ - the IAM role ARN is associated with the DB cluster and
--     can be used to access other Amazon services on your behalf.
--
-- -   @PENDING@ - the IAM role ARN is being associated with the DB
--     cluster.
--
-- -   @INVALID@ - the IAM role ARN is associated with the DB cluster, but
--     the DB cluster is unable to assume the IAM role in order to access
--     other Amazon services on your behalf.
newDBClusterRole ::
  DBClusterRole
newDBClusterRole :: DBClusterRole
newDBClusterRole =
  DBClusterRole'
    { $sel:featureName:DBClusterRole' :: Maybe Text
featureName = forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:DBClusterRole' :: Maybe Text
roleArn = forall a. Maybe a
Prelude.Nothing,
      $sel:status:DBClusterRole' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the feature associated with the Amazon Identity and Access
-- Management (IAM) role. For the list of supported feature names, see
-- <https://docs.aws.amazon.com/neptune/latest/userguide/api-other-apis.html#DescribeDBEngineVersions DescribeDBEngineVersions>.
dbClusterRole_featureName :: Lens.Lens' DBClusterRole (Prelude.Maybe Prelude.Text)
dbClusterRole_featureName :: Lens' DBClusterRole (Maybe Text)
dbClusterRole_featureName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBClusterRole' {Maybe Text
featureName :: Maybe Text
$sel:featureName:DBClusterRole' :: DBClusterRole -> Maybe Text
featureName} -> Maybe Text
featureName) (\s :: DBClusterRole
s@DBClusterRole' {} Maybe Text
a -> DBClusterRole
s {$sel:featureName:DBClusterRole' :: Maybe Text
featureName = Maybe Text
a} :: DBClusterRole)

-- | The Amazon Resource Name (ARN) of the IAM role that is associated with
-- the DB cluster.
dbClusterRole_roleArn :: Lens.Lens' DBClusterRole (Prelude.Maybe Prelude.Text)
dbClusterRole_roleArn :: Lens' DBClusterRole (Maybe Text)
dbClusterRole_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBClusterRole' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:DBClusterRole' :: DBClusterRole -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: DBClusterRole
s@DBClusterRole' {} Maybe Text
a -> DBClusterRole
s {$sel:roleArn:DBClusterRole' :: Maybe Text
roleArn = Maybe Text
a} :: DBClusterRole)

-- | Describes the state of association between the IAM role and the DB
-- cluster. The Status property returns one of the following values:
--
-- -   @ACTIVE@ - the IAM role ARN is associated with the DB cluster and
--     can be used to access other Amazon services on your behalf.
--
-- -   @PENDING@ - the IAM role ARN is being associated with the DB
--     cluster.
--
-- -   @INVALID@ - the IAM role ARN is associated with the DB cluster, but
--     the DB cluster is unable to assume the IAM role in order to access
--     other Amazon services on your behalf.
dbClusterRole_status :: Lens.Lens' DBClusterRole (Prelude.Maybe Prelude.Text)
dbClusterRole_status :: Lens' DBClusterRole (Maybe Text)
dbClusterRole_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DBClusterRole' {Maybe Text
status :: Maybe Text
$sel:status:DBClusterRole' :: DBClusterRole -> Maybe Text
status} -> Maybe Text
status) (\s :: DBClusterRole
s@DBClusterRole' {} Maybe Text
a -> DBClusterRole
s {$sel:status:DBClusterRole' :: Maybe Text
status = Maybe Text
a} :: DBClusterRole)

instance Data.FromXML DBClusterRole where
  parseXML :: [Node] -> Either String DBClusterRole
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> Maybe Text -> DBClusterRole
DBClusterRole'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"FeatureName")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"RoleArn")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Status")

instance Prelude.Hashable DBClusterRole where
  hashWithSalt :: Int -> DBClusterRole -> Int
hashWithSalt Int
_salt DBClusterRole' {Maybe Text
status :: Maybe Text
roleArn :: Maybe Text
featureName :: Maybe Text
$sel:status:DBClusterRole' :: DBClusterRole -> Maybe Text
$sel:roleArn:DBClusterRole' :: DBClusterRole -> Maybe Text
$sel:featureName:DBClusterRole' :: DBClusterRole -> 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` Maybe Text
roleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status

instance Prelude.NFData DBClusterRole where
  rnf :: DBClusterRole -> ()
rnf DBClusterRole' {Maybe Text
status :: Maybe Text
roleArn :: Maybe Text
featureName :: Maybe Text
$sel:status:DBClusterRole' :: DBClusterRole -> Maybe Text
$sel:roleArn:DBClusterRole' :: DBClusterRole -> Maybe Text
$sel:featureName:DBClusterRole' :: DBClusterRole -> 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 Maybe Text
roleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
status