{-# 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.Resource where
import qualified Amazonka.Core as Core
import Amazonka.LakeFormation.Types.CatalogResource
import Amazonka.LakeFormation.Types.DataLocationResource
import Amazonka.LakeFormation.Types.DatabaseResource
import Amazonka.LakeFormation.Types.LFTagKeyResource
import Amazonka.LakeFormation.Types.LFTagPolicyResource
import Amazonka.LakeFormation.Types.TableResource
import Amazonka.LakeFormation.Types.TableWithColumnsResource
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Resource = Resource'
{
Resource -> Maybe DataLocationResource
dataLocation :: Prelude.Maybe DataLocationResource,
Resource -> Maybe DatabaseResource
database :: Prelude.Maybe DatabaseResource,
Resource -> Maybe LFTagKeyResource
lFTag :: Prelude.Maybe LFTagKeyResource,
Resource -> Maybe CatalogResource
catalog :: Prelude.Maybe CatalogResource,
Resource -> Maybe LFTagPolicyResource
lFTagPolicy :: Prelude.Maybe LFTagPolicyResource,
Resource -> Maybe TableResource
table :: Prelude.Maybe TableResource,
Resource -> Maybe TableWithColumnsResource
tableWithColumns :: Prelude.Maybe TableWithColumnsResource
}
deriving (Resource -> Resource -> Bool
(Resource -> Resource -> Bool)
-> (Resource -> Resource -> Bool) -> Eq Resource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Resource -> Resource -> Bool
$c/= :: Resource -> Resource -> Bool
== :: Resource -> Resource -> Bool
$c== :: Resource -> Resource -> Bool
Prelude.Eq, ReadPrec [Resource]
ReadPrec Resource
Int -> ReadS Resource
ReadS [Resource]
(Int -> ReadS Resource)
-> ReadS [Resource]
-> ReadPrec Resource
-> ReadPrec [Resource]
-> Read Resource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Resource]
$creadListPrec :: ReadPrec [Resource]
readPrec :: ReadPrec Resource
$creadPrec :: ReadPrec Resource
readList :: ReadS [Resource]
$creadList :: ReadS [Resource]
readsPrec :: Int -> ReadS Resource
$creadsPrec :: Int -> ReadS Resource
Prelude.Read, Int -> Resource -> ShowS
[Resource] -> ShowS
Resource -> String
(Int -> Resource -> ShowS)
-> (Resource -> String) -> ([Resource] -> ShowS) -> Show Resource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Resource] -> ShowS
$cshowList :: [Resource] -> ShowS
show :: Resource -> String
$cshow :: Resource -> String
showsPrec :: Int -> Resource -> ShowS
$cshowsPrec :: Int -> Resource -> ShowS
Prelude.Show, (forall x. Resource -> Rep Resource x)
-> (forall x. Rep Resource x -> Resource) -> Generic Resource
forall x. Rep Resource x -> Resource
forall x. Resource -> Rep Resource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Resource x -> Resource
$cfrom :: forall x. Resource -> Rep Resource x
Prelude.Generic)
newResource ::
Resource
newResource :: Resource
newResource =
Resource' :: Maybe DataLocationResource
-> Maybe DatabaseResource
-> Maybe LFTagKeyResource
-> Maybe CatalogResource
-> Maybe LFTagPolicyResource
-> Maybe TableResource
-> Maybe TableWithColumnsResource
-> Resource
Resource'
{ $sel:dataLocation:Resource' :: Maybe DataLocationResource
dataLocation = Maybe DataLocationResource
forall a. Maybe a
Prelude.Nothing,
$sel:database:Resource' :: Maybe DatabaseResource
database = Maybe DatabaseResource
forall a. Maybe a
Prelude.Nothing,
$sel:lFTag:Resource' :: Maybe LFTagKeyResource
lFTag = Maybe LFTagKeyResource
forall a. Maybe a
Prelude.Nothing,
$sel:catalog:Resource' :: Maybe CatalogResource
catalog = Maybe CatalogResource
forall a. Maybe a
Prelude.Nothing,
$sel:lFTagPolicy:Resource' :: Maybe LFTagPolicyResource
lFTagPolicy = Maybe LFTagPolicyResource
forall a. Maybe a
Prelude.Nothing,
$sel:table:Resource' :: Maybe TableResource
table = Maybe TableResource
forall a. Maybe a
Prelude.Nothing,
$sel:tableWithColumns:Resource' :: Maybe TableWithColumnsResource
tableWithColumns = Maybe TableWithColumnsResource
forall a. Maybe a
Prelude.Nothing
}
resource_dataLocation :: Lens.Lens' Resource (Prelude.Maybe DataLocationResource)
resource_dataLocation :: (Maybe DataLocationResource -> f (Maybe DataLocationResource))
-> Resource -> f Resource
resource_dataLocation = (Resource -> Maybe DataLocationResource)
-> (Resource -> Maybe DataLocationResource -> Resource)
-> Lens
Resource
Resource
(Maybe DataLocationResource)
(Maybe DataLocationResource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe DataLocationResource
dataLocation :: Maybe DataLocationResource
$sel:dataLocation:Resource' :: Resource -> Maybe DataLocationResource
dataLocation} -> Maybe DataLocationResource
dataLocation) (\s :: Resource
s@Resource' {} Maybe DataLocationResource
a -> Resource
s {$sel:dataLocation:Resource' :: Maybe DataLocationResource
dataLocation = Maybe DataLocationResource
a} :: Resource)
resource_database :: Lens.Lens' Resource (Prelude.Maybe DatabaseResource)
resource_database :: (Maybe DatabaseResource -> f (Maybe DatabaseResource))
-> Resource -> f Resource
resource_database = (Resource -> Maybe DatabaseResource)
-> (Resource -> Maybe DatabaseResource -> Resource)
-> Lens
Resource Resource (Maybe DatabaseResource) (Maybe DatabaseResource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe DatabaseResource
database :: Maybe DatabaseResource
$sel:database:Resource' :: Resource -> Maybe DatabaseResource
database} -> Maybe DatabaseResource
database) (\s :: Resource
s@Resource' {} Maybe DatabaseResource
a -> Resource
s {$sel:database:Resource' :: Maybe DatabaseResource
database = Maybe DatabaseResource
a} :: Resource)
resource_lFTag :: Lens.Lens' Resource (Prelude.Maybe LFTagKeyResource)
resource_lFTag :: (Maybe LFTagKeyResource -> f (Maybe LFTagKeyResource))
-> Resource -> f Resource
resource_lFTag = (Resource -> Maybe LFTagKeyResource)
-> (Resource -> Maybe LFTagKeyResource -> Resource)
-> Lens
Resource Resource (Maybe LFTagKeyResource) (Maybe LFTagKeyResource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe LFTagKeyResource
lFTag :: Maybe LFTagKeyResource
$sel:lFTag:Resource' :: Resource -> Maybe LFTagKeyResource
lFTag} -> Maybe LFTagKeyResource
lFTag) (\s :: Resource
s@Resource' {} Maybe LFTagKeyResource
a -> Resource
s {$sel:lFTag:Resource' :: Maybe LFTagKeyResource
lFTag = Maybe LFTagKeyResource
a} :: Resource)
resource_catalog :: Lens.Lens' Resource (Prelude.Maybe CatalogResource)
resource_catalog :: (Maybe CatalogResource -> f (Maybe CatalogResource))
-> Resource -> f Resource
resource_catalog = (Resource -> Maybe CatalogResource)
-> (Resource -> Maybe CatalogResource -> Resource)
-> Lens
Resource Resource (Maybe CatalogResource) (Maybe CatalogResource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe CatalogResource
catalog :: Maybe CatalogResource
$sel:catalog:Resource' :: Resource -> Maybe CatalogResource
catalog} -> Maybe CatalogResource
catalog) (\s :: Resource
s@Resource' {} Maybe CatalogResource
a -> Resource
s {$sel:catalog:Resource' :: Maybe CatalogResource
catalog = Maybe CatalogResource
a} :: Resource)
resource_lFTagPolicy :: Lens.Lens' Resource (Prelude.Maybe LFTagPolicyResource)
resource_lFTagPolicy :: (Maybe LFTagPolicyResource -> f (Maybe LFTagPolicyResource))
-> Resource -> f Resource
resource_lFTagPolicy = (Resource -> Maybe LFTagPolicyResource)
-> (Resource -> Maybe LFTagPolicyResource -> Resource)
-> Lens
Resource
Resource
(Maybe LFTagPolicyResource)
(Maybe LFTagPolicyResource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe LFTagPolicyResource
lFTagPolicy :: Maybe LFTagPolicyResource
$sel:lFTagPolicy:Resource' :: Resource -> Maybe LFTagPolicyResource
lFTagPolicy} -> Maybe LFTagPolicyResource
lFTagPolicy) (\s :: Resource
s@Resource' {} Maybe LFTagPolicyResource
a -> Resource
s {$sel:lFTagPolicy:Resource' :: Maybe LFTagPolicyResource
lFTagPolicy = Maybe LFTagPolicyResource
a} :: Resource)
resource_table :: Lens.Lens' Resource (Prelude.Maybe TableResource)
resource_table :: (Maybe TableResource -> f (Maybe TableResource))
-> Resource -> f Resource
resource_table = (Resource -> Maybe TableResource)
-> (Resource -> Maybe TableResource -> Resource)
-> Lens
Resource Resource (Maybe TableResource) (Maybe TableResource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe TableResource
table :: Maybe TableResource
$sel:table:Resource' :: Resource -> Maybe TableResource
table} -> Maybe TableResource
table) (\s :: Resource
s@Resource' {} Maybe TableResource
a -> Resource
s {$sel:table:Resource' :: Maybe TableResource
table = Maybe TableResource
a} :: Resource)
resource_tableWithColumns :: Lens.Lens' Resource (Prelude.Maybe TableWithColumnsResource)
resource_tableWithColumns :: (Maybe TableWithColumnsResource
-> f (Maybe TableWithColumnsResource))
-> Resource -> f Resource
resource_tableWithColumns = (Resource -> Maybe TableWithColumnsResource)
-> (Resource -> Maybe TableWithColumnsResource -> Resource)
-> Lens
Resource
Resource
(Maybe TableWithColumnsResource)
(Maybe TableWithColumnsResource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe TableWithColumnsResource
tableWithColumns :: Maybe TableWithColumnsResource
$sel:tableWithColumns:Resource' :: Resource -> Maybe TableWithColumnsResource
tableWithColumns} -> Maybe TableWithColumnsResource
tableWithColumns) (\s :: Resource
s@Resource' {} Maybe TableWithColumnsResource
a -> Resource
s {$sel:tableWithColumns:Resource' :: Maybe TableWithColumnsResource
tableWithColumns = Maybe TableWithColumnsResource
a} :: Resource)
instance Core.FromJSON Resource where
parseJSON :: Value -> Parser Resource
parseJSON =
String -> (Object -> Parser Resource) -> Value -> Parser Resource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Resource"
( \Object
x ->
Maybe DataLocationResource
-> Maybe DatabaseResource
-> Maybe LFTagKeyResource
-> Maybe CatalogResource
-> Maybe LFTagPolicyResource
-> Maybe TableResource
-> Maybe TableWithColumnsResource
-> Resource
Resource'
(Maybe DataLocationResource
-> Maybe DatabaseResource
-> Maybe LFTagKeyResource
-> Maybe CatalogResource
-> Maybe LFTagPolicyResource
-> Maybe TableResource
-> Maybe TableWithColumnsResource
-> Resource)
-> Parser (Maybe DataLocationResource)
-> Parser
(Maybe DatabaseResource
-> Maybe LFTagKeyResource
-> Maybe CatalogResource
-> Maybe LFTagPolicyResource
-> Maybe TableResource
-> Maybe TableWithColumnsResource
-> Resource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DataLocationResource)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DataLocation")
Parser
(Maybe DatabaseResource
-> Maybe LFTagKeyResource
-> Maybe CatalogResource
-> Maybe LFTagPolicyResource
-> Maybe TableResource
-> Maybe TableWithColumnsResource
-> Resource)
-> Parser (Maybe DatabaseResource)
-> Parser
(Maybe LFTagKeyResource
-> Maybe CatalogResource
-> Maybe LFTagPolicyResource
-> Maybe TableResource
-> Maybe TableWithColumnsResource
-> Resource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DatabaseResource)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Database")
Parser
(Maybe LFTagKeyResource
-> Maybe CatalogResource
-> Maybe LFTagPolicyResource
-> Maybe TableResource
-> Maybe TableWithColumnsResource
-> Resource)
-> Parser (Maybe LFTagKeyResource)
-> Parser
(Maybe CatalogResource
-> Maybe LFTagPolicyResource
-> Maybe TableResource
-> Maybe TableWithColumnsResource
-> Resource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LFTagKeyResource)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LFTag")
Parser
(Maybe CatalogResource
-> Maybe LFTagPolicyResource
-> Maybe TableResource
-> Maybe TableWithColumnsResource
-> Resource)
-> Parser (Maybe CatalogResource)
-> Parser
(Maybe LFTagPolicyResource
-> Maybe TableResource
-> Maybe TableWithColumnsResource
-> Resource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe CatalogResource)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Catalog")
Parser
(Maybe LFTagPolicyResource
-> Maybe TableResource
-> Maybe TableWithColumnsResource
-> Resource)
-> Parser (Maybe LFTagPolicyResource)
-> Parser
(Maybe TableResource -> Maybe TableWithColumnsResource -> Resource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LFTagPolicyResource)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LFTagPolicy")
Parser
(Maybe TableResource -> Maybe TableWithColumnsResource -> Resource)
-> Parser (Maybe TableResource)
-> Parser (Maybe TableWithColumnsResource -> Resource)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TableResource)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Table")
Parser (Maybe TableWithColumnsResource -> Resource)
-> Parser (Maybe TableWithColumnsResource) -> Parser Resource
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe TableWithColumnsResource)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"TableWithColumns")
)
instance Prelude.Hashable Resource
instance Prelude.NFData Resource
instance Core.ToJSON Resource where
toJSON :: Resource -> Value
toJSON Resource' {Maybe CatalogResource
Maybe DataLocationResource
Maybe DatabaseResource
Maybe LFTagKeyResource
Maybe LFTagPolicyResource
Maybe TableResource
Maybe TableWithColumnsResource
tableWithColumns :: Maybe TableWithColumnsResource
table :: Maybe TableResource
lFTagPolicy :: Maybe LFTagPolicyResource
catalog :: Maybe CatalogResource
lFTag :: Maybe LFTagKeyResource
database :: Maybe DatabaseResource
dataLocation :: Maybe DataLocationResource
$sel:tableWithColumns:Resource' :: Resource -> Maybe TableWithColumnsResource
$sel:table:Resource' :: Resource -> Maybe TableResource
$sel:lFTagPolicy:Resource' :: Resource -> Maybe LFTagPolicyResource
$sel:catalog:Resource' :: Resource -> Maybe CatalogResource
$sel:lFTag:Resource' :: Resource -> Maybe LFTagKeyResource
$sel:database:Resource' :: Resource -> Maybe DatabaseResource
$sel:dataLocation:Resource' :: Resource -> Maybe DataLocationResource
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DataLocation" Text -> DataLocationResource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (DataLocationResource -> Pair)
-> Maybe DataLocationResource -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DataLocationResource
dataLocation,
(Text
"Database" Text -> DatabaseResource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (DatabaseResource -> Pair) -> Maybe DatabaseResource -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DatabaseResource
database,
(Text
"LFTag" Text -> LFTagKeyResource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (LFTagKeyResource -> Pair) -> Maybe LFTagKeyResource -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LFTagKeyResource
lFTag,
(Text
"Catalog" Text -> CatalogResource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CatalogResource -> Pair) -> Maybe CatalogResource -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CatalogResource
catalog,
(Text
"LFTagPolicy" Text -> LFTagPolicyResource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (LFTagPolicyResource -> Pair)
-> Maybe LFTagPolicyResource -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LFTagPolicyResource
lFTagPolicy,
(Text
"Table" Text -> TableResource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (TableResource -> Pair) -> Maybe TableResource -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TableResource
table,
(Text
"TableWithColumns" Text -> TableWithColumnsResource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(TableWithColumnsResource -> Pair)
-> Maybe TableWithColumnsResource -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TableWithColumnsResource
tableWithColumns
]
)