{-# 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.Glue.Types.AggregateOperation where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Glue.Types.AggFunction
import qualified Amazonka.Prelude as Prelude
data AggregateOperation = AggregateOperation'
{
AggregateOperation -> [Text]
column :: [Prelude.Text],
AggregateOperation -> AggFunction
aggFunc :: AggFunction
}
deriving (AggregateOperation -> AggregateOperation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AggregateOperation -> AggregateOperation -> Bool
$c/= :: AggregateOperation -> AggregateOperation -> Bool
== :: AggregateOperation -> AggregateOperation -> Bool
$c== :: AggregateOperation -> AggregateOperation -> Bool
Prelude.Eq, ReadPrec [AggregateOperation]
ReadPrec AggregateOperation
Int -> ReadS AggregateOperation
ReadS [AggregateOperation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AggregateOperation]
$creadListPrec :: ReadPrec [AggregateOperation]
readPrec :: ReadPrec AggregateOperation
$creadPrec :: ReadPrec AggregateOperation
readList :: ReadS [AggregateOperation]
$creadList :: ReadS [AggregateOperation]
readsPrec :: Int -> ReadS AggregateOperation
$creadsPrec :: Int -> ReadS AggregateOperation
Prelude.Read, Int -> AggregateOperation -> ShowS
[AggregateOperation] -> ShowS
AggregateOperation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AggregateOperation] -> ShowS
$cshowList :: [AggregateOperation] -> ShowS
show :: AggregateOperation -> String
$cshow :: AggregateOperation -> String
showsPrec :: Int -> AggregateOperation -> ShowS
$cshowsPrec :: Int -> AggregateOperation -> ShowS
Prelude.Show, forall x. Rep AggregateOperation x -> AggregateOperation
forall x. AggregateOperation -> Rep AggregateOperation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AggregateOperation x -> AggregateOperation
$cfrom :: forall x. AggregateOperation -> Rep AggregateOperation x
Prelude.Generic)
newAggregateOperation ::
AggFunction ->
AggregateOperation
newAggregateOperation :: AggFunction -> AggregateOperation
newAggregateOperation AggFunction
pAggFunc_ =
AggregateOperation'
{ $sel:column:AggregateOperation' :: [Text]
column = forall a. Monoid a => a
Prelude.mempty,
$sel:aggFunc:AggregateOperation' :: AggFunction
aggFunc = AggFunction
pAggFunc_
}
aggregateOperation_column :: Lens.Lens' AggregateOperation [Prelude.Text]
aggregateOperation_column :: Lens' AggregateOperation [Text]
aggregateOperation_column = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregateOperation' {[Text]
column :: [Text]
$sel:column:AggregateOperation' :: AggregateOperation -> [Text]
column} -> [Text]
column) (\s :: AggregateOperation
s@AggregateOperation' {} [Text]
a -> AggregateOperation
s {$sel:column:AggregateOperation' :: [Text]
column = [Text]
a} :: AggregateOperation) 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
aggregateOperation_aggFunc :: Lens.Lens' AggregateOperation AggFunction
aggregateOperation_aggFunc :: Lens' AggregateOperation AggFunction
aggregateOperation_aggFunc = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregateOperation' {AggFunction
aggFunc :: AggFunction
$sel:aggFunc:AggregateOperation' :: AggregateOperation -> AggFunction
aggFunc} -> AggFunction
aggFunc) (\s :: AggregateOperation
s@AggregateOperation' {} AggFunction
a -> AggregateOperation
s {$sel:aggFunc:AggregateOperation' :: AggFunction
aggFunc = AggFunction
a} :: AggregateOperation)
instance Data.FromJSON AggregateOperation where
parseJSON :: Value -> Parser AggregateOperation
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"AggregateOperation"
( \Object
x ->
[Text] -> AggFunction -> AggregateOperation
AggregateOperation'
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
"Column" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
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
"AggFunc")
)
instance Prelude.Hashable AggregateOperation where
hashWithSalt :: Int -> AggregateOperation -> Int
hashWithSalt Int
_salt AggregateOperation' {[Text]
AggFunction
aggFunc :: AggFunction
column :: [Text]
$sel:aggFunc:AggregateOperation' :: AggregateOperation -> AggFunction
$sel:column:AggregateOperation' :: AggregateOperation -> [Text]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
column
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` AggFunction
aggFunc
instance Prelude.NFData AggregateOperation where
rnf :: AggregateOperation -> ()
rnf AggregateOperation' {[Text]
AggFunction
aggFunc :: AggFunction
column :: [Text]
$sel:aggFunc:AggregateOperation' :: AggregateOperation -> AggFunction
$sel:column:AggregateOperation' :: AggregateOperation -> [Text]
..} =
forall a. NFData a => a -> ()
Prelude.rnf [Text]
column
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf AggFunction
aggFunc
instance Data.ToJSON AggregateOperation where
toJSON :: AggregateOperation -> Value
toJSON AggregateOperation' {[Text]
AggFunction
aggFunc :: AggFunction
column :: [Text]
$sel:aggFunc:AggregateOperation' :: AggregateOperation -> AggFunction
$sel:column:AggregateOperation' :: AggregateOperation -> [Text]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Column" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
column),
forall a. a -> Maybe a
Prelude.Just (Key
"AggFunc" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= AggFunction
aggFunc)
]
)