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

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

-- | An IAM role that the cluster can use to access other Amazon Web Services
-- services.
--
-- /See:/ 'newAwsRedshiftClusterIamRole' smart constructor.
data AwsRedshiftClusterIamRole = AwsRedshiftClusterIamRole'
  { -- | The ARN of the IAM role.
    AwsRedshiftClusterIamRole -> Maybe Text
iamRoleArn :: Prelude.Maybe Prelude.Text,
    -- | The status of the IAM role\'s association with the cluster.
    --
    -- Valid values: @in-sync@ | @adding@ | @removing@
    AwsRedshiftClusterIamRole -> Maybe Text
applyStatus :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsRedshiftClusterIamRole -> AwsRedshiftClusterIamRole -> Bool
(AwsRedshiftClusterIamRole -> AwsRedshiftClusterIamRole -> Bool)
-> (AwsRedshiftClusterIamRole -> AwsRedshiftClusterIamRole -> Bool)
-> Eq AwsRedshiftClusterIamRole
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsRedshiftClusterIamRole -> AwsRedshiftClusterIamRole -> Bool
$c/= :: AwsRedshiftClusterIamRole -> AwsRedshiftClusterIamRole -> Bool
== :: AwsRedshiftClusterIamRole -> AwsRedshiftClusterIamRole -> Bool
$c== :: AwsRedshiftClusterIamRole -> AwsRedshiftClusterIamRole -> Bool
Prelude.Eq, ReadPrec [AwsRedshiftClusterIamRole]
ReadPrec AwsRedshiftClusterIamRole
Int -> ReadS AwsRedshiftClusterIamRole
ReadS [AwsRedshiftClusterIamRole]
(Int -> ReadS AwsRedshiftClusterIamRole)
-> ReadS [AwsRedshiftClusterIamRole]
-> ReadPrec AwsRedshiftClusterIamRole
-> ReadPrec [AwsRedshiftClusterIamRole]
-> Read AwsRedshiftClusterIamRole
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsRedshiftClusterIamRole]
$creadListPrec :: ReadPrec [AwsRedshiftClusterIamRole]
readPrec :: ReadPrec AwsRedshiftClusterIamRole
$creadPrec :: ReadPrec AwsRedshiftClusterIamRole
readList :: ReadS [AwsRedshiftClusterIamRole]
$creadList :: ReadS [AwsRedshiftClusterIamRole]
readsPrec :: Int -> ReadS AwsRedshiftClusterIamRole
$creadsPrec :: Int -> ReadS AwsRedshiftClusterIamRole
Prelude.Read, Int -> AwsRedshiftClusterIamRole -> ShowS
[AwsRedshiftClusterIamRole] -> ShowS
AwsRedshiftClusterIamRole -> String
(Int -> AwsRedshiftClusterIamRole -> ShowS)
-> (AwsRedshiftClusterIamRole -> String)
-> ([AwsRedshiftClusterIamRole] -> ShowS)
-> Show AwsRedshiftClusterIamRole
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsRedshiftClusterIamRole] -> ShowS
$cshowList :: [AwsRedshiftClusterIamRole] -> ShowS
show :: AwsRedshiftClusterIamRole -> String
$cshow :: AwsRedshiftClusterIamRole -> String
showsPrec :: Int -> AwsRedshiftClusterIamRole -> ShowS
$cshowsPrec :: Int -> AwsRedshiftClusterIamRole -> ShowS
Prelude.Show, (forall x.
 AwsRedshiftClusterIamRole -> Rep AwsRedshiftClusterIamRole x)
-> (forall x.
    Rep AwsRedshiftClusterIamRole x -> AwsRedshiftClusterIamRole)
-> Generic AwsRedshiftClusterIamRole
forall x.
Rep AwsRedshiftClusterIamRole x -> AwsRedshiftClusterIamRole
forall x.
AwsRedshiftClusterIamRole -> Rep AwsRedshiftClusterIamRole x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsRedshiftClusterIamRole x -> AwsRedshiftClusterIamRole
$cfrom :: forall x.
AwsRedshiftClusterIamRole -> Rep AwsRedshiftClusterIamRole x
Prelude.Generic)

-- |
-- Create a value of 'AwsRedshiftClusterIamRole' 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:
--
-- 'iamRoleArn', 'awsRedshiftClusterIamRole_iamRoleArn' - The ARN of the IAM role.
--
-- 'applyStatus', 'awsRedshiftClusterIamRole_applyStatus' - The status of the IAM role\'s association with the cluster.
--
-- Valid values: @in-sync@ | @adding@ | @removing@
newAwsRedshiftClusterIamRole ::
  AwsRedshiftClusterIamRole
newAwsRedshiftClusterIamRole :: AwsRedshiftClusterIamRole
newAwsRedshiftClusterIamRole =
  AwsRedshiftClusterIamRole' :: Maybe Text -> Maybe Text -> AwsRedshiftClusterIamRole
AwsRedshiftClusterIamRole'
    { $sel:iamRoleArn:AwsRedshiftClusterIamRole' :: Maybe Text
iamRoleArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:applyStatus:AwsRedshiftClusterIamRole' :: Maybe Text
applyStatus = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The status of the IAM role\'s association with the cluster.
--
-- Valid values: @in-sync@ | @adding@ | @removing@
awsRedshiftClusterIamRole_applyStatus :: Lens.Lens' AwsRedshiftClusterIamRole (Prelude.Maybe Prelude.Text)
awsRedshiftClusterIamRole_applyStatus :: (Maybe Text -> f (Maybe Text))
-> AwsRedshiftClusterIamRole -> f AwsRedshiftClusterIamRole
awsRedshiftClusterIamRole_applyStatus = (AwsRedshiftClusterIamRole -> Maybe Text)
-> (AwsRedshiftClusterIamRole
    -> Maybe Text -> AwsRedshiftClusterIamRole)
-> Lens
     AwsRedshiftClusterIamRole
     AwsRedshiftClusterIamRole
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsRedshiftClusterIamRole' {Maybe Text
applyStatus :: Maybe Text
$sel:applyStatus:AwsRedshiftClusterIamRole' :: AwsRedshiftClusterIamRole -> Maybe Text
applyStatus} -> Maybe Text
applyStatus) (\s :: AwsRedshiftClusterIamRole
s@AwsRedshiftClusterIamRole' {} Maybe Text
a -> AwsRedshiftClusterIamRole
s {$sel:applyStatus:AwsRedshiftClusterIamRole' :: Maybe Text
applyStatus = Maybe Text
a} :: AwsRedshiftClusterIamRole)

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

instance Prelude.Hashable AwsRedshiftClusterIamRole

instance Prelude.NFData AwsRedshiftClusterIamRole

instance Core.ToJSON AwsRedshiftClusterIamRole where
  toJSON :: AwsRedshiftClusterIamRole -> Value
toJSON AwsRedshiftClusterIamRole' {Maybe Text
applyStatus :: Maybe Text
iamRoleArn :: Maybe Text
$sel:applyStatus:AwsRedshiftClusterIamRole' :: AwsRedshiftClusterIamRole -> Maybe Text
$sel:iamRoleArn:AwsRedshiftClusterIamRole' :: AwsRedshiftClusterIamRole -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"IamRoleArn" 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
iamRoleArn,
            (Text
"ApplyStatus" 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
applyStatus
          ]
      )