{-# 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.CastColumnTypeOperation where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types.ColumnDataType
data CastColumnTypeOperation = CastColumnTypeOperation'
{
CastColumnTypeOperation -> Maybe Text
format :: Prelude.Maybe Prelude.Text,
CastColumnTypeOperation -> Text
columnName :: Prelude.Text,
CastColumnTypeOperation -> ColumnDataType
newColumnType' :: ColumnDataType
}
deriving (CastColumnTypeOperation -> CastColumnTypeOperation -> Bool
(CastColumnTypeOperation -> CastColumnTypeOperation -> Bool)
-> (CastColumnTypeOperation -> CastColumnTypeOperation -> Bool)
-> Eq CastColumnTypeOperation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CastColumnTypeOperation -> CastColumnTypeOperation -> Bool
$c/= :: CastColumnTypeOperation -> CastColumnTypeOperation -> Bool
== :: CastColumnTypeOperation -> CastColumnTypeOperation -> Bool
$c== :: CastColumnTypeOperation -> CastColumnTypeOperation -> Bool
Prelude.Eq, ReadPrec [CastColumnTypeOperation]
ReadPrec CastColumnTypeOperation
Int -> ReadS CastColumnTypeOperation
ReadS [CastColumnTypeOperation]
(Int -> ReadS CastColumnTypeOperation)
-> ReadS [CastColumnTypeOperation]
-> ReadPrec CastColumnTypeOperation
-> ReadPrec [CastColumnTypeOperation]
-> Read CastColumnTypeOperation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CastColumnTypeOperation]
$creadListPrec :: ReadPrec [CastColumnTypeOperation]
readPrec :: ReadPrec CastColumnTypeOperation
$creadPrec :: ReadPrec CastColumnTypeOperation
readList :: ReadS [CastColumnTypeOperation]
$creadList :: ReadS [CastColumnTypeOperation]
readsPrec :: Int -> ReadS CastColumnTypeOperation
$creadsPrec :: Int -> ReadS CastColumnTypeOperation
Prelude.Read, Int -> CastColumnTypeOperation -> ShowS
[CastColumnTypeOperation] -> ShowS
CastColumnTypeOperation -> String
(Int -> CastColumnTypeOperation -> ShowS)
-> (CastColumnTypeOperation -> String)
-> ([CastColumnTypeOperation] -> ShowS)
-> Show CastColumnTypeOperation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CastColumnTypeOperation] -> ShowS
$cshowList :: [CastColumnTypeOperation] -> ShowS
show :: CastColumnTypeOperation -> String
$cshow :: CastColumnTypeOperation -> String
showsPrec :: Int -> CastColumnTypeOperation -> ShowS
$cshowsPrec :: Int -> CastColumnTypeOperation -> ShowS
Prelude.Show, (forall x.
CastColumnTypeOperation -> Rep CastColumnTypeOperation x)
-> (forall x.
Rep CastColumnTypeOperation x -> CastColumnTypeOperation)
-> Generic CastColumnTypeOperation
forall x. Rep CastColumnTypeOperation x -> CastColumnTypeOperation
forall x. CastColumnTypeOperation -> Rep CastColumnTypeOperation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CastColumnTypeOperation x -> CastColumnTypeOperation
$cfrom :: forall x. CastColumnTypeOperation -> Rep CastColumnTypeOperation x
Prelude.Generic)
newCastColumnTypeOperation ::
Prelude.Text ->
ColumnDataType ->
CastColumnTypeOperation
newCastColumnTypeOperation :: Text -> ColumnDataType -> CastColumnTypeOperation
newCastColumnTypeOperation
Text
pColumnName_
ColumnDataType
pNewColumnType_ =
CastColumnTypeOperation' :: Maybe Text -> Text -> ColumnDataType -> CastColumnTypeOperation
CastColumnTypeOperation'
{ $sel:format:CastColumnTypeOperation' :: Maybe Text
format = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:columnName:CastColumnTypeOperation' :: Text
columnName = Text
pColumnName_,
$sel:newColumnType':CastColumnTypeOperation' :: ColumnDataType
newColumnType' = ColumnDataType
pNewColumnType_
}
castColumnTypeOperation_format :: Lens.Lens' CastColumnTypeOperation (Prelude.Maybe Prelude.Text)
castColumnTypeOperation_format :: (Maybe Text -> f (Maybe Text))
-> CastColumnTypeOperation -> f CastColumnTypeOperation
castColumnTypeOperation_format = (CastColumnTypeOperation -> Maybe Text)
-> (CastColumnTypeOperation
-> Maybe Text -> CastColumnTypeOperation)
-> Lens
CastColumnTypeOperation
CastColumnTypeOperation
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CastColumnTypeOperation' {Maybe Text
format :: Maybe Text
$sel:format:CastColumnTypeOperation' :: CastColumnTypeOperation -> Maybe Text
format} -> Maybe Text
format) (\s :: CastColumnTypeOperation
s@CastColumnTypeOperation' {} Maybe Text
a -> CastColumnTypeOperation
s {$sel:format:CastColumnTypeOperation' :: Maybe Text
format = Maybe Text
a} :: CastColumnTypeOperation)
castColumnTypeOperation_columnName :: Lens.Lens' CastColumnTypeOperation Prelude.Text
castColumnTypeOperation_columnName :: (Text -> f Text)
-> CastColumnTypeOperation -> f CastColumnTypeOperation
castColumnTypeOperation_columnName = (CastColumnTypeOperation -> Text)
-> (CastColumnTypeOperation -> Text -> CastColumnTypeOperation)
-> Lens CastColumnTypeOperation CastColumnTypeOperation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CastColumnTypeOperation' {Text
columnName :: Text
$sel:columnName:CastColumnTypeOperation' :: CastColumnTypeOperation -> Text
columnName} -> Text
columnName) (\s :: CastColumnTypeOperation
s@CastColumnTypeOperation' {} Text
a -> CastColumnTypeOperation
s {$sel:columnName:CastColumnTypeOperation' :: Text
columnName = Text
a} :: CastColumnTypeOperation)
castColumnTypeOperation_newColumnType :: Lens.Lens' CastColumnTypeOperation ColumnDataType
castColumnTypeOperation_newColumnType :: (ColumnDataType -> f ColumnDataType)
-> CastColumnTypeOperation -> f CastColumnTypeOperation
castColumnTypeOperation_newColumnType = (CastColumnTypeOperation -> ColumnDataType)
-> (CastColumnTypeOperation
-> ColumnDataType -> CastColumnTypeOperation)
-> Lens
CastColumnTypeOperation
CastColumnTypeOperation
ColumnDataType
ColumnDataType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CastColumnTypeOperation' {ColumnDataType
newColumnType' :: ColumnDataType
$sel:newColumnType':CastColumnTypeOperation' :: CastColumnTypeOperation -> ColumnDataType
newColumnType'} -> ColumnDataType
newColumnType') (\s :: CastColumnTypeOperation
s@CastColumnTypeOperation' {} ColumnDataType
a -> CastColumnTypeOperation
s {$sel:newColumnType':CastColumnTypeOperation' :: ColumnDataType
newColumnType' = ColumnDataType
a} :: CastColumnTypeOperation)
instance Core.FromJSON CastColumnTypeOperation where
parseJSON :: Value -> Parser CastColumnTypeOperation
parseJSON =
String
-> (Object -> Parser CastColumnTypeOperation)
-> Value
-> Parser CastColumnTypeOperation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"CastColumnTypeOperation"
( \Object
x ->
Maybe Text -> Text -> ColumnDataType -> CastColumnTypeOperation
CastColumnTypeOperation'
(Maybe Text -> Text -> ColumnDataType -> CastColumnTypeOperation)
-> Parser (Maybe Text)
-> Parser (Text -> ColumnDataType -> CastColumnTypeOperation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Format")
Parser (Text -> ColumnDataType -> CastColumnTypeOperation)
-> Parser Text
-> Parser (ColumnDataType -> CastColumnTypeOperation)
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
"ColumnName")
Parser (ColumnDataType -> CastColumnTypeOperation)
-> Parser ColumnDataType -> Parser CastColumnTypeOperation
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser ColumnDataType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"NewColumnType")
)
instance Prelude.Hashable CastColumnTypeOperation
instance Prelude.NFData CastColumnTypeOperation
instance Core.ToJSON CastColumnTypeOperation where
toJSON :: CastColumnTypeOperation -> Value
toJSON CastColumnTypeOperation' {Maybe Text
Text
ColumnDataType
newColumnType' :: ColumnDataType
columnName :: Text
format :: Maybe Text
$sel:newColumnType':CastColumnTypeOperation' :: CastColumnTypeOperation -> ColumnDataType
$sel:columnName:CastColumnTypeOperation' :: CastColumnTypeOperation -> Text
$sel:format:CastColumnTypeOperation' :: CastColumnTypeOperation -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Format" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
format,
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
"NewColumnType" Text -> ColumnDataType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ColumnDataType
newColumnType')
]
)