{-# 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.SecurityHub.Types.AwsRdsDbClusterAssociatedRole
-- 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)
module Amazonka.SecurityHub.Types.AwsRdsDbClusterAssociatedRole where

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

-- | An IAM role that is associated with the Amazon RDS DB cluster.
--
-- /See:/ 'newAwsRdsDbClusterAssociatedRole' smart constructor.
data AwsRdsDbClusterAssociatedRole = AwsRdsDbClusterAssociatedRole'
  { -- | The status of the association between the IAM role and the DB cluster.
    AwsRdsDbClusterAssociatedRole -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the IAM role.
    AwsRdsDbClusterAssociatedRole -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsRdsDbClusterAssociatedRole
-> AwsRdsDbClusterAssociatedRole -> Bool
(AwsRdsDbClusterAssociatedRole
 -> AwsRdsDbClusterAssociatedRole -> Bool)
-> (AwsRdsDbClusterAssociatedRole
    -> AwsRdsDbClusterAssociatedRole -> Bool)
-> Eq AwsRdsDbClusterAssociatedRole
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsRdsDbClusterAssociatedRole
-> AwsRdsDbClusterAssociatedRole -> Bool
$c/= :: AwsRdsDbClusterAssociatedRole
-> AwsRdsDbClusterAssociatedRole -> Bool
== :: AwsRdsDbClusterAssociatedRole
-> AwsRdsDbClusterAssociatedRole -> Bool
$c== :: AwsRdsDbClusterAssociatedRole
-> AwsRdsDbClusterAssociatedRole -> Bool
Prelude.Eq, ReadPrec [AwsRdsDbClusterAssociatedRole]
ReadPrec AwsRdsDbClusterAssociatedRole
Int -> ReadS AwsRdsDbClusterAssociatedRole
ReadS [AwsRdsDbClusterAssociatedRole]
(Int -> ReadS AwsRdsDbClusterAssociatedRole)
-> ReadS [AwsRdsDbClusterAssociatedRole]
-> ReadPrec AwsRdsDbClusterAssociatedRole
-> ReadPrec [AwsRdsDbClusterAssociatedRole]
-> Read AwsRdsDbClusterAssociatedRole
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsRdsDbClusterAssociatedRole]
$creadListPrec :: ReadPrec [AwsRdsDbClusterAssociatedRole]
readPrec :: ReadPrec AwsRdsDbClusterAssociatedRole
$creadPrec :: ReadPrec AwsRdsDbClusterAssociatedRole
readList :: ReadS [AwsRdsDbClusterAssociatedRole]
$creadList :: ReadS [AwsRdsDbClusterAssociatedRole]
readsPrec :: Int -> ReadS AwsRdsDbClusterAssociatedRole
$creadsPrec :: Int -> ReadS AwsRdsDbClusterAssociatedRole
Prelude.Read, Int -> AwsRdsDbClusterAssociatedRole -> ShowS
[AwsRdsDbClusterAssociatedRole] -> ShowS
AwsRdsDbClusterAssociatedRole -> String
(Int -> AwsRdsDbClusterAssociatedRole -> ShowS)
-> (AwsRdsDbClusterAssociatedRole -> String)
-> ([AwsRdsDbClusterAssociatedRole] -> ShowS)
-> Show AwsRdsDbClusterAssociatedRole
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsRdsDbClusterAssociatedRole] -> ShowS
$cshowList :: [AwsRdsDbClusterAssociatedRole] -> ShowS
show :: AwsRdsDbClusterAssociatedRole -> String
$cshow :: AwsRdsDbClusterAssociatedRole -> String
showsPrec :: Int -> AwsRdsDbClusterAssociatedRole -> ShowS
$cshowsPrec :: Int -> AwsRdsDbClusterAssociatedRole -> ShowS
Prelude.Show, (forall x.
 AwsRdsDbClusterAssociatedRole
 -> Rep AwsRdsDbClusterAssociatedRole x)
-> (forall x.
    Rep AwsRdsDbClusterAssociatedRole x
    -> AwsRdsDbClusterAssociatedRole)
-> Generic AwsRdsDbClusterAssociatedRole
forall x.
Rep AwsRdsDbClusterAssociatedRole x
-> AwsRdsDbClusterAssociatedRole
forall x.
AwsRdsDbClusterAssociatedRole
-> Rep AwsRdsDbClusterAssociatedRole x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsRdsDbClusterAssociatedRole x
-> AwsRdsDbClusterAssociatedRole
$cfrom :: forall x.
AwsRdsDbClusterAssociatedRole
-> Rep AwsRdsDbClusterAssociatedRole x
Prelude.Generic)

-- |
-- Create a value of 'AwsRdsDbClusterAssociatedRole' 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:
--
-- 'status', 'awsRdsDbClusterAssociatedRole_status' - The status of the association between the IAM role and the DB cluster.
--
-- 'roleArn', 'awsRdsDbClusterAssociatedRole_roleArn' - The ARN of the IAM role.
newAwsRdsDbClusterAssociatedRole ::
  AwsRdsDbClusterAssociatedRole
newAwsRdsDbClusterAssociatedRole :: AwsRdsDbClusterAssociatedRole
newAwsRdsDbClusterAssociatedRole =
  AwsRdsDbClusterAssociatedRole' :: Maybe Text -> Maybe Text -> AwsRdsDbClusterAssociatedRole
AwsRdsDbClusterAssociatedRole'
    { $sel:status:AwsRdsDbClusterAssociatedRole' :: Maybe Text
status =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:AwsRdsDbClusterAssociatedRole' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the association between the IAM role and the DB cluster.
awsRdsDbClusterAssociatedRole_status :: Lens.Lens' AwsRdsDbClusterAssociatedRole (Prelude.Maybe Prelude.Text)
awsRdsDbClusterAssociatedRole_status :: (Maybe Text -> f (Maybe Text))
-> AwsRdsDbClusterAssociatedRole -> f AwsRdsDbClusterAssociatedRole
awsRdsDbClusterAssociatedRole_status = (AwsRdsDbClusterAssociatedRole -> Maybe Text)
-> (AwsRdsDbClusterAssociatedRole
    -> Maybe Text -> AwsRdsDbClusterAssociatedRole)
-> Lens
     AwsRdsDbClusterAssociatedRole
     AwsRdsDbClusterAssociatedRole
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsRdsDbClusterAssociatedRole' {Maybe Text
status :: Maybe Text
$sel:status:AwsRdsDbClusterAssociatedRole' :: AwsRdsDbClusterAssociatedRole -> Maybe Text
status} -> Maybe Text
status) (\s :: AwsRdsDbClusterAssociatedRole
s@AwsRdsDbClusterAssociatedRole' {} Maybe Text
a -> AwsRdsDbClusterAssociatedRole
s {$sel:status:AwsRdsDbClusterAssociatedRole' :: Maybe Text
status = Maybe Text
a} :: AwsRdsDbClusterAssociatedRole)

-- | The ARN of the IAM role.
awsRdsDbClusterAssociatedRole_roleArn :: Lens.Lens' AwsRdsDbClusterAssociatedRole (Prelude.Maybe Prelude.Text)
awsRdsDbClusterAssociatedRole_roleArn :: (Maybe Text -> f (Maybe Text))
-> AwsRdsDbClusterAssociatedRole -> f AwsRdsDbClusterAssociatedRole
awsRdsDbClusterAssociatedRole_roleArn = (AwsRdsDbClusterAssociatedRole -> Maybe Text)
-> (AwsRdsDbClusterAssociatedRole
    -> Maybe Text -> AwsRdsDbClusterAssociatedRole)
-> Lens
     AwsRdsDbClusterAssociatedRole
     AwsRdsDbClusterAssociatedRole
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsRdsDbClusterAssociatedRole' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:AwsRdsDbClusterAssociatedRole' :: AwsRdsDbClusterAssociatedRole -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: AwsRdsDbClusterAssociatedRole
s@AwsRdsDbClusterAssociatedRole' {} Maybe Text
a -> AwsRdsDbClusterAssociatedRole
s {$sel:roleArn:AwsRdsDbClusterAssociatedRole' :: Maybe Text
roleArn = Maybe Text
a} :: AwsRdsDbClusterAssociatedRole)

instance Core.FromJSON AwsRdsDbClusterAssociatedRole where
  parseJSON :: Value -> Parser AwsRdsDbClusterAssociatedRole
parseJSON =
    String
-> (Object -> Parser AwsRdsDbClusterAssociatedRole)
-> Value
-> Parser AwsRdsDbClusterAssociatedRole
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsRdsDbClusterAssociatedRole"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> AwsRdsDbClusterAssociatedRole
AwsRdsDbClusterAssociatedRole'
            (Maybe Text -> Maybe Text -> AwsRdsDbClusterAssociatedRole)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AwsRdsDbClusterAssociatedRole)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser (Maybe Text -> AwsRdsDbClusterAssociatedRole)
-> Parser (Maybe Text) -> Parser AwsRdsDbClusterAssociatedRole
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RoleArn")
      )

instance
  Prelude.Hashable
    AwsRdsDbClusterAssociatedRole

instance Prelude.NFData AwsRdsDbClusterAssociatedRole

instance Core.ToJSON AwsRdsDbClusterAssociatedRole where
  toJSON :: AwsRdsDbClusterAssociatedRole -> Value
toJSON AwsRdsDbClusterAssociatedRole' {Maybe Text
roleArn :: Maybe Text
status :: Maybe Text
$sel:roleArn:AwsRdsDbClusterAssociatedRole' :: AwsRdsDbClusterAssociatedRole -> Maybe Text
$sel:status:AwsRdsDbClusterAssociatedRole' :: AwsRdsDbClusterAssociatedRole -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Status" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
status,
            (Text
"RoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
roleArn
          ]
      )