{-# 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.Definition where
import Amazonka.Budgets.Types.IamActionDefinition
import Amazonka.Budgets.Types.ScpActionDefinition
import Amazonka.Budgets.Types.SsmActionDefinition
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Definition = Definition'
{
Definition -> Maybe ScpActionDefinition
scpActionDefinition :: Prelude.Maybe ScpActionDefinition,
Definition -> Maybe IamActionDefinition
iamActionDefinition :: Prelude.Maybe IamActionDefinition,
Definition -> Maybe SsmActionDefinition
ssmActionDefinition :: Prelude.Maybe SsmActionDefinition
}
deriving (Definition -> Definition -> Bool
(Definition -> Definition -> Bool)
-> (Definition -> Definition -> Bool) -> Eq Definition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Definition -> Definition -> Bool
$c/= :: Definition -> Definition -> Bool
== :: Definition -> Definition -> Bool
$c== :: Definition -> Definition -> Bool
Prelude.Eq, ReadPrec [Definition]
ReadPrec Definition
Int -> ReadS Definition
ReadS [Definition]
(Int -> ReadS Definition)
-> ReadS [Definition]
-> ReadPrec Definition
-> ReadPrec [Definition]
-> Read Definition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Definition]
$creadListPrec :: ReadPrec [Definition]
readPrec :: ReadPrec Definition
$creadPrec :: ReadPrec Definition
readList :: ReadS [Definition]
$creadList :: ReadS [Definition]
readsPrec :: Int -> ReadS Definition
$creadsPrec :: Int -> ReadS Definition
Prelude.Read, Int -> Definition -> ShowS
[Definition] -> ShowS
Definition -> String
(Int -> Definition -> ShowS)
-> (Definition -> String)
-> ([Definition] -> ShowS)
-> Show Definition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Definition] -> ShowS
$cshowList :: [Definition] -> ShowS
show :: Definition -> String
$cshow :: Definition -> String
showsPrec :: Int -> Definition -> ShowS
$cshowsPrec :: Int -> Definition -> ShowS
Prelude.Show, (forall x. Definition -> Rep Definition x)
-> (forall x. Rep Definition x -> Definition) -> Generic Definition
forall x. Rep Definition x -> Definition
forall x. Definition -> Rep Definition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Definition x -> Definition
$cfrom :: forall x. Definition -> Rep Definition x
Prelude.Generic)
newDefinition ::
Definition
newDefinition :: Definition
newDefinition =
Definition' :: Maybe ScpActionDefinition
-> Maybe IamActionDefinition
-> Maybe SsmActionDefinition
-> Definition
Definition'
{ $sel:scpActionDefinition:Definition' :: Maybe ScpActionDefinition
scpActionDefinition = Maybe ScpActionDefinition
forall a. Maybe a
Prelude.Nothing,
$sel:iamActionDefinition:Definition' :: Maybe IamActionDefinition
iamActionDefinition = Maybe IamActionDefinition
forall a. Maybe a
Prelude.Nothing,
$sel:ssmActionDefinition:Definition' :: Maybe SsmActionDefinition
ssmActionDefinition = Maybe SsmActionDefinition
forall a. Maybe a
Prelude.Nothing
}
definition_scpActionDefinition :: Lens.Lens' Definition (Prelude.Maybe ScpActionDefinition)
definition_scpActionDefinition :: (Maybe ScpActionDefinition -> f (Maybe ScpActionDefinition))
-> Definition -> f Definition
definition_scpActionDefinition = (Definition -> Maybe ScpActionDefinition)
-> (Definition -> Maybe ScpActionDefinition -> Definition)
-> Lens
Definition
Definition
(Maybe ScpActionDefinition)
(Maybe ScpActionDefinition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Definition' {Maybe ScpActionDefinition
scpActionDefinition :: Maybe ScpActionDefinition
$sel:scpActionDefinition:Definition' :: Definition -> Maybe ScpActionDefinition
scpActionDefinition} -> Maybe ScpActionDefinition
scpActionDefinition) (\s :: Definition
s@Definition' {} Maybe ScpActionDefinition
a -> Definition
s {$sel:scpActionDefinition:Definition' :: Maybe ScpActionDefinition
scpActionDefinition = Maybe ScpActionDefinition
a} :: Definition)
definition_iamActionDefinition :: Lens.Lens' Definition (Prelude.Maybe IamActionDefinition)
definition_iamActionDefinition :: (Maybe IamActionDefinition -> f (Maybe IamActionDefinition))
-> Definition -> f Definition
definition_iamActionDefinition = (Definition -> Maybe IamActionDefinition)
-> (Definition -> Maybe IamActionDefinition -> Definition)
-> Lens
Definition
Definition
(Maybe IamActionDefinition)
(Maybe IamActionDefinition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Definition' {Maybe IamActionDefinition
iamActionDefinition :: Maybe IamActionDefinition
$sel:iamActionDefinition:Definition' :: Definition -> Maybe IamActionDefinition
iamActionDefinition} -> Maybe IamActionDefinition
iamActionDefinition) (\s :: Definition
s@Definition' {} Maybe IamActionDefinition
a -> Definition
s {$sel:iamActionDefinition:Definition' :: Maybe IamActionDefinition
iamActionDefinition = Maybe IamActionDefinition
a} :: Definition)
definition_ssmActionDefinition :: Lens.Lens' Definition (Prelude.Maybe SsmActionDefinition)
definition_ssmActionDefinition :: (Maybe SsmActionDefinition -> f (Maybe SsmActionDefinition))
-> Definition -> f Definition
definition_ssmActionDefinition = (Definition -> Maybe SsmActionDefinition)
-> (Definition -> Maybe SsmActionDefinition -> Definition)
-> Lens
Definition
Definition
(Maybe SsmActionDefinition)
(Maybe SsmActionDefinition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Definition' {Maybe SsmActionDefinition
ssmActionDefinition :: Maybe SsmActionDefinition
$sel:ssmActionDefinition:Definition' :: Definition -> Maybe SsmActionDefinition
ssmActionDefinition} -> Maybe SsmActionDefinition
ssmActionDefinition) (\s :: Definition
s@Definition' {} Maybe SsmActionDefinition
a -> Definition
s {$sel:ssmActionDefinition:Definition' :: Maybe SsmActionDefinition
ssmActionDefinition = Maybe SsmActionDefinition
a} :: Definition)
instance Core.FromJSON Definition where
parseJSON :: Value -> Parser Definition
parseJSON =
String
-> (Object -> Parser Definition) -> Value -> Parser Definition
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Definition"
( \Object
x ->
Maybe ScpActionDefinition
-> Maybe IamActionDefinition
-> Maybe SsmActionDefinition
-> Definition
Definition'
(Maybe ScpActionDefinition
-> Maybe IamActionDefinition
-> Maybe SsmActionDefinition
-> Definition)
-> Parser (Maybe ScpActionDefinition)
-> Parser
(Maybe IamActionDefinition
-> Maybe SsmActionDefinition -> Definition)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ScpActionDefinition)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ScpActionDefinition")
Parser
(Maybe IamActionDefinition
-> Maybe SsmActionDefinition -> Definition)
-> Parser (Maybe IamActionDefinition)
-> Parser (Maybe SsmActionDefinition -> Definition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe IamActionDefinition)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IamActionDefinition")
Parser (Maybe SsmActionDefinition -> Definition)
-> Parser (Maybe SsmActionDefinition) -> Parser Definition
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SsmActionDefinition)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SsmActionDefinition")
)
instance Prelude.Hashable Definition
instance Prelude.NFData Definition
instance Core.ToJSON Definition where
toJSON :: Definition -> Value
toJSON Definition' {Maybe IamActionDefinition
Maybe ScpActionDefinition
Maybe SsmActionDefinition
ssmActionDefinition :: Maybe SsmActionDefinition
iamActionDefinition :: Maybe IamActionDefinition
scpActionDefinition :: Maybe ScpActionDefinition
$sel:ssmActionDefinition:Definition' :: Definition -> Maybe SsmActionDefinition
$sel:iamActionDefinition:Definition' :: Definition -> Maybe IamActionDefinition
$sel:scpActionDefinition:Definition' :: Definition -> Maybe ScpActionDefinition
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ScpActionDefinition" Text -> ScpActionDefinition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(ScpActionDefinition -> Pair)
-> Maybe ScpActionDefinition -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ScpActionDefinition
scpActionDefinition,
(Text
"IamActionDefinition" Text -> IamActionDefinition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(IamActionDefinition -> Pair)
-> Maybe IamActionDefinition -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe IamActionDefinition
iamActionDefinition,
(Text
"SsmActionDefinition" Text -> SsmActionDefinition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(SsmActionDefinition -> Pair)
-> Maybe SsmActionDefinition -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SsmActionDefinition
ssmActionDefinition
]
)