{-# 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.AwsRdsDbInstanceAssociatedRole
-- 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.AwsRdsDbInstanceAssociatedRole where

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

-- | An IAM role associated with the DB instance.
--
-- /See:/ 'newAwsRdsDbInstanceAssociatedRole' smart constructor.
data AwsRdsDbInstanceAssociatedRole = AwsRdsDbInstanceAssociatedRole'
  { -- | Describes the state of the association between the IAM role and the DB
    -- instance. The @Status@ property returns one of the following values:
    --
    -- -   @ACTIVE@ - The IAM role ARN is associated with the DB instance and
    --     can be used to access other Amazon Web Services services on your
    --     behalf.
    --
    -- -   @PENDING@ - The IAM role ARN is being associated with the DB
    --     instance.
    --
    -- -   @INVALID@ - The IAM role ARN is associated with the DB instance. But
    --     the DB instance is unable to assume the IAM role in order to access
    --     other Amazon Web Services services on your behalf.
    AwsRdsDbInstanceAssociatedRole -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The name of the feature associated with the IAM role.
    AwsRdsDbInstanceAssociatedRole -> Maybe Text
featureName :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the IAM role that is associated with the DB instance.
    AwsRdsDbInstanceAssociatedRole -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsRdsDbInstanceAssociatedRole
-> AwsRdsDbInstanceAssociatedRole -> Bool
(AwsRdsDbInstanceAssociatedRole
 -> AwsRdsDbInstanceAssociatedRole -> Bool)
-> (AwsRdsDbInstanceAssociatedRole
    -> AwsRdsDbInstanceAssociatedRole -> Bool)
-> Eq AwsRdsDbInstanceAssociatedRole
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsRdsDbInstanceAssociatedRole
-> AwsRdsDbInstanceAssociatedRole -> Bool
$c/= :: AwsRdsDbInstanceAssociatedRole
-> AwsRdsDbInstanceAssociatedRole -> Bool
== :: AwsRdsDbInstanceAssociatedRole
-> AwsRdsDbInstanceAssociatedRole -> Bool
$c== :: AwsRdsDbInstanceAssociatedRole
-> AwsRdsDbInstanceAssociatedRole -> Bool
Prelude.Eq, ReadPrec [AwsRdsDbInstanceAssociatedRole]
ReadPrec AwsRdsDbInstanceAssociatedRole
Int -> ReadS AwsRdsDbInstanceAssociatedRole
ReadS [AwsRdsDbInstanceAssociatedRole]
(Int -> ReadS AwsRdsDbInstanceAssociatedRole)
-> ReadS [AwsRdsDbInstanceAssociatedRole]
-> ReadPrec AwsRdsDbInstanceAssociatedRole
-> ReadPrec [AwsRdsDbInstanceAssociatedRole]
-> Read AwsRdsDbInstanceAssociatedRole
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsRdsDbInstanceAssociatedRole]
$creadListPrec :: ReadPrec [AwsRdsDbInstanceAssociatedRole]
readPrec :: ReadPrec AwsRdsDbInstanceAssociatedRole
$creadPrec :: ReadPrec AwsRdsDbInstanceAssociatedRole
readList :: ReadS [AwsRdsDbInstanceAssociatedRole]
$creadList :: ReadS [AwsRdsDbInstanceAssociatedRole]
readsPrec :: Int -> ReadS AwsRdsDbInstanceAssociatedRole
$creadsPrec :: Int -> ReadS AwsRdsDbInstanceAssociatedRole
Prelude.Read, Int -> AwsRdsDbInstanceAssociatedRole -> ShowS
[AwsRdsDbInstanceAssociatedRole] -> ShowS
AwsRdsDbInstanceAssociatedRole -> String
(Int -> AwsRdsDbInstanceAssociatedRole -> ShowS)
-> (AwsRdsDbInstanceAssociatedRole -> String)
-> ([AwsRdsDbInstanceAssociatedRole] -> ShowS)
-> Show AwsRdsDbInstanceAssociatedRole
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsRdsDbInstanceAssociatedRole] -> ShowS
$cshowList :: [AwsRdsDbInstanceAssociatedRole] -> ShowS
show :: AwsRdsDbInstanceAssociatedRole -> String
$cshow :: AwsRdsDbInstanceAssociatedRole -> String
showsPrec :: Int -> AwsRdsDbInstanceAssociatedRole -> ShowS
$cshowsPrec :: Int -> AwsRdsDbInstanceAssociatedRole -> ShowS
Prelude.Show, (forall x.
 AwsRdsDbInstanceAssociatedRole
 -> Rep AwsRdsDbInstanceAssociatedRole x)
