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