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