{-# 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.DataBrew.Types.Input where
import qualified Amazonka.Core as Core
import Amazonka.DataBrew.Types.DataCatalogInputDefinition
import Amazonka.DataBrew.Types.DatabaseInputDefinition
import Amazonka.DataBrew.Types.S3Location
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Input = Input'
{
Input -> Maybe DataCatalogInputDefinition
dataCatalogInputDefinition :: Prelude.Maybe DataCatalogInputDefinition,
Input -> Maybe S3Location
s3InputDefinition :: Prelude.Maybe S3Location,
Input -> Maybe DatabaseInputDefinition
databaseInputDefinition :: Prelude.Maybe DatabaseInputDefinition
}
deriving (Input -> Input -> Bool
(Input -> Input -> Bool) -> (Input -> Input -> Bool) -> Eq Input
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Input -> Input -> Bool
$c/= :: Input -> Input -> Bool
== :: Input -> Input -> Bool
$c== :: Input -> Input -> Bool
Prelude.Eq, ReadPrec [Input]
ReadPrec Input
Int -> ReadS Input
ReadS [Input]
(Int -> ReadS Input)
-> ReadS [Input]
-> ReadPrec Input
-> ReadPrec [Input]
-> Read Input
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Input]
$creadListPrec :: ReadPrec [Input]
readPrec :: ReadPrec Input
$creadPrec :: ReadPrec Input
readList :: ReadS [Input]
$creadList :: ReadS [Input]
readsPrec :: Int -> ReadS Input
$creadsPrec :: Int -> ReadS Input
Prelude.Read, Int -> Input -> ShowS
[Input] -> ShowS
Input -> String
(Int -> Input -> ShowS)
-> (Input -> String) -> ([Input] -> ShowS) -> Show Input
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Input] -> ShowS
$cshowList :: [Input] -> ShowS
show :: Input -> String
$cshow :: Input -> String
showsPrec :: Int -> Input -> ShowS
$cshowsPrec :: Int -> Input -> ShowS
Prelude.Show, (forall x. Input -> Rep Input x)
-> (forall x. Rep Input x -> Input) -> Generic Input
forall x. Rep Input x -> Input
forall x. Input -> Rep Input x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Input x -> Input
$cfrom :: forall x. Input -> Rep Input x
Prelude.Generic)
newInput ::
Input
newInput :: Input
newInput =
Input' :: Maybe DataCatalogInputDefinition
-> Maybe S3Location -> Maybe DatabaseInputDefinition -> Input
Input'
{ $sel:dataCatalogInputDefinition:Input' :: Maybe DataCatalogInputDefinition
dataCatalogInputDefinition =
Maybe DataCatalogInputDefinition
forall a. Maybe a
Prelude.Nothing,
$sel:s3InputDefinition:Input' :: Maybe S3Location
s3InputDefinition = Maybe S3Location
forall a. Maybe a
Prelude.Nothing,
$sel:databaseInputDefinition:Input' :: Maybe DatabaseInputDefinition
databaseInputDefinition = Maybe DatabaseInputDefinition
forall a. Maybe a
Prelude.Nothing
}
input_dataCatalogInputDefinition :: Lens.Lens' Input (Prelude.Maybe DataCatalogInputDefinition)
input_dataCatalogInputDefinition :: (Maybe DataCatalogInputDefinition
-> f (Maybe DataCatalogInputDefinition))
-> Input -> f Input
input_dataCatalogInputDefinition = (Input -> Maybe DataCatalogInputDefinition)
-> (Input -> Maybe DataCatalogInputDefinition -> Input)
-> Lens
Input
Input
(Maybe DataCatalogInputDefinition)
(Maybe DataCatalogInputDefinition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Input' {Maybe DataCatalogInputDefinition
dataCatalogInputDefinition :: Maybe DataCatalogInputDefinition
$sel:dataCatalogInputDefinition:Input' :: Input -> Maybe DataCatalogInputDefinition
dataCatalogInputDefinition} -> Maybe DataCatalogInputDefinition
dataCatalogInputDefinition) (\s :: Input
s@Input' {} Maybe DataCatalogInputDefinition
a -> Input
s {$sel:dataCatalogInputDefinition:Input' :: Maybe DataCatalogInputDefinition
dataCatalogInputDefinition = Maybe DataCatalogInputDefinition
a} :: Input)
input_s3InputDefinition :: Lens.Lens' Input (Prelude.Maybe S3Location)
input_s3InputDefinition :: (Maybe S3Location -> f (Maybe S3Location)) -> Input -> f Input
input_s3InputDefinition = (Input -> Maybe S3Location)
-> (Input -> Maybe S3Location -> Input)
-> Lens Input Input (Maybe S3Location) (Maybe S3Location)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Input' {Maybe S3Location
s3InputDefinition :: Maybe S3Location
$sel:s3InputDefinition:Input' :: Input -> Maybe S3Location
s3InputDefinition} -> Maybe S3Location
s3InputDefinition) (\s :: Input
s@Input' {} Maybe S3Location
a -> Input
s {$sel:s3InputDefinition:Input' :: Maybe S3Location
s3InputDefinition = Maybe S3Location
a} :: Input)
input_databaseInputDefinition :: Lens.Lens' Input (Prelude.Maybe DatabaseInputDefinition)
input_databaseInputDefinition :: (Maybe DatabaseInputDefinition
-> f (Maybe DatabaseInputDefinition))
-> Input -> f Input
input_databaseInputDefinition = (Input -> Maybe DatabaseInputDefinition)
-> (Input -> Maybe DatabaseInputDefinition -> Input)
-> Lens
Input
Input
(Maybe DatabaseInputDefinition)
(Maybe DatabaseInputDefinition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Input' {Maybe DatabaseInputDefinition
databaseInputDefinition :: Maybe DatabaseInputDefinition
$sel:databaseInputDefinition:Input' :: Input -> Maybe DatabaseInputDefinition
databaseInputDefinition} -> Maybe DatabaseInputDefinition
databaseInputDefinition) (\s :: Input
s@Input' {} Maybe DatabaseInputDefinition
a -> Input
s {$sel:databaseInputDefinition:Input' :: Maybe DatabaseInputDefinition
databaseInputDefinition = Maybe DatabaseInputDefinition
a} :: Input)
instance Core.FromJSON Input where
parseJSON :: Value -> Parser Input
parseJSON =
String -> (Object -> Parser Input) -> Value -> Parser Input
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Input"
( \Object
x ->
Maybe DataCatalogInputDefinition
-> Maybe S3Location -> Maybe DatabaseInputDefinition -> Input
Input'
(Maybe DataCatalogInputDefinition
-> Maybe S3Location -> Maybe DatabaseInputDefinition -> Input)
-> Parser (Maybe DataCatalogInputDefinition)
-> Parser
(Maybe S3Location -> Maybe DatabaseInputDefinition -> Input)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DataCatalogInputDefinition)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DataCatalogInputDefinition")
Parser (Maybe S3Location -> Maybe DatabaseInputDefinition -> Input)
-> Parser (Maybe S3Location)
-> Parser (Maybe DatabaseInputDefinition -> Input)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe S3Location)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"S3InputDefinition")
Parser (Maybe DatabaseInputDefinition -> Input)
-> Parser (Maybe DatabaseInputDefinition) -> Parser Input
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DatabaseInputDefinition)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DatabaseInputDefinition")
)
instance Prelude.Hashable Input
instance Prelude.NFData Input
instance Core.ToJSON Input where
toJSON :: Input -> Value
toJSON Input' {Maybe S3Location
Maybe DatabaseInputDefinition
Maybe DataCatalogInputDefinition
databaseInputDefinition :: Maybe DatabaseInputDefinition
s3InputDefinition :: Maybe S3Location
dataCatalogInputDefinition :: Maybe DataCatalogInputDefinition
$sel:databaseInputDefinition:Input' :: Input -> Maybe DatabaseInputDefinition
$sel:s3InputDefinition:Input' :: Input -> Maybe S3Location
$sel:dataCatalogInputDefinition:Input' :: Input -> Maybe DataCatalogInputDefinition
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DataCatalogInputDefinition" Text -> DataCatalogInputDefinition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(DataCatalogInputDefinition -> Pair)
-> Maybe DataCatalogInputDefinition -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DataCatalogInputDefinition
dataCatalogInputDefinition,
(Text
"S3InputDefinition" Text -> S3Location -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(S3Location -> Pair) -> Maybe S3Location -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3Location
s3InputDefinition,
(Text
"DatabaseInputDefinition" Text -> DatabaseInputDefinition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(DatabaseInputDefinition -> Pair)
-> Maybe DatabaseInputDefinition -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DatabaseInputDefinition
databaseInputDefinition
]
)