{-# 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 #-}
module Amazonka.IAM.Types.AttachedPolicy where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AttachedPolicy = AttachedPolicy'
{
AttachedPolicy -> Maybe Text
policyName :: Prelude.Maybe Prelude.Text,
AttachedPolicy -> Maybe Text
policyArn :: Prelude.Maybe Prelude.Text
}
deriving (AttachedPolicy -> AttachedPolicy -> Bool
(AttachedPolicy -> AttachedPolicy -> Bool)
-> (AttachedPolicy -> AttachedPolicy -> Bool) -> Eq AttachedPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachedPolicy -> AttachedPolicy -> Bool
$c/= :: AttachedPolicy -> AttachedPolicy -> Bool
== :: AttachedPolicy -> AttachedPolicy -> Bool
$c== :: AttachedPolicy -> AttachedPolicy -> Bool
Prelude.Eq, ReadPrec [AttachedPolicy]
ReadPrec AttachedPolicy
Int -> ReadS AttachedPolicy
ReadS [AttachedPolicy]
(Int -> ReadS AttachedPolicy)
-> ReadS [AttachedPolicy]
-> ReadPrec AttachedPolicy
-> ReadPrec [AttachedPolicy]
-> Read AttachedPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachedPolicy]
$creadListPrec :: ReadPrec [AttachedPolicy]
readPrec :: ReadPrec AttachedPolicy
$creadPrec :: ReadPrec AttachedPolicy
readList :: ReadS [AttachedPolicy]
$creadList :: ReadS [AttachedPolicy]
readsPrec :: Int -> ReadS AttachedPolicy
$creadsPrec :: Int -> ReadS AttachedPolicy
Prelude.Read, Int -> AttachedPolicy -> ShowS
[AttachedPolicy] -> ShowS
AttachedPolicy -> String
(Int -> AttachedPolicy -> ShowS)
-> (AttachedPolicy -> String)
-> ([AttachedPolicy] -> ShowS)
-> Show AttachedPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachedPolicy] -> ShowS
$cshowList :: [AttachedPolicy] -> ShowS
show :: AttachedPolicy -> String
$cshow :: AttachedPolicy -> String
showsPrec :: Int -> AttachedPolicy -> ShowS
$cshowsPrec :: Int -> AttachedPolicy -> ShowS
Prelude.Show, (forall x. AttachedPolicy -> Rep AttachedPolicy x)
-> (forall x. Rep AttachedPolicy x -> AttachedPolicy)
-> Generic AttachedPolicy
forall x. Rep AttachedPolicy x -> AttachedPolicy
forall x. AttachedPolicy -> Rep AttachedPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttachedPolicy x -> AttachedPolicy
$cfrom :: forall x. AttachedPolicy -> Rep AttachedPolicy x
Prelude.Generic)
newAttachedPolicy ::
AttachedPolicy
newAttachedPolicy :: AttachedPolicy
newAttachedPolicy =
AttachedPolicy' :: Maybe Text -> Maybe Text -> AttachedPolicy
AttachedPolicy'
{ $sel:policyName:AttachedPolicy' :: Maybe Text
policyName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:policyArn:AttachedPolicy' :: Maybe Text
policyArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
attachedPolicy_policyName :: Lens.Lens' AttachedPolicy (Prelude.Maybe Prelude.Text)
attachedPolicy_policyName :: (Maybe Text -> f (Maybe Text))
-> AttachedPolicy -> f AttachedPolicy
attachedPolicy_policyName = (AttachedPolicy -> Maybe Text)
-> (AttachedPolicy -> Maybe Text -> AttachedPolicy)
-> Lens AttachedPolicy AttachedPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachedPolicy' {Maybe Text
policyName :: Maybe Text
$sel:policyName:AttachedPolicy' :: AttachedPolicy -> Maybe Text
policyName} -> Maybe Text
policyName) (\s :: AttachedPolicy
s@AttachedPolicy' {} Maybe Text
a -> AttachedPolicy
s {$sel:policyName:AttachedPolicy' :: Maybe Text
policyName = Maybe Text
a} :: AttachedPolicy)
attachedPolicy_policyArn :: Lens.Lens' AttachedPolicy (Prelude.Maybe Prelude.Text)
attachedPolicy_policyArn :: (Maybe Text -> f (Maybe Text))
-> AttachedPolicy -> f AttachedPolicy
attachedPolicy_policyArn = (AttachedPolicy -> Maybe Text)
-> (AttachedPolicy -> Maybe Text -> AttachedPolicy)
-> Lens AttachedPolicy AttachedPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachedPolicy' {Maybe Text
policyArn :: Maybe Text
$sel:policyArn:AttachedPolicy' :: AttachedPolicy -> Maybe Text
policyArn} -> Maybe Text
policyArn) (\s :: AttachedPolicy
s@AttachedPolicy' {} Maybe Text
a -> AttachedPolicy
s {$sel:policyArn:AttachedPolicy' :: Maybe Text
policyArn = Maybe Text
a} :: AttachedPolicy)
instance Core.FromXML AttachedPolicy where
parseXML :: [Node] -> Either String AttachedPolicy
parseXML [Node]
x =
Maybe Text -> Maybe Text -> AttachedPolicy
AttachedPolicy'
(Maybe Text -> Maybe Text -> AttachedPolicy)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> AttachedPolicy)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PolicyName")
Either String (Maybe Text -> AttachedPolicy)
-> Either String (Maybe Text) -> Either String AttachedPolicy
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PolicyArn")
instance Prelude.Hashable AttachedPolicy
instance Prelude.NFData AttachedPolicy