{-# 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.EC2.Types.InstanceState where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import Amazonka.EC2.Types.InstanceStateName
import qualified Amazonka.Prelude as Prelude
data InstanceState = InstanceState'
{
InstanceState -> InstanceStateName
name :: InstanceStateName,
InstanceState -> Int
code :: Prelude.Int
}
deriving (InstanceState -> InstanceState -> Bool
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]
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
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. 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 ::
InstanceStateName ->
Prelude.Int ->
InstanceState
newInstanceState :: InstanceStateName -> Int -> InstanceState
newInstanceState InstanceStateName
pName_ Int
pCode_ =
InstanceState' {$sel:name:InstanceState' :: InstanceStateName
name = InstanceStateName
pName_, $sel:code:InstanceState' :: Int
code = Int
pCode_}
instanceState_name :: Lens.Lens' InstanceState InstanceStateName
instanceState_name :: Lens' InstanceState InstanceStateName
instanceState_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceState' {InstanceStateName
name :: InstanceStateName
$sel:name:InstanceState' :: InstanceState -> InstanceStateName
name} -> InstanceStateName
name) (\s :: InstanceState
s@InstanceState' {} InstanceStateName
a -> InstanceState
s {$sel:name:InstanceState' :: InstanceStateName
name = InstanceStateName
a} :: InstanceState)
instanceState_code :: Lens.Lens' InstanceState Prelude.Int
instanceState_code :: Lens' InstanceState Int
instanceState_code = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceState' {Int
code :: Int
$sel:code:InstanceState' :: InstanceState -> Int
code} -> Int
code) (\s :: InstanceState
s@InstanceState' {} Int
a -> InstanceState
s {$sel:code:InstanceState' :: Int
code = Int
a} :: InstanceState)
instance Data.FromXML InstanceState where
parseXML :: [Node] -> Either String InstanceState
parseXML [Node]
x =
InstanceStateName -> Int -> InstanceState
InstanceState'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"name")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"code")
instance Prelude.Hashable InstanceState where
hashWithSalt :: Int -> InstanceState -> Int
hashWithSalt Int
_salt InstanceState' {Int
InstanceStateName
code :: Int
name :: InstanceStateName
$sel:code:InstanceState' :: InstanceState -> Int
$sel:name:InstanceState' :: InstanceState -> InstanceStateName
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` InstanceStateName
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
code
instance Prelude.NFData InstanceState where
rnf :: InstanceState -> ()
rnf InstanceState' {Int
InstanceStateName
code :: Int
name :: InstanceStateName
$sel:code:InstanceState' :: InstanceState -> Int
$sel:name:InstanceState' :: InstanceState -> InstanceStateName
..} =
forall a. NFData a => a -> ()
Prelude.rnf InstanceStateName
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
code