{-# 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.AccountState 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.ResourceState
import Amazonka.Inspector2.Types.State
import qualified Amazonka.Prelude as Prelude
data AccountState = AccountState'
{
AccountState -> Text
accountId :: Prelude.Text,
AccountState -> ResourceState
resourceState :: ResourceState,
AccountState -> State
state :: State
}
deriving (AccountState -> AccountState -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountState -> AccountState -> Bool
$c/= :: AccountState -> AccountState -> Bool
== :: AccountState -> AccountState -> Bool
$c== :: AccountState -> AccountState -> Bool
Prelude.Eq, ReadPrec [AccountState]
ReadPrec AccountState
Int -> ReadS AccountState
ReadS [AccountState]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccountState]
$creadListPrec :: ReadPrec [AccountState]
readPrec :: ReadPrec AccountState
$creadPrec :: ReadPrec AccountState
readList :: ReadS [AccountState]
$creadList :: ReadS [AccountState]
readsPrec :: Int -> ReadS AccountState
$creadsPrec :: Int -> ReadS AccountState
Prelude.Read, Int -> AccountState -> ShowS
[AccountState] -> ShowS
AccountState -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountState] -> ShowS
$cshowList :: [AccountState] -> ShowS
show :: AccountState -> String
$cshow :: AccountState -> String
showsPrec :: Int -> AccountState -> ShowS
$cshowsPrec :: Int -> AccountState -> ShowS
Prelude.Show, forall x. Rep AccountState x -> AccountState
forall x. AccountState -> Rep AccountState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccountState x -> AccountState
$cfrom :: forall x. AccountState -> Rep AccountState x
Prelude.Generic)
newAccountState ::
Prelude.Text ->
ResourceState ->
State ->
AccountState
newAccountState :: Text -> ResourceState -> State -> AccountState
newAccountState Text
pAccountId_ ResourceState
pResourceState_ State
pState_ =
AccountState'
{ $sel:accountId:AccountState' :: Text
accountId = Text
pAccountId_,
$sel:resourceState:AccountState' :: ResourceState
resourceState = ResourceState
pResourceState_,
$sel:state:AccountState' :: State
state = State
pState_
}
accountState_accountId :: Lens.Lens' AccountState Prelude.Text
accountState_accountId :: Lens' AccountState Text
accountState_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountState' {Text
accountId :: Text
$sel:accountId:AccountState' :: AccountState -> Text
accountId} -> Text
accountId) (\s :: AccountState
s@AccountState' {} Text
a -> AccountState
s {$sel:accountId:AccountState' :: Text
accountId = Text
a} :: AccountState)
accountState_resourceState :: Lens.Lens' AccountState ResourceState
accountState_resourceState :: Lens' AccountState ResourceState
accountState_resourceState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountState' {ResourceState
resourceState :: ResourceState
$sel:resourceState:AccountState' :: AccountState -> ResourceState
resourceState} -> ResourceState
resourceState) (\s :: AccountState
s@AccountState' {} ResourceState
a -> AccountState
s {$sel:resourceState:AccountState' :: ResourceState
resourceState = ResourceState
a} :: AccountState)
accountState_state :: Lens.Lens' AccountState State
accountState_state :: Lens' AccountState State
accountState_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountState' {State
state :: State
$sel:state:AccountState' :: AccountState -> State
state} -> State
state) (\s :: AccountState
s@AccountState' {} State
a -> AccountState
s {$sel:state:AccountState' :: State
state = State
a} :: AccountState)
instance Data.FromJSON AccountState where
parseJSON :: Value -> Parser AccountState
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"AccountState"
( \Object
x ->
Text -> ResourceState -> State -> AccountState
AccountState'
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
"accountId")
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
"resourceState")
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
"state")
)
instance Prelude.Hashable AccountState where
hashWithSalt :: Int -> AccountState -> Int
hashWithSalt Int
_salt AccountState' {Text
State
ResourceState
state :: State
resourceState :: ResourceState
accountId :: Text
$sel:state:AccountState' :: AccountState -> State
$sel:resourceState:AccountState' :: AccountState -> ResourceState
$sel:accountId:AccountState' :: AccountState -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
accountId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ResourceState
resourceState
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` State
state
instance Prelude.NFData AccountState where
rnf :: AccountState -> ()
rnf AccountState' {Text
State
ResourceState
state :: State
resourceState :: ResourceState
accountId :: Text
$sel:state:AccountState' :: AccountState -> State
$sel:resourceState:AccountState' :: AccountState -> ResourceState
$sel:accountId:AccountState' :: AccountState -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
accountId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ResourceState
resourceState
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf State
state