{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Inspector2.Types.AccountState
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
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

-- | An object with details the status of an Amazon Web Services account
-- within your Amazon Inspector environment.
--
-- /See:/ 'newAccountState' smart constructor.
data AccountState = AccountState'
  { -- | The Amazon Web Services account ID.
    AccountState -> Text
accountId :: Prelude.Text,
    -- | An object detailing which resources Amazon Inspector is enabled to scan
    -- for the account.
    AccountState -> ResourceState
resourceState :: ResourceState,
    -- | An object detailing the status of Amazon Inspector for the account.
    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)

-- |
-- Create a value of 'AccountState' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'accountId', 'accountState_accountId' - The Amazon Web Services account ID.
--
-- 'resourceState', 'accountState_resourceState' - An object detailing which resources Amazon Inspector is enabled to scan
-- for the account.
--
-- 'state', 'accountState_state' - An object detailing the status of Amazon Inspector for the account.
newAccountState ::
  -- | 'accountId'
  Prelude.Text ->
  -- | 'resourceState'
  ResourceState ->
  -- | 'state'
  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_
    }

-- | The Amazon Web Services account ID.
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)

-- | An object detailing which resources Amazon Inspector is enabled to scan
-- for the account.
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)

-- | An object detailing the status of Amazon Inspector for the account.
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