{-# 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.LakeFormation.Types.TaggedTable
-- 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.LakeFormation.Types.TaggedTable where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LakeFormation.Types.ColumnLFTag
import Amazonka.LakeFormation.Types.LFTagPair
import Amazonka.LakeFormation.Types.TableResource
import qualified Amazonka.Prelude as Prelude

-- | A structure describing a table resource with LF-tags.
--
-- /See:/ 'newTaggedTable' smart constructor.
data TaggedTable = TaggedTable'
  { -- | A list of LF-tags attached to the database where the table resides.
    TaggedTable -> Maybe (NonEmpty LFTagPair)
lFTagOnDatabase :: Prelude.Maybe (Prelude.NonEmpty LFTagPair),
    -- | A list of LF-tags attached to columns in the table.
    TaggedTable -> Maybe [ColumnLFTag]
lFTagsOnColumns :: Prelude.Maybe [ColumnLFTag],
    -- | A list of LF-tags attached to the table.
    TaggedTable -> Maybe (NonEmpty LFTagPair)
lFTagsOnTable :: Prelude.Maybe (Prelude.NonEmpty LFTagPair),
    -- | A table that has LF-tags attached to it.
    TaggedTable -> Maybe TableResource
table :: Prelude.Maybe TableResource
  }
  deriving (TaggedTable -> TaggedTable -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TaggedTable -> TaggedTable -> Bool
$c/= :: TaggedTable -> TaggedTable -> Bool
== :: TaggedTable -> TaggedTable -> Bool
$c== :: TaggedTable -> TaggedTable -> Bool
Prelude.Eq, ReadPrec [TaggedTable]
ReadPrec TaggedTable
Int -> ReadS TaggedTable
ReadS [TaggedTable]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TaggedTable]
$creadListPrec :: ReadPrec [TaggedTable]
readPrec :: ReadPrec TaggedTable
$creadPrec :: ReadPrec TaggedTable
readList :: ReadS [TaggedTable]
$creadList :: ReadS [TaggedTable]
readsPrec :: Int -> ReadS TaggedTable
$creadsPrec :: Int -> ReadS TaggedTable
Prelude.Read, Int -> TaggedTable -> ShowS
[TaggedTable] -> ShowS
TaggedTable -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TaggedTable] -> ShowS
$cshowList :: [TaggedTable] -> ShowS
show :: TaggedTable -> String
$cshow :: TaggedTable -> String
showsPrec :: Int -> TaggedTable -> ShowS
$cshowsPrec :: Int -> TaggedTable -> ShowS
Prelude.Show, forall x. Rep TaggedTable x -> TaggedTable
forall x. TaggedTable -> Rep TaggedTable x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TaggedTable x -> TaggedTable
$cfrom :: forall x. TaggedTable -> Rep TaggedTable x
Prelude.Generic)

-- |
-- Create a value of 'TaggedTable' 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:
--
-- 'lFTagOnDatabase', 'taggedTable_lFTagOnDatabase' - A list of LF-tags attached to the database where the table resides.
--
-- 'lFTagsOnColumns', 'taggedTable_lFTagsOnColumns' - A list of LF-tags attached to columns in the table.
--
-- 'lFTagsOnTable', 'taggedTable_lFTagsOnTable' - A list of LF-tags attached to the table.
--
-- 'table', 'taggedTable_table' - A table that has LF-tags attached to it.
newTaggedTable ::
  TaggedTable
newTaggedTable :: TaggedTable
newTaggedTable =
  TaggedTable'
    { $sel:lFTagOnDatabase:TaggedTable' :: Maybe (NonEmpty LFTagPair)
lFTagOnDatabase = forall a. Maybe a
Prelude.Nothing,
      $sel:lFTagsOnColumns:TaggedTable' :: Maybe [ColumnLFTag]
lFTagsOnColumns = forall a. Maybe a
Prelude.Nothing,
      $sel:lFTagsOnTable:TaggedTable' :: Maybe (NonEmpty LFTagPair)
lFTagsOnTable = forall a. Maybe a
Prelude.Nothing,
      $sel:table:TaggedTable' :: Maybe TableResource
table = forall a. Maybe a
Prelude.Nothing
    }

-- | A list of LF-tags attached to the database where the table resides.
taggedTable_lFTagOnDatabase :: Lens.Lens' TaggedTable (Prelude.Maybe (Prelude.NonEmpty LFTagPair))
taggedTable_lFTagOnDatabase :: Lens' TaggedTable (Maybe (NonEmpty LFTagPair))
taggedTable_lFTagOnDatabase = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaggedTable' {Maybe (NonEmpty LFTagPair)
lFTagOnDatabase :: Maybe (NonEmpty LFTagPair)
$sel:lFTagOnDatabase:TaggedTable' :: TaggedTable -> Maybe (NonEmpty LFTagPair)
lFTagOnDatabase} -> Maybe (NonEmpty LFTagPair)
lFTagOnDatabase) (\s :: TaggedTable
s@TaggedTable' {} Maybe (NonEmpty LFTagPair)
a -> TaggedTable
s {$sel:lFTagOnDatabase:TaggedTable' :: Maybe (NonEmpty LFTagPair)
lFTagOnDatabase = Maybe (NonEmpty LFTagPair)
a} :: TaggedTable) 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

