{-# 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.RenameColumnOperation where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data RenameColumnOperation = RenameColumnOperation'
{
RenameColumnOperation -> Text
columnName :: Prelude.Text,
RenameColumnOperation -> Text
newColumnName' :: Prelude.Text
}
deriving (RenameColumnOperation -> RenameColumnOperation -> Bool
(RenameColumnOperation -> RenameColumnOperation -> Bool)
-> (RenameColumnOperation -> RenameColumnOperation -> Bool)
-> Eq RenameColumnOperation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RenameColumnOperation -> RenameColumnOperation -> Bool
$c/= :: RenameColumnOperation -> RenameColumnOperation -> Bool
== :: RenameColumnOperation -> RenameColumnOperation -> Bool
$c== :: RenameColumnOperation -> RenameColumnOperation -> Bool
Prelude.Eq, ReadPrec [RenameColumnOperation]
ReadPrec RenameColumnOperation
Int -> ReadS RenameColumnOperation
ReadS [RenameColumnOperation]
(Int -> ReadS RenameColumnOperation)
-> ReadS [RenameColumnOperation]
-> ReadPrec RenameColumnOperation
-> ReadPrec [RenameColumnOperation]
-> Read RenameColumnOperation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RenameColumnOperation]
$creadListPrec :: ReadPrec [RenameColumnOperation]
readPrec :: ReadPrec RenameColumnOperation
$creadPrec :: ReadPrec RenameColumnOperation
readList :: ReadS [RenameColumnOperation]
$creadList :: ReadS [RenameColumnOperation]
readsPrec :: Int -> ReadS RenameColumnOperation
$creadsPrec :: Int -> ReadS RenameColumnOperation
Prelude.Read, Int -> RenameColumnOperation -> ShowS
[RenameColumnOperation] -> ShowS
RenameColumnOperation -> String
(Int -> RenameColumnOperation -> ShowS)
-> (RenameColumnOperation -> String)
-> ([RenameColumnOperation] -> ShowS)
-> Show RenameColumnOperation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RenameColumnOperation] -> ShowS
$cshowList :: [RenameColumnOperation] -> ShowS
show :: RenameColumnOperation -> String
$cshow :: RenameColumnOperation -> String
showsPrec :: Int -> RenameColumnOperation -> ShowS
$cshowsPrec :: Int -> RenameColumnOperation -> ShowS
Prelude.Show, (forall x. RenameColumnOperation -> Rep RenameColumnOperation x)
-> (forall x. Rep RenameColumnOperation x -> RenameColumnOperation)
-> Generic RenameColumnOperation
forall x. Rep RenameColumnOperation x -> RenameColumnOperation
forall x. RenameColumnOperation -> Rep RenameColumnOperation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RenameColumnOperation x -> RenameColumnOperation
$cfrom :: forall x. RenameColumnOperation -> Rep RenameColumnOperation x
Prelude.Generic)
newRenameColumnOperation ::
Prelude.Text ->
Prelude.Text ->
RenameColumnOperation
newRenameColumnOperation :: Text -> Text -> RenameColumnOperation
newRenameColumnOperation Text
pColumnName_ Text
pNewColumnName_ =
RenameColumnOperation' :: Text -> Text -> RenameColumnOperation
RenameColumnOperation'
{ $sel:columnName:RenameColumnOperation' :: Text
columnName = Text
pColumnName_,
$sel:newColumnName':RenameColumnOperation' :: Text
newColumnName' = Text
pNewColumnName_
}
renameColumnOperation_columnName :: Lens.Lens' RenameColumnOperation Prelude.Text
renameColumnOperation_columnName :: (Text -> f Text)
-> RenameColumnOperation -> f RenameColumnOperation
renameColumnOperation_columnName = (RenameColumnOperation -> Text)
-> (RenameColumnOperation -> Text -> RenameColumnOperation)
-> Lens RenameColumnOperation RenameColumnOperation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RenameColumnOperation' {Text
columnName :: Text
$sel:columnName:RenameColumnOperation' :: RenameColumnOperation -> Text
columnName} -> Text
columnName) (\s :: RenameColumnOperation
s@RenameColumnOperation' {} Text
a -> RenameColumnOperation
s {$sel:columnName:RenameColumnOperation' :: Text
columnName = Text
a} :: RenameColumnOperation)
renameColumnOperation_newColumnName :: Lens.Lens' RenameColumnOperation Prelude.Text
renameColumnOperation_newColumnName :: (Text -> f Text)
-> RenameColumnOperation -> f RenameColumnOperation
renameColumnOperation_newColumnName = (RenameColumnOperation -> Text)
-> (RenameColumnOperation -> Text -> RenameColumnOperation)
-> Lens RenameColumnOperation RenameColumnOperation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RenameColumnOperation' {Text
newColumnName' :: Text
$sel:newColumnName':RenameColumnOperation' :: RenameColumnOperation -> Text
newColumnName'} -> Text
newColumnName') (\s :: RenameColumnOperation
s@RenameColumnOperation' {} Text
a -> RenameColumnOperation
s {$sel:newColumnName':RenameColumnOperation' :: Text
newColumnName' = Text
a} :: RenameColumnOperation)
instance Core.FromJSON RenameColumnOperation where
parseJSON :: Value -> Parser RenameColumnOperation
parseJSON =
String
-> (Object -> Parser RenameColumnOperation)
-> Value
-> Parser RenameColumnOperation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"RenameColumnOperation"
( \Object
x ->
Text -> Text -> RenameColumnOperation
RenameColumnOperation'
(Text -> Text -> RenameColumnOperation)
-> Parser Text -> Parser (Text -> RenameColumnOperation)
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 -> RenameColumnOperation)
-> Parser Text -> Parser RenameColumnOperation
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
"NewColumnName")
)
instance Prelude.Hashable RenameColumnOperation
instance Prelude.NFData RenameColumnOperation
instance Core.ToJSON RenameColumnOperation where
toJSON :: RenameColumnOperation -> Value
toJSON RenameColumnOperation' {Text
newColumnName' :: Text
columnName :: Text
$sel:newColumnName':RenameColumnOperation' :: RenameColumnOperation -> Text
$sel:columnName:RenameColumnOperation' :: RenameColumnOperation -> 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
"NewColumnName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
newColumnName')
]
)