{-# 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.RedshiftData.Types.TableMember
-- 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.RedshiftData.Types.TableMember where

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

-- | The properties of a table.
--
-- /See:/ 'newTableMember' smart constructor.
data TableMember = TableMember'
  { -- | The schema containing the table.
    TableMember -> Maybe Text
schema :: Prelude.Maybe Prelude.Text,
    -- | The name of the table.
    TableMember -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The type of the table. Possible values include TABLE, VIEW, SYSTEM
    -- TABLE, GLOBAL TEMPORARY, LOCAL TEMPORARY, ALIAS, and SYNONYM.
    TableMember -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
  }
  deriving (TableMember -> TableMember -> Bool
(TableMember -> TableMember -> Bool)
-> (TableMember -> TableMember -> Bool) -> Eq TableMember
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TableMember -> TableMember -> Bool
$c/= :: TableMember -> TableMember -> Bool
== :: TableMember -> TableMember -> Bool
$c== :: TableMember -> TableMember -> Bool
Prelude.Eq, ReadPrec [TableMember]
ReadPrec TableMember
Int -> ReadS TableMember
ReadS [TableMember]
(Int -> ReadS TableMember)
-> ReadS [TableMember]
-> ReadPrec TableMember
-> ReadPrec [TableMember]
-> Read TableMember
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TableMember]
$creadListPrec :: ReadPrec [TableMember]
readPrec :: ReadPrec TableMember
$creadPrec :: ReadPrec TableMember
readList :: ReadS [TableMember]
$creadList :: ReadS [TableMember]
readsPrec :: Int -> ReadS TableMember
$creadsPrec :: Int -> ReadS TableMember
Prelude.Read, Int -> TableMember -> ShowS
[TableMember] -> ShowS
TableMember -> String
(Int -> TableMember -> ShowS)
-> (TableMember -> String)
-> ([TableMember] -> ShowS)
-> Show TableMember
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TableMember] -> ShowS
$cshowList :: [TableMember] -> ShowS
show :: TableMember -> String
$cshow :: TableMember -> String
showsPrec :: Int -> TableMember -> ShowS
$cshowsPrec :: Int -> TableMember -> ShowS
Prelude.Show, (forall x. TableMember -> Rep TableMember x)
-> (forall x. Rep TableMember x -> TableMember)
-> Generic TableMember
forall x. Rep TableMember x -> TableMember
forall x. TableMember -> Rep TableMember x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TableMember x -> TableMember
$cfrom :: forall x. TableMember -> Rep TableMember x
Prelude.Generic)

-- |
-- Create a value of 'TableMember' 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:
--
-- 'schema', 'tableMember_schema' - The schema containing the table.
--
-- 'name', 'tableMember_name' - The name of the table.
--
-- 'type'', 'tableMember_type' - The type of the table. Possible values include TABLE, VIEW, SYSTEM
-- TABLE, GLOBAL TEMPORARY, LOCAL TEMPORARY, ALIAS, and SYNONYM.
newTableMember ::
  TableMember
newTableMember :: TableMember
newTableMember =
  TableMember' :: Maybe Text -> Maybe Text -> Maybe Text -> TableMember
TableMember'
    { $sel:schema:TableMember' :: Maybe Text
schema = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:TableMember' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':TableMember' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The schema containing the table.
tableMember_schema :: Lens.Lens' TableMember (Prelude.Maybe Prelude.Text)
tableMember_schema :: (Maybe Text -> f (Maybe Text)) -> TableMember -> f TableMember
tableMember_schema = (TableMember -> Maybe Text)
-> (TableMember -> Maybe Text -> TableMember)
-> Lens TableMember TableMember (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableMember' {Maybe Text
schema :: Maybe Text
$sel:schema:TableMember' :: TableMember -> Maybe Text
schema} -> Maybe Text
schema) (\s :: TableMember
s@TableMember' {} Maybe Text
a -> TableMember
s {$sel:schema:TableMember' :: Maybe Text
schema = Maybe Text
a} :: TableMember)

-- | The name of the table.
tableMember_name :: Lens.Lens' TableMember (Prelude.Maybe Prelude.Text)
tableMember_name :: (Maybe Text -> f (Maybe Text)) -> TableMember -> f TableMember
tableMember_name = (TableMember -> Maybe Text)
-> (TableMember -> Maybe Text -> TableMember)
-> Lens TableMember TableMember (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableMember' {Maybe Text
name :: Maybe Text
$sel:name:TableMember' :: TableMember -> Maybe Text
name} -> Maybe Text
name) (\s :: TableMember
s@TableMember' {} Maybe Text
a -> TableMember
s {$sel:name:TableMember' :: Maybe Text
name = Maybe Text
a} :: TableMember)

-- | The type of the table. Possible values include TABLE, VIEW, SYSTEM
-- TABLE, GLOBAL TEMPORARY, LOCAL TEMPORARY, ALIAS, and SYNONYM.
tableMember_type :: Lens.Lens' TableMember (Prelude.Maybe Prelude.Text)
tableMember_type :: (Maybe Text -> f (Maybe Text)) -> TableMember -> f TableMember
tableMember_type = (TableMember -> Maybe Text)
-> (TableMember -> Maybe Text -> TableMember)
-> Lens TableMember TableMember (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableMember' {Maybe Text
type' :: Maybe Text
$sel:type':TableMember' :: TableMember -> Maybe Text
type'} -> Maybe Text
type') (\s :: TableMember
s@TableMember' {} Maybe Text
a -> TableMember
s {$sel:type':TableMember' :: Maybe Text
type' = Maybe Text
a} :: TableMember)

instance Core.FromJSON TableMember where
  parseJSON :: Value -> Parser TableMember
parseJSON =
    String
-> (Object -> Parser TableMember) -> Value -> Parser TableMember
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TableMember"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> TableMember
TableMember'
            (Maybe Text -> Maybe Text -> Maybe Text -> TableMember)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> TableMember)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"schema")
            Parser (Maybe Text -> Maybe Text -> TableMember)
-> Parser (Maybe Text) -> Parser (Maybe Text -> TableMember)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
            Parser (Maybe Text -> TableMember)
-> Parser (Maybe Text) -> Parser TableMember
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"type")
      )

instance Prelude.Hashable TableMember

instance Prelude.NFData TableMember