-> (forall x.
    Rep AwsRdsDbInstanceAssociatedRole x
    -> AwsRdsDbInstanceAssociatedRole)
-> Generic AwsRdsDbInstanceAssociatedRole
forall x.
Rep AwsRdsDbInstanceAssociatedRole x
-> AwsRdsDbInstanceAssociatedRole
forall x.
AwsRdsDbInstanceAssociatedRole
-> Rep AwsRdsDbInstanceAssociatedRole x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsRdsDbInstanceAssociatedRole x
-> AwsRdsDbInstanceAssociatedRole
$cfrom :: forall x.
AwsRdsDbInstanceAssociatedRole
-> Rep AwsRdsDbInstanceAssociatedRole x
Prelude.Generic)

-- |
-- Create a value of 'AwsRdsDbInstanceAssociatedRole' 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', 'awsRdsDbInstanceAssociatedRole_status' - Describes the state of the association between the IAM role and the DB
-- instance. The @Status@ property returns one of the following values:
--
-- -   @ACTIVE@ - The IAM role ARN is associated with the DB instance and
--     can be used to access other Amazon Web Services services on your
--     behalf.
--
-- -   @PENDING@ - The IAM role ARN is being associated with the DB
--     instance.
--
-- -   @INVALID@ - The IAM role ARN is associated with the DB instance. But
--     the DB instance is unable to assume the IAM role in order to access
--     other Amazon Web Services services on your behalf.
--
-- 'featureName', 'awsRdsDbInstanceAssociatedRole_featureName' - The name of the feature associated with the IAM role.
--
-- 'roleArn', 'awsRdsDbInstanceAssociatedRole_roleArn' - The ARN of the IAM role that is associated with the DB instance.
newAwsRdsDbInstanceAssociatedRole ::
  AwsRdsDbInstanceAssociatedRole
newAwsRdsDbInstanceAssociatedRole :: AwsRdsDbInstanceAssociatedRole
newAwsRdsDbInstanceAssociatedRole =
  AwsRdsDbInstanceAssociatedRole' :: Maybe Text
-> Maybe Text -> Maybe Text -> AwsRdsDbInstanceAssociatedRole
AwsRdsDbInstanceAssociatedRole'
    { $sel:status:AwsRdsDbInstanceAssociatedRole' :: Maybe Text
status =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:featureName:AwsRdsDbInstanceAssociatedRole' :: Maybe Text
featureName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:AwsRdsDbInstanceAssociatedRole' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The name of the feature associated with the IAM role.
awsRdsDbInstanceAssociatedRole_featureName :: Lens.Lens' AwsRdsDbInstanceAssociatedRole (Prelude.Maybe Prelude.Text)
awsRdsDbInstanceAssociatedRole_featureName :: (Maybe Text -> f (Maybe Text))
-> AwsRdsDbInstanceAssociatedRole
-> f AwsRdsDbInstanceAssociatedRole
awsRdsDbInstanceAssociatedRole_featureName = (AwsRdsDbInstanceAssociatedRole -> Maybe Text)
-> (AwsRdsDbInstanceAssociatedRole
    -> Maybe Text -> AwsRdsDbInstanceAssociatedRole)
-> Lens
     AwsRdsDbInstanceAssociatedRole
     AwsRdsDbInstanceAssociatedRole
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsRdsDbInstanceAssociatedRole' {Maybe Text
featureName :: Maybe Text
$sel:featureName:AwsRdsDbInstanceAssociatedRole' :: AwsRdsDbInstanceAssociatedRole -> Maybe Text
featureName} -> Maybe Text
featureName) (\s :: AwsRdsDbInstanceAssociatedRole
s@AwsRdsDbInstanceAssociatedRole' {} Maybe Text
a -> AwsRdsDbInstanceAssociatedRole
s {$sel:featureName:AwsRdsDbInstanceAssociatedRole' :: Maybe Text
featureName = Maybe Text
a} :: AwsRdsDbInstanceAssociatedRole)

