{-# 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.FIS.Types.Action where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.FIS.Types.ActionParameter
import Amazonka.FIS.Types.ActionTarget
import qualified Amazonka.Prelude as Prelude
data Action = Action'
{
Action -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
Action -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
Action -> Maybe (HashMap Text ActionParameter)
parameters :: Prelude.Maybe (Prelude.HashMap Prelude.Text ActionParameter),
Action -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
Action -> Maybe (HashMap Text ActionTarget)
targets :: Prelude.Maybe (Prelude.HashMap Prelude.Text ActionTarget)
}
deriving (Action -> Action -> Bool
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]
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
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. 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'
{ $sel:description:Action' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:id:Action' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
$sel:parameters:Action' :: Maybe (HashMap Text ActionParameter)
parameters = forall a. Maybe a
Prelude.Nothing,
$sel:tags:Action' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
$sel:targets:Action' :: Maybe (HashMap Text ActionTarget)
targets = forall a. Maybe a
Prelude.Nothing
}
action_description :: Lens.Lens' Action (Prelude.Maybe Prelude.Text)
action_description :: Lens' Action (Maybe Text)
action_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {Maybe Text
description :: Maybe Text
$sel:description:Action' :: Action -> Maybe Text
description} -> Maybe Text
description) (\s :: Action
s@Action' {} Maybe Text
a -> Action
s {$sel:description:Action' :: Maybe Text
description = Maybe Text
a} :: Action)
action_id :: Lens.Lens' Action (Prelude.Maybe Prelude.Text)
action_id :: Lens' Action (Maybe Text)
action_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {Maybe Text
id :: Maybe Text
$sel:id:Action' :: Action -> Maybe Text
id} -> Maybe Text
id) (\s :: Action
s@Action' {} Maybe Text
a -> Action
s {$sel:id:Action' :: Maybe Text
id = Maybe Text
a} :: Action)
action_parameters :: Lens.Lens' Action (Prelude.Maybe (Prelude.HashMap Prelude.Text ActionParameter))
action_parameters :: Lens' Action (Maybe (HashMap Text ActionParameter))
action_parameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {Maybe (HashMap Text ActionParameter)
parameters :: Maybe (HashMap Text ActionParameter)
$sel:parameters:Action' :: Action -> Maybe (HashMap Text ActionParameter)
parameters} -> Maybe (HashMap Text ActionParameter)
parameters) (\s :: Action
s@Action' {} Maybe (HashMap Text ActionParameter)
a -> Action
s {$sel:parameters:Action' :: Maybe (HashMap Text ActionParameter)
parameters = Maybe (HashMap Text ActionParameter)
a} :: Action) 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
action_tags :: Lens.Lens' Action (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
action_tags :: Lens' Action (Maybe (HashMap Text Text))
action_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:Action' :: Action -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: Action
s@Action' {} Maybe (HashMap Text Text)
a -> Action
s {$sel:tags:Action' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: Action) 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
action_targets :: Lens.Lens' Action (Prelude.Maybe (Prelude.HashMap Prelude.Text ActionTarget))
action_targets :: Lens' Action (Maybe (HashMap Text ActionTarget))
action_targets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Action' {Maybe (HashMap Text ActionTarget)
targets :: Maybe (HashMap Text ActionTarget)
$sel:targets:Action' :: Action -> Maybe (HashMap Text ActionTarget)
targets} -> Maybe (HashMap Text ActionTarget)
targets) (\s :: Action
s@Action' {} Maybe (HashMap Text ActionTarget)
a -> Action
s {$sel:targets:Action' :: Maybe (HashMap Text ActionTarget)
targets = Maybe (HashMap Text ActionTarget)
a} :: Action) 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
instance Data.FromJSON Action where
parseJSON :: Value -> Parser Action
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Action"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe (HashMap Text ActionParameter)
-> Maybe (HashMap Text Text)
-> Maybe (HashMap Text ActionTarget)
-> Action
Action'
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
"description")
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
"id")
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
"parameters" 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
"tags" 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
"targets" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable Action where
hashWithSalt :: Int -> Action -> Int
hashWithSalt Int
_salt Action' {Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text ActionParameter)
Maybe (HashMap Text ActionTarget)
targets :: Maybe (HashMap Text ActionTarget)
tags :: Maybe (HashMap Text Text)
parameters :: Maybe (HashMap Text ActionParameter)
id :: Maybe Text
description :: Maybe Text
$sel:targets:Action' :: Action -> Maybe (HashMap Text ActionTarget)
$sel:tags:Action' :: Action -> Maybe (HashMap Text Text)
$sel:parameters:Action' :: Action -> Maybe (HashMap Text ActionParameter)
$sel:id:Action' :: Action -> Maybe Text
$sel:description:Action' :: Action -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text ActionParameter)
parameters
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text ActionTarget)
targets
instance Prelude.NFData Action where
rnf :: Action -> ()
rnf Action' {Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text ActionParameter)
Maybe (HashMap Text ActionTarget)
targets :: Maybe (HashMap Text ActionTarget)
tags :: Maybe (HashMap Text Text)
parameters :: Maybe (HashMap Text ActionParameter)
id :: Maybe Text
description :: Maybe Text
$sel:targets:Action' :: Action -> Maybe (HashMap Text ActionTarget)
$sel:tags:Action' :: Action -> Maybe (HashMap Text Text)
$sel:parameters:Action' :: Action -> Maybe (HashMap Text ActionParameter)
$sel:id:Action' :: Action -> Maybe Text
$sel:description:Action' :: Action -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text ActionParameter)
parameters
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text ActionTarget)
targets