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