{-# 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.DynamoDB.Types.Get where
import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.Types.AttributeValue
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Get = Get'
{
Get -> Maybe Text
projectionExpression :: Prelude.Maybe Prelude.Text,
Get -> Maybe (HashMap Text Text)
expressionAttributeNames :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
Get -> HashMap Text AttributeValue
key :: Prelude.HashMap Prelude.Text AttributeValue,
Get -> Text
tableName :: Prelude.Text
}
deriving (Get -> Get -> Bool
(Get -> Get -> Bool) -> (Get -> Get -> Bool) -> Eq Get
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Get -> Get -> Bool
$c/= :: Get -> Get -> Bool
== :: Get -> Get -> Bool
$c== :: Get -> Get -> Bool
Prelude.Eq, ReadPrec [Get]
ReadPrec Get
Int -> ReadS Get
ReadS [Get]
(Int -> ReadS Get)
-> ReadS [Get] -> ReadPrec Get -> ReadPrec [Get] -> Read Get
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Get]
$creadListPrec :: ReadPrec [Get]
readPrec :: ReadPrec Get
$creadPrec :: ReadPrec Get
readList :: ReadS [Get]
$creadList :: ReadS [Get]
readsPrec :: Int -> ReadS Get
$creadsPrec :: Int -> ReadS Get
Prelude.Read, Int -> Get -> ShowS
[Get] -> ShowS
Get -> String
(Int -> Get -> ShowS)
-> (Get -> String) -> ([Get] -> ShowS) -> Show Get
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Get] -> ShowS
$cshowList :: [Get] -> ShowS
show :: Get -> String
$cshow :: Get -> String
showsPrec :: Int -> Get -> ShowS
$cshowsPrec :: Int -> Get -> ShowS
Prelude.Show, (forall x. Get -> Rep Get x)
-> (forall x. Rep Get x -> Get) -> Generic Get
forall x. Rep Get x -> Get
forall x. Get -> Rep Get x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Get x -> Get
$cfrom :: forall x. Get -> Rep Get x
Prelude.Generic)
newGet ::
Prelude.Text ->
Get
newGet :: Text -> Get
newGet Text
pTableName_ =
Get' :: Maybe Text
-> Maybe (HashMap Text Text)
-> HashMap Text AttributeValue
-> Text
-> Get
Get'
{ $sel:projectionExpression:Get' :: Maybe Text
projectionExpression = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:expressionAttributeNames:Get' :: Maybe (HashMap Text Text)
expressionAttributeNames = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:key:Get' :: HashMap Text AttributeValue
key = HashMap Text AttributeValue
forall a. Monoid a => a
Prelude.mempty,
$sel:tableName:Get' :: Text
tableName = Text
pTableName_
}
get_projectionExpression :: Lens.Lens' Get (Prelude.Maybe Prelude.Text)
get_projectionExpression :: (Maybe Text -> f (Maybe Text)) -> Get -> f Get
get_projectionExpression = (Get -> Maybe Text)
-> (Get -> Maybe Text -> Get)
-> Lens Get Get (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Get' {Maybe Text
projectionExpression :: Maybe Text
$sel:projectionExpression:Get' :: Get -> Maybe Text
projectionExpression} -> Maybe Text
projectionExpression) (\s :: Get
s@Get' {} Maybe Text
a -> Get
s {$sel:projectionExpression:Get' :: Maybe Text
projectionExpression = Maybe Text
a} :: Get)
get_expressionAttributeNames :: Lens.Lens' Get (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
get_expressionAttributeNames :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Get -> f Get
get_expressionAttributeNames = (Get -> Maybe (HashMap Text Text))
-> (Get -> Maybe (HashMap Text Text) -> Get)
-> Lens
Get Get (Maybe (HashMap Text Text)) (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Get' {Maybe (HashMap Text Text)
expressionAttributeNames :: Maybe (HashMap Text Text)
$sel:expressionAttributeNames:Get' :: Get -> Maybe (HashMap Text Text)
expressionAttributeNames} -> Maybe (HashMap Text Text)
expressionAttributeNames) (\s :: Get
s@Get' {} Maybe (HashMap Text Text)
a -> Get
s {$sel:expressionAttributeNames:Get' :: Maybe (HashMap Text Text)
expressionAttributeNames = Maybe (HashMap Text Text)
a} :: Get) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Get -> f Get)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Get
-> f Get
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
get_key :: Lens.Lens' Get (Prelude.HashMap Prelude.Text AttributeValue)
get_key :: (HashMap Text AttributeValue -> f (HashMap Text AttributeValue))
-> Get -> f Get
get_key = (Get -> HashMap Text AttributeValue)
-> (Get -> HashMap Text AttributeValue -> Get)
-> Lens
Get Get (HashMap Text AttributeValue) (HashMap Text AttributeValue)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Get' {HashMap Text AttributeValue
key :: HashMap Text AttributeValue
$sel:key:Get' :: Get -> HashMap Text AttributeValue
key} -> HashMap Text AttributeValue
key) (\s :: Get
s@Get' {} HashMap Text AttributeValue
a -> Get
s {$sel:key:Get' :: HashMap Text AttributeValue
key = HashMap Text AttributeValue
a} :: Get) ((HashMap Text AttributeValue -> f (HashMap Text AttributeValue))
-> Get -> f Get)
-> ((HashMap Text AttributeValue
-> f (HashMap Text AttributeValue))
-> HashMap Text AttributeValue -> f (HashMap Text AttributeValue))
-> (HashMap Text AttributeValue -> f (HashMap Text AttributeValue))
-> Get
-> f Get
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text AttributeValue -> f (HashMap Text AttributeValue))
-> HashMap Text AttributeValue -> f (HashMap Text AttributeValue)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
get_tableName :: Lens.Lens' Get Prelude.Text
get_tableName :: (Text -> f Text) -> Get -> f Get
get_tableName = (Get -> Text) -> (Get -> Text -> Get) -> Lens Get Get Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Get' {Text
tableName :: Text
$sel:tableName:Get' :: Get -> Text
tableName} -> Text
tableName) (\s :: Get
s@Get' {} Text
a -> Get
s {$sel:tableName:Get' :: Text
tableName = Text
a} :: Get)
instance Prelude.Hashable Get
instance Prelude.NFData Get
instance Core.ToJSON Get where
toJSON :: Get -> Value
toJSON Get' {Maybe Text
Maybe (HashMap Text Text)
Text
HashMap Text AttributeValue
tableName :: Text
key :: HashMap Text AttributeValue
expressionAttributeNames :: Maybe (HashMap Text Text)
projectionExpression :: Maybe Text
$sel:tableName:Get' :: Get -> Text
$sel:key:Get' :: Get -> HashMap Text AttributeValue
$sel:expressionAttributeNames:Get' :: Get -> Maybe (HashMap Text Text)
$sel:projectionExpression:Get' :: Get -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ProjectionExpression" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
projectionExpression,
(Text
"ExpressionAttributeNames" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
expressionAttributeNames,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Key" Text -> HashMap Text AttributeValue -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HashMap Text AttributeValue
key),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TableName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tableName)
]
)