{-# 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.ColumnLFTag
-- 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.ColumnLFTag 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.LFTagPair
import qualified Amazonka.Prelude as Prelude

-- | A structure containing the name of a column resource and the LF-tags
-- attached to it.
--
-- /See:/ 'newColumnLFTag' smart constructor.
data ColumnLFTag = ColumnLFTag'
  { -- | The LF-tags attached to a column resource.
    ColumnLFTag -> Maybe (NonEmpty LFTagPair)
lFTags :: Prelude.Maybe (Prelude.NonEmpty LFTagPair),
    -- | The name of a column resource.
    ColumnLFTag -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (ColumnLFTag -> ColumnLFTag -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ColumnLFTag -> ColumnLFTag -> Bool
$c/= :: ColumnLFTag -> ColumnLFTag -> Bool
== :: ColumnLFTag -> ColumnLFTag -> Bool
$c== :: ColumnLFTag -> ColumnLFTag -> Bool
Prelude.Eq, ReadPrec [ColumnLFTag]
ReadPrec ColumnLFTag
Int -> ReadS ColumnLFTag
ReadS [ColumnLFTag]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ColumnLFTag]
$creadListPrec :: ReadPrec [ColumnLFTag]
readPrec :: ReadPrec ColumnLFTag
$creadPrec :: ReadPrec ColumnLFTag
readList :: ReadS [ColumnLFTag]
$creadList :: ReadS [ColumnLFTag]
readsPrec :: Int -> ReadS ColumnLFTag
$creadsPrec :: Int -> ReadS ColumnLFTag
Prelude.Read, Int -> ColumnLFTag -> ShowS
[ColumnLFTag] -> ShowS
ColumnLFTag -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ColumnLFTag] -> ShowS
$cshowList :: [ColumnLFTag] -> ShowS
show :: ColumnLFTag -> String
$cshow :: ColumnLFTag -> String
showsPrec :: Int -> ColumnLFTag -> ShowS
$cshowsPrec :: Int -> ColumnLFTag -> ShowS
Prelude.Show, forall x. Rep ColumnLFTag x -> ColumnLFTag
forall x. ColumnLFTag -> Rep ColumnLFTag x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ColumnLFTag x -> ColumnLFTag
$cfrom :: forall x. ColumnLFTag -> Rep ColumnLFTag x
Prelude.Generic)

-- |
-- Create a value of 'ColumnLFTag' 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:
--
-- 'lFTags', 'columnLFTag_lFTags' - The LF-tags attached to a column resource.
--
-- 'name', 'columnLFTag_name' - The name of a column resource.
newColumnLFTag ::
  ColumnLFTag
newColumnLFTag :: ColumnLFTag
newColumnLFTag =
  ColumnLFTag'
    { $sel:lFTags:ColumnLFTag' :: Maybe (NonEmpty LFTagPair)
lFTags = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ColumnLFTag' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing
    }

-- | The LF-tags attached to a column resource.
columnLFTag_lFTags :: Lens.Lens' ColumnLFTag (Prelude.Maybe (Prelude.NonEmpty LFTagPair))
columnLFTag_lFTags :: Lens' ColumnLFTag (Maybe (NonEmpty LFTagPair))
columnLFTag_lFTags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ColumnLFTag' {Maybe (NonEmpty LFTagPair)
lFTags :: Maybe (NonEmpty LFTagPair)
$sel:lFTags:ColumnLFTag' :: ColumnLFTag -> Maybe (NonEmpty LFTagPair)
lFTags} -> Maybe (NonEmpty LFTagPair)
lFTags) (\s :: ColumnLFTag
s@ColumnLFTag' {} Maybe (NonEmpty LFTagPair)
a -> ColumnLFTag
s {$sel:lFTags:ColumnLFTag' :: Maybe (NonEmpty LFTagPair)
lFTags = Maybe (NonEmpty LFTagPair)
a} :: ColumnLFTag) 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

-- | The name of a column resource.
columnLFTag_name :: Lens.Lens' ColumnLFTag (Prelude.Maybe Prelude.Text)
columnLFTag_name :: Lens' ColumnLFTag (Maybe Text)
columnLFTag_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ColumnLFTag' {Maybe Text
name :: Maybe Text
$sel:name:ColumnLFTag' :: ColumnLFTag -> Maybe Text
name} -> Maybe Text
name) (\s :: ColumnLFTag
s@ColumnLFTag' {} Maybe Text
a -> ColumnLFTag
s {$sel:name:ColumnLFTag' :: Maybe Text
name = Maybe Text
a} :: ColumnLFTag)

instance Data.FromJSON ColumnLFTag where
  parseJSON :: Value -> Parser ColumnLFTag
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ColumnLFTag"
      ( \Object
x ->
          Maybe (NonEmpty LFTagPair) -> Maybe Text -> ColumnLFTag
ColumnLFTag'
            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
"LFTags")
            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
"Name")
      )

instance Prelude.Hashable ColumnLFTag where
  hashWithSalt :: Int -> ColumnLFTag -> Int
hashWithSalt Int
_salt ColumnLFTag' {Maybe (NonEmpty LFTagPair)
Maybe Text
name :: Maybe Text
lFTags :: Maybe (NonEmpty LFTagPair)
$sel:name:ColumnLFTag' :: ColumnLFTag -> Maybe Text
$sel:lFTags:ColumnLFTag' :: ColumnLFTag -> Maybe (NonEmpty LFTagPair)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty LFTagPair)
lFTags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name

instance Prelude.NFData ColumnLFTag where
  rnf :: ColumnLFTag -> ()
rnf ColumnLFTag' {Maybe (NonEmpty LFTagPair)
Maybe Text
name :: Maybe Text
lFTags :: Maybe (NonEmpty LFTagPair)
$sel:name:ColumnLFTag' :: ColumnLFTag -> Maybe Text
$sel:lFTags:ColumnLFTag' :: ColumnLFTag -> Maybe (NonEmpty LFTagPair)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty LFTagPair)
lFTags seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name