{-# 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.CalculatedColumn where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data CalculatedColumn = CalculatedColumn'
{
CalculatedColumn -> Text
columnName :: Prelude.Text,
CalculatedColumn -> Text
columnId :: Prelude.Text,
CalculatedColumn -> Text
expression :: Prelude.Text
}
deriving (CalculatedColumn -> CalculatedColumn -> Bool
(CalculatedColumn -> CalculatedColumn -> Bool)
-> (CalculatedColumn -> CalculatedColumn -> Bool)
-> Eq CalculatedColumn
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CalculatedColumn -> CalculatedColumn -> Bool
$c/= :: CalculatedColumn -> CalculatedColumn -> Bool
== :: CalculatedColumn -> CalculatedColumn -> Bool
$c== :: CalculatedColumn -> CalculatedColumn -> Bool
Prelude.Eq, ReadPrec [CalculatedColumn]
ReadPrec CalculatedColumn
Int -> ReadS CalculatedColumn
ReadS [CalculatedColumn]
(Int -> ReadS CalculatedColumn)
-> ReadS [CalculatedColumn]
-> ReadPrec CalculatedColumn
-> ReadPrec [CalculatedColumn]
-> Read CalculatedColumn
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CalculatedColumn]
$creadListPrec :: ReadPrec [CalculatedColumn]
readPrec :: ReadPrec CalculatedColumn
$creadPrec :: ReadPrec CalculatedColumn
readList :: ReadS [CalculatedColumn]
$creadList :: ReadS [CalculatedColumn]
readsPrec :: Int -> ReadS CalculatedColumn
$creadsPrec :: Int -> ReadS CalculatedColumn
Prelude.Read, Int -> CalculatedColumn -> ShowS
[CalculatedColumn] -> ShowS
CalculatedColumn -> String
(Int -> CalculatedColumn -> ShowS)
-> (CalculatedColumn -> String)
-> ([CalculatedColumn] -> ShowS)
-> Show CalculatedColumn
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CalculatedColumn] -> ShowS
$cshowList :: [CalculatedColumn] -> ShowS
show :: CalculatedColumn -> String
$cshow :: CalculatedColumn -> String
showsPrec :: Int -> CalculatedColumn -> ShowS
$cshowsPrec :: Int -> CalculatedColumn -> ShowS
Prelude.Show, (forall x. CalculatedColumn -> Rep CalculatedColumn x)
-> (forall x. Rep CalculatedColumn x -> CalculatedColumn)
-> Generic CalculatedColumn
forall x. Rep CalculatedColumn x -> CalculatedColumn
forall x. CalculatedColumn -> Rep CalculatedColumn x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CalculatedColumn x -> CalculatedColumn
$cfrom :: forall x. CalculatedColumn -> Rep CalculatedColumn x
Prelude.Generic)
newCalculatedColumn ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CalculatedColumn
newCalculatedColumn :: Text -> Text -> Text -> CalculatedColumn
newCalculatedColumn
Text
pColumnName_
Text
pColumnId_
Text
pExpression_ =
CalculatedColumn' :: Text -> Text -> Text -> CalculatedColumn
CalculatedColumn'
{ $sel:columnName:CalculatedColumn' :: Text
columnName = Text
pColumnName_,
$sel:columnId:CalculatedColumn' :: Text
columnId = Text
pColumnId_,
$sel:expression:CalculatedColumn' :: Text
expression = Text
pExpression_
}
calculatedColumn_columnName :: Lens.Lens' CalculatedColumn Prelude.Text
calculatedColumn_columnName :: (Text -> f Text) -> CalculatedColumn -> f CalculatedColumn
calculatedColumn_columnName = (CalculatedColumn -> Text)
-> (CalculatedColumn -> Text -> CalculatedColumn)
-> Lens CalculatedColumn CalculatedColumn Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculatedColumn' {Text
columnName :: Text
$sel:columnName:CalculatedColumn' :: CalculatedColumn -> Text
columnName} -> Text
columnName) (\s :: CalculatedColumn
s@CalculatedColumn' {} Text
a -> CalculatedColumn
s {$sel:columnName:CalculatedColumn' :: Text
columnName = Text
a} :: CalculatedColumn)
calculatedColumn_columnId :: Lens.Lens' CalculatedColumn Prelude.Text
calculatedColumn_columnId :: (Text -> f Text) -> CalculatedColumn -> f CalculatedColumn
calculatedColumn_columnId = (CalculatedColumn -> Text)
-> (CalculatedColumn -> Text -> CalculatedColumn)
-> Lens CalculatedColumn CalculatedColumn Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculatedColumn' {Text
columnId :: Text
$sel:columnId:CalculatedColumn' :: CalculatedColumn -> Text
columnId} -> Text
columnId) (\s :: CalculatedColumn
s@CalculatedColumn' {} Text
a -> CalculatedColumn
s {$sel:columnId:CalculatedColumn' :: Text
columnId = Text
a} :: CalculatedColumn)
calculatedColumn_expression :: Lens.Lens' CalculatedColumn Prelude.Text
calculatedColumn_expression :: (Text -> f Text) -> CalculatedColumn -> f CalculatedColumn
calculatedColumn_expression = (CalculatedColumn -> Text)
-> (CalculatedColumn -> Text -> CalculatedColumn)
-> Lens CalculatedColumn CalculatedColumn Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CalculatedColumn' {Text
expression :: Text
$sel:expression:CalculatedColumn' :: CalculatedColumn -> Text
expression} -> Text
expression) (\s :: CalculatedColumn
s@CalculatedColumn' {} Text
a -> CalculatedColumn
s {$sel:expression:CalculatedColumn' :: Text
expression = Text
a} :: CalculatedColumn)
instance Core.FromJSON CalculatedColumn where
parseJSON :: Value -> Parser CalculatedColumn
parseJSON =
String
-> (Object -> Parser CalculatedColumn)
-> Value
-> Parser CalculatedColumn
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CalculatedColumn"
( \Object
x ->
Text -> Text -> Text -> CalculatedColumn
CalculatedColumn'
(Text -> Text -> Text -> CalculatedColumn)
-> Parser Text -> Parser (Text -> Text -> CalculatedColumn)
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
"ColumnName")
Parser (Text -> Text -> CalculatedColumn)
-> Parser Text -> Parser (Text -> CalculatedColumn)
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
"ColumnId")
Parser (Text -> CalculatedColumn)
-> Parser Text -> Parser CalculatedColumn
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
"Expression")
)
instance Prelude.Hashable CalculatedColumn
instance Prelude.NFData CalculatedColumn
instance Core.ToJSON CalculatedColumn where
toJSON :: CalculatedColumn -> Value
toJSON CalculatedColumn' {Text
expression :: Text
columnId :: Text
columnName :: Text
$sel:expression:CalculatedColumn' :: CalculatedColumn -> Text
$sel:columnId:CalculatedColumn' :: CalculatedColumn -> Text
$sel:columnName:CalculatedColumn' :: CalculatedColumn -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ColumnName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
columnName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ColumnId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
columnId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Expression" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
expression)
]
)