-- | A list of LF-tags attached to columns in the table.
taggedTable_lFTagsOnColumns :: Lens.Lens' TaggedTable (Prelude.Maybe [ColumnLFTag])
taggedTable_lFTagsOnColumns :: Lens' TaggedTable (Maybe [ColumnLFTag])
taggedTable_lFTagsOnColumns = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaggedTable' {Maybe [ColumnLFTag]
lFTagsOnColumns :: Maybe [ColumnLFTag]
$sel:lFTagsOnColumns:TaggedTable' :: TaggedTable -> Maybe [ColumnLFTag]
lFTagsOnColumns} -> Maybe [ColumnLFTag]
lFTagsOnColumns) (\s :: TaggedTable
s@TaggedTable' {} Maybe [ColumnLFTag]
a -> TaggedTable
s {$sel:lFTagsOnColumns:TaggedTable' :: Maybe [ColumnLFTag]
lFTagsOnColumns = Maybe [ColumnLFTag]
a} :: TaggedTable) 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

-- | A list of LF-tags attached to the table.
taggedTable_lFTagsOnTable :: Lens.Lens' TaggedTable (Prelude.Maybe (Prelude.NonEmpty LFTagPair))
taggedTable_lFTagsOnTable :: Lens' TaggedTable (Maybe (NonEmpty LFTagPair))
taggedTable_lFTagsOnTable = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaggedTable' {Maybe (NonEmpty LFTagPair)
lFTagsOnTable :: Maybe (NonEmpty LFTagPair)
$sel:lFTagsOnTable:TaggedTable' :: TaggedTable -> Maybe (NonEmpty LFTagPair)
lFTagsOnTable} -> Maybe (NonEmpty LFTagPair)
lFTagsOnTable) (\s :: TaggedTable
s@TaggedTable' {} Maybe (NonEmpty LFTagPair)
a -> TaggedTable
s {$sel:lFTagsOnTable:TaggedTable' :: Maybe (NonEmpty LFTagPair)
lFTagsOnTable = Maybe (NonEmpty LFTagPair)
a} :: TaggedTable) 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

-- | A table that has LF-tags attached to it.
taggedTable_table :: Lens.Lens' TaggedTable (Prelude.Maybe TableResource)
taggedTable_table :: Lens' TaggedTable (Maybe TableResource)
taggedTable_table = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaggedTable' {Maybe TableResource
table :: Maybe TableResource
$sel:table:TaggedTable' :: TaggedTable -> Maybe TableResource
table} -> Maybe TableResource
table) (\s :: TaggedTable
s@TaggedTable' {} Maybe TableResource
a -> TaggedTable
s {$sel:table:TaggedTable' :: Maybe TableResource
table = Maybe TableResource
a} :: TaggedTable)

instance Data.FromJSON TaggedTable where
  parseJSON :: Value -> Parser TaggedTable
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TaggedTable"
      ( \Object
x ->
          Maybe (NonEmpty LFTagPair)
-> Maybe [ColumnLFTag]
-> Maybe (NonEmpty LFTagPair)
-> Maybe TableResource
-> TaggedTable
TaggedTable'
            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
"LFTagOnDatabase")
            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
"LFTagsOnColumns"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"LFTagsOnTable")
            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
"Table")
      )

instance Prelude.Hashable TaggedTable where
  hashWithSalt :: Int -> TaggedTable -> Int
hashWithSalt Int
_salt TaggedTable' {Maybe [ColumnLFTag]
Maybe (NonEmpty LFTagPair)
Maybe TableResource
table :: Maybe TableResource
lFTagsOnTable :: Maybe (NonEmpty LFTagPair)
lFTagsOnColumns :: Maybe [ColumnLFTag]
lFTagOnDatabase :: Maybe (NonEmpty LFTagPair)
$sel:table:TaggedTable' :: TaggedTable -> Maybe TableResource
$sel:lFTagsOnTable:TaggedTable' :: TaggedTable -> Maybe (NonEmpty LFTagPair)
$sel:lFTagsOnColumns:TaggedTable' :: TaggedTable -> Maybe [ColumnLFTag]
$sel:lFTagOnDatabase:TaggedTable' :: TaggedTable -> Maybe (NonEmpty LFTagPair)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty LFTagPair)
lFTagOnDatabase
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ColumnLFTag]
lFTagsOnColumns
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty LFTagPair)
lFTagsOnTable
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TableResource
table

instance Prelude.NFData TaggedTable where
  rnf :: TaggedTable -> ()
rnf TaggedTable' {Maybe [ColumnLFTag]
Maybe (NonEmpty LFTagPair)
Maybe TableResource
table :: Maybe TableResource
lFTagsOnTable :: Maybe (NonEmpty LFTagPair)
lFTagsOnColumns :: Maybe [ColumnLFTag]
lFTagOnDatabase :: Maybe (NonEmpty LFTagPair)
$sel:table:TaggedTable' :: TaggedTable -> Maybe TableResource
$sel:lFTagsOnTable:TaggedTable' :: TaggedTable -> Maybe (NonEmpty LFTagPair)
$sel:lFTagsOnColumns:TaggedTable' :: TaggedTable -> Maybe [ColumnLFTag]
$sel:lFTagOnDatabase:TaggedTable' :: TaggedTable -> Maybe (NonEmpty LFTagPair)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty LFTagPair)
lFTagOnDatabase
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ColumnLFTag]
lFTagsOnColumns
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty LFTagPair)
lFTagsOnTable
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TableResource
table