{-# 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.TimestreamAction where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types.TimestreamDimension
import Amazonka.IoT.Types.TimestreamTimestamp
import qualified Amazonka.Prelude as Prelude
data TimestreamAction = TimestreamAction'
{
TimestreamAction -> Maybe TimestreamTimestamp
timestamp :: Prelude.Maybe TimestreamTimestamp,
TimestreamAction -> Text
roleArn :: Prelude.Text,
TimestreamAction -> Text
databaseName :: Prelude.Text,
TimestreamAction -> Text
tableName :: Prelude.Text,
TimestreamAction -> NonEmpty TimestreamDimension
dimensions :: Prelude.NonEmpty TimestreamDimension
}
deriving (TimestreamAction -> TimestreamAction -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimestreamAction -> TimestreamAction -> Bool
$c/= :: TimestreamAction -> TimestreamAction -> Bool
== :: TimestreamAction -> TimestreamAction -> Bool
$c== :: TimestreamAction -> TimestreamAction -> Bool
Prelude.Eq, ReadPrec [TimestreamAction]
ReadPrec TimestreamAction
Int -> ReadS TimestreamAction
ReadS [TimestreamAction]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TimestreamAction]
$creadListPrec :: ReadPrec [TimestreamAction]
readPrec :: ReadPrec TimestreamAction
$creadPrec :: ReadPrec TimestreamAction
readList :: ReadS [TimestreamAction]
$creadList :: ReadS [TimestreamAction]
readsPrec :: Int -> ReadS TimestreamAction
$creadsPrec :: Int -> ReadS TimestreamAction
Prelude.Read, Int -> TimestreamAction -> ShowS
[TimestreamAction] -> ShowS
TimestreamAction -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TimestreamAction] -> ShowS
$cshowList :: [TimestreamAction] -> ShowS
show :: TimestreamAction -> String
$cshow :: TimestreamAction -> String
showsPrec :: Int -> TimestreamAction -> ShowS
$cshowsPrec :: Int -> TimestreamAction -> ShowS
Prelude.Show, forall x. Rep TimestreamAction x -> TimestreamAction
forall x. TimestreamAction -> Rep TimestreamAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TimestreamAction x -> TimestreamAction
$cfrom :: forall x. TimestreamAction -> Rep TimestreamAction x
Prelude.Generic)
newTimestreamAction ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.NonEmpty TimestreamDimension ->
TimestreamAction
newTimestreamAction :: Text
-> Text -> Text -> NonEmpty TimestreamDimension -> TimestreamAction
newTimestreamAction
Text
pRoleArn_
Text
pDatabaseName_
Text
pTableName_
NonEmpty TimestreamDimension
pDimensions_ =
TimestreamAction'
{ $sel:timestamp:TimestreamAction' :: Maybe TimestreamTimestamp
timestamp = forall a. Maybe a
Prelude.Nothing,
$sel:roleArn:TimestreamAction' :: Text
roleArn = Text
pRoleArn_,
$sel:databaseName:TimestreamAction' :: Text
databaseName = Text
pDatabaseName_,
$sel:tableName:TimestreamAction' :: Text
tableName = Text
pTableName_,
$sel:dimensions:TimestreamAction' :: NonEmpty TimestreamDimension
dimensions = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty TimestreamDimension
pDimensions_
}
timestreamAction_timestamp :: Lens.Lens' TimestreamAction (Prelude.Maybe TimestreamTimestamp)
timestreamAction_timestamp :: Lens' TimestreamAction (Maybe TimestreamTimestamp)
timestreamAction_timestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamAction' {Maybe TimestreamTimestamp
timestamp :: Maybe TimestreamTimestamp
$sel:timestamp:TimestreamAction' :: TimestreamAction -> Maybe TimestreamTimestamp
timestamp} -> Maybe TimestreamTimestamp
timestamp) (\s :: TimestreamAction
s@TimestreamAction' {} Maybe TimestreamTimestamp
a -> TimestreamAction
s {$sel:timestamp:TimestreamAction' :: Maybe TimestreamTimestamp
timestamp = Maybe TimestreamTimestamp
a} :: TimestreamAction)
timestreamAction_roleArn :: Lens.Lens' TimestreamAction Prelude.Text
timestreamAction_roleArn :: Lens' TimestreamAction Text
timestreamAction_roleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamAction' {Text
roleArn :: Text
$sel:roleArn:TimestreamAction' :: TimestreamAction -> Text
roleArn} -> Text
roleArn) (\s :: TimestreamAction
s@TimestreamAction' {} Text
a -> TimestreamAction
s {$sel:roleArn:TimestreamAction' :: Text
roleArn = Text
a} :: TimestreamAction)
timestreamAction_databaseName :: Lens.Lens' TimestreamAction Prelude.Text
timestreamAction_databaseName :: Lens' TimestreamAction Text
timestreamAction_databaseName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamAction' {Text
databaseName :: Text
$sel:databaseName:TimestreamAction' :: TimestreamAction -> Text
databaseName} -> Text
databaseName) (\s :: TimestreamAction
s@TimestreamAction' {} Text
a -> TimestreamAction
s {$sel:databaseName:TimestreamAction' :: Text
databaseName = Text
a} :: TimestreamAction)
timestreamAction_tableName :: Lens.Lens' TimestreamAction Prelude.Text
timestreamAction_tableName :: Lens' TimestreamAction Text
timestreamAction_tableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamAction' {Text
tableName :: Text
$sel:tableName:TimestreamAction' :: TimestreamAction -> Text
tableName} -> Text
tableName) (\s :: TimestreamAction
s@TimestreamAction' {} Text
a -> TimestreamAction
s {$sel:tableName:TimestreamAction' :: Text
tableName = Text
a} :: TimestreamAction)
timestreamAction_dimensions :: Lens.Lens' TimestreamAction (Prelude.NonEmpty TimestreamDimension)
timestreamAction_dimensions :: Lens' TimestreamAction (NonEmpty TimestreamDimension)
timestreamAction_dimensions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamAction' {NonEmpty TimestreamDimension
dimensions :: NonEmpty TimestreamDimension
$sel:dimensions:TimestreamAction' :: TimestreamAction -> NonEmpty TimestreamDimension
dimensions} -> NonEmpty TimestreamDimension
dimensions) (\s :: TimestreamAction
s@TimestreamAction' {} NonEmpty TimestreamDimension
a -> TimestreamAction
s {$sel:dimensions:TimestreamAction' :: NonEmpty TimestreamDimension
dimensions = NonEmpty TimestreamDimension
a} :: TimestreamAction) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON TimestreamAction where
parseJSON :: Value -> Parser TimestreamAction
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"TimestreamAction"
( \Object
x ->
Maybe TimestreamTimestamp
-> Text
-> Text
-> Text
-> NonEmpty TimestreamDimension
-> TimestreamAction
TimestreamAction'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"timestamp")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"roleArn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"databaseName")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"tableName")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"dimensions")
)
instance Prelude.Hashable TimestreamAction where
hashWithSalt :: Int -> TimestreamAction -> Int
hashWithSalt Int
_salt TimestreamAction' {Maybe TimestreamTimestamp
NonEmpty TimestreamDimension
Text
dimensions :: NonEmpty TimestreamDimension
tableName :: Text
databaseName :: Text
roleArn :: Text
timestamp :: Maybe TimestreamTimestamp
$sel:dimensions:TimestreamAction' :: TimestreamAction -> NonEmpty TimestreamDimension
$sel:tableName:TimestreamAction' :: TimestreamAction -> Text
$sel:databaseName:TimestreamAction' :: TimestreamAction -> Text
$sel:roleArn:TimestreamAction' :: TimestreamAction -> Text
$sel:timestamp:TimestreamAction' :: TimestreamAction -> Maybe TimestreamTimestamp
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TimestreamTimestamp
timestamp
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
roleArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
databaseName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
tableName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty TimestreamDimension
dimensions
instance Prelude.NFData TimestreamAction where
rnf :: TimestreamAction -> ()
rnf TimestreamAction' {Maybe TimestreamTimestamp
NonEmpty TimestreamDimension
Text
dimensions :: NonEmpty TimestreamDimension
tableName :: Text
databaseName :: Text
roleArn :: Text
timestamp :: Maybe TimestreamTimestamp
$sel:dimensions:TimestreamAction' :: TimestreamAction -> NonEmpty TimestreamDimension
$sel:tableName:TimestreamAction' :: TimestreamAction -> Text
$sel:databaseName:TimestreamAction' :: TimestreamAction -> Text
$sel:roleArn:TimestreamAction' :: TimestreamAction -> Text
$sel:timestamp:TimestreamAction' :: TimestreamAction -> Maybe TimestreamTimestamp
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe TimestreamTimestamp
timestamp
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
roleArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
databaseName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
tableName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty TimestreamDimension
dimensions
instance Data.ToJSON TimestreamAction where
toJSON :: TimestreamAction -> Value
toJSON TimestreamAction' {Maybe TimestreamTimestamp
NonEmpty TimestreamDimension
Text
dimensions :: NonEmpty TimestreamDimension
tableName :: Text
databaseName :: Text
roleArn :: Text
timestamp :: Maybe TimestreamTimestamp
$sel:dimensions:TimestreamAction' :: TimestreamAction -> NonEmpty TimestreamDimension
$sel:tableName:TimestreamAction' :: TimestreamAction -> Text
$sel:databaseName:TimestreamAction' :: TimestreamAction -> Text
$sel:roleArn:TimestreamAction' :: TimestreamAction -> Text
$sel:timestamp:TimestreamAction' :: TimestreamAction -> Maybe TimestreamTimestamp
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"timestamp" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TimestreamTimestamp
timestamp,
forall a. a -> Maybe a
Prelude.Just (Key
"roleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
roleArn),
forall a. a -> Maybe a
Prelude.Just (Key
"databaseName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
databaseName),
forall a. a -> Maybe a
Prelude.Just (Key
"tableName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
tableName),
forall a. a -> Maybe a
Prelude.Just (Key
"dimensions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty TimestreamDimension
dimensions)
]
)