{-# 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.Inspector2.Types.State where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Inspector2.Types.ErrorCode
import Amazonka.Inspector2.Types.Status
import qualified Amazonka.Prelude as Prelude
data State = State'
{
State -> ErrorCode
errorCode :: ErrorCode,
State -> Text
errorMessage :: Prelude.Text,
State -> Status
status :: Status
}
deriving (State -> State -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: State -> State -> Bool
$c/= :: State -> State -> Bool
== :: State -> State -> Bool
$c== :: State -> State -> Bool
Prelude.Eq, ReadPrec [State]
ReadPrec State
Int -> ReadS State
ReadS [State]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [State]
$creadListPrec :: ReadPrec [State]
readPrec :: ReadPrec State
$creadPrec :: ReadPrec State
readList :: ReadS [State]
$creadList :: ReadS [State]
readsPrec :: Int -> ReadS State
$creadsPrec :: Int -> ReadS State
Prelude.Read, Int -> State -> ShowS
[State] -> ShowS
State -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [State] -> ShowS
$cshowList :: [State] -> ShowS
show :: State -> String
$cshow :: State -> String
showsPrec :: Int -> State -> ShowS
$cshowsPrec :: Int -> State -> ShowS
Prelude.Show, forall x. Rep State x -> State
forall x. State -> Rep State x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep State x -> State
$cfrom :: forall x. State -> Rep State x
Prelude.Generic)
newState ::
ErrorCode ->
Prelude.Text ->
Status ->
State
newState :: ErrorCode -> Text -> Status -> State
newState ErrorCode
pErrorCode_ Text
pErrorMessage_ Status
pStatus_ =
State'
{ $sel:errorCode:State' :: ErrorCode
errorCode = ErrorCode
pErrorCode_,
$sel:errorMessage:State' :: Text
errorMessage = Text
pErrorMessage_,
$sel:status:State' :: Status
status = Status
pStatus_
}
state_errorCode :: Lens.Lens' State ErrorCode
state_errorCode :: Lens' State ErrorCode
state_errorCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\State' {ErrorCode
errorCode :: ErrorCode
$sel:errorCode:State' :: State -> ErrorCode
errorCode} -> ErrorCode
errorCode) (\s :: State
s@State' {} ErrorCode
a -> State
s {$sel:errorCode:State' :: ErrorCode
errorCode = ErrorCode
a} :: State)
state_errorMessage :: Lens.Lens' State Prelude.Text
state_errorMessage :: Lens' State Text
state_errorMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\State' {Text
errorMessage :: Text
$sel:errorMessage:State' :: State -> Text
errorMessage} -> Text
errorMessage) (\s :: State
s@State' {} Text
a -> State
s {$sel:errorMessage:State' :: Text
errorMessage = Text
a} :: State)
state_status :: Lens.Lens' State Status
state_status :: Lens' State Status
state_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\State' {Status
status :: Status
$sel:status:State' :: State -> Status
status} -> Status
status) (\s :: State
s@State' {} Status
a -> State
s {$sel:status:State' :: Status
status = Status
a} :: State)
instance Data.FromJSON State where
parseJSON :: Value -> Parser State
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"State"
( \Object
x ->
ErrorCode -> Text -> Status -> State
State'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"errorCode")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"errorMessage")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"status")
)
instance Prelude.Hashable State where
hashWithSalt :: Int -> State -> Int
hashWithSalt Int
_salt State' {Text
ErrorCode
Status
status :: Status
errorMessage :: Text
errorCode :: ErrorCode
$sel:status:State' :: State -> Status
$sel:errorMessage:State' :: State -> Text
$sel:errorCode:State' :: State -> ErrorCode
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ErrorCode
errorCode
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
errorMessage
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Status
status
instance Prelude.NFData State where
rnf :: State -> ()
rnf State' {Text
ErrorCode
Status
status :: Status
errorMessage :: Text
errorCode :: ErrorCode
$sel:status:State' :: State -> Status
$sel:errorMessage:State' :: State -> Text
$sel:errorCode:State' :: State -> ErrorCode
..} =
forall a. NFData a => a -> ()
Prelude.rnf ErrorCode
errorCode
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
errorMessage
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Status
status