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