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