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