{-# 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.TimeStreamQuery.Types.TimestreamDestination
-- 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.TimeStreamQuery.Types.TimestreamDestination 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

-- | Destination for scheduled query.
--
-- /See:/ 'newTimestreamDestination' smart constructor.
data TimestreamDestination = TimestreamDestination'
  { -- | Timestream database name.
    TimestreamDestination -> Maybe Text
databaseName :: Prelude.Maybe Prelude.Text,
    -- | Timestream table name.
    TimestreamDestination -> Maybe Text
tableName :: Prelude.Maybe Prelude.Text
  }
  deriving (TimestreamDestination -> TimestreamDestination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TimestreamDestination -> TimestreamDestination -> Bool
$c/= :: TimestreamDestination -> TimestreamDestination -> Bool
== :: TimestreamDestination -> TimestreamDestination -> Bool
$c== :: TimestreamDestination -> TimestreamDestination -> Bool
Prelude.Eq, ReadPrec [TimestreamDestination]
ReadPrec TimestreamDestination
Int -> ReadS TimestreamDestination
ReadS [TimestreamDestination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TimestreamDestination]
$creadListPrec :: ReadPrec [TimestreamDestination]
readPrec :: ReadPrec TimestreamDestination
$creadPrec :: ReadPrec TimestreamDestination
readList :: ReadS [TimestreamDestination]
$creadList :: ReadS [TimestreamDestination]
readsPrec :: Int -> ReadS TimestreamDestination
$creadsPrec :: Int -> ReadS TimestreamDestination
Prelude.Read, Int -> TimestreamDestination -> ShowS
[TimestreamDestination] -> ShowS
TimestreamDestination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TimestreamDestination] -> ShowS
$cshowList :: [TimestreamDestination] -> ShowS
show :: TimestreamDestination -> String
$cshow :: TimestreamDestination -> String
showsPrec :: Int -> TimestreamDestination -> ShowS
$cshowsPrec :: Int -> TimestreamDestination -> ShowS
Prelude.Show, forall x. Rep TimestreamDestination x -> TimestreamDestination
forall x. TimestreamDestination -> Rep TimestreamDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TimestreamDestination x -> TimestreamDestination
$cfrom :: forall x. TimestreamDestination -> Rep TimestreamDestination x
Prelude.Generic)

-- |
-- Create a value of 'TimestreamDestination' 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:
--
-- 'databaseName', 'timestreamDestination_databaseName' - Timestream database name.
--
-- 'tableName', 'timestreamDestination_tableName' - Timestream table name.
newTimestreamDestination ::
  TimestreamDestination
newTimestreamDestination :: TimestreamDestination
newTimestreamDestination =
  TimestreamDestination'
    { $sel:databaseName:TimestreamDestination' :: Maybe Text
databaseName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:tableName:TimestreamDestination' :: Maybe Text
tableName = forall a. Maybe a
Prelude.Nothing
    }

-- | Timestream database name.
timestreamDestination_databaseName :: Lens.Lens' TimestreamDestination (Prelude.Maybe Prelude.Text)
timestreamDestination_databaseName :: Lens' TimestreamDestination (Maybe Text)
timestreamDestination_databaseName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamDestination' {Maybe Text
databaseName :: Maybe Text
$sel:databaseName:TimestreamDestination' :: TimestreamDestination -> Maybe Text
databaseName} -> Maybe Text
databaseName) (\s :: TimestreamDestination
s@TimestreamDestination' {} Maybe Text
a -> TimestreamDestination
s {$sel:databaseName:TimestreamDestination' :: Maybe Text
databaseName = Maybe Text
a} :: TimestreamDestination)

-- | Timestream table name.
timestreamDestination_tableName :: Lens.Lens' TimestreamDestination (Prelude.Maybe Prelude.Text)
timestreamDestination_tableName :: Lens' TimestreamDestination (Maybe Text)
timestreamDestination_tableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TimestreamDestination' {Maybe Text
tableName :: Maybe Text
$sel:tableName:TimestreamDestination' :: TimestreamDestination -> Maybe Text
tableName} -> Maybe Text
tableName) (\s :: TimestreamDestination
s@TimestreamDestination' {} Maybe Text
a -> TimestreamDestination
s {$sel:tableName:TimestreamDestination' :: Maybe Text
tableName = Maybe Text
a} :: TimestreamDestination)

instance Data.FromJSON TimestreamDestination where
  parseJSON :: Value -> Parser TimestreamDestination
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TimestreamDestination"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> TimestreamDestination
TimestreamDestination'
            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
"DatabaseName")
            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
"TableName")
      )

instance Prelude.Hashable TimestreamDestination where
  hashWithSalt :: Int -> TimestreamDestination -> Int
hashWithSalt Int
_salt TimestreamDestination' {Maybe Text
tableName :: Maybe Text
databaseName :: Maybe Text
$sel:tableName:TimestreamDestination' :: TimestreamDestination -> Maybe Text
$sel:databaseName:TimestreamDestination' :: TimestreamDestination -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
databaseName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
tableName

instance Prelude.NFData TimestreamDestination where
  rnf :: TimestreamDestination -> ()
rnf TimestreamDestination' {Maybe Text
tableName :: Maybe Text
databaseName :: Maybe Text
$sel:tableName:TimestreamDestination' :: TimestreamDestination -> Maybe Text
$sel:databaseName:TimestreamDestination' :: TimestreamDestination -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
databaseName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
tableName