{-# 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.Glue.Types.S3CatalogTarget where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Glue.Types.CatalogSchemaChangePolicy
import qualified Amazonka.Prelude as Prelude
data S3CatalogTarget = S3CatalogTarget'
{
S3CatalogTarget -> Maybe [[Text]]
partitionKeys :: Prelude.Maybe [[Prelude.Text]],
S3CatalogTarget -> Maybe CatalogSchemaChangePolicy
schemaChangePolicy :: Prelude.Maybe CatalogSchemaChangePolicy,
S3CatalogTarget -> Text
name :: Prelude.Text,
S3CatalogTarget -> NonEmpty Text
inputs :: Prelude.NonEmpty Prelude.Text,
S3CatalogTarget -> Text
table :: Prelude.Text,
S3CatalogTarget -> Text
database :: Prelude.Text
}
deriving (S3CatalogTarget -> S3CatalogTarget -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3CatalogTarget -> S3CatalogTarget -> Bool
$c/= :: S3CatalogTarget -> S3CatalogTarget -> Bool
== :: S3CatalogTarget -> S3CatalogTarget -> Bool
$c== :: S3CatalogTarget -> S3CatalogTarget -> Bool
Prelude.Eq, ReadPrec [S3CatalogTarget]
ReadPrec S3CatalogTarget
Int -> ReadS S3CatalogTarget
ReadS [S3CatalogTarget]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3CatalogTarget]
$creadListPrec :: ReadPrec [S3CatalogTarget]
readPrec :: ReadPrec S3CatalogTarget
$creadPrec :: ReadPrec S3CatalogTarget
readList :: ReadS [S3CatalogTarget]
$creadList :: ReadS [S3CatalogTarget]
readsPrec :: Int -> ReadS S3CatalogTarget
$creadsPrec :: Int -> ReadS S3CatalogTarget
Prelude.Read, Int -> S3CatalogTarget -> ShowS
[S3CatalogTarget] -> ShowS
S3CatalogTarget -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3CatalogTarget] -> ShowS
$cshowList :: [S3CatalogTarget] -> ShowS
show :: S3CatalogTarget -> String
$cshow :: S3CatalogTarget -> String
showsPrec :: Int -> S3CatalogTarget -> ShowS
$cshowsPrec :: Int -> S3CatalogTarget -> ShowS
Prelude.Show, forall x. Rep S3CatalogTarget x -> S3CatalogTarget
forall x. S3CatalogTarget -> Rep S3CatalogTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3CatalogTarget x -> S3CatalogTarget
$cfrom :: forall x. S3CatalogTarget -> Rep S3CatalogTarget x
Prelude.Generic)
newS3CatalogTarget ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
S3CatalogTarget
newS3CatalogTarget :: Text -> NonEmpty Text -> Text -> Text -> S3CatalogTarget
newS3CatalogTarget Text
pName_ NonEmpty Text
pInputs_ Text
pTable_ Text
pDatabase_ =
S3CatalogTarget'
{ $sel:partitionKeys:S3CatalogTarget' :: Maybe [[Text]]
partitionKeys = forall a. Maybe a
Prelude.Nothing,
$sel:schemaChangePolicy:S3CatalogTarget' :: Maybe CatalogSchemaChangePolicy
schemaChangePolicy = forall a. Maybe a
Prelude.Nothing,
$sel:name:S3CatalogTarget' :: Text
name = Text
pName_,
$sel:inputs:S3CatalogTarget' :: NonEmpty Text
inputs = 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
pInputs_,
$sel:table:S3CatalogTarget' :: Text
table = Text
pTable_,
$sel:database:S3CatalogTarget' :: Text
database = Text
pDatabase_
}
s3CatalogTarget_partitionKeys :: Lens.Lens' S3CatalogTarget (Prelude.Maybe [[Prelude.Text]])
s3CatalogTarget_partitionKeys :: Lens' S3CatalogTarget (Maybe [[Text]])
s3CatalogTarget_partitionKeys = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3CatalogTarget' {Maybe [[Text]]
partitionKeys :: Maybe [[Text]]
$sel:partitionKeys:S3CatalogTarget' :: S3CatalogTarget -> Maybe [[Text]]
partitionKeys} -> Maybe [[Text]]
partitionKeys) (\s :: S3CatalogTarget
s@S3CatalogTarget' {} Maybe [[Text]]
a -> S3CatalogTarget
s {$sel:partitionKeys:S3CatalogTarget' :: Maybe [[Text]]
partitionKeys = Maybe [[Text]]
a} :: S3CatalogTarget) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
s3CatalogTarget_schemaChangePolicy :: Lens.Lens' S3CatalogTarget (Prelude.Maybe CatalogSchemaChangePolicy)
s3CatalogTarget_schemaChangePolicy :: Lens' S3CatalogTarget (Maybe CatalogSchemaChangePolicy)
s3CatalogTarget_schemaChangePolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3CatalogTarget' {Maybe CatalogSchemaChangePolicy
schemaChangePolicy :: Maybe CatalogSchemaChangePolicy
$sel:schemaChangePolicy:S3CatalogTarget' :: S3CatalogTarget -> Maybe CatalogSchemaChangePolicy
schemaChangePolicy} -> Maybe CatalogSchemaChangePolicy
schemaChangePolicy) (\s :: S3CatalogTarget
s@S3CatalogTarget' {} Maybe CatalogSchemaChangePolicy
a -> S3CatalogTarget
s {$sel:schemaChangePolicy:S3CatalogTarget' :: Maybe CatalogSchemaChangePolicy
schemaChangePolicy = Maybe CatalogSchemaChangePolicy
a} :: S3CatalogTarget)
s3CatalogTarget_name :: Lens.Lens' S3CatalogTarget Prelude.Text
s3CatalogTarget_name :: Lens' S3CatalogTarget Text
s3CatalogTarget_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3CatalogTarget' {Text
name :: Text
$sel:name:S3CatalogTarget' :: S3CatalogTarget -> Text
name} -> Text
name) (\s :: S3CatalogTarget
s@S3CatalogTarget' {} Text
a -> S3CatalogTarget
s {$sel:name:S3CatalogTarget' :: Text
name = Text
a} :: S3CatalogTarget)
s3CatalogTarget_inputs :: Lens.Lens' S3CatalogTarget (Prelude.NonEmpty Prelude.Text)
s3CatalogTarget_inputs :: Lens' S3CatalogTarget (NonEmpty Text)
s3CatalogTarget_inputs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3CatalogTarget' {NonEmpty Text
inputs :: NonEmpty Text
$sel:inputs:S3CatalogTarget' :: S3CatalogTarget -> NonEmpty Text
inputs} -> NonEmpty Text
inputs) (\s :: S3CatalogTarget
s@S3CatalogTarget' {} NonEmpty Text
a -> S3CatalogTarget
s {$sel:inputs:S3CatalogTarget' :: NonEmpty Text
inputs = NonEmpty Text
a} :: S3CatalogTarget) 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
s3CatalogTarget_table :: Lens.Lens' S3CatalogTarget Prelude.Text
s3CatalogTarget_table :: Lens' S3CatalogTarget Text
s3CatalogTarget_table = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3CatalogTarget' {Text
table :: Text
$sel:table:S3CatalogTarget' :: S3CatalogTarget -> Text
table} -> Text
table) (\s :: S3CatalogTarget
s@S3CatalogTarget' {} Text
a -> S3CatalogTarget
s {$sel:table:S3CatalogTarget' :: Text
table = Text
a} :: S3CatalogTarget)
s3CatalogTarget_database :: Lens.Lens' S3CatalogTarget Prelude.Text
s3CatalogTarget_database :: Lens' S3CatalogTarget Text
s3CatalogTarget_database = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3CatalogTarget' {Text
database :: Text
$sel:database:S3CatalogTarget' :: S3CatalogTarget -> Text
database} -> Text
database) (\s :: S3CatalogTarget
s@S3CatalogTarget' {} Text
a -> S3CatalogTarget
s {$sel:database:S3CatalogTarget' :: Text
database = Text
a} :: S3CatalogTarget)
instance Data.FromJSON S3CatalogTarget where
parseJSON :: Value -> Parser S3CatalogTarget
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"S3CatalogTarget"
( \Object
x ->
Maybe [[Text]]
-> Maybe CatalogSchemaChangePolicy
-> Text
-> NonEmpty Text
-> Text
-> Text
-> S3CatalogTarget
S3CatalogTarget'
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
"PartitionKeys" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SchemaChangePolicy")
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
"Name")
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
"Inputs")
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
"Table")
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
"Database")
)
instance Prelude.Hashable S3CatalogTarget where
hashWithSalt :: Int -> S3CatalogTarget -> Int
hashWithSalt Int
_salt S3CatalogTarget' {Maybe [[Text]]
Maybe CatalogSchemaChangePolicy
NonEmpty Text
Text
database :: Text
table :: Text
inputs :: NonEmpty Text
name :: Text
schemaChangePolicy :: Maybe CatalogSchemaChangePolicy
partitionKeys :: Maybe [[Text]]
$sel:database:S3CatalogTarget' :: S3CatalogTarget -> Text
$sel:table:S3CatalogTarget' :: S3CatalogTarget -> Text
$sel:inputs:S3CatalogTarget' :: S3CatalogTarget -> NonEmpty Text
$sel:name:S3CatalogTarget' :: S3CatalogTarget -> Text
$sel:schemaChangePolicy:S3CatalogTarget' :: S3CatalogTarget -> Maybe CatalogSchemaChangePolicy
$sel:partitionKeys:S3CatalogTarget' :: S3CatalogTarget -> Maybe [[Text]]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [[Text]]
partitionKeys
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CatalogSchemaChangePolicy
schemaChangePolicy
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
inputs
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
table
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
database
instance Prelude.NFData S3CatalogTarget where
rnf :: S3CatalogTarget -> ()
rnf S3CatalogTarget' {Maybe [[Text]]
Maybe CatalogSchemaChangePolicy
NonEmpty Text
Text
database :: Text
table :: Text
inputs :: NonEmpty Text
name :: Text
schemaChangePolicy :: Maybe CatalogSchemaChangePolicy
partitionKeys :: Maybe [[Text]]
$sel:database:S3CatalogTarget' :: S3CatalogTarget -> Text
$sel:table:S3CatalogTarget' :: S3CatalogTarget -> Text
$sel:inputs:S3CatalogTarget' :: S3CatalogTarget -> NonEmpty Text
$sel:name:S3CatalogTarget' :: S3CatalogTarget -> Text
$sel:schemaChangePolicy:S3CatalogTarget' :: S3CatalogTarget -> Maybe CatalogSchemaChangePolicy
$sel:partitionKeys:S3CatalogTarget' :: S3CatalogTarget -> Maybe [[Text]]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [[Text]]
partitionKeys
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CatalogSchemaChangePolicy
schemaChangePolicy
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
inputs
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
table
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
database
instance Data.ToJSON S3CatalogTarget where
toJSON :: S3CatalogTarget -> Value
toJSON S3CatalogTarget' {Maybe [[Text]]
Maybe CatalogSchemaChangePolicy
NonEmpty Text
Text
database :: Text
table :: Text
inputs :: NonEmpty Text
name :: Text
schemaChangePolicy :: Maybe CatalogSchemaChangePolicy
partitionKeys :: Maybe [[Text]]
$sel:database:S3CatalogTarget' :: S3CatalogTarget -> Text
$sel:table:S3CatalogTarget' :: S3CatalogTarget -> Text
$sel:inputs:S3CatalogTarget' :: S3CatalogTarget -> NonEmpty Text
$sel:name:S3CatalogTarget' :: S3CatalogTarget -> Text
$sel:schemaChangePolicy:S3CatalogTarget' :: S3CatalogTarget -> Maybe CatalogSchemaChangePolicy
$sel:partitionKeys:S3CatalogTarget' :: S3CatalogTarget -> Maybe [[Text]]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"PartitionKeys" 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]]
partitionKeys,
(Key
"SchemaChangePolicy" 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 CatalogSchemaChangePolicy
schemaChangePolicy,
forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just (Key
"Inputs" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
inputs),
forall a. a -> Maybe a
Prelude.Just (Key
"Table" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
table),
forall a. a -> Maybe a
Prelude.Just (Key
"Database" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
database)
]
)