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