{-# 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.Budgets.Types.IamActionDefinition 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
data IamActionDefinition = IamActionDefinition'
{
IamActionDefinition -> Maybe (NonEmpty Text)
groups :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
IamActionDefinition -> Maybe (NonEmpty Text)
roles :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
IamActionDefinition -> Maybe (NonEmpty Text)
users :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
IamActionDefinition -> Text
policyArn :: Prelude.Text
}
deriving (IamActionDefinition -> IamActionDefinition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IamActionDefinition -> IamActionDefinition -> Bool
$c/= :: IamActionDefinition -> IamActionDefinition -> Bool
== :: IamActionDefinition -> IamActionDefinition -> Bool
$c== :: IamActionDefinition -> IamActionDefinition -> Bool
Prelude.Eq, ReadPrec [IamActionDefinition]
ReadPrec IamActionDefinition
Int -> ReadS IamActionDefinition
ReadS [IamActionDefinition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IamActionDefinition]
$creadListPrec :: ReadPrec [IamActionDefinition]
readPrec :: ReadPrec IamActionDefinition
$creadPrec :: ReadPrec IamActionDefinition
readList :: ReadS [IamActionDefinition]
$creadList :: ReadS [IamActionDefinition]
readsPrec :: Int -> ReadS IamActionDefinition
$creadsPrec :: Int -> ReadS IamActionDefinition
Prelude.Read, Int -> IamActionDefinition -> ShowS
[IamActionDefinition] -> ShowS
IamActionDefinition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IamActionDefinition] -> ShowS
$cshowList :: [IamActionDefinition] -> ShowS
show :: IamActionDefinition -> String
$cshow :: IamActionDefinition -> String
showsPrec :: Int -> IamActionDefinition -> ShowS
$cshowsPrec :: Int -> IamActionDefinition -> ShowS
Prelude.Show, forall x. Rep IamActionDefinition x -> IamActionDefinition
forall x. IamActionDefinition -> Rep IamActionDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IamActionDefinition x -> IamActionDefinition
$cfrom :: forall x. IamActionDefinition -> Rep IamActionDefinition x
Prelude.Generic)
newIamActionDefinition ::
Prelude.Text ->
IamActionDefinition
newIamActionDefinition :: Text -> IamActionDefinition
newIamActionDefinition Text
pPolicyArn_ =
IamActionDefinition'
{ $sel:groups:IamActionDefinition' :: Maybe (NonEmpty Text)
groups = forall a. Maybe a
Prelude.Nothing,
$sel:roles:IamActionDefinition' :: Maybe (NonEmpty Text)
roles = forall a. Maybe a
Prelude.Nothing,
$sel:users:IamActionDefinition' :: Maybe (NonEmpty Text)
users = forall a. Maybe a
Prelude.Nothing,
$sel:policyArn:IamActionDefinition' :: Text
policyArn = Text
pPolicyArn_
}
iamActionDefinition_groups :: Lens.Lens' IamActionDefinition (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
iamActionDefinition_groups :: Lens' IamActionDefinition (Maybe (NonEmpty Text))
iamActionDefinition_groups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IamActionDefinition' {Maybe (NonEmpty Text)
groups :: Maybe (NonEmpty Text)
$sel:groups:IamActionDefinition' :: IamActionDefinition -> Maybe (NonEmpty Text)
groups} -> Maybe (NonEmpty Text)
groups) (\s :: IamActionDefinition
s@IamActionDefinition' {} Maybe (NonEmpty Text)
a -> IamActionDefinition
s {$sel:groups:IamActionDefinition' :: Maybe (NonEmpty Text)
groups = Maybe (NonEmpty Text)
a} :: IamActionDefinition) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
iamActionDefinition_roles :: Lens.Lens' IamActionDefinition (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
iamActionDefinition_roles :: Lens' IamActionDefinition (Maybe (NonEmpty Text))
iamActionDefinition_roles = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IamActionDefinition' {Maybe (NonEmpty Text)
roles :: Maybe (NonEmpty Text)
$sel:roles:IamActionDefinition' :: IamActionDefinition -> Maybe (NonEmpty Text)
roles} -> Maybe (NonEmpty Text)
roles) (\s :: IamActionDefinition
s@IamActionDefinition' {} Maybe (NonEmpty Text)
a -> IamActionDefinition
s {$sel:roles:IamActionDefinition' :: Maybe (NonEmpty Text)
roles = Maybe (NonEmpty Text)
a} :: IamActionDefinition) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
iamActionDefinition_users :: Lens.Lens' IamActionDefinition (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
iamActionDefinition_users :: Lens' IamActionDefinition (Maybe (NonEmpty Text))
iamActionDefinition_users = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IamActionDefinition' {Maybe (NonEmpty Text)
users :: Maybe (NonEmpty Text)
$sel:users:IamActionDefinition' :: IamActionDefinition -> Maybe (NonEmpty Text)
users} -> Maybe (NonEmpty Text)
users) (\s :: IamActionDefinition
s@IamActionDefinition' {} Maybe (NonEmpty Text)
a -> IamActionDefinition
s {$sel:users:IamActionDefinition' :: Maybe (NonEmpty Text)
users = Maybe (NonEmpty Text)
a} :: IamActionDefinition) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
iamActionDefinition_policyArn :: Lens.Lens' IamActionDefinition Prelude.Text
iamActionDefinition_policyArn :: Lens' IamActionDefinition Text
iamActionDefinition_policyArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IamActionDefinition' {Text
policyArn :: Text
$sel:policyArn:IamActionDefinition' :: IamActionDefinition -> Text
policyArn} -> Text
policyArn) (\s :: IamActionDefinition
s@IamActionDefinition' {} Text
a -> IamActionDefinition
s {$sel:policyArn:IamActionDefinition' :: Text
policyArn = Text
a} :: IamActionDefinition)
instance Data.FromJSON IamActionDefinition where
parseJSON :: Value -> Parser IamActionDefinition
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"IamActionDefinition"
( \Object
x ->
Maybe (NonEmpty Text)
-> Maybe (NonEmpty Text)
-> Maybe (NonEmpty Text)
-> Text
-> IamActionDefinition
IamActionDefinition'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Groups")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Roles")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Users")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"PolicyArn")
)
instance Prelude.Hashable IamActionDefinition where
hashWithSalt :: Int -> IamActionDefinition -> Int
hashWithSalt Int
_salt IamActionDefinition' {Maybe (NonEmpty Text)
Text
policyArn :: Text
users :: Maybe (NonEmpty Text)
roles :: Maybe (NonEmpty Text)
groups :: Maybe (NonEmpty Text)
$sel:policyArn:IamActionDefinition' :: IamActionDefinition -> Text
$sel:users:IamActionDefinition' :: IamActionDefinition -> Maybe (NonEmpty Text)
$sel:roles:IamActionDefinition' :: IamActionDefinition -> Maybe (NonEmpty Text)
$sel:groups:IamActionDefinition' :: IamActionDefinition -> Maybe (NonEmpty Text)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
groups
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
roles
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
users
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
policyArn
instance Prelude.NFData IamActionDefinition where
rnf :: IamActionDefinition -> ()
rnf IamActionDefinition' {Maybe (NonEmpty Text)
Text
policyArn :: Text
users :: Maybe (NonEmpty Text)
roles :: Maybe (NonEmpty Text)
groups :: Maybe (NonEmpty Text)
$sel:policyArn:IamActionDefinition' :: IamActionDefinition -> Text
$sel:users:IamActionDefinition' :: IamActionDefinition -> Maybe (NonEmpty Text)
$sel:roles:IamActionDefinition' :: IamActionDefinition -> Maybe (NonEmpty Text)
$sel:groups:IamActionDefinition' :: IamActionDefinition -> Maybe (NonEmpty Text)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
groups
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
roles
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
users
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
policyArn
instance Data.ToJSON IamActionDefinition where
toJSON :: IamActionDefinition -> Value
toJSON IamActionDefinition' {Maybe (NonEmpty Text)
Text
policyArn :: Text
users :: Maybe (NonEmpty Text)
roles :: Maybe (NonEmpty Text)
groups :: Maybe (NonEmpty Text)
$sel:policyArn:IamActionDefinition' :: IamActionDefinition -> Text
$sel:users:IamActionDefinition' :: IamActionDefinition -> Maybe (NonEmpty Text)
$sel:roles:IamActionDefinition' :: IamActionDefinition -> Maybe (NonEmpty Text)
$sel:groups:IamActionDefinition' :: IamActionDefinition -> Maybe (NonEmpty Text)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Groups" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
groups,
(Key
"Roles" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
roles,
(Key
"Users" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
users,
forall a. a -> Maybe a
Prelude.Just (Key
"PolicyArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
policyArn)
]
)