-- | The ARN of the IAM role that is associated with the DB instance.
awsRdsDbInstanceAssociatedRole_roleArn :: Lens.Lens' AwsRdsDbInstanceAssociatedRole (Prelude.Maybe Prelude.Text)
awsRdsDbInstanceAssociatedRole_roleArn :: (Maybe Text -> f (Maybe Text))
-> AwsRdsDbInstanceAssociatedRole
-> f AwsRdsDbInstanceAssociatedRole
awsRdsDbInstanceAssociatedRole_roleArn = (AwsRdsDbInstanceAssociatedRole -> Maybe Text)
-> (AwsRdsDbInstanceAssociatedRole
    -> Maybe Text -> AwsRdsDbInstanceAssociatedRole)
-> Lens
     AwsRdsDbInstanceAssociatedRole
     AwsRdsDbInstanceAssociatedRole
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsRdsDbInstanceAssociatedRole' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:AwsRdsDbInstanceAssociatedRole' :: AwsRdsDbInstanceAssociatedRole -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: AwsRdsDbInstanceAssociatedRole
s@AwsRdsDbInstanceAssociatedRole' {} Maybe Text
a -> AwsRdsDbInstanceAssociatedRole
s {$sel:roleArn:AwsRdsDbInstanceAssociatedRole' :: Maybe Text
roleArn = Maybe Text
a} :: AwsRdsDbInstanceAssociatedRole)

instance Core.FromJSON AwsRdsDbInstanceAssociatedRole where
  parseJSON :: Value -> Parser AwsRdsDbInstanceAssociatedRole
parseJSON =
    String
-> (Object -> Parser AwsRdsDbInstanceAssociatedRole)
-> Value
-> Parser AwsRdsDbInstanceAssociatedRole
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsRdsDbInstanceAssociatedRole"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> AwsRdsDbInstanceAssociatedRole
AwsRdsDbInstanceAssociatedRole'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> AwsRdsDbInstanceAssociatedRole)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> AwsRdsDbInstanceAssociatedRole)
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 -> Maybe Text -> AwsRdsDbInstanceAssociatedRole)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AwsRdsDbInstanceAssociatedRole)
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
"FeatureName")
            Parser (Maybe Text -> AwsRdsDbInstanceAssociatedRole)
-> Parser (Maybe Text) -> Parser AwsRdsDbInstanceAssociatedRole
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
    AwsRdsDbInstanceAssociatedRole

instance
  Prelude.NFData
    AwsRdsDbInstanceAssociatedRole

instance Core.ToJSON AwsRdsDbInstanceAssociatedRole where
  toJSON :: AwsRdsDbInstanceAssociatedRole -> Value
toJSON AwsRdsDbInstanceAssociatedRole' {Maybe Text
roleArn :: Maybe Text
featureName :: Maybe Text
status :: Maybe Text
$sel:roleArn:AwsRdsDbInstanceAssociatedRole' :: AwsRdsDbInstanceAssociatedRole -> Maybe Text
$sel:featureName:AwsRdsDbInstanceAssociatedRole' :: AwsRdsDbInstanceAssociatedRole -> Maybe Text
$sel:status:AwsRdsDbInstanceAssociatedRole' :: AwsRdsDbInstanceAssociatedRole -> 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
"FeatureName" 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
featureName,
            (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
          ]
      )