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