{-# 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.CloudSearchDomains.Types.Bucket where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Bucket = Bucket'
{
Bucket -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
Bucket -> Maybe Integer
count :: Prelude.Maybe Prelude.Integer
}
deriving (Bucket -> Bucket -> Bool
(Bucket -> Bucket -> Bool)
-> (Bucket -> Bucket -> Bool) -> Eq Bucket
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Bucket -> Bucket -> Bool
$c/= :: Bucket -> Bucket -> Bool
== :: Bucket -> Bucket -> Bool
$c== :: Bucket -> Bucket -> Bool
Prelude.Eq, ReadPrec [Bucket]
ReadPrec Bucket
Int -> ReadS Bucket
ReadS [Bucket]
(Int -> ReadS Bucket)
-> ReadS [Bucket]
-> ReadPrec Bucket
-> ReadPrec [Bucket]
-> Read Bucket
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Bucket]
$creadListPrec :: ReadPrec [Bucket]
readPrec :: ReadPrec Bucket
$creadPrec :: ReadPrec Bucket
readList :: ReadS [Bucket]
$creadList :: ReadS [Bucket]
readsPrec :: Int -> ReadS Bucket
$creadsPrec :: Int -> ReadS Bucket
Prelude.Read, Int -> Bucket -> ShowS
[Bucket] -> ShowS
Bucket -> String
(Int -> Bucket -> ShowS)
-> (Bucket -> String) -> ([Bucket] -> ShowS) -> Show Bucket
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Bucket] -> ShowS
$cshowList :: [Bucket] -> ShowS
show :: Bucket -> String
$cshow :: Bucket -> String
showsPrec :: Int -> Bucket -> ShowS
$cshowsPrec :: Int -> Bucket -> ShowS
Prelude.Show, (forall x. Bucket -> Rep Bucket x)
-> (forall x. Rep Bucket x -> Bucket) -> Generic Bucket
forall x. Rep Bucket x -> Bucket
forall x. Bucket -> Rep Bucket x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Bucket x -> Bucket
$cfrom :: forall x. Bucket -> Rep Bucket x
Prelude.Generic)
newBucket ::
Bucket
newBucket :: Bucket
newBucket =
Bucket' :: Maybe Text -> Maybe Integer -> Bucket
Bucket'
{ $sel:value:Bucket' :: Maybe Text
value = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:count:Bucket' :: Maybe Integer
count = Maybe Integer
forall a. Maybe a
Prelude.Nothing
}
bucket_value :: Lens.Lens' Bucket (Prelude.Maybe Prelude.Text)
bucket_value :: (Maybe Text -> f (Maybe Text)) -> Bucket -> f Bucket
bucket_value = (Bucket -> Maybe Text)
-> (Bucket -> Maybe Text -> Bucket)
-> Lens Bucket Bucket (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bucket' {Maybe Text
value :: Maybe Text
$sel:value:Bucket' :: Bucket -> Maybe Text
value} -> Maybe Text
value) (\s :: Bucket
s@Bucket' {} Maybe Text
a -> Bucket
s {$sel:value:Bucket' :: Maybe Text
value = Maybe Text
a} :: Bucket)
bucket_count :: Lens.Lens' Bucket (Prelude.Maybe Prelude.Integer)
bucket_count :: (Maybe Integer -> f (Maybe Integer)) -> Bucket -> f Bucket
bucket_count = (Bucket -> Maybe Integer)
-> (Bucket -> Maybe Integer -> Bucket)
-> Lens Bucket Bucket (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bucket' {Maybe Integer
count :: Maybe Integer
$sel:count:Bucket' :: Bucket -> Maybe Integer
count} -> Maybe Integer
count) (\s :: Bucket
s@Bucket' {} Maybe Integer
a -> Bucket
s {$sel:count:Bucket' :: Maybe Integer
count = Maybe Integer
a} :: Bucket)
instance Core.FromJSON Bucket where
parseJSON :: Value -> Parser Bucket
parseJSON =
String -> (Object -> Parser Bucket) -> Value -> Parser Bucket
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Bucket"
( \Object
x ->
Maybe Text -> Maybe Integer -> Bucket
Bucket'
(Maybe Text -> Maybe Integer -> Bucket)
-> Parser (Maybe Text) -> Parser (Maybe Integer -> Bucket)
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
"value")
Parser (Maybe Integer -> Bucket)
-> Parser (Maybe Integer) -> Parser Bucket
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"count")
)
instance Prelude.Hashable Bucket
instance Prelude.NFData Bucket