{-# 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.LFTagKeyResource 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 LFTagKeyResource = LFTagKeyResource'
{
LFTagKeyResource -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
LFTagKeyResource -> Text
tagKey :: Prelude.Text,
LFTagKeyResource -> NonEmpty Text
tagValues :: Prelude.NonEmpty Prelude.Text
}
deriving (LFTagKeyResource -> LFTagKeyResource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LFTagKeyResource -> LFTagKeyResource -> Bool
$c/= :: LFTagKeyResource -> LFTagKeyResource -> Bool
== :: LFTagKeyResource -> LFTagKeyResource -> Bool
$c== :: LFTagKeyResource -> LFTagKeyResource -> Bool
Prelude.Eq, ReadPrec [LFTagKeyResource]
ReadPrec LFTagKeyResource
Int -> ReadS LFTagKeyResource
ReadS [LFTagKeyResource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LFTagKeyResource]
$creadListPrec :: ReadPrec [LFTagKeyResource]
readPrec :: ReadPrec LFTagKeyResource
$creadPrec :: ReadPrec LFTagKeyResource
readList :: ReadS [LFTagKeyResource]
$creadList :: ReadS [LFTagKeyResource]
readsPrec :: Int -> ReadS LFTagKeyResource
$creadsPrec :: Int -> ReadS LFTagKeyResource
Prelude.Read, Int -> LFTagKeyResource -> ShowS
[LFTagKeyResource] -> ShowS
LFTagKeyResource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LFTagKeyResource] -> ShowS
$cshowList :: [LFTagKeyResource] -> ShowS
show :: LFTagKeyResource -> String
$cshow :: LFTagKeyResource -> String
showsPrec :: Int -> LFTagKeyResource -> ShowS
$cshowsPrec :: Int -> LFTagKeyResource -> ShowS
Prelude.Show, forall x. Rep LFTagKeyResource x -> LFTagKeyResource
forall x. LFTagKeyResource -> Rep LFTagKeyResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LFTagKeyResource x -> LFTagKeyResource
$cfrom :: forall x. LFTagKeyResource -> Rep LFTagKeyResource x
Prelude.Generic)
newLFTagKeyResource ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
LFTagKeyResource
newLFTagKeyResource :: Text -> NonEmpty Text -> LFTagKeyResource
newLFTagKeyResource Text
pTagKey_ NonEmpty Text
pTagValues_ =
LFTagKeyResource'
{ $sel:catalogId:LFTagKeyResource' :: Maybe Text
catalogId = forall a. Maybe a
Prelude.Nothing,
$sel:tagKey:LFTagKeyResource' :: Text
tagKey = Text
pTagKey_,
$sel:tagValues:LFTagKeyResource' :: 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_
}
lFTagKeyResource_catalogId :: Lens.Lens' LFTagKeyResource (Prelude.Maybe Prelude.Text)
lFTagKeyResource_catalogId :: Lens' LFTagKeyResource (Maybe Text)
lFTagKeyResource_catalogId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LFTagKeyResource' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:LFTagKeyResource' :: LFTagKeyResource -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: LFTagKeyResource
s@LFTagKeyResource' {} Maybe Text
a -> LFTagKeyResource
s {$sel:catalogId:LFTagKeyResource' :: Maybe Text
catalogId = Maybe Text
a} :: LFTagKeyResource)
lFTagKeyResource_tagKey :: Lens.Lens' LFTagKeyResource Prelude.Text
lFTagKeyResource_tagKey :: Lens' LFTagKeyResource Text
lFTagKeyResource_tagKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LFTagKeyResource' {Text
tagKey :: Text
$sel:tagKey:LFTagKeyResource' :: LFTagKeyResource -> Text
tagKey} -> Text
tagKey) (\s :: LFTagKeyResource
s@LFTagKeyResource' {} Text
a -> LFTagKeyResource
s {$sel:tagKey:LFTagKeyResource' :: Text
tagKey = Text
a} :: LFTagKeyResource)
lFTagKeyResource_tagValues :: Lens.Lens' LFTagKeyResource (Prelude.NonEmpty Prelude.Text)
lFTagKeyResource_tagValues :: Lens' LFTagKeyResource (NonEmpty Text)
lFTagKeyResource_tagValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LFTagKeyResource' {NonEmpty Text
tagValues :: NonEmpty Text
$sel:tagValues:LFTagKeyResource' :: LFTagKeyResource -> NonEmpty Text
tagValues} -> NonEmpty Text
tagValues) (\s :: LFTagKeyResource
s@LFTagKeyResource' {} NonEmpty Text
a -> LFTagKeyResource
s {$sel:tagValues:LFTagKeyResource' :: NonEmpty Text
tagValues = NonEmpty Text
a} :: LFTagKeyResource) 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 LFTagKeyResource where
parseJSON :: Value -> Parser LFTagKeyResource
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"LFTagKeyResource"
( \Object
x ->
Maybe Text -> Text -> NonEmpty Text -> LFTagKeyResource
LFTagKeyResource'
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 LFTagKeyResource where
hashWithSalt :: Int -> LFTagKeyResource -> Int
hashWithSalt Int
_salt LFTagKeyResource' {Maybe Text
NonEmpty Text
Text
tagValues :: NonEmpty Text
tagKey :: Text
catalogId :: Maybe Text
$sel:tagValues:LFTagKeyResource' :: LFTagKeyResource -> NonEmpty Text
$sel:tagKey:LFTagKeyResource' :: LFTagKeyResource -> Text
$sel:catalogId:LFTagKeyResource' :: LFTagKeyResource -> 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 LFTagKeyResource where
rnf :: LFTagKeyResource -> ()
rnf LFTagKeyResource' {Maybe Text
NonEmpty Text
Text
tagValues :: NonEmpty Text
tagKey :: Text
catalogId :: Maybe Text
$sel:tagValues:LFTagKeyResource' :: LFTagKeyResource -> NonEmpty Text
$sel:tagKey:LFTagKeyResource' :: LFTagKeyResource -> Text
$sel:catalogId:LFTagKeyResource' :: LFTagKeyResource -> 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 LFTagKeyResource where
toJSON :: LFTagKeyResource -> Value
toJSON LFTagKeyResource' {Maybe Text
NonEmpty Text
Text
tagValues :: NonEmpty Text
tagKey :: Text
catalogId :: Maybe Text
$sel:tagValues:LFTagKeyResource' :: LFTagKeyResource -> NonEmpty Text
$sel:tagKey:LFTagKeyResource' :: LFTagKeyResource -> Text
$sel:catalogId:LFTagKeyResource' :: LFTagKeyResource -> 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)
]
)