{-# 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.SortCriterion where
import qualified Amazonka.Core as Core
import Amazonka.Glue.Types.Sort
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SortCriterion = SortCriterion'
{
SortCriterion -> Maybe Sort
sort :: Prelude.Maybe Sort,
SortCriterion -> Maybe Text
fieldName :: Prelude.Maybe Prelude.Text
}
deriving (SortCriterion -> SortCriterion -> Bool
(SortCriterion -> SortCriterion -> Bool)
-> (SortCriterion -> SortCriterion -> Bool) -> Eq SortCriterion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SortCriterion -> SortCriterion -> Bool
$c/= :: SortCriterion -> SortCriterion -> Bool
== :: SortCriterion -> SortCriterion -> Bool
$c== :: SortCriterion -> SortCriterion -> Bool
Prelude.Eq, ReadPrec [SortCriterion]
ReadPrec SortCriterion
Int -> ReadS SortCriterion
ReadS [SortCriterion]
(Int -> ReadS SortCriterion)
-> ReadS [SortCriterion]
-> ReadPrec SortCriterion
-> ReadPrec [SortCriterion]
-> Read SortCriterion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SortCriterion]
$creadListPrec :: ReadPrec [SortCriterion]
readPrec :: ReadPrec SortCriterion
$creadPrec :: ReadPrec SortCriterion
readList :: ReadS [SortCriterion]
$creadList :: ReadS [SortCriterion]
readsPrec :: Int -> ReadS SortCriterion
$creadsPrec :: Int -> ReadS SortCriterion
Prelude.Read, Int -> SortCriterion -> ShowS
[SortCriterion] -> ShowS
SortCriterion -> String
(Int -> SortCriterion -> ShowS)
-> (SortCriterion -> String)
-> ([SortCriterion] -> ShowS)
-> Show SortCriterion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SortCriterion] -> ShowS
$cshowList :: [SortCriterion] -> ShowS
show :: SortCriterion -> String
$cshow :: SortCriterion -> String
showsPrec :: Int -> SortCriterion -> ShowS
$cshowsPrec :: Int -> SortCriterion -> ShowS
Prelude.Show, (forall x. SortCriterion -> Rep SortCriterion x)
-> (forall x. Rep SortCriterion x -> SortCriterion)
-> Generic SortCriterion
forall x. Rep SortCriterion x -> SortCriterion
forall x. SortCriterion -> Rep SortCriterion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SortCriterion x -> SortCriterion
$cfrom :: forall x. SortCriterion -> Rep SortCriterion x
Prelude.Generic)
newSortCriterion ::
SortCriterion
newSortCriterion :: SortCriterion
newSortCriterion =
SortCriterion' :: Maybe Sort -> Maybe Text -> SortCriterion
SortCriterion'
{ $sel:sort:SortCriterion' :: Maybe Sort
sort = Maybe Sort
forall a. Maybe a
Prelude.Nothing,
$sel:fieldName:SortCriterion' :: Maybe Text
fieldName = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
sortCriterion_sort :: Lens.Lens' SortCriterion (Prelude.Maybe Sort)
sortCriterion_sort :: (Maybe Sort -> f (Maybe Sort)) -> SortCriterion -> f SortCriterion
sortCriterion_sort = (SortCriterion -> Maybe Sort)
-> (SortCriterion -> Maybe Sort -> SortCriterion)
-> Lens SortCriterion SortCriterion (Maybe Sort) (Maybe Sort)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SortCriterion' {Maybe Sort
sort :: Maybe Sort
$sel:sort:SortCriterion' :: SortCriterion -> Maybe Sort
sort} -> Maybe Sort
sort) (\s :: SortCriterion
s@SortCriterion' {} Maybe Sort
a -> SortCriterion
s {$sel:sort:SortCriterion' :: Maybe Sort
sort = Maybe Sort
a} :: SortCriterion)
sortCriterion_fieldName :: Lens.Lens' SortCriterion (Prelude.Maybe Prelude.Text)
sortCriterion_fieldName :: (Maybe Text -> f (Maybe Text)) -> SortCriterion -> f SortCriterion
sortCriterion_fieldName = (SortCriterion -> Maybe Text)
-> (SortCriterion -> Maybe Text -> SortCriterion)
-> Lens SortCriterion SortCriterion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SortCriterion' {Maybe Text
fieldName :: Maybe Text
$sel:fieldName:SortCriterion' :: SortCriterion -> Maybe Text
fieldName} -> Maybe Text
fieldName) (\s :: SortCriterion
s@SortCriterion' {} Maybe Text
a -> SortCriterion
s {$sel:fieldName:SortCriterion' :: Maybe Text
fieldName = Maybe Text
a} :: SortCriterion)
instance Prelude.Hashable SortCriterion
instance Prelude.NFData SortCriterion
instance Core.ToJSON SortCriterion where
toJSON :: SortCriterion -> Value
toJSON SortCriterion' {Maybe Text
Maybe Sort
fieldName :: Maybe Text
sort :: Maybe Sort
$sel:fieldName:SortCriterion' :: SortCriterion -> Maybe Text
$sel:sort:SortCriterion' :: SortCriterion -> Maybe Sort
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"Sort" Text -> Sort -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sort -> Pair) -> Maybe Sort -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Sort
sort,
(Text
"FieldName" 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
fieldName
]
)