{-# 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.TimeStreamQuery.Types.TimestreamConfiguration 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
import Amazonka.TimeStreamQuery.Types.DimensionMapping
import Amazonka.TimeStreamQuery.Types.MixedMeasureMapping
import Amazonka.TimeStreamQuery.Types.MultiMeasureMappings
data TimestreamConfiguration = TimestreamConfiguration'
{
TimestreamConfiguration -> Maybe Text
measureNameColumn :: Prelude.Maybe Prelude.Text,
TimestreamConfiguration -> Maybe (NonEmpty MixedMeasureMapping)
mixedMeasureMappings :: Prelude.Maybe (Prelude.NonEmpty MixedMeasureMapping),
TimestreamConfiguration -> Maybe MultiMeasureMappings
multiMeasureMappings :: Prelude.Maybe MultiMeasureMappings,
TimestreamConfiguration -> Text
databaseName :: Prelude.Text,
TimestreamConfiguration -> Text
tableName :: Prelude.Text,
TimestreamConfiguration -> Text
timeColumn :: Prelude.Text,
TimestreamConfiguration -> [DimensionMapping]
dimensionMappings :: [DimensionMapping]
}
deriving (TimestreamConfiguration -> TimestreamConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimestreamConfiguration -> TimestreamConfiguration -> Bool
$c/= :: TimestreamConfiguration -> TimestreamConfiguration -> Bool
== :: TimestreamConfiguration -> TimestreamConfiguration -> Bool
$c== :: TimestreamConfiguration -> TimestreamConfiguration -> Bool
Prelude.Eq, ReadPrec [TimestreamConfiguration]
ReadPrec TimestreamConfiguration
Int -> ReadS TimestreamConfiguration
ReadS [TimestreamConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TimestreamConfiguration]
$creadListPrec :: ReadPrec [TimestreamConfiguration]
readPrec :: ReadPrec TimestreamConfiguration
$creadPrec :: ReadPrec TimestreamConfiguration
readList :: ReadS [TimestreamConfiguration]
$creadList :: ReadS [TimestreamConfiguration]
readsPrec :: Int -> ReadS TimestreamConfiguration
$creadsPrec :: Int -> ReadS TimestreamConfiguration
Prelude.Read, Int -> TimestreamConfiguration -> ShowS
[TimestreamConfiguration] -> ShowS
TimestreamConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TimestreamConfiguration] -> ShowS
$cshowList :: [TimestreamConfiguration] -> ShowS
show :: TimestreamConfiguration -> String
$cshow :: TimestreamConfiguration -> String
showsPrec :: Int -> TimestreamConfiguration -> ShowS
$cshowsPrec :: Int -> TimestreamConfiguration -> ShowS
Prelude.Show, forall x. Rep TimestreamConfiguration x -> TimestreamConfiguration
forall x. TimestreamConfiguration -> Rep TimestreamConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TimestreamConfiguration x -> TimestreamConfiguration
$cfrom :: forall x. TimestreamConfiguration -> Rep TimestreamConfiguration x
Prelude.Generic)
newTimestreamConfiguration ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
TimestreamConfiguration
newTimestreamConfiguration :: Text -> Text -> Text -> TimestreamConfiguration
newTimestreamConfiguration
Text
pDatabaseName_
Text
pTableName_
Text
pTimeColumn_ =
TimestreamConfiguration'
{ $sel:measureNameColumn:TimestreamConfiguration' :: Maybe Text
measureNameColumn =
forall a. Maybe a
Prelude.Nothing,
$sel:mixedMeasureMappings:TimestreamConfiguration' :: Maybe (NonEmpty MixedMeasureMapping)
mixedMeasureMappings = forall a. Maybe a
Prelude.Nothing,
$sel:multiMeasureMappings:TimestreamConfiguration' :: Maybe MultiMeasureMappings
multiMeasureMappings = forall a. Maybe a
Prelude.Nothing,
$sel:databaseName:TimestreamConfiguration' :: Text
databaseName = Text
pDatabaseName_,
$sel:tableName:TimestreamConfiguration' :: Text
tableName = Text
pTableName_,
$sel:timeColumn:TimestreamConfiguration' :: Text
timeColumn = Text
pTimeColumn_,
$sel:dimensionMappings:TimestreamConfiguration' :: [DimensionMapping]
dimensionMappings = forall a. Monoid a => a
Prelude.mempty
}
timestreamConfiguration_measureNameColumn :: Lens.Lens' TimestreamConfiguration (Prelude.Maybe Prelude.Text)
timestreamConfiguration_measureNameColumn :: Lens' TimestreamConfiguration (Maybe Text)
timestreamConfiguration_measureNameColumn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamConfiguration' {Maybe Text
measureNameColumn :: Maybe Text
$sel:measureNameColumn:TimestreamConfiguration' :: TimestreamConfiguration -> Maybe Text
measureNameColumn} -> Maybe Text
measureNameColumn) (\s :: TimestreamConfiguration
s@TimestreamConfiguration' {} Maybe Text
a -> TimestreamConfiguration
s {$sel:measureNameColumn:TimestreamConfiguration' :: Maybe Text
measureNameColumn = Maybe Text
a} :: TimestreamConfiguration)
timestreamConfiguration_mixedMeasureMappings :: Lens.Lens' TimestreamConfiguration (Prelude.Maybe (Prelude.NonEmpty MixedMeasureMapping))
timestreamConfiguration_mixedMeasureMappings :: Lens'
TimestreamConfiguration (Maybe (NonEmpty MixedMeasureMapping))
timestreamConfiguration_mixedMeasureMappings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamConfiguration' {Maybe (NonEmpty MixedMeasureMapping)
mixedMeasureMappings :: Maybe (NonEmpty MixedMeasureMapping)
$sel:mixedMeasureMappings:TimestreamConfiguration' :: TimestreamConfiguration -> Maybe (NonEmpty MixedMeasureMapping)
mixedMeasureMappings} -> Maybe (NonEmpty MixedMeasureMapping)
mixedMeasureMappings) (\s :: TimestreamConfiguration
s@TimestreamConfiguration' {} Maybe (NonEmpty MixedMeasureMapping)
a -> TimestreamConfiguration
s {$sel:mixedMeasureMappings:TimestreamConfiguration' :: Maybe (NonEmpty MixedMeasureMapping)
mixedMeasureMappings = Maybe (NonEmpty MixedMeasureMapping)
a} :: TimestreamConfiguration) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
timestreamConfiguration_multiMeasureMappings :: Lens.Lens' TimestreamConfiguration (Prelude.Maybe MultiMeasureMappings)
timestreamConfiguration_multiMeasureMappings :: Lens' TimestreamConfiguration (Maybe MultiMeasureMappings)
timestreamConfiguration_multiMeasureMappings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamConfiguration' {Maybe MultiMeasureMappings
multiMeasureMappings :: Maybe MultiMeasureMappings
$sel:multiMeasureMappings:TimestreamConfiguration' :: TimestreamConfiguration -> Maybe MultiMeasureMappings
multiMeasureMappings} -> Maybe MultiMeasureMappings
multiMeasureMappings) (\s :: TimestreamConfiguration
s@TimestreamConfiguration' {} Maybe MultiMeasureMappings
a -> TimestreamConfiguration
s {$sel:multiMeasureMappings:TimestreamConfiguration' :: Maybe MultiMeasureMappings
multiMeasureMappings = Maybe MultiMeasureMappings
a} :: TimestreamConfiguration)
timestreamConfiguration_databaseName :: Lens.Lens' TimestreamConfiguration Prelude.Text
timestreamConfiguration_databaseName :: Lens' TimestreamConfiguration Text
timestreamConfiguration_databaseName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamConfiguration' {Text
databaseName :: Text
$sel:databaseName:TimestreamConfiguration' :: TimestreamConfiguration -> Text
databaseName} -> Text
databaseName) (\s :: TimestreamConfiguration
s@TimestreamConfiguration' {} Text
a -> TimestreamConfiguration
s {$sel:databaseName:TimestreamConfiguration' :: Text
databaseName = Text
a} :: TimestreamConfiguration)
timestreamConfiguration_tableName :: Lens.Lens' TimestreamConfiguration Prelude.Text
timestreamConfiguration_tableName :: Lens' TimestreamConfiguration Text
timestreamConfiguration_tableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamConfiguration' {Text
tableName :: Text
$sel:tableName:TimestreamConfiguration' :: TimestreamConfiguration -> Text
tableName} -> Text
tableName) (\s :: TimestreamConfiguration
s@TimestreamConfiguration' {} Text
a -> TimestreamConfiguration
s {$sel:tableName:TimestreamConfiguration' :: Text
tableName = Text
a} :: TimestreamConfiguration)
timestreamConfiguration_timeColumn :: Lens.Lens' TimestreamConfiguration Prelude.Text
timestreamConfiguration_timeColumn :: Lens' TimestreamConfiguration Text
timestreamConfiguration_timeColumn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamConfiguration' {Text
timeColumn :: Text
$sel:timeColumn:TimestreamConfiguration' :: TimestreamConfiguration -> Text
timeColumn} -> Text
timeColumn) (\s :: TimestreamConfiguration
s@TimestreamConfiguration' {} Text
a -> TimestreamConfiguration
s {$sel:timeColumn:TimestreamConfiguration' :: Text
timeColumn = Text
a} :: TimestreamConfiguration)
timestreamConfiguration_dimensionMappings :: Lens.Lens' TimestreamConfiguration [DimensionMapping]
timestreamConfiguration_dimensionMappings :: Lens' TimestreamConfiguration [DimensionMapping]
timestreamConfiguration_dimensionMappings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamConfiguration' {[DimensionMapping]
dimensionMappings :: [DimensionMapping]
$sel:dimensionMappings:TimestreamConfiguration' :: TimestreamConfiguration -> [DimensionMapping]
dimensionMappings} -> [DimensionMapping]
dimensionMappings) (\s :: TimestreamConfiguration
s@TimestreamConfiguration' {} [DimensionMapping]
a -> TimestreamConfiguration
s {$sel:dimensionMappings:TimestreamConfiguration' :: [DimensionMapping]
dimensionMappings = [DimensionMapping]
a} :: TimestreamConfiguration) 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 TimestreamConfiguration where
parseJSON :: Value -> Parser TimestreamConfiguration
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"TimestreamConfiguration"
( \Object
x ->
Maybe Text
-> Maybe (NonEmpty MixedMeasureMapping)
-> Maybe MultiMeasureMappings
-> Text
-> Text
-> Text
-> [DimensionMapping]
-> TimestreamConfiguration
TimestreamConfiguration'
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
"MeasureNameColumn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"MixedMeasureMappings")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"MultiMeasureMappings")
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
"TimeColumn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DimensionMappings"
forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable TimestreamConfiguration where
hashWithSalt :: Int -> TimestreamConfiguration -> Int
hashWithSalt Int
_salt TimestreamConfiguration' {[DimensionMapping]
Maybe (NonEmpty MixedMeasureMapping)
Maybe Text
Maybe MultiMeasureMappings
Text
dimensionMappings :: [DimensionMapping]
timeColumn :: Text
tableName :: Text
databaseName :: Text
multiMeasureMappings :: Maybe MultiMeasureMappings
mixedMeasureMappings :: Maybe (NonEmpty MixedMeasureMapping)
measureNameColumn :: Maybe Text
$sel:dimensionMappings:TimestreamConfiguration' :: TimestreamConfiguration -> [DimensionMapping]
$sel:timeColumn:TimestreamConfiguration' :: TimestreamConfiguration -> Text
$sel:tableName:TimestreamConfiguration' :: TimestreamConfiguration -> Text
$sel:databaseName:TimestreamConfiguration' :: TimestreamConfiguration -> Text
$sel:multiMeasureMappings:TimestreamConfiguration' :: TimestreamConfiguration -> Maybe MultiMeasureMappings
$sel:mixedMeasureMappings:TimestreamConfiguration' :: TimestreamConfiguration -> Maybe (NonEmpty MixedMeasureMapping)
$sel:measureNameColumn:TimestreamConfiguration' :: TimestreamConfiguration -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
measureNameColumn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty MixedMeasureMapping)
mixedMeasureMappings
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MultiMeasureMappings
multiMeasureMappings
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` Text
timeColumn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [DimensionMapping]
dimensionMappings
instance Prelude.NFData TimestreamConfiguration where
rnf :: TimestreamConfiguration -> ()
rnf TimestreamConfiguration' {[DimensionMapping]
Maybe (NonEmpty MixedMeasureMapping)
Maybe Text
Maybe MultiMeasureMappings
Text
dimensionMappings :: [DimensionMapping]
timeColumn :: Text
tableName :: Text
databaseName :: Text
multiMeasureMappings :: Maybe MultiMeasureMappings
mixedMeasureMappings :: Maybe (NonEmpty MixedMeasureMapping)
measureNameColumn :: Maybe Text
$sel:dimensionMappings:TimestreamConfiguration' :: TimestreamConfiguration -> [DimensionMapping]
$sel:timeColumn:TimestreamConfiguration' :: TimestreamConfiguration -> Text
$sel:tableName:TimestreamConfiguration' :: TimestreamConfiguration -> Text
$sel:databaseName:TimestreamConfiguration' :: TimestreamConfiguration -> Text
$sel:multiMeasureMappings:TimestreamConfiguration' :: TimestreamConfiguration -> Maybe MultiMeasureMappings
$sel:mixedMeasureMappings:TimestreamConfiguration' :: TimestreamConfiguration -> Maybe (NonEmpty MixedMeasureMapping)
$sel:measureNameColumn:TimestreamConfiguration' :: TimestreamConfiguration -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
measureNameColumn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty MixedMeasureMapping)
mixedMeasureMappings
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MultiMeasureMappings
multiMeasureMappings
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 Text
timeColumn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [DimensionMapping]
dimensionMappings
instance Data.ToJSON TimestreamConfiguration where
toJSON :: TimestreamConfiguration -> Value
toJSON TimestreamConfiguration' {[DimensionMapping]
Maybe (NonEmpty MixedMeasureMapping)
Maybe Text
Maybe MultiMeasureMappings
Text
dimensionMappings :: [DimensionMapping]
timeColumn :: Text
tableName :: Text
databaseName :: Text
multiMeasureMappings :: Maybe MultiMeasureMappings
mixedMeasureMappings :: Maybe (NonEmpty MixedMeasureMapping)
measureNameColumn :: Maybe Text
$sel:dimensionMappings:TimestreamConfiguration' :: TimestreamConfiguration -> [DimensionMapping]
$sel:timeColumn:TimestreamConfiguration' :: TimestreamConfiguration -> Text
$sel:tableName:TimestreamConfiguration' :: TimestreamConfiguration -> Text
$sel:databaseName:TimestreamConfiguration' :: TimestreamConfiguration -> Text
$sel:multiMeasureMappings:TimestreamConfiguration' :: TimestreamConfiguration -> Maybe MultiMeasureMappings
$sel:mixedMeasureMappings:TimestreamConfiguration' :: TimestreamConfiguration -> Maybe (NonEmpty MixedMeasureMapping)
$sel:measureNameColumn:TimestreamConfiguration' :: TimestreamConfiguration -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"MeasureNameColumn" 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 Text
measureNameColumn,
(Key
"MixedMeasureMappings" 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 (NonEmpty MixedMeasureMapping)
mixedMeasureMappings,
(Key
"MultiMeasureMappings" 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 MultiMeasureMappings
multiMeasureMappings,
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
"TimeColumn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
timeColumn),
forall a. a -> Maybe a
Prelude.Just
(Key
"DimensionMappings" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [DimensionMapping]
dimensionMappings)
]
)