{-# 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.QuickSight.Types.VisualCustomAction 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
import Amazonka.QuickSight.Types.VisualCustomActionOperation
import Amazonka.QuickSight.Types.VisualCustomActionTrigger
import Amazonka.QuickSight.Types.WidgetStatus
data VisualCustomAction = VisualCustomAction'
{
VisualCustomAction -> Maybe WidgetStatus
status :: Prelude.Maybe WidgetStatus,
VisualCustomAction -> Text
customActionId :: Prelude.Text,
VisualCustomAction -> Text
name :: Prelude.Text,
VisualCustomAction -> VisualCustomActionTrigger
trigger :: VisualCustomActionTrigger,
VisualCustomAction -> NonEmpty VisualCustomActionOperation
actionOperations :: Prelude.NonEmpty VisualCustomActionOperation
}
deriving (VisualCustomAction -> VisualCustomAction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VisualCustomAction -> VisualCustomAction -> Bool
$c/= :: VisualCustomAction -> VisualCustomAction -> Bool
== :: VisualCustomAction -> VisualCustomAction -> Bool
$c== :: VisualCustomAction -> VisualCustomAction -> Bool
Prelude.Eq, Int -> VisualCustomAction -> ShowS
[VisualCustomAction] -> ShowS
VisualCustomAction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VisualCustomAction] -> ShowS
$cshowList :: [VisualCustomAction] -> ShowS
show :: VisualCustomAction -> String
$cshow :: VisualCustomAction -> String
showsPrec :: Int -> VisualCustomAction -> ShowS
$cshowsPrec :: Int -> VisualCustomAction -> ShowS
Prelude.Show, forall x. Rep VisualCustomAction x -> VisualCustomAction
forall x. VisualCustomAction -> Rep VisualCustomAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VisualCustomAction x -> VisualCustomAction
$cfrom :: forall x. VisualCustomAction -> Rep VisualCustomAction x
Prelude.Generic)
newVisualCustomAction ::
Prelude.Text ->
Prelude.Text ->
VisualCustomActionTrigger ->
Prelude.NonEmpty VisualCustomActionOperation ->
VisualCustomAction
newVisualCustomAction :: Text
-> Text
-> VisualCustomActionTrigger
-> NonEmpty VisualCustomActionOperation
-> VisualCustomAction
newVisualCustomAction
Text
pCustomActionId_
Text
pName_
VisualCustomActionTrigger
pTrigger_
NonEmpty VisualCustomActionOperation
pActionOperations_ =
VisualCustomAction'
{ $sel:status:VisualCustomAction' :: Maybe WidgetStatus
status = forall a. Maybe a
Prelude.Nothing,
$sel:customActionId:VisualCustomAction' :: Text
customActionId = Text
pCustomActionId_,
$sel:name:VisualCustomAction' :: Text
name = Text
pName_,
$sel:trigger:VisualCustomAction' :: VisualCustomActionTrigger
trigger = VisualCustomActionTrigger
pTrigger_,
$sel:actionOperations:VisualCustomAction' :: NonEmpty VisualCustomActionOperation
actionOperations =
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty VisualCustomActionOperation
pActionOperations_
}
visualCustomAction_status :: Lens.Lens' VisualCustomAction (Prelude.Maybe WidgetStatus)
visualCustomAction_status :: Lens' VisualCustomAction (Maybe WidgetStatus)
visualCustomAction_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VisualCustomAction' {Maybe WidgetStatus
status :: Maybe WidgetStatus
$sel:status:VisualCustomAction' :: VisualCustomAction -> Maybe WidgetStatus
status} -> Maybe WidgetStatus
status) (\s :: VisualCustomAction
s@VisualCustomAction' {} Maybe WidgetStatus
a -> VisualCustomAction
s {$sel:status:VisualCustomAction' :: Maybe WidgetStatus
status = Maybe WidgetStatus
a} :: VisualCustomAction)
visualCustomAction_customActionId :: Lens.Lens' VisualCustomAction Prelude.Text
visualCustomAction_customActionId :: Lens' VisualCustomAction Text
visualCustomAction_customActionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VisualCustomAction' {Text
customActionId :: Text
$sel:customActionId:VisualCustomAction' :: VisualCustomAction -> Text
customActionId} -> Text
customActionId) (\s :: VisualCustomAction
s@VisualCustomAction' {} Text
a -> VisualCustomAction
s {$sel:customActionId:VisualCustomAction' :: Text
customActionId = Text
a} :: VisualCustomAction)
visualCustomAction_name :: Lens.Lens' VisualCustomAction Prelude.Text
visualCustomAction_name :: Lens' VisualCustomAction Text
visualCustomAction_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VisualCustomAction' {Text
name :: Text
$sel:name:VisualCustomAction' :: VisualCustomAction -> Text
name} -> Text
name) (\s :: VisualCustomAction
s@VisualCustomAction' {} Text
a -> VisualCustomAction
s {$sel:name:VisualCustomAction' :: Text
name = Text
a} :: VisualCustomAction)
visualCustomAction_trigger :: Lens.Lens' VisualCustomAction VisualCustomActionTrigger
visualCustomAction_trigger :: Lens' VisualCustomAction VisualCustomActionTrigger
visualCustomAction_trigger = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VisualCustomAction' {VisualCustomActionTrigger
trigger :: VisualCustomActionTrigger
$sel:trigger:VisualCustomAction' :: VisualCustomAction -> VisualCustomActionTrigger
trigger} -> VisualCustomActionTrigger
trigger) (\s :: VisualCustomAction
s@VisualCustomAction' {} VisualCustomActionTrigger
a -> VisualCustomAction
s {$sel:trigger:VisualCustomAction' :: VisualCustomActionTrigger
trigger = VisualCustomActionTrigger
a} :: VisualCustomAction)
visualCustomAction_actionOperations :: Lens.Lens' VisualCustomAction (Prelude.NonEmpty VisualCustomActionOperation)
visualCustomAction_actionOperations :: Lens' VisualCustomAction (NonEmpty VisualCustomActionOperation)
visualCustomAction_actionOperations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VisualCustomAction' {NonEmpty VisualCustomActionOperation
actionOperations :: NonEmpty VisualCustomActionOperation
$sel:actionOperations:VisualCustomAction' :: VisualCustomAction -> NonEmpty VisualCustomActionOperation
actionOperations} -> NonEmpty VisualCustomActionOperation
actionOperations) (\s :: VisualCustomAction
s@VisualCustomAction' {} NonEmpty VisualCustomActionOperation
a -> VisualCustomAction
s {$sel:actionOperations:VisualCustomAction' :: NonEmpty VisualCustomActionOperation
actionOperations = NonEmpty VisualCustomActionOperation
a} :: VisualCustomAction) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON VisualCustomAction where
parseJSON :: Value -> Parser VisualCustomAction
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"VisualCustomAction"
( \Object
x ->
Maybe WidgetStatus
-> Text
-> Text
-> VisualCustomActionTrigger
-> NonEmpty VisualCustomActionOperation
-> VisualCustomAction
VisualCustomAction'
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
"Status")
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
"CustomActionId")
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
"Name")
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
"Trigger")
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
"ActionOperations")
)
instance Prelude.Hashable VisualCustomAction where
hashWithSalt :: Int -> VisualCustomAction -> Int
hashWithSalt Int
_salt VisualCustomAction' {Maybe WidgetStatus
NonEmpty VisualCustomActionOperation
Text
VisualCustomActionTrigger
actionOperations :: NonEmpty VisualCustomActionOperation
trigger :: VisualCustomActionTrigger
name :: Text
customActionId :: Text
status :: Maybe WidgetStatus
$sel:actionOperations:VisualCustomAction' :: VisualCustomAction -> NonEmpty VisualCustomActionOperation
$sel:trigger:VisualCustomAction' :: VisualCustomAction -> VisualCustomActionTrigger
$sel:name:VisualCustomAction' :: VisualCustomAction -> Text
$sel:customActionId:VisualCustomAction' :: VisualCustomAction -> Text
$sel:status:VisualCustomAction' :: VisualCustomAction -> Maybe WidgetStatus
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe WidgetStatus
status
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
customActionId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` VisualCustomActionTrigger
trigger
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty VisualCustomActionOperation
actionOperations
instance Prelude.NFData VisualCustomAction where
rnf :: VisualCustomAction -> ()
rnf VisualCustomAction' {Maybe WidgetStatus
NonEmpty VisualCustomActionOperation
Text
VisualCustomActionTrigger
actionOperations :: NonEmpty VisualCustomActionOperation
trigger :: VisualCustomActionTrigger
name :: Text
customActionId :: Text
status :: Maybe WidgetStatus
$sel:actionOperations:VisualCustomAction' :: VisualCustomAction -> NonEmpty VisualCustomActionOperation
$sel:trigger:VisualCustomAction' :: VisualCustomAction -> VisualCustomActionTrigger
$sel:name:VisualCustomAction' :: VisualCustomAction -> Text
$sel:customActionId:VisualCustomAction' :: VisualCustomAction -> Text
$sel:status:VisualCustomAction' :: VisualCustomAction -> Maybe WidgetStatus
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe WidgetStatus
status
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
customActionId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf VisualCustomActionTrigger
trigger
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty VisualCustomActionOperation
actionOperations
instance Data.ToJSON VisualCustomAction where
toJSON :: VisualCustomAction -> Value
toJSON VisualCustomAction' {Maybe WidgetStatus
NonEmpty VisualCustomActionOperation
Text
VisualCustomActionTrigger
actionOperations :: NonEmpty VisualCustomActionOperation
trigger :: VisualCustomActionTrigger
name :: Text
customActionId :: Text
status :: Maybe WidgetStatus
$sel:actionOperations:VisualCustomAction' :: VisualCustomAction -> NonEmpty VisualCustomActionOperation
$sel:trigger:VisualCustomAction' :: VisualCustomAction -> VisualCustomActionTrigger
$sel:name:VisualCustomAction' :: VisualCustomAction -> Text
$sel:customActionId:VisualCustomAction' :: VisualCustomAction -> Text
$sel:status:VisualCustomAction' :: VisualCustomAction -> Maybe WidgetStatus
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Status" 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 WidgetStatus
status,
forall a. a -> Maybe a
Prelude.Just
(Key
"CustomActionId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
customActionId),
forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just (Key
"Trigger" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= VisualCustomActionTrigger
trigger),
forall a. a -> Maybe a
Prelude.Just
(Key
"ActionOperations" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty VisualCustomActionOperation
actionOperations)
]
)