{-# 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.Redshift.Types.ClusterIamRole
-- 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.Redshift.Types.ClusterIamRole 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
import Amazonka.Redshift.Internal

-- | An Identity and Access Management (IAM) role that can be used by the
-- associated Amazon Redshift cluster to access other Amazon Web Services
-- services.
--
-- /See:/ 'newClusterIamRole' smart constructor.
data ClusterIamRole = ClusterIamRole'
  { -- | A value that describes the status of the IAM role\'s association with an
    -- Amazon Redshift cluster.
    --
    -- The following are possible statuses and descriptions.
    --
    -- -   @in-sync@: The role is available for use by the cluster.
    --
    -- -   @adding@: The role is in the process of being associated with the
    --     cluster.
    --
    -- -   @removing@: The role is in the process of being disassociated with
    --     the cluster.
    ClusterIamRole -> Maybe Text
applyStatus :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the IAM role, for example,
    -- @arn:aws:iam::123456789012:role\/RedshiftCopyUnload@.
    ClusterIamRole -> Maybe Text
iamRoleArn :: Prelude.Maybe Prelude.Text
  }
  deriving (ClusterIamRole -> ClusterIamRole -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClusterIamRole -> ClusterIamRole -> Bool
$c/= :: ClusterIamRole -> ClusterIamRole -> Bool
== :: ClusterIamRole -> ClusterIamRole -> Bool
$c== :: ClusterIamRole -> ClusterIamRole -> Bool
Prelude.Eq, ReadPrec [ClusterIamRole]
ReadPrec ClusterIamRole
Int -> ReadS ClusterIamRole
ReadS [ClusterIamRole]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClusterIamRole]
$creadListPrec :: ReadPrec [ClusterIamRole]
readPrec :: ReadPrec ClusterIamRole
$creadPrec :: ReadPrec ClusterIamRole
readList :: ReadS [ClusterIamRole]
$creadList :: ReadS [ClusterIamRole]
readsPrec :: Int -> ReadS ClusterIamRole
$creadsPrec :: Int -> ReadS ClusterIamRole
Prelude.Read, Int -> ClusterIamRole -> ShowS
[ClusterIamRole] -> ShowS
ClusterIamRole -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClusterIamRole] -> ShowS
$cshowList :: [ClusterIamRole] -> ShowS
show :: ClusterIamRole -> String
$cshow :: ClusterIamRole -> String
showsPrec :: Int -> ClusterIamRole -> ShowS
$cshowsPrec :: Int -> ClusterIamRole -> ShowS
Prelude.Show, forall x. Rep ClusterIamRole x -> ClusterIamRole
forall x. ClusterIamRole -> Rep ClusterIamRole x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClusterIamRole x -> ClusterIamRole
$cfrom :: forall x. ClusterIamRole -> Rep ClusterIamRole x
Prelude.Generic)

-- |
-- Create a value of 'ClusterIamRole' 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:
--
-- 'applyStatus', 'clusterIamRole_applyStatus' - A value that describes the status of the IAM role\'s association with an
-- Amazon Redshift cluster.
--
-- The following are possible statuses and descriptions.
--
-- -   @in-sync@: The role is available for use by the cluster.
--
-- -   @adding@: The role is in the process of being associated with the
--     cluster.
--
-- -   @removing@: The role is in the process of being disassociated with
--     the cluster.
--
-- 'iamRoleArn', 'clusterIamRole_iamRoleArn' - The Amazon Resource Name (ARN) of the IAM role, for example,
-- @arn:aws:iam::123456789012:role\/RedshiftCopyUnload@.
newClusterIamRole ::
  ClusterIamRole
newClusterIamRole :: ClusterIamRole
newClusterIamRole =
  ClusterIamRole'
    { $sel:applyStatus:ClusterIamRole' :: Maybe Text
applyStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:iamRoleArn:ClusterIamRole' :: Maybe Text
iamRoleArn = forall a. Maybe a
Prelude.Nothing
    }

-- | A value that describes the status of the IAM role\'s association with an
-- Amazon Redshift cluster.
--
-- The following are possible statuses and descriptions.
--
-- -   @in-sync@: The role is available for use by the cluster.
--
-- -   @adding@: The role is in the process of being associated with the
--     cluster.
--
-- -   @removing@: The role is in the process of being disassociated with
--     the cluster.
clusterIamRole_applyStatus :: Lens.Lens' ClusterIamRole (Prelude.Maybe Prelude.Text)
clusterIamRole_applyStatus :: Lens' ClusterIamRole (Maybe Text)
clusterIamRole_applyStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterIamRole' {Maybe Text
applyStatus :: Maybe Text
$sel:applyStatus:ClusterIamRole' :: ClusterIamRole -> Maybe Text
applyStatus} -> Maybe Text
applyStatus) (\s :: ClusterIamRole
s@ClusterIamRole' {} Maybe Text
a -> ClusterIamRole
s {$sel:applyStatus:ClusterIamRole' :: Maybe Text
applyStatus = Maybe Text
a} :: ClusterIamRole)

-- | The Amazon Resource Name (ARN) of the IAM role, for example,
-- @arn:aws:iam::123456789012:role\/RedshiftCopyUnload@.
clusterIamRole_iamRoleArn :: Lens.Lens' ClusterIamRole (Prelude.Maybe Prelude.Text)
clusterIamRole_iamRoleArn :: Lens' ClusterIamRole (Maybe Text)
clusterIamRole_iamRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClusterIamRole' {Maybe Text
iamRoleArn :: Maybe Text
$sel:iamRoleArn:ClusterIamRole' :: ClusterIamRole -> Maybe Text
iamRoleArn} -> Maybe Text
iamRoleArn) (\s :: ClusterIamRole
s@ClusterIamRole' {} Maybe Text
a -> ClusterIamRole
s {$sel:iamRoleArn:ClusterIamRole' :: Maybe Text
iamRoleArn = Maybe Text
a} :: ClusterIamRole)

instance Data.FromXML ClusterIamRole where
  parseXML :: [Node] -> Either String ClusterIamRole
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> ClusterIamRole
ClusterIamRole'
      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
"ApplyStatus")
      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
"IamRoleArn")

instance Prelude.Hashable ClusterIamRole where
  hashWithSalt :: Int -> ClusterIamRole -> Int
hashWithSalt Int
_salt ClusterIamRole' {Maybe Text
iamRoleArn :: Maybe Text
applyStatus :: Maybe Text
$sel:iamRoleArn:ClusterIamRole' :: ClusterIamRole -> Maybe Text
$sel:applyStatus:ClusterIamRole' :: ClusterIamRole -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
applyStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
iamRoleArn

instance Prelude.NFData ClusterIamRole where
  rnf :: ClusterIamRole -> ()
rnf ClusterIamRole' {Maybe Text
iamRoleArn :: Maybe Text
applyStatus :: Maybe Text
$sel:iamRoleArn:ClusterIamRole' :: ClusterIamRole -> Maybe Text
$sel:applyStatus:ClusterIamRole' :: ClusterIamRole -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
applyStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
iamRoleArn