{-# 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.QuickSight.Types.ActiveIAMPolicyAssignment
-- 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.QuickSight.Types.ActiveIAMPolicyAssignment where

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

-- | The active Identity and Access Management (IAM) policy assignment.
--
-- /See:/ 'newActiveIAMPolicyAssignment' smart constructor.
data ActiveIAMPolicyAssignment = ActiveIAMPolicyAssignment'
  { -- | A name for the IAMpolicy assignment.
    ActiveIAMPolicyAssignment -> Maybe Text
assignmentName :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the resource.
    ActiveIAMPolicyAssignment -> Maybe Text
policyArn :: Prelude.Maybe Prelude.Text
  }
  deriving (ActiveIAMPolicyAssignment -> ActiveIAMPolicyAssignment -> Bool
(ActiveIAMPolicyAssignment -> ActiveIAMPolicyAssignment -> Bool)
-> (ActiveIAMPolicyAssignment -> ActiveIAMPolicyAssignment -> Bool)
-> Eq ActiveIAMPolicyAssignment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActiveIAMPolicyAssignment -> ActiveIAMPolicyAssignment -> Bool
$c/= :: ActiveIAMPolicyAssignment -> ActiveIAMPolicyAssignment -> Bool
== :: ActiveIAMPolicyAssignment -> ActiveIAMPolicyAssignment -> Bool
$c== :: ActiveIAMPolicyAssignment -> ActiveIAMPolicyAssignment -> Bool
Prelude.Eq, ReadPrec [ActiveIAMPolicyAssignment]
ReadPrec ActiveIAMPolicyAssignment
Int -> ReadS ActiveIAMPolicyAssignment
ReadS [ActiveIAMPolicyAssignment]
(Int -> ReadS ActiveIAMPolicyAssignment)
-> ReadS [ActiveIAMPolicyAssignment]
-> ReadPrec ActiveIAMPolicyAssignment
-> ReadPrec [ActiveIAMPolicyAssignment]
-> Read ActiveIAMPolicyAssignment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActiveIAMPolicyAssignment]
$creadListPrec :: ReadPrec [ActiveIAMPolicyAssignment]
readPrec :: ReadPrec ActiveIAMPolicyAssignment
$creadPrec :: ReadPrec ActiveIAMPolicyAssignment
readList :: ReadS [ActiveIAMPolicyAssignment]
$creadList :: ReadS [ActiveIAMPolicyAssignment]
readsPrec :: Int -> ReadS ActiveIAMPolicyAssignment
$creadsPrec :: Int -> ReadS ActiveIAMPolicyAssignment
Prelude.Read, Int -> ActiveIAMPolicyAssignment -> ShowS
[ActiveIAMPolicyAssignment] -> ShowS
ActiveIAMPolicyAssignment -> String
(Int -> ActiveIAMPolicyAssignment -> ShowS)
-> (ActiveIAMPolicyAssignment -> String)
-> ([ActiveIAMPolicyAssignment] -> ShowS)
-> Show ActiveIAMPolicyAssignment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActiveIAMPolicyAssignment] -> ShowS
$cshowList :: [ActiveIAMPolicyAssignment] -> ShowS
show :: ActiveIAMPolicyAssignment -> String
$cshow :: ActiveIAMPolicyAssignment -> String
showsPrec :: Int -> ActiveIAMPolicyAssignment -> ShowS
$cshowsPrec :: Int -> ActiveIAMPolicyAssignment -> ShowS
Prelude.Show, (forall x.
 ActiveIAMPolicyAssignment -> Rep ActiveIAMPolicyAssignment x)
-> (forall x.
    Rep ActiveIAMPolicyAssignment x -> ActiveIAMPolicyAssignment)
-> Generic ActiveIAMPolicyAssignment
forall x.
Rep ActiveIAMPolicyAssignment x -> ActiveIAMPolicyAssignment
forall x.
ActiveIAMPolicyAssignment -> Rep ActiveIAMPolicyAssignment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ActiveIAMPolicyAssignment x -> ActiveIAMPolicyAssignment
$cfrom :: forall x.
ActiveIAMPolicyAssignment -> Rep ActiveIAMPolicyAssignment x
Prelude.Generic)

-- |
-- Create a value of 'ActiveIAMPolicyAssignment' 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:
--
-- 'assignmentName', 'activeIAMPolicyAssignment_assignmentName' - A name for the IAMpolicy assignment.
--
-- 'policyArn', 'activeIAMPolicyAssignment_policyArn' - The Amazon Resource Name (ARN) of the resource.
newActiveIAMPolicyAssignment ::
  ActiveIAMPolicyAssignment
newActiveIAMPolicyAssignment :: ActiveIAMPolicyAssignment
newActiveIAMPolicyAssignment =
  ActiveIAMPolicyAssignment' :: Maybe Text -> Maybe Text -> ActiveIAMPolicyAssignment
ActiveIAMPolicyAssignment'
    { $sel:assignmentName:ActiveIAMPolicyAssignment' :: Maybe Text
assignmentName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:policyArn:ActiveIAMPolicyAssignment' :: Maybe Text
policyArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A name for the IAMpolicy assignment.
activeIAMPolicyAssignment_assignmentName :: Lens.Lens' ActiveIAMPolicyAssignment (Prelude.Maybe Prelude.Text)
activeIAMPolicyAssignment_assignmentName :: (Maybe Text -> f (Maybe Text))
-> ActiveIAMPolicyAssignment -> f ActiveIAMPolicyAssignment
activeIAMPolicyAssignment_assignmentName = (ActiveIAMPolicyAssignment -> Maybe Text)
-> (ActiveIAMPolicyAssignment
    -> Maybe Text -> ActiveIAMPolicyAssignment)
-> Lens
     ActiveIAMPolicyAssignment
     ActiveIAMPolicyAssignment
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActiveIAMPolicyAssignment' {Maybe Text
assignmentName :: Maybe Text
$sel:assignmentName:ActiveIAMPolicyAssignment' :: ActiveIAMPolicyAssignment -> Maybe Text
assignmentName} -> Maybe Text
assignmentName) (\s :: ActiveIAMPolicyAssignment
s@ActiveIAMPolicyAssignment' {} Maybe Text
a -> ActiveIAMPolicyAssignment
s {$sel:assignmentName:ActiveIAMPolicyAssignment' :: Maybe Text
assignmentName = Maybe Text
a} :: ActiveIAMPolicyAssignment)

-- | The Amazon Resource Name (ARN) of the resource.
activeIAMPolicyAssignment_policyArn :: Lens.Lens' ActiveIAMPolicyAssignment (Prelude.Maybe Prelude.Text)
activeIAMPolicyAssignment_policyArn :: (Maybe Text -> f (Maybe Text))
-> ActiveIAMPolicyAssignment -> f ActiveIAMPolicyAssignment
activeIAMPolicyAssignment_policyArn = (ActiveIAMPolicyAssignment -> Maybe Text)
-> (ActiveIAMPolicyAssignment
    -> Maybe Text -> ActiveIAMPolicyAssignment)
-> Lens
     ActiveIAMPolicyAssignment
     ActiveIAMPolicyAssignment
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActiveIAMPolicyAssignment' {Maybe Text
policyArn :: Maybe Text
$sel:policyArn:ActiveIAMPolicyAssignment' :: ActiveIAMPolicyAssignment -> Maybe Text
policyArn} -> Maybe Text
policyArn) (\s :: ActiveIAMPolicyAssignment
s@ActiveIAMPolicyAssignment' {} Maybe Text
a -> ActiveIAMPolicyAssignment
s {$sel:policyArn:ActiveIAMPolicyAssignment' :: Maybe Text
policyArn = Maybe Text
a} :: ActiveIAMPolicyAssignment)

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

instance Prelude.Hashable ActiveIAMPolicyAssignment

instance Prelude.NFData ActiveIAMPolicyAssignment