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