{-# 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 #-}
module Amazonka.LakeFormation.Types.LFTagPair 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
data LFTagPair = LFTagPair'
{
LFTagPair -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
LFTagPair -> Text
tagKey :: Prelude.Text,
LFTagPair -> NonEmpty Text
tagValues :: Prelude.NonEmpty Prelude.Text
}
deriving (LFTagPair -> LFTagPair -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LFTagPair -> LFTagPair -> Bool
$c/= :: LFTagPair -> LFTagPair -> Bool
== :: LFTagPair -> LFTagPair -> Bool
$c== :: LFTagPair -> LFTagPair -> Bool
Prelude.Eq, ReadPrec [LFTagPair]
ReadPrec LFTagPair
Int -> ReadS LFTagPair
ReadS [LFTagPair]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LFTagPair]
$creadListPrec :: ReadPrec [LFTagPair]
readPrec :: ReadPrec LFTagPair
$creadPrec :: ReadPrec LFTagPair
readList :: ReadS [LFTagPair]
$creadList :: ReadS [LFTagPair]
readsPrec :: Int -> ReadS LFTagPair
$creadsPrec :: Int -> ReadS LFTagPair
Prelude.Read, Int -> LFTagPair -> ShowS
[LFTagPair] -> ShowS
LFTagPair -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LFTagPair] -> ShowS
$cshowList :: [LFTagPair] -> ShowS
show :: LFTagPair -> String
$cshow :: LFTagPair -> String
showsPrec :: Int -> LFTagPair -> ShowS
$cshowsPrec :: Int -> LFTagPair -> ShowS
Prelude.Show, forall x. Rep LFTagPair x -> LFTagPair
forall x. LFTagPair -> Rep LFTagPair x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LFTagPair x -> LFTagPair
$cfrom :: forall x. LFTagPair -> Rep LFTagPair x
Prelude.Generic)
newLFTagPair ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
LFTagPair
newLFTagPair :: Text -> NonEmpty Text -> LFTagPair
newLFTagPair Text
pTagKey_ NonEmpty Text
pTagValues_ =
LFTagPair'
{ $sel:catalogId:LFTagPair' :: Maybe Text
catalogId = forall a. Maybe a
Prelude.Nothing,
$sel:tagKey:LFTagPair' :: Text
tagKey = Text
pTagKey_,
$sel:tagValues:LFTagPair' :: NonEmpty Text
tagValues = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pTagValues_
}
lFTagPair_catalogId :: Lens.Lens' LFTagPair (Prelude.Maybe Prelude.Text)
lFTagPair_catalogId :: Lens' LFTagPair (Maybe Text)
lFTagPair_catalogId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LFTagPair' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:LFTagPair' :: LFTagPair -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: LFTagPair
s@LFTagPair' {} Maybe Text
a -> LFTagPair
s {$sel:catalogId:LFTagPair' :: Maybe Text
catalogId = Maybe Text
a} :: LFTagPair)
lFTagPair_tagKey :: Lens.Lens' LFTagPair Prelude.Text
lFTagPair_tagKey :: Lens' LFTagPair Text
lFTagPair_tagKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LFTagPair' {Text
tagKey :: Text
$sel:tagKey:LFTagPair' :: LFTagPair -> Text
tagKey} -> Text
tagKey) (\s :: LFTagPair
s@LFTagPair' {} Text
a -> LFTagPair
s {$sel:tagKey:LFTagPair' :: Text
tagKey = Text
a} :: LFTagPair)
lFTagPair_tagValues :: Lens.Lens' LFTagPair (Prelude.NonEmpty Prelude.Text)
lFTagPair_tagValues :: Lens' LFTagPair (NonEmpty Text)
lFTagPair_tagValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LFTagPair' {NonEmpty Text
tagValues :: NonEmpty Text
$sel:tagValues:LFTagPair' :: LFTagPair -> NonEmpty Text
tagValues} -> NonEmpty Text
tagValues) (\s :: LFTagPair
s@LFTagPair' {} NonEmpty Text
a -> LFTagPair
s {$sel:tagValues:LFTagPair' :: NonEmpty Text
tagValues = NonEmpty Text
a} :: LFTagPair) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON LFTagPair where
parseJSON :: Value -> Parser LFTagPair
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"LFTagPair"
( \Object
x ->
Maybe Text -> Text -> NonEmpty Text -> LFTagPair
LFTagPair'
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
"CatalogId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"TagKey")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"TagValues")
)
instance Prelude.Hashable LFTagPair where
hashWithSalt :: Int -> LFTagPair -> Int
hashWithSalt Int
_salt LFTagPair' {Maybe Text
NonEmpty Text
Text
tagValues :: NonEmpty Text
tagKey :: Text
catalogId :: Maybe Text
$sel:tagValues:LFTagPair' :: LFTagPair -> NonEmpty Text
$sel:tagKey:LFTagPair' :: LFTagPair -> Text
$sel:catalogId:LFTagPair' :: LFTagPair -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
catalogId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
tagKey
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
tagValues
instance Prelude.NFData LFTagPair where
rnf :: LFTagPair -> ()
rnf LFTagPair' {Maybe Text
NonEmpty Text
Text
tagValues :: NonEmpty Text
tagKey :: Text
catalogId :: Maybe Text
$sel:tagValues:LFTagPair' :: LFTagPair -> NonEmpty Text
$sel:tagKey:LFTagPair' :: LFTagPair -> Text
$sel:catalogId:LFTagPair' :: LFTagPair -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
catalogId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
tagKey
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
tagValues
instance Data.ToJSON LFTagPair where
toJSON :: LFTagPair -> Value
toJSON LFTagPair' {Maybe Text
NonEmpty Text
Text
tagValues :: NonEmpty Text
tagKey :: Text
catalogId :: Maybe Text
$sel:tagValues:LFTagPair' :: LFTagPair -> NonEmpty Text
$sel:tagKey:LFTagPair' :: LFTagPair -> Text
$sel:catalogId:LFTagPair' :: LFTagPair -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"CatalogId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
catalogId,
forall a. a -> Maybe a
Prelude.Just (Key
"TagKey" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
tagKey),
forall a. a -> Maybe a
Prelude.Just (Key
"TagValues" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
tagValues)
]
)