{-# 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.LFTag where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data LFTag = LFTag'
{
LFTag -> Text
tagKey :: Prelude.Text,
LFTag -> NonEmpty Text
tagValues :: Prelude.NonEmpty Prelude.Text
}
deriving (LFTag -> LFTag -> Bool
(LFTag -> LFTag -> Bool) -> (LFTag -> LFTag -> Bool) -> Eq LFTag
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LFTag -> LFTag -> Bool
$c/= :: LFTag -> LFTag -> Bool
== :: LFTag -> LFTag -> Bool
$c== :: LFTag -> LFTag -> Bool
Prelude.Eq, ReadPrec [LFTag]
ReadPrec LFTag
Int -> ReadS LFTag
ReadS [LFTag]
(Int -> ReadS LFTag)
-> ReadS [LFTag]
-> ReadPrec LFTag
-> ReadPrec [LFTag]
-> Read LFTag
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LFTag]
$creadListPrec :: ReadPrec [LFTag]
readPrec :: ReadPrec LFTag
$creadPrec :: ReadPrec LFTag
readList :: ReadS [LFTag]
$creadList :: ReadS [LFTag]
readsPrec :: Int -> ReadS LFTag
$creadsPrec :: Int -> ReadS LFTag
Prelude.Read, Int -> LFTag -> ShowS
[LFTag] -> ShowS
LFTag -> String
(Int -> LFTag -> ShowS)
-> (LFTag -> String) -> ([LFTag] -> ShowS) -> Show LFTag
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LFTag] -> ShowS
$cshowList :: [LFTag] -> ShowS
show :: LFTag -> String
$cshow :: LFTag -> String
showsPrec :: Int -> LFTag -> ShowS
$cshowsPrec :: Int -> LFTag -> ShowS
Prelude.Show, (forall x. LFTag -> Rep LFTag x)
-> (forall x. Rep LFTag x -> LFTag) -> Generic LFTag
forall x. Rep LFTag x -> LFTag
forall x. LFTag -> Rep LFTag x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LFTag x -> LFTag
$cfrom :: forall x. LFTag -> Rep LFTag x
Prelude.Generic)
newLFTag ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
LFTag
newLFTag :: Text -> NonEmpty Text -> LFTag
newLFTag Text
pTagKey_ NonEmpty Text
pTagValues_ =
LFTag' :: Text -> NonEmpty Text -> LFTag
LFTag'
{ $sel:tagKey:LFTag' :: Text
tagKey = Text
pTagKey_,
$sel:tagValues:LFTag' :: NonEmpty Text
tagValues = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pTagValues_
}
lFTag_tagKey :: Lens.Lens' LFTag Prelude.Text
lFTag_tagKey :: (Text -> f Text) -> LFTag -> f LFTag
lFTag_tagKey = (LFTag -> Text)
-> (LFTag -> Text -> LFTag) -> Lens LFTag LFTag Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LFTag' {Text
tagKey :: Text
$sel:tagKey:LFTag' :: LFTag -> Text
tagKey} -> Text
tagKey) (\s :: LFTag
s@LFTag' {} Text
a -> LFTag
s {$sel:tagKey:LFTag' :: Text
tagKey = Text
a} :: LFTag)
lFTag_tagValues :: Lens.Lens' LFTag (Prelude.NonEmpty Prelude.Text)
lFTag_tagValues :: (NonEmpty Text -> f (NonEmpty Text)) -> LFTag -> f LFTag
lFTag_tagValues = (LFTag -> NonEmpty Text)
-> (LFTag -> NonEmpty Text -> LFTag)
-> Lens LFTag LFTag (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LFTag' {NonEmpty Text
tagValues :: NonEmpty Text
$sel:tagValues:LFTag' :: LFTag -> NonEmpty Text
tagValues} -> NonEmpty Text
tagValues) (\s :: LFTag
s@LFTag' {} NonEmpty Text
a -> LFTag
s {$sel:tagValues:LFTag' :: NonEmpty Text
tagValues = NonEmpty Text
a} :: LFTag) ((NonEmpty Text -> f (NonEmpty Text)) -> LFTag -> f LFTag)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> LFTag
-> f LFTag
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON LFTag where
parseJSON :: Value -> Parser LFTag
parseJSON =
String -> (Object -> Parser LFTag) -> Value -> Parser LFTag
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"LFTag"
( \Object
x ->
Text -> NonEmpty Text -> LFTag
LFTag'
(Text -> NonEmpty Text -> LFTag)
-> Parser Text -> Parser (NonEmpty Text -> LFTag)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TagKey")
Parser (NonEmpty Text -> LFTag)
-> Parser (NonEmpty Text) -> Parser LFTag
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (NonEmpty Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TagValues")
)
instance Prelude.Hashable LFTag
instance Prelude.NFData LFTag
instance Core.ToJSON LFTag where
toJSON :: LFTag -> Value
toJSON LFTag' {NonEmpty Text
Text
tagValues :: NonEmpty Text
tagKey :: Text
$sel:tagValues:LFTag' :: LFTag -> NonEmpty Text
$sel:tagKey:LFTag' :: LFTag -> 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
"TagKey" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tagKey),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TagValues" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
tagValues)
]
)