{-# 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.SecurityHub.Types.AwsIamUserPolicy where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AwsIamUserPolicy = AwsIamUserPolicy'
{
AwsIamUserPolicy -> Maybe Text
policyName :: Prelude.Maybe Prelude.Text
}
deriving (AwsIamUserPolicy -> AwsIamUserPolicy -> Bool
(AwsIamUserPolicy -> AwsIamUserPolicy -> Bool)
-> (AwsIamUserPolicy -> AwsIamUserPolicy -> Bool)
-> Eq AwsIamUserPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsIamUserPolicy -> AwsIamUserPolicy -> Bool
$c/= :: AwsIamUserPolicy -> AwsIamUserPolicy -> Bool
== :: AwsIamUserPolicy -> AwsIamUserPolicy -> Bool
$c== :: AwsIamUserPolicy -> AwsIamUserPolicy -> Bool
Prelude.Eq, ReadPrec [AwsIamUserPolicy]
ReadPrec AwsIamUserPolicy
Int -> ReadS AwsIamUserPolicy
ReadS [AwsIamUserPolicy]
(Int -> ReadS AwsIamUserPolicy)
-> ReadS [AwsIamUserPolicy]
-> ReadPrec AwsIamUserPolicy
-> ReadPrec [AwsIamUserPolicy]
-> Read AwsIamUserPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsIamUserPolicy]
$creadListPrec :: ReadPrec [AwsIamUserPolicy]
readPrec :: ReadPrec AwsIamUserPolicy
$creadPrec :: ReadPrec AwsIamUserPolicy
readList :: ReadS [AwsIamUserPolicy]
$creadList :: ReadS [AwsIamUserPolicy]
readsPrec :: Int -> ReadS AwsIamUserPolicy
$creadsPrec :: Int -> ReadS AwsIamUserPolicy
Prelude.Read, Int -> AwsIamUserPolicy -> ShowS
[AwsIamUserPolicy] -> ShowS
AwsIamUserPolicy -> String
(Int -> AwsIamUserPolicy -> ShowS)
-> (AwsIamUserPolicy -> String)
-> ([AwsIamUserPolicy] -> ShowS)
-> Show AwsIamUserPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsIamUserPolicy] -> ShowS
$cshowList :: [AwsIamUserPolicy] -> ShowS
show :: AwsIamUserPolicy -> String
$cshow :: AwsIamUserPolicy -> String
showsPrec :: Int -> AwsIamUserPolicy -> ShowS
$cshowsPrec :: Int -> AwsIamUserPolicy -> ShowS
Prelude.Show, (forall x. AwsIamUserPolicy -> Rep AwsIamUserPolicy x)
-> (forall x. Rep AwsIamUserPolicy x -> AwsIamUserPolicy)
-> Generic AwsIamUserPolicy
forall x. Rep AwsIamUserPolicy x -> AwsIamUserPolicy
forall x. AwsIamUserPolicy -> Rep AwsIamUserPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AwsIamUserPolicy x -> AwsIamUserPolicy
$cfrom :: forall x. AwsIamUserPolicy -> Rep AwsIamUserPolicy x
Prelude.Generic)
newAwsIamUserPolicy ::
AwsIamUserPolicy
newAwsIamUserPolicy :: AwsIamUserPolicy
newAwsIamUserPolicy =
AwsIamUserPolicy' :: Maybe Text -> AwsIamUserPolicy
AwsIamUserPolicy' {$sel:policyName:AwsIamUserPolicy' :: Maybe Text
policyName = Maybe Text
forall a. Maybe a
Prelude.Nothing}
awsIamUserPolicy_policyName :: Lens.Lens' AwsIamUserPolicy (Prelude.Maybe Prelude.Text)
awsIamUserPolicy_policyName :: (Maybe Text -> f (Maybe Text))
-> AwsIamUserPolicy -> f AwsIamUserPolicy
awsIamUserPolicy_policyName = (AwsIamUserPolicy -> Maybe Text)
-> (AwsIamUserPolicy -> Maybe Text -> AwsIamUserPolicy)
-> Lens AwsIamUserPolicy AwsIamUserPolicy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamUserPolicy' {Maybe Text
policyName :: Maybe Text
$sel:policyName:AwsIamUserPolicy' :: AwsIamUserPolicy -> Maybe Text
policyName} -> Maybe Text
policyName) (\s :: AwsIamUserPolicy
s@AwsIamUserPolicy' {} Maybe Text
a -> AwsIamUserPolicy
s {$sel:policyName:AwsIamUserPolicy' :: Maybe Text
policyName = Maybe Text
a} :: AwsIamUserPolicy)
instance Core.FromJSON AwsIamUserPolicy where
parseJSON :: Value -> Parser AwsIamUserPolicy
parseJSON =
String
-> (Object -> Parser AwsIamUserPolicy)
-> Value
-> Parser AwsIamUserPolicy
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AwsIamUserPolicy"
( \Object
x ->
Maybe Text -> AwsIamUserPolicy
AwsIamUserPolicy'
(Maybe Text -> AwsIamUserPolicy)
-> Parser (Maybe Text) -> Parser AwsIamUserPolicy
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
"PolicyName")
)
instance Prelude.Hashable AwsIamUserPolicy
instance Prelude.NFData AwsIamUserPolicy
instance Core.ToJSON AwsIamUserPolicy where
toJSON :: AwsIamUserPolicy -> Value
toJSON AwsIamUserPolicy' {Maybe Text
policyName :: Maybe Text
$sel:policyName:AwsIamUserPolicy' :: AwsIamUserPolicy -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"PolicyName" 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
policyName]
)