{-# 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.LFTagPolicyResource 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.LFTag
import Amazonka.LakeFormation.Types.ResourceType
import qualified Amazonka.Prelude as Prelude
data LFTagPolicyResource = LFTagPolicyResource'
{
LFTagPolicyResource -> Maybe Text
catalogId :: Prelude.Maybe Prelude.Text,
LFTagPolicyResource -> ResourceType
resourceType :: ResourceType,
LFTagPolicyResource -> NonEmpty LFTag
expression :: Prelude.NonEmpty LFTag
}
deriving (LFTagPolicyResource -> LFTagPolicyResource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LFTagPolicyResource -> LFTagPolicyResource -> Bool
$c/= :: LFTagPolicyResource -> LFTagPolicyResource -> Bool
== :: LFTagPolicyResource -> LFTagPolicyResource -> Bool
$c== :: LFTagPolicyResource -> LFTagPolicyResource -> Bool
Prelude.Eq, ReadPrec [LFTagPolicyResource]
ReadPrec LFTagPolicyResource
Int -> ReadS LFTagPolicyResource
ReadS [LFTagPolicyResource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LFTagPolicyResource]
$creadListPrec :: ReadPrec [LFTagPolicyResource]
readPrec :: ReadPrec LFTagPolicyResource
$creadPrec :: ReadPrec LFTagPolicyResource
readList :: ReadS [LFTagPolicyResource]
$creadList :: ReadS [LFTagPolicyResource]
readsPrec :: Int -> ReadS LFTagPolicyResource
$creadsPrec :: Int -> ReadS LFTagPolicyResource
Prelude.Read, Int -> LFTagPolicyResource -> ShowS
[LFTagPolicyResource] -> ShowS
LFTagPolicyResource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LFTagPolicyResource] -> ShowS
$cshowList :: [LFTagPolicyResource] -> ShowS
show :: LFTagPolicyResource -> String
$cshow :: LFTagPolicyResource -> String
showsPrec :: Int -> LFTagPolicyResource -> ShowS
$cshowsPrec :: Int -> LFTagPolicyResource -> ShowS
Prelude.Show, forall x. Rep LFTagPolicyResource x -> LFTagPolicyResource
forall x. LFTagPolicyResource -> Rep LFTagPolicyResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LFTagPolicyResource x -> LFTagPolicyResource
$cfrom :: forall x. LFTagPolicyResource -> Rep LFTagPolicyResource x
Prelude.Generic)
newLFTagPolicyResource ::
ResourceType ->
Prelude.NonEmpty LFTag ->
LFTagPolicyResource
newLFTagPolicyResource :: ResourceType -> NonEmpty LFTag -> LFTagPolicyResource
newLFTagPolicyResource ResourceType
pResourceType_ NonEmpty LFTag
pExpression_ =
LFTagPolicyResource'
{ $sel:catalogId:LFTagPolicyResource' :: Maybe Text
catalogId = forall a. Maybe a
Prelude.Nothing,
$sel:resourceType:LFTagPolicyResource' :: ResourceType
resourceType = ResourceType
pResourceType_,
$sel:expression:LFTagPolicyResource' :: NonEmpty LFTag
expression = 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 LFTag
pExpression_
}
lFTagPolicyResource_catalogId :: Lens.Lens' LFTagPolicyResource (Prelude.Maybe Prelude.Text)
lFTagPolicyResource_catalogId :: Lens' LFTagPolicyResource (Maybe Text)
lFTagPolicyResource_catalogId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LFTagPolicyResource' {Maybe Text
catalogId :: Maybe Text
$sel:catalogId:LFTagPolicyResource' :: LFTagPolicyResource -> Maybe Text
catalogId} -> Maybe Text
catalogId) (\s :: LFTagPolicyResource
s@LFTagPolicyResource' {} Maybe Text
a -> LFTagPolicyResource
s {$sel:catalogId:LFTagPolicyResource' :: Maybe Text
catalogId = Maybe Text
a} :: LFTagPolicyResource)
lFTagPolicyResource_resourceType :: Lens.Lens' LFTagPolicyResource ResourceType
lFTagPolicyResource_resourceType :: Lens' LFTagPolicyResource ResourceType
lFTagPolicyResource_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LFTagPolicyResource' {ResourceType
resourceType :: ResourceType
$sel:resourceType:LFTagPolicyResource' :: LFTagPolicyResource -> ResourceType
resourceType} -> ResourceType
resourceType) (\s :: LFTagPolicyResource
s@LFTagPolicyResource' {} ResourceType
a -> LFTagPolicyResource
s {$sel:resourceType:LFTagPolicyResource' :: ResourceType
resourceType = ResourceType
a} :: LFTagPolicyResource)
lFTagPolicyResource_expression :: Lens.Lens' LFTagPolicyResource (Prelude.NonEmpty LFTag)
lFTagPolicyResource_expression :: Lens' LFTagPolicyResource (NonEmpty LFTag)
lFTagPolicyResource_expression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LFTagPolicyResource' {NonEmpty LFTag
expression :: NonEmpty LFTag
$sel:expression:LFTagPolicyResource' :: LFTagPolicyResource -> NonEmpty LFTag
expression} -> NonEmpty LFTag
expression) (\s :: LFTagPolicyResource
s@LFTagPolicyResource' {} NonEmpty LFTag
a -> LFTagPolicyResource
s {$sel:expression:LFTagPolicyResource' :: NonEmpty LFTag
expression = NonEmpty LFTag
a} :: LFTagPolicyResource) 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 LFTagPolicyResource where
parseJSON :: Value -> Parser LFTagPolicyResource
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"LFTagPolicyResource"
( \Object
x ->
Maybe Text -> ResourceType -> NonEmpty LFTag -> LFTagPolicyResource
LFTagPolicyResource'
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
"ResourceType")
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
"Expression")
)
instance Prelude.Hashable LFTagPolicyResource where
hashWithSalt :: Int -> LFTagPolicyResource -> Int
hashWithSalt Int
_salt LFTagPolicyResource' {Maybe Text
NonEmpty LFTag
ResourceType
expression :: NonEmpty LFTag
resourceType :: ResourceType
catalogId :: Maybe Text
$sel:expression:LFTagPolicyResource' :: LFTagPolicyResource -> NonEmpty LFTag
$sel:resourceType:LFTagPolicyResource' :: LFTagPolicyResource -> ResourceType
$sel:catalogId:LFTagPolicyResource' :: LFTagPolicyResource -> 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` ResourceType
resourceType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty LFTag
expression
instance Prelude.NFData LFTagPolicyResource where
rnf :: LFTagPolicyResource -> ()
rnf LFTagPolicyResource' {Maybe Text
NonEmpty LFTag
ResourceType
expression :: NonEmpty LFTag
resourceType :: ResourceType
catalogId :: Maybe Text
$sel:expression:LFTagPolicyResource' :: LFTagPolicyResource -> NonEmpty LFTag
$sel:resourceType:LFTagPolicyResource' :: LFTagPolicyResource -> ResourceType
$sel:catalogId:LFTagPolicyResource' :: LFTagPolicyResource -> 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 ResourceType
resourceType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty LFTag
expression
instance Data.ToJSON LFTagPolicyResource where
toJSON :: LFTagPolicyResource -> Value
toJSON LFTagPolicyResource' {Maybe Text
NonEmpty LFTag
ResourceType
expression :: NonEmpty LFTag
resourceType :: ResourceType
catalogId :: Maybe Text
$sel:expression:LFTagPolicyResource' :: LFTagPolicyResource -> NonEmpty LFTag
$sel:resourceType:LFTagPolicyResource' :: LFTagPolicyResource -> ResourceType
$sel:catalogId:LFTagPolicyResource' :: LFTagPolicyResource -> 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
"ResourceType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ResourceType
resourceType),
forall a. a -> Maybe a
Prelude.Just (Key
"Expression" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty LFTag
expression)
]
)