{-# 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.DMS.Types.TableToReload
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.DMS.Types.TableToReload where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides the name of the schema and table to be reloaded.
--
-- /See:/ 'newTableToReload' smart constructor.
data TableToReload = TableToReload'
  { -- | The schema name of the table to be reloaded.
    TableToReload -> Text
schemaName :: Prelude.Text,
    -- | The table name of the table to be reloaded.
    TableToReload -> Text
tableName :: Prelude.Text
  }
  deriving (TableToReload -> TableToReload -> Bool
(TableToReload -> TableToReload -> Bool)
-> (TableToReload -> TableToReload -> Bool) -> Eq TableToReload
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TableToReload -> TableToReload -> Bool
$c/= :: TableToReload -> TableToReload -> Bool
== :: TableToReload -> TableToReload -> Bool
$c== :: TableToReload -> TableToReload -> Bool
Prelude.Eq, ReadPrec [TableToReload]
ReadPrec TableToReload
Int -> ReadS TableToReload
ReadS [TableToReload]
(Int -> ReadS TableToReload)
-> ReadS [TableToReload]
-> ReadPrec TableToReload
-> ReadPrec [TableToReload]
-> Read TableToReload
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TableToReload]
$creadListPrec :: ReadPrec [TableToReload]
readPrec :: ReadPrec TableToReload
$creadPrec :: ReadPrec TableToReload
readList :: ReadS [TableToReload]
$creadList :: ReadS [TableToReload]
readsPrec :: Int -> ReadS TableToReload
$creadsPrec :: Int -> ReadS TableToReload
Prelude.Read, Int -> TableToReload -> ShowS
[TableToReload] -> ShowS
TableToReload -> String
(Int -> TableToReload -> ShowS)
-> (TableToReload -> String)
-> ([TableToReload] -> ShowS)
-> Show TableToReload
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TableToReload] -> ShowS
$cshowList :: [TableToReload] -> ShowS
show :: TableToReload -> String
$cshow :: TableToReload -> String
showsPrec :: Int -> TableToReload -> ShowS
$cshowsPrec :: Int -> TableToReload -> ShowS
Prelude.Show, (forall x. TableToReload -> Rep TableToReload x)
-> (forall x. Rep TableToReload x -> TableToReload)
-> Generic TableToReload
forall x. Rep TableToReload x -> TableToReload
forall x. TableToReload -> Rep TableToReload x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TableToReload x -> TableToReload
$cfrom :: forall x. TableToReload -> Rep TableToReload x
Prelude.Generic)

-- |
-- Create a value of 'TableToReload' 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:
--
-- 'schemaName', 'tableToReload_schemaName' - The schema name of the table to be reloaded.
--
-- 'tableName', 'tableToReload_tableName' - The table name of the table to be reloaded.
newTableToReload ::
  -- | 'schemaName'
  Prelude.Text ->
  -- | 'tableName'
  Prelude.Text ->
  TableToReload
newTableToReload :: Text -> Text -> TableToReload
newTableToReload Text
pSchemaName_ Text
pTableName_ =
  TableToReload' :: Text -> Text -> TableToReload
TableToReload'
    { $sel:schemaName:TableToReload' :: Text
schemaName = Text
pSchemaName_,
      $sel:tableName:TableToReload' :: Text
tableName = Text
pTableName_
    }

-- | The schema name of the table to be reloaded.
tableToReload_schemaName :: Lens.Lens' TableToReload Prelude.Text
tableToReload_schemaName :: (Text -> f Text) -> TableToReload -> f TableToReload
tableToReload_schemaName = (TableToReload -> Text)
-> (TableToReload -> Text -> TableToReload)
-> Lens TableToReload TableToReload Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableToReload' {Text
schemaName :: Text
$sel:schemaName:TableToReload' :: TableToReload -> Text
schemaName} -> Text
schemaName) (\s :: TableToReload
s@TableToReload' {} Text
a -> TableToReload
s {$sel:schemaName:TableToReload' :: Text
schemaName = Text
a} :: TableToReload)

-- | The table name of the table to be reloaded.
tableToReload_tableName :: Lens.Lens' TableToReload Prelude.Text
tableToReload_tableName :: (Text -> f Text) -> TableToReload -> f TableToReload
tableToReload_tableName = (TableToReload -> Text)
-> (TableToReload -> Text -> TableToReload)
-> Lens TableToReload TableToReload Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableToReload' {Text
tableName :: Text
$sel:tableName:TableToReload' :: TableToReload -> Text
tableName} -> Text
tableName) (\s :: TableToReload
s@TableToReload' {} Text
a -> TableToReload
s {$sel:tableName:TableToReload' :: Text
tableName = Text
a} :: TableToReload)

instance Prelude.Hashable TableToReload

instance Prelude.NFData TableToReload

instance Core.ToJSON TableToReload where
  toJSON :: TableToReload -> Value
toJSON TableToReload' {Text
tableName :: Text
schemaName :: Text
$sel:tableName:TableToReload' :: TableToReload -> Text
$sel:schemaName:TableToReload' :: TableToReload -> 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
"SchemaName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
schemaName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TableName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tableName)
          ]
      )