{-# 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.Glue.Types.PartitionIndex where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PartitionIndex = PartitionIndex'
{
PartitionIndex -> NonEmpty Text
keys :: Prelude.NonEmpty Prelude.Text,
PartitionIndex -> Text
indexName :: Prelude.Text
}
deriving (PartitionIndex -> PartitionIndex -> Bool
(PartitionIndex -> PartitionIndex -> Bool)
-> (PartitionIndex -> PartitionIndex -> Bool) -> Eq PartitionIndex
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PartitionIndex -> PartitionIndex -> Bool
$c/= :: PartitionIndex -> PartitionIndex -> Bool
== :: PartitionIndex -> PartitionIndex -> Bool
$c== :: PartitionIndex -> PartitionIndex -> Bool
Prelude.Eq, ReadPrec [PartitionIndex]
ReadPrec PartitionIndex
Int -> ReadS PartitionIndex
ReadS [PartitionIndex]
(Int -> ReadS PartitionIndex)
-> ReadS [PartitionIndex]
-> ReadPrec PartitionIndex
-> ReadPrec [PartitionIndex]
-> Read PartitionIndex
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PartitionIndex]
$creadListPrec :: ReadPrec [PartitionIndex]
readPrec :: ReadPrec PartitionIndex
$creadPrec :: ReadPrec PartitionIndex
readList :: ReadS [PartitionIndex]
$creadList :: ReadS [PartitionIndex]
readsPrec :: Int -> ReadS PartitionIndex
$creadsPrec :: Int -> ReadS PartitionIndex
Prelude.Read, Int -> PartitionIndex -> ShowS
[PartitionIndex] -> ShowS
PartitionIndex -> String
(Int -> PartitionIndex -> ShowS)
-> (PartitionIndex -> String)
-> ([PartitionIndex] -> ShowS)
-> Show PartitionIndex
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PartitionIndex] -> ShowS
$cshowList :: [PartitionIndex] -> ShowS
show :: PartitionIndex -> String
$cshow :: PartitionIndex -> String
showsPrec :: Int -> PartitionIndex -> ShowS
$cshowsPrec :: Int -> PartitionIndex -> ShowS
Prelude.Show, (forall x. PartitionIndex -> Rep PartitionIndex x)
-> (forall x. Rep PartitionIndex x -> PartitionIndex)
-> Generic PartitionIndex
forall x. Rep PartitionIndex x -> PartitionIndex
forall x. PartitionIndex -> Rep PartitionIndex x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PartitionIndex x -> PartitionIndex
$cfrom :: forall x. PartitionIndex -> Rep PartitionIndex x
Prelude.Generic)
newPartitionIndex ::
Prelude.NonEmpty Prelude.Text ->
Prelude.Text ->
PartitionIndex
newPartitionIndex :: NonEmpty Text -> Text -> PartitionIndex
newPartitionIndex NonEmpty Text
pKeys_ Text
pIndexName_ =
PartitionIndex' :: NonEmpty Text -> Text -> PartitionIndex
PartitionIndex'
{ $sel:keys:PartitionIndex' :: NonEmpty Text
keys = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pKeys_,
$sel:indexName:PartitionIndex' :: Text
indexName = Text
pIndexName_
}
partitionIndex_keys :: Lens.Lens' PartitionIndex (Prelude.NonEmpty Prelude.Text)
partitionIndex_keys :: (NonEmpty Text -> f (NonEmpty Text))
-> PartitionIndex -> f PartitionIndex
partitionIndex_keys = (PartitionIndex -> NonEmpty Text)
-> (PartitionIndex -> NonEmpty Text -> PartitionIndex)
-> Lens
PartitionIndex PartitionIndex (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PartitionIndex' {NonEmpty Text
keys :: NonEmpty Text
$sel:keys:PartitionIndex' :: PartitionIndex -> NonEmpty Text
keys} -> NonEmpty Text
keys) (\s :: PartitionIndex
s@PartitionIndex' {} NonEmpty Text
a -> PartitionIndex
s {$sel:keys:PartitionIndex' :: NonEmpty Text
keys = NonEmpty Text
a} :: PartitionIndex) ((NonEmpty Text -> f (NonEmpty Text))
-> PartitionIndex -> f PartitionIndex)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> PartitionIndex
-> f PartitionIndex
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
partitionIndex_indexName :: Lens.Lens' PartitionIndex Prelude.Text
partitionIndex_indexName :: (Text -> f Text) -> PartitionIndex -> f PartitionIndex
partitionIndex_indexName = (PartitionIndex -> Text)
-> (PartitionIndex -> Text -> PartitionIndex)
-> Lens PartitionIndex PartitionIndex Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PartitionIndex' {Text
indexName :: Text
$sel:indexName:PartitionIndex' :: PartitionIndex -> Text
indexName} -> Text
indexName) (\s :: PartitionIndex
s@PartitionIndex' {} Text
a -> PartitionIndex
s {$sel:indexName:PartitionIndex' :: Text
indexName = Text
a} :: PartitionIndex)
instance Prelude.Hashable PartitionIndex
instance Prelude.NFData PartitionIndex
instance Core.ToJSON PartitionIndex where
toJSON :: PartitionIndex -> Value
toJSON PartitionIndex' {NonEmpty Text
Text
indexName :: Text
keys :: NonEmpty Text
$sel:indexName:PartitionIndex' :: PartitionIndex -> Text
$sel:keys:PartitionIndex' :: PartitionIndex -> NonEmpty 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
"Keys" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
keys),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"IndexName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
indexName)
]
)