{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.IoTFleetWise.Types.TimestreamResources
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoTFleetWise.Types.TimestreamResources 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

-- | The registered Amazon Timestream resources that Amazon Web Services IoT
-- FleetWise edge agent software can transfer your vehicle data to.
--
-- /See:/ 'newTimestreamResources' smart constructor.
data TimestreamResources = TimestreamResources'
  { -- | The name of the registered Amazon Timestream database.
    TimestreamResources -> Text
timestreamDatabaseName :: Prelude.Text,
    -- | The name of the registered Amazon Timestream database table.
    TimestreamResources -> Text
timestreamTableName :: Prelude.Text
  }
  deriving (TimestreamResources -> TimestreamResources -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimestreamResources -> TimestreamResources -> Bool
$c/= :: TimestreamResources -> TimestreamResources -> Bool
== :: TimestreamResources -> TimestreamResources -> Bool
$c== :: TimestreamResources -> TimestreamResources -> Bool
Prelude.Eq, ReadPrec [TimestreamResources]
ReadPrec TimestreamResources
Int -> ReadS TimestreamResources
ReadS [TimestreamResources]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TimestreamResources]
$creadListPrec :: ReadPrec [TimestreamResources]
readPrec :: ReadPrec TimestreamResources
$creadPrec :: ReadPrec TimestreamResources
readList :: ReadS [TimestreamResources]
$creadList :: ReadS [TimestreamResources]
readsPrec :: Int -> ReadS TimestreamResources
$creadsPrec :: Int -> ReadS TimestreamResources
Prelude.Read, Int -> TimestreamResources -> ShowS
[TimestreamResources] -> ShowS
TimestreamResources -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TimestreamResources] -> ShowS
$cshowList :: [TimestreamResources] -> ShowS
show :: TimestreamResources -> String
$cshow :: TimestreamResources -> String
showsPrec :: Int -> TimestreamResources -> ShowS
$cshowsPrec :: Int -> TimestreamResources -> ShowS
Prelude.Show, forall x. Rep TimestreamResources x -> TimestreamResources
forall x. TimestreamResources -> Rep TimestreamResources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TimestreamResources x -> TimestreamResources
$cfrom :: forall x. TimestreamResources -> Rep TimestreamResources x
Prelude.Generic)

-- |
-- Create a value of 'TimestreamResources' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'timestreamDatabaseName', 'timestreamResources_timestreamDatabaseName' - The name of the registered Amazon Timestream database.
--
-- 'timestreamTableName', 'timestreamResources_timestreamTableName' - The name of the registered Amazon Timestream database table.
newTimestreamResources ::
  -- | 'timestreamDatabaseName'
  Prelude.Text ->
  -- | 'timestreamTableName'
  Prelude.Text ->
  TimestreamResources
newTimestreamResources :: Text -> Text -> TimestreamResources
newTimestreamResources
  Text
pTimestreamDatabaseName_
  Text
pTimestreamTableName_ =
    TimestreamResources'
      { $sel:timestreamDatabaseName:TimestreamResources' :: Text
timestreamDatabaseName =
          Text
pTimestreamDatabaseName_,
        $sel:timestreamTableName:TimestreamResources' :: Text
timestreamTableName = Text
pTimestreamTableName_
      }

-- | The name of the registered Amazon Timestream database.
timestreamResources_timestreamDatabaseName :: Lens.Lens' TimestreamResources Prelude.Text
timestreamResources_timestreamDatabaseName :: Lens' TimestreamResources Text
timestreamResources_timestreamDatabaseName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamResources' {Text
timestreamDatabaseName :: Text
$sel:timestreamDatabaseName:TimestreamResources' :: TimestreamResources -> Text
timestreamDatabaseName} -> Text
timestreamDatabaseName) (\s :: TimestreamResources
s@TimestreamResources' {} Text
a -> TimestreamResources
s {$sel:timestreamDatabaseName:TimestreamResources' :: Text
timestreamDatabaseName = Text
a} :: TimestreamResources)

-- | The name of the registered Amazon Timestream database table.
timestreamResources_timestreamTableName :: Lens.Lens' TimestreamResources Prelude.Text
timestreamResources_timestreamTableName :: Lens' TimestreamResources Text
timestreamResources_timestreamTableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamResources' {Text
timestreamTableName :: Text
$sel:timestreamTableName:TimestreamResources' :: TimestreamResources -> Text
timestreamTableName} -> Text
timestreamTableName) (\s :: TimestreamResources
s@TimestreamResources' {} Text
a -> TimestreamResources
s {$sel:timestreamTableName:TimestreamResources' :: Text
timestreamTableName = Text
a} :: TimestreamResources)

instance Data.FromJSON TimestreamResources where
  parseJSON :: Value -> Parser TimestreamResources
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TimestreamResources"
      ( \Object
x ->
          Text -> Text -> TimestreamResources
TimestreamResources'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"timestreamDatabaseName")
            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
"timestreamTableName")
      )

instance Prelude.Hashable TimestreamResources where
  hashWithSalt :: Int -> TimestreamResources -> Int
hashWithSalt Int
_salt TimestreamResources' {Text
timestreamTableName :: Text
timestreamDatabaseName :: Text
$sel:timestreamTableName:TimestreamResources' :: TimestreamResources -> Text
$sel:timestreamDatabaseName:TimestreamResources' :: TimestreamResources -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
timestreamDatabaseName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
timestreamTableName

instance Prelude.NFData TimestreamResources where
  rnf :: TimestreamResources -> ()
rnf TimestreamResources' {Text
timestreamTableName :: Text
timestreamDatabaseName :: Text
$sel:timestreamTableName:TimestreamResources' :: TimestreamResources -> Text
$sel:timestreamDatabaseName:TimestreamResources' :: TimestreamResources -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
timestreamDatabaseName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
timestreamTableName

instance Data.ToJSON TimestreamResources where
  toJSON :: TimestreamResources -> Value
toJSON TimestreamResources' {Text
timestreamTableName :: Text
timestreamDatabaseName :: Text
$sel:timestreamTableName:TimestreamResources' :: TimestreamResources -> Text
$sel:timestreamDatabaseName:TimestreamResources' :: TimestreamResources -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"timestreamDatabaseName"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
timestreamDatabaseName
              ),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"timestreamTableName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
timestreamTableName)
          ]
      )