{-# 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.Action where
import qualified Amazonka.Core as Core
import Amazonka.Glue.Types.NotificationProperty
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Action = Action'
{
Action -> Maybe NotificationProperty
notificationProperty :: Prelude.Maybe NotificationProperty,
Action -> Maybe (HashMap Text Text)
arguments :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
Action -> Maybe Text
jobName :: Prelude.Maybe Prelude.Text,
Action -> Maybe Text
securityConfiguration :: Prelude.Maybe Prelude.Text,
Action -> Maybe Natural
timeout :: Prelude.Maybe Prelude.Natural,
Action -> Maybe Text
crawlerName :: Prelude.Maybe Prelude.Text
}
deriving (Action -> Action -> Bool
(Action -> Action -> Bool)
-> (Action -> Action -> Bool) -> Eq Action
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Action -> Action -> Bool
$c/= :: Action -> Action -> Bool
== :: Action -> Action -> Bool
$c== :: Action -> Action -> Bool
Prelude.Eq, ReadPrec [Action]
ReadPrec Action
Int -> ReadS Action
ReadS [Action]
(Int -> ReadS Action)
-> ReadS [Action]
-> ReadPrec Action
-> ReadPrec [Action]
-> Read Action
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Action]
$creadListPrec :: ReadPrec [Action]
readPrec :: ReadPrec Action
$creadPrec :: ReadPrec Action
readList :: ReadS [Action]
$creadList :: ReadS [Action]
readsPrec :: Int -> ReadS Action
$creadsPrec :: Int -> ReadS Action
Prelude.Read, Int -> Action -> ShowS
[Action] -> ShowS
Action -> String
(Int -> Action -> ShowS)
-> (Action -> String) -> ([Action] -> ShowS) -> Show Action
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Action] -> ShowS
$cshowList :: [Action] -> ShowS
show :: Action -> String
$cshow :: Action -> String
showsPrec :: Int -> Action -> ShowS
$cshowsPrec :: Int -> Action -> ShowS
Prelude.Show, (forall x. Action -> Rep Action x)
-> (forall x. Rep Action x -> Action) -> Generic Action
forall x. Rep Action x -> Action
forall x. Action -> Rep Action x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Action x -> Action
$cfrom :: forall x. Action -> Rep Action x
Prelude.Generic)
newAction ::
Action
newAction :: Action
newAction =
Action' :: Maybe NotificationProperty
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> Action
Action'
{ $sel:notificationProperty:Action' :: Maybe NotificationProperty
notificationProperty = Maybe NotificationProperty
forall a. Maybe a
Prelude.Nothing,
$sel:arguments:Action' :: Maybe (HashMap Text Text)
arguments = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:jobName:Action' :: Maybe Text
jobName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:securityConfiguration:Action' :: Maybe Text
securityConfiguration = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:timeout:Action' :: Maybe Natural
timeout = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:crawlerName:Action' :: Maybe Text
crawlerName = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
action_notificationProperty :: Lens.Lens' Action (Prelude.Maybe NotificationProperty)
action_notificationProperty :: (Maybe NotificationProperty -> f (Maybe NotificationProperty))
-> Action -> f Action
action_notificationProperty = (Action -> Maybe NotificationProperty)
-> (Action -> Maybe NotificationProperty -> Action)
-> Lens
Action
Action
(Maybe NotificationProperty)
(Maybe NotificationProperty)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {Maybe NotificationProperty
notificationProperty :: Maybe NotificationProperty
$sel:notificationProperty:Action' :: Action -> Maybe NotificationProperty
notificationProperty} -> Maybe NotificationProperty
notificationProperty) (\s :: Action
s@Action' {} Maybe NotificationProperty
a -> Action
s {$sel:notificationProperty:Action' :: Maybe NotificationProperty
notificationProperty = Maybe NotificationProperty
a} :: Action)
action_arguments :: Lens.Lens' Action (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
action_arguments :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Action -> f Action
action_arguments = (Action -> Maybe (HashMap Text Text))
-> (Action -> Maybe (HashMap Text Text) -> Action)
-> Lens
Action
Action
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {Maybe (HashMap Text Text)
arguments :: Maybe (HashMap Text Text)
$sel:arguments:Action' :: Action -> Maybe (HashMap Text Text)
arguments} -> Maybe (HashMap Text Text)
arguments) (\s :: Action
s@Action' {} Maybe (HashMap Text Text)
a -> Action
s {$sel:arguments:Action' :: Maybe (HashMap Text Text)
arguments = Maybe (HashMap Text Text)
a} :: Action) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Action -> f Action)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Action
-> f Action
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
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 AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
action_jobName :: Lens.Lens' Action (Prelude.Maybe Prelude.Text)
action_jobName :: (Maybe Text -> f (Maybe Text)) -> Action -> f Action
action_jobName = (Action -> Maybe Text)
-> (Action -> Maybe Text -> Action)
-> Lens Action Action (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {Maybe Text
jobName :: Maybe Text
$sel:jobName:Action' :: Action -> Maybe Text
jobName} -> Maybe Text
jobName) (\s :: Action
s@Action' {} Maybe Text
a -> Action
s {$sel:jobName:Action' :: Maybe Text
jobName = Maybe Text
a} :: Action)
action_securityConfiguration :: Lens.Lens' Action (Prelude.Maybe Prelude.Text)
action_securityConfiguration :: (Maybe Text -> f (Maybe Text)) -> Action -> f Action
action_securityConfiguration = (Action -> Maybe Text)
-> (Action -> Maybe Text -> Action)
-> Lens Action Action (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {Maybe Text
securityConfiguration :: Maybe Text
$sel:securityConfiguration:Action' :: Action -> Maybe Text
securityConfiguration} -> Maybe Text
securityConfiguration) (\s :: Action
s@Action' {} Maybe Text
a -> Action
s {$sel:securityConfiguration:Action' :: Maybe Text
securityConfiguration = Maybe Text
a} :: Action)
action_timeout :: Lens.Lens' Action (Prelude.Maybe Prelude.Natural)
action_timeout :: (Maybe Natural -> f (Maybe Natural)) -> Action -> f Action
action_timeout = (Action -> Maybe Natural)
-> (Action -> Maybe Natural -> Action)
-> Lens Action Action (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {Maybe Natural
timeout :: Maybe Natural
$sel:timeout:Action' :: Action -> Maybe Natural
timeout} -> Maybe Natural
timeout) (\s :: Action
s@Action' {} Maybe Natural
a -> Action
s {$sel:timeout:Action' :: Maybe Natural
timeout = Maybe Natural
a} :: Action)
action_crawlerName :: Lens.Lens' Action (Prelude.Maybe Prelude.Text)
action_crawlerName :: (Maybe Text -> f (Maybe Text)) -> Action -> f Action
action_crawlerName = (Action -> Maybe Text)
-> (Action -> Maybe Text -> Action)
-> Lens Action Action (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {Maybe Text
crawlerName :: Maybe Text
$sel:crawlerName:Action' :: Action -> Maybe Text
crawlerName} -> Maybe Text
crawlerName) (\s :: Action
s@Action' {} Maybe Text
a -> Action
s {$sel:crawlerName:Action' :: Maybe Text
crawlerName = Maybe Text
a} :: Action)
instance Core.FromJSON Action where
parseJSON :: Value -> Parser Action
parseJSON =
String -> (Object -> Parser Action) -> Value -> Parser Action
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Action"
( \Object
x ->
Maybe NotificationProperty
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> Action
Action'
(Maybe NotificationProperty
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> Action)
-> Parser (Maybe NotificationProperty)
-> Parser
(Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> Action)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe NotificationProperty)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NotificationProperty")
Parser
(Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> Action)
-> Parser (Maybe (HashMap Text Text))
-> Parser
(Maybe Text -> Maybe Text -> Maybe Natural -> Maybe Text -> Action)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Arguments" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe Text -> Maybe Text -> Maybe Natural -> Maybe Text -> Action)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Natural -> Maybe Text -> Action)
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
"JobName")
Parser (Maybe Text -> Maybe Natural -> Maybe Text -> Action)
-> Parser (Maybe Text)
-> Parser (Maybe Natural -> Maybe Text -> Action)
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
"SecurityConfiguration")
Parser (Maybe Natural -> Maybe Text -> Action)
-> Parser (Maybe Natural) -> Parser (Maybe Text -> Action)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Timeout")
Parser (Maybe Text -> Action)
-> Parser (Maybe Text) -> Parser Action
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
"CrawlerName")
)
instance Prelude.Hashable Action
instance Prelude.NFData Action
instance Core.ToJSON Action where
toJSON :: Action -> Value
toJSON Action' {Maybe Natural
Maybe Text
Maybe (HashMap Text Text)
Maybe NotificationProperty
crawlerName :: Maybe Text
timeout :: Maybe Natural
securityConfiguration :: Maybe Text
jobName :: Maybe Text
arguments :: Maybe (HashMap Text Text)
notificationProperty :: Maybe NotificationProperty
$sel:crawlerName:Action' :: Action -> Maybe Text
$sel:timeout:Action' :: Action -> Maybe Natural
$sel:securityConfiguration:Action' :: Action -> Maybe Text
$sel:jobName:Action' :: Action -> Maybe Text
$sel:arguments:Action' :: Action -> Maybe (HashMap Text Text)
$sel:notificationProperty:Action' :: Action -> Maybe NotificationProperty
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"NotificationProperty" Text -> NotificationProperty -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(NotificationProperty -> Pair)
-> Maybe NotificationProperty -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NotificationProperty
notificationProperty,
(Text
"Arguments" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
arguments,
(Text
"JobName" 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
jobName,
(Text
"SecurityConfiguration" 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
securityConfiguration,
(Text
"Timeout" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
timeout,
(Text
"CrawlerName" 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
crawlerName
]
)