{-# 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.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
keyValue :: Prelude.Maybe Prelude.Text,
Bucket -> Maybe Int
count :: Prelude.Maybe Prelude.Int
}
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 Int -> Bucket
Bucket'
{ $sel:keyValue:Bucket' :: Maybe Text
keyValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:count:Bucket' :: Maybe Int
count = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
bucket_keyValue :: Lens.Lens' Bucket (Prelude.Maybe Prelude.Text)
bucket_keyValue :: (Maybe Text -> f (Maybe Text)) -> Bucket -> f Bucket
bucket_keyValue = (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
keyValue :: Maybe Text
$sel:keyValue:Bucket' :: Bucket -> Maybe Text
keyValue} -> Maybe Text
keyValue) (\s :: Bucket
s@Bucket' {} Maybe Text
a -> Bucket
s {$sel:keyValue:Bucket' :: Maybe Text
keyValue = Maybe Text
a} :: Bucket)
bucket_count :: Lens.Lens' Bucket (Prelude.Maybe Prelude.Int)
bucket_count :: (Maybe Int -> f (Maybe Int)) -> Bucket -> f Bucket
bucket_count = (Bucket -> Maybe Int)
-> (Bucket -> Maybe Int -> Bucket)
-> Lens Bucket Bucket (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Bucket' {Maybe Int
count :: Maybe Int
$sel:count:Bucket' :: Bucket -> Maybe Int
count} -> Maybe Int
count) (\s :: Bucket
s@Bucket' {} Maybe Int
a -> Bucket
s {$sel:count:Bucket' :: Maybe Int
count = Maybe Int
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 Int -> Bucket
Bucket'
(Maybe Text -> Maybe Int -> Bucket)
-> Parser (Maybe Text) -> Parser (Maybe Int -> 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
"keyValue")
Parser (Maybe Int -> Bucket) -> Parser (Maybe Int) -> Parser Bucket
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"count")
)
instance Prelude.Hashable Bucket
instance Prelude.NFData Bucket