{-# 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.Action where
import Amazonka.Budgets.Types.ActionStatus
import Amazonka.Budgets.Types.ActionThreshold
import Amazonka.Budgets.Types.ActionType
import Amazonka.Budgets.Types.ApprovalModel
import Amazonka.Budgets.Types.Definition
import Amazonka.Budgets.Types.NotificationType
import Amazonka.Budgets.Types.Subscriber
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Action = Action'
{
Action -> Text
actionId :: Prelude.Text,
Action -> Text
budgetName :: Prelude.Text,
Action -> NotificationType
notificationType :: NotificationType,
Action -> ActionType
actionType :: ActionType,
Action -> ActionThreshold
actionThreshold :: ActionThreshold,
Action -> Definition
definition :: Definition,
Action -> Text
executionRoleArn :: Prelude.Text,
Action -> ApprovalModel
approvalModel :: ApprovalModel,
Action -> ActionStatus
status :: ActionStatus,
Action -> NonEmpty Subscriber
subscribers :: Prelude.NonEmpty Subscriber
}
deriving (Action -> Action -> Bool
(Action -> Action -> Bool)
-> (Action -> Action -> Bool) -> Eq Action
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Action -> Action -> Bool
$c/= :: Action -> Action -> Bool
== :: Action -> Action -> Bool
$c== :: Action -> Action -> Bool
Prelude.Eq, Int -> Action -> ShowS
[Action] -> ShowS
Action -> String
(Int -> Action -> ShowS)
-> (Action -> String) -> ([Action] -> ShowS) -> Show Action
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Action] -> ShowS
$cshowList :: [Action] -> ShowS
show :: Action -> String
$cshow :: Action -> String
showsPrec :: Int -> Action -> ShowS
$cshowsPrec :: Int -> Action -> ShowS
Prelude.Show, (forall x. Action -> Rep Action x)
-> (forall x. Rep Action x -> Action) -> Generic Action
forall x. Rep Action x -> Action
forall x. Action -> Rep Action x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Action x -> Action
$cfrom :: forall x. Action -> Rep Action x
Prelude.Generic)
newAction ::
Prelude.Text ->
Prelude.Text ->
NotificationType ->
ActionType ->
ActionThreshold ->
Definition ->
Prelude.Text ->
ApprovalModel ->
ActionStatus ->
Prelude.NonEmpty Subscriber ->
Action
newAction :: Text
-> Text
-> NotificationType
-> ActionType
-> ActionThreshold
-> Definition
-> Text
-> ApprovalModel
-> ActionStatus
-> NonEmpty Subscriber
-> Action
newAction
Text
pActionId_
Text
pBudgetName_
NotificationType
pNotificationType_
ActionType
pActionType_
ActionThreshold
pActionThreshold_
Definition
pDefinition_
Text
pExecutionRoleArn_
ApprovalModel
pApprovalModel_
ActionStatus
pStatus_
NonEmpty Subscriber
pSubscribers_ =
Action' :: Text
-> Text
-> NotificationType
-> ActionType
-> ActionThreshold
-> Definition
-> Text
-> ApprovalModel
-> ActionStatus
-> NonEmpty Subscriber
-> Action
Action'
{ $sel:actionId:Action' :: Text
actionId = Text
pActionId_,
$sel:budgetName:Action' :: Text
budgetName = Text
pBudgetName_,
$sel:notificationType:Action' :: NotificationType
notificationType = NotificationType
pNotificationType_,
$sel:actionType:Action' :: ActionType
actionType = ActionType
pActionType_,
$sel:actionThreshold:Action' :: ActionThreshold
actionThreshold = ActionThreshold
pActionThreshold_,
$sel:definition:Action' :: Definition
definition = Definition
pDefinition_,
$sel:executionRoleArn:Action' :: Text
executionRoleArn = Text
pExecutionRoleArn_,
$sel:approvalModel:Action' :: ApprovalModel
approvalModel = ApprovalModel
pApprovalModel_,
$sel:status:Action' :: ActionStatus
status = ActionStatus
pStatus_,
$sel:subscribers:Action' :: NonEmpty Subscriber
subscribers = Tagged (NonEmpty Subscriber) (Identity (NonEmpty Subscriber))
-> Tagged (NonEmpty Subscriber) (Identity (NonEmpty Subscriber))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Subscriber) (Identity (NonEmpty Subscriber))
-> Tagged (NonEmpty Subscriber) (Identity (NonEmpty Subscriber)))
-> NonEmpty Subscriber -> NonEmpty Subscriber
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Subscriber
pSubscribers_
}
action_actionId :: Lens.Lens' Action Prelude.Text
action_actionId :: (Text -> f Text) -> Action -> f Action
action_actionId = (Action -> Text)
-> (Action -> Text -> Action) -> Lens Action Action Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {Text
actionId :: Text
$sel:actionId:Action' :: Action -> Text
actionId} -> Text
actionId) (\s :: Action
s@Action' {} Text
a -> Action
s {$sel:actionId:Action' :: Text
actionId = Text
a} :: Action)
action_budgetName :: Lens.Lens' Action Prelude.Text
action_budgetName :: (Text -> f Text) -> Action -> f Action
action_budgetName = (Action -> Text)
-> (Action -> Text -> Action) -> Lens Action Action Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {Text
budgetName :: Text
$sel:budgetName:Action' :: Action -> Text
budgetName} -> Text
budgetName) (\s :: Action
s@Action' {} Text
a -> Action
s {$sel:budgetName:Action' :: Text
budgetName = Text
a} :: Action)
action_notificationType :: Lens.Lens' Action NotificationType
action_notificationType :: (NotificationType -> f NotificationType) -> Action -> f Action
action_notificationType = (Action -> NotificationType)
-> (Action -> NotificationType -> Action)
-> Lens Action Action NotificationType NotificationType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {NotificationType
notificationType :: NotificationType
$sel:notificationType:Action' :: Action -> NotificationType
notificationType} -> NotificationType
notificationType) (\s :: Action
s@Action' {} NotificationType
a -> Action
s {$sel:notificationType:Action' :: NotificationType
notificationType = NotificationType
a} :: Action)
action_actionType :: Lens.Lens' Action ActionType
action_actionType :: (ActionType -> f ActionType) -> Action -> f Action
action_actionType = (Action -> ActionType)
-> (Action -> ActionType -> Action)
-> Lens Action Action ActionType ActionType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {ActionType
actionType :: ActionType
$sel:actionType:Action' :: Action -> ActionType
actionType} -> ActionType
actionType) (\s :: Action
s@Action' {} ActionType
a -> Action
s {$sel:actionType:Action' :: ActionType
actionType = ActionType
a} :: Action)
action_actionThreshold :: Lens.Lens' Action ActionThreshold
action_actionThreshold :: (ActionThreshold -> f ActionThreshold) -> Action -> f Action
action_actionThreshold = (Action -> ActionThreshold)
-> (Action -> ActionThreshold -> Action)
-> Lens Action Action ActionThreshold ActionThreshold
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {ActionThreshold
actionThreshold :: ActionThreshold
$sel:actionThreshold:Action' :: Action -> ActionThreshold
actionThreshold} -> ActionThreshold
actionThreshold) (\s :: Action
s@Action' {} ActionThreshold
a -> Action
s {$sel:actionThreshold:Action' :: ActionThreshold
actionThreshold = ActionThreshold
a} :: Action)
action_definition :: Lens.Lens' Action Definition
action_definition :: (Definition -> f Definition) -> Action -> f Action
action_definition = (Action -> Definition)
-> (Action -> Definition -> Action)
-> Lens Action Action Definition Definition
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {Definition
definition :: Definition
$sel:definition:Action' :: Action -> Definition
definition} -> Definition
definition) (\s :: Action
s@Action' {} Definition
a -> Action
s {$sel:definition:Action' :: Definition
definition = Definition
a} :: Action)
action_executionRoleArn :: Lens.Lens' Action Prelude.Text
action_executionRoleArn :: (Text -> f Text) -> Action -> f Action
action_executionRoleArn = (Action -> Text)
-> (Action -> Text -> Action) -> Lens Action Action Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {Text
executionRoleArn :: Text
$sel:executionRoleArn:Action' :: Action -> Text
executionRoleArn} -> Text
executionRoleArn) (\s :: Action
s@Action' {} Text
a -> Action
s {$sel:executionRoleArn:Action' :: Text
executionRoleArn = Text
a} :: Action)
action_approvalModel :: Lens.Lens' Action ApprovalModel
action_approvalModel :: (ApprovalModel -> f ApprovalModel) -> Action -> f Action
action_approvalModel = (Action -> ApprovalModel)
-> (Action -> ApprovalModel -> Action)
-> Lens Action Action ApprovalModel ApprovalModel
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {ApprovalModel
approvalModel :: ApprovalModel
$sel:approvalModel:Action' :: Action -> ApprovalModel
approvalModel} -> ApprovalModel
approvalModel) (\s :: Action
s@Action' {} ApprovalModel
a -> Action
s {$sel:approvalModel:Action' :: ApprovalModel
approvalModel = ApprovalModel
a} :: Action)
action_status :: Lens.Lens' Action ActionStatus
action_status :: (ActionStatus -> f ActionStatus) -> Action -> f Action
action_status = (Action -> ActionStatus)
-> (Action -> ActionStatus -> Action)
-> Lens Action Action ActionStatus ActionStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {ActionStatus
status :: ActionStatus
$sel:status:Action' :: Action -> ActionStatus
status} -> ActionStatus
status) (\s :: Action
s@Action' {} ActionStatus
a -> Action
s {$sel:status:Action' :: ActionStatus
status = ActionStatus
a} :: Action)
action_subscribers :: Lens.Lens' Action (Prelude.NonEmpty Subscriber)
action_subscribers :: (NonEmpty Subscriber -> f (NonEmpty Subscriber))
-> Action -> f Action
action_subscribers = (Action -> NonEmpty Subscriber)
-> (Action -> NonEmpty Subscriber -> Action)
-> Lens Action Action (NonEmpty Subscriber) (NonEmpty Subscriber)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {NonEmpty Subscriber
subscribers :: NonEmpty Subscriber
$sel:subscribers:Action' :: Action -> NonEmpty Subscriber
subscribers} -> NonEmpty Subscriber
subscribers) (\s :: Action
s@Action' {} NonEmpty Subscriber
a -> Action
s {$sel:subscribers:Action' :: NonEmpty Subscriber
subscribers = NonEmpty Subscriber
a} :: Action) ((NonEmpty Subscriber -> f (NonEmpty Subscriber))
-> Action -> f Action)
-> ((NonEmpty Subscriber -> f (NonEmpty Subscriber))
-> NonEmpty Subscriber -> f (NonEmpty Subscriber))
-> (NonEmpty Subscriber -> f (NonEmpty Subscriber))
-> Action
-> f Action
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Subscriber -> f (NonEmpty Subscriber))
-> NonEmpty Subscriber -> f (NonEmpty Subscriber)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON Action where
parseJSON :: Value -> Parser Action
parseJSON =
String -> (Object -> Parser Action) -> Value -> Parser Action
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Action"
( \Object
x ->
Text
-> Text
-> NotificationType
-> ActionType
-> ActionThreshold
-> Definition
-> Text
-> ApprovalModel
-> ActionStatus
-> NonEmpty Subscriber
-> Action
Action'
(Text
-> Text
-> NotificationType
-> ActionType
-> ActionThreshold
-> Definition
-> Text
-> ApprovalModel
-> ActionStatus
-> NonEmpty Subscriber
-> Action)
-> Parser Text
-> Parser
(Text
-> NotificationType
-> ActionType
-> ActionThreshold
-> Definition
-> Text
-> ApprovalModel
-> ActionStatus
-> NonEmpty Subscriber
-> Action)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ActionId")
Parser
(Text
-> NotificationType
-> ActionType
-> ActionThreshold
-> Definition
-> Text
-> ApprovalModel
-> ActionStatus
-> NonEmpty Subscriber
-> Action)
-> Parser Text
-> Parser
(NotificationType
-> ActionType
-> ActionThreshold
-> Definition
-> Text
-> ApprovalModel
-> ActionStatus
-> NonEmpty Subscriber
-> Action)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"BudgetName")
Parser
(NotificationType
-> ActionType
-> ActionThreshold
-> Definition
-> Text
-> ApprovalModel
-> ActionStatus
-> NonEmpty Subscriber
-> Action)
-> Parser NotificationType
-> Parser
(ActionType
-> ActionThreshold
-> Definition
-> Text
-> ApprovalModel
-> ActionStatus
-> NonEmpty Subscriber
-> Action)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser NotificationType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"NotificationType")
Parser
(ActionType
-> ActionThreshold
-> Definition
-> Text
-> ApprovalModel
-> ActionStatus
-> NonEmpty Subscriber
-> Action)
-> Parser ActionType
-> Parser
(ActionThreshold
-> Definition
-> Text
-> ApprovalModel
-> ActionStatus
-> NonEmpty Subscriber
-> Action)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ActionType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ActionType")
Parser
(ActionThreshold
-> Definition
-> Text
-> ApprovalModel
-> ActionStatus
-> NonEmpty Subscriber
-> Action)
-> Parser ActionThreshold
-> Parser
(Definition
-> Text
-> ApprovalModel
-> ActionStatus
-> NonEmpty Subscriber
-> Action)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ActionThreshold
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ActionThreshold")
Parser
(Definition
-> Text
-> ApprovalModel
-> ActionStatus
-> NonEmpty Subscriber
-> Action)
-> Parser Definition
-> Parser
(Text
-> ApprovalModel -> ActionStatus -> NonEmpty Subscriber -> Action)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Definition
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Definition")
Parser
(Text
-> ApprovalModel -> ActionStatus -> NonEmpty Subscriber -> Action)
-> Parser Text
-> Parser
(ApprovalModel -> ActionStatus -> NonEmpty Subscriber -> Action)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ExecutionRoleArn")
Parser
(ApprovalModel -> ActionStatus -> NonEmpty Subscriber -> Action)
-> Parser ApprovalModel
-> Parser (ActionStatus -> NonEmpty Subscriber -> Action)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ApprovalModel
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"ApprovalModel")
Parser (ActionStatus -> NonEmpty Subscriber -> Action)
-> Parser ActionStatus -> Parser (NonEmpty Subscriber -> Action)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ActionStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Status")
Parser (NonEmpty Subscriber -> Action)
-> Parser (NonEmpty Subscriber) -> Parser Action
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty Subscriber)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Subscribers")
)
instance Prelude.Hashable Action
instance Prelude.NFData Action