{-# 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.ResourceState
-- 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.ResourceState 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.State
import qualified Amazonka.Prelude as Prelude

-- | Details the state of Amazon Inspector for each resource type Amazon
-- Inspector scans.
--
-- /See:/ 'newResourceState' smart constructor.
data ResourceState = ResourceState'
  { ResourceState -> Maybe State
lambda :: Prelude.Maybe State,
    -- | An object detailing the state of Amazon Inspector scanning for Amazon
    -- EC2 resources.
    ResourceState -> State
ec2 :: State,
    -- | An object detailing the state of Amazon Inspector scanning for Amazon
    -- ECR resources.
    ResourceState -> State
ecr :: State
  }
  deriving (ResourceState -> ResourceState -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceState -> ResourceState -> Bool
$c/= :: ResourceState -> ResourceState -> Bool
== :: ResourceState -> ResourceState -> Bool
$c== :: ResourceState -> ResourceState -> Bool
Prelude.Eq, ReadPrec [ResourceState]
ReadPrec ResourceState
Int -> ReadS ResourceState
ReadS [ResourceState]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceState]
$creadListPrec :: ReadPrec [ResourceState]
readPrec :: ReadPrec ResourceState
$creadPrec :: ReadPrec ResourceState
readList :: ReadS [ResourceState]
$creadList :: ReadS [ResourceState]
readsPrec :: Int -> ReadS ResourceState
$creadsPrec :: Int -> ReadS ResourceState
Prelude.Read, Int -> ResourceState -> ShowS
[ResourceState] -> ShowS
ResourceState -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceState] -> ShowS
$cshowList :: [ResourceState] -> ShowS
show :: ResourceState -> String
$cshow :: ResourceState -> String
showsPrec :: Int -> ResourceState -> ShowS
$cshowsPrec :: Int -> ResourceState -> ShowS
Prelude.Show, forall x. Rep ResourceState x -> ResourceState
forall x. ResourceState -> Rep ResourceState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourceState x -> ResourceState
$cfrom :: forall x. ResourceState -> Rep ResourceState x
Prelude.Generic)

-- |
-- Create a value of 'ResourceState' 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:
--
-- 'lambda', 'resourceState_lambda' - Undocumented member.
--
-- 'ec2', 'resourceState_ec2' - An object detailing the state of Amazon Inspector scanning for Amazon
-- EC2 resources.
--
-- 'ecr', 'resourceState_ecr' - An object detailing the state of Amazon Inspector scanning for Amazon
-- ECR resources.
newResourceState ::
  -- | 'ec2'
  State ->
  -- | 'ecr'
  State ->
  ResourceState
newResourceState :: State -> State -> ResourceState
newResourceState State
pEc2_ State
pEcr_ =
  ResourceState'
    { $sel:lambda:ResourceState' :: Maybe State
lambda = forall a. Maybe a
Prelude.Nothing,
      $sel:ec2:ResourceState' :: State
ec2 = State
pEc2_,
      $sel:ecr:ResourceState' :: State
ecr = State
pEcr_
    }

-- | Undocumented member.
resourceState_lambda :: Lens.Lens' ResourceState (Prelude.Maybe State)
resourceState_lambda :: Lens' ResourceState (Maybe State)
resourceState_lambda = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceState' {Maybe State
lambda :: Maybe State
$sel:lambda:ResourceState' :: ResourceState -> Maybe State
lambda} -> Maybe State
lambda) (\s :: ResourceState
s@ResourceState' {} Maybe State
a -> ResourceState
s {$sel:lambda:ResourceState' :: Maybe State
lambda = Maybe State
a} :: ResourceState)

-- | An object detailing the state of Amazon Inspector scanning for Amazon
-- EC2 resources.
resourceState_ec2 :: Lens.Lens' ResourceState State
resourceState_ec2 :: Lens' ResourceState State
resourceState_ec2 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceState' {State
ec2 :: State
$sel:ec2:ResourceState' :: ResourceState -> State
ec2} -> State
ec2) (\s :: ResourceState
s@ResourceState' {} State
a -> ResourceState
s {$sel:ec2:ResourceState' :: State
ec2 = State
a} :: ResourceState)

-- | An object detailing the state of Amazon Inspector scanning for Amazon
-- ECR resources.
resourceState_ecr :: Lens.Lens' ResourceState State
resourceState_ecr :: Lens' ResourceState State
resourceState_ecr = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceState' {State
ecr :: State
$sel:ecr:ResourceState' :: ResourceState -> State
ecr} -> State
ecr) (\s :: ResourceState
s@ResourceState' {} State
a -> ResourceState
s {$sel:ecr:ResourceState' :: State
ecr = State
a} :: ResourceState)

instance Data.FromJSON ResourceState where
  parseJSON :: Value -> Parser ResourceState
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ResourceState"
      ( \Object
x ->
          Maybe State -> State -> State -> ResourceState
ResourceState'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"lambda")
            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
"ec2")
            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
"ecr")
      )

instance Prelude.Hashable ResourceState where
  hashWithSalt :: Int -> ResourceState -> Int
hashWithSalt Int
_salt ResourceState' {Maybe State
State
ecr :: State
ec2 :: State
lambda :: Maybe State
$sel:ecr:ResourceState' :: ResourceState -> State
$sel:ec2:ResourceState' :: ResourceState -> State
$sel:lambda:ResourceState' :: ResourceState -> Maybe State
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe State
lambda
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` State
ec2
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` State
ecr

instance Prelude.NFData ResourceState where
  rnf :: ResourceState -> ()
rnf ResourceState' {Maybe State
State
ecr :: State
ec2 :: State
lambda :: Maybe State
$sel:ecr:ResourceState' :: ResourceState -> State
$sel:ec2:ResourceState' :: ResourceState -> State
$sel:lambda:ResourceState' :: ResourceState -> Maybe State
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe State
lambda
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf State
ec2
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf State
ecr