{-# 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.GuardDuty.Types.MalwareProtectionConfigurationResult
-- 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.GuardDuty.Types.MalwareProtectionConfigurationResult where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GuardDuty.Types.ScanEc2InstanceWithFindingsResult
import qualified Amazonka.Prelude as Prelude

-- | An object that contains information on the status of all Malware
-- Protection data sources.
--
-- /See:/ 'newMalwareProtectionConfigurationResult' smart constructor.
data MalwareProtectionConfigurationResult = MalwareProtectionConfigurationResult'
  { -- | Describes the configuration of Malware Protection for EC2 instances with
    -- findings.
    MalwareProtectionConfigurationResult
-> Maybe ScanEc2InstanceWithFindingsResult
scanEc2InstanceWithFindings :: Prelude.Maybe ScanEc2InstanceWithFindingsResult,
    -- | The GuardDuty Malware Protection service role.
    MalwareProtectionConfigurationResult -> Maybe Text
serviceRole :: Prelude.Maybe Prelude.Text
  }
  deriving (MalwareProtectionConfigurationResult
-> MalwareProtectionConfigurationResult -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MalwareProtectionConfigurationResult
-> MalwareProtectionConfigurationResult -> Bool
$c/= :: MalwareProtectionConfigurationResult
-> MalwareProtectionConfigurationResult -> Bool
== :: MalwareProtectionConfigurationResult
-> MalwareProtectionConfigurationResult -> Bool
$c== :: MalwareProtectionConfigurationResult
-> MalwareProtectionConfigurationResult -> Bool
Prelude.Eq, ReadPrec [MalwareProtectionConfigurationResult]
ReadPrec MalwareProtectionConfigurationResult
Int -> ReadS MalwareProtectionConfigurationResult
ReadS [MalwareProtectionConfigurationResult]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MalwareProtectionConfigurationResult]
$creadListPrec :: ReadPrec [MalwareProtectionConfigurationResult]
readPrec :: ReadPrec MalwareProtectionConfigurationResult
$creadPrec :: ReadPrec MalwareProtectionConfigurationResult
readList :: ReadS [MalwareProtectionConfigurationResult]
$creadList :: ReadS [MalwareProtectionConfigurationResult]
readsPrec :: Int -> ReadS MalwareProtectionConfigurationResult
$creadsPrec :: Int -> ReadS MalwareProtectionConfigurationResult
Prelude.Read, Int -> MalwareProtectionConfigurationResult -> ShowS
[MalwareProtectionConfigurationResult] -> ShowS
MalwareProtectionConfigurationResult -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MalwareProtectionConfigurationResult] -> ShowS
$cshowList :: [MalwareProtectionConfigurationResult] -> ShowS
show :: MalwareProtectionConfigurationResult -> String
$cshow :: MalwareProtectionConfigurationResult -> String
showsPrec :: Int -> MalwareProtectionConfigurationResult -> ShowS
$cshowsPrec :: Int -> MalwareProtectionConfigurationResult -> ShowS
Prelude.Show, forall x.
Rep MalwareProtectionConfigurationResult x
-> MalwareProtectionConfigurationResult
forall x.
MalwareProtectionConfigurationResult
-> Rep MalwareProtectionConfigurationResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MalwareProtectionConfigurationResult x
-> MalwareProtectionConfigurationResult
$cfrom :: forall x.
MalwareProtectionConfigurationResult
-> Rep MalwareProtectionConfigurationResult x
Prelude.Generic)

-- |
-- Create a value of 'MalwareProtectionConfigurationResult' 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:
--
-- 'scanEc2InstanceWithFindings', 'malwareProtectionConfigurationResult_scanEc2InstanceWithFindings' - Describes the configuration of Malware Protection for EC2 instances with
-- findings.
--
-- 'serviceRole', 'malwareProtectionConfigurationResult_serviceRole' - The GuardDuty Malware Protection service role.
newMalwareProtectionConfigurationResult ::
  MalwareProtectionConfigurationResult
newMalwareProtectionConfigurationResult :: MalwareProtectionConfigurationResult
newMalwareProtectionConfigurationResult =
  MalwareProtectionConfigurationResult'
    { $sel:scanEc2InstanceWithFindings:MalwareProtectionConfigurationResult' :: Maybe ScanEc2InstanceWithFindingsResult
scanEc2InstanceWithFindings =
        forall a. Maybe a
Prelude.Nothing,
      $sel:serviceRole:MalwareProtectionConfigurationResult' :: Maybe Text
serviceRole = forall a. Maybe a
Prelude.Nothing
    }

-- | Describes the configuration of Malware Protection for EC2 instances with
-- findings.
malwareProtectionConfigurationResult_scanEc2InstanceWithFindings :: Lens.Lens' MalwareProtectionConfigurationResult (Prelude.Maybe ScanEc2InstanceWithFindingsResult)
malwareProtectionConfigurationResult_scanEc2InstanceWithFindings :: Lens'
  MalwareProtectionConfigurationResult
  (Maybe ScanEc2InstanceWithFindingsResult)
malwareProtectionConfigurationResult_scanEc2InstanceWithFindings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MalwareProtectionConfigurationResult' {Maybe ScanEc2InstanceWithFindingsResult
scanEc2InstanceWithFindings :: Maybe ScanEc2InstanceWithFindingsResult
$sel:scanEc2InstanceWithFindings:MalwareProtectionConfigurationResult' :: MalwareProtectionConfigurationResult
-> Maybe ScanEc2InstanceWithFindingsResult
scanEc2InstanceWithFindings} -> Maybe ScanEc2InstanceWithFindingsResult
scanEc2InstanceWithFindings) (\s :: MalwareProtectionConfigurationResult
s@MalwareProtectionConfigurationResult' {} Maybe ScanEc2InstanceWithFindingsResult
a -> MalwareProtectionConfigurationResult
s {$sel:scanEc2InstanceWithFindings:MalwareProtectionConfigurationResult' :: Maybe ScanEc2InstanceWithFindingsResult
scanEc2InstanceWithFindings = Maybe ScanEc2InstanceWithFindingsResult
a} :: MalwareProtectionConfigurationResult)

-- | The GuardDuty Malware Protection service role.
malwareProtectionConfigurationResult_serviceRole :: Lens.Lens' MalwareProtectionConfigurationResult (Prelude.Maybe Prelude.Text)
malwareProtectionConfigurationResult_serviceRole :: Lens' MalwareProtectionConfigurationResult (Maybe Text)
malwareProtectionConfigurationResult_serviceRole = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MalwareProtectionConfigurationResult' {Maybe Text
serviceRole :: Maybe Text
$sel:serviceRole:MalwareProtectionConfigurationResult' :: MalwareProtectionConfigurationResult -> Maybe Text
serviceRole} -> Maybe Text
serviceRole) (\s :: MalwareProtectionConfigurationResult
s@MalwareProtectionConfigurationResult' {} Maybe Text
a -> MalwareProtectionConfigurationResult
s {$sel:serviceRole:MalwareProtectionConfigurationResult' :: Maybe Text
serviceRole = Maybe Text
a} :: MalwareProtectionConfigurationResult)

instance
  Data.FromJSON
    MalwareProtectionConfigurationResult
  where
  parseJSON :: Value -> Parser MalwareProtectionConfigurationResult
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MalwareProtectionConfigurationResult"
      ( \Object
x ->
          Maybe ScanEc2InstanceWithFindingsResult
-> Maybe Text -> MalwareProtectionConfigurationResult
MalwareProtectionConfigurationResult'
            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
"scanEc2InstanceWithFindings")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"serviceRole")
      )

instance
  Prelude.Hashable
    MalwareProtectionConfigurationResult
  where
  hashWithSalt :: Int -> MalwareProtectionConfigurationResult -> Int
hashWithSalt
    Int
_salt
    MalwareProtectionConfigurationResult' {Maybe Text
Maybe ScanEc2InstanceWithFindingsResult
serviceRole :: Maybe Text
scanEc2InstanceWithFindings :: Maybe ScanEc2InstanceWithFindingsResult
$sel:serviceRole:MalwareProtectionConfigurationResult' :: MalwareProtectionConfigurationResult -> Maybe Text
$sel:scanEc2InstanceWithFindings:MalwareProtectionConfigurationResult' :: MalwareProtectionConfigurationResult
-> Maybe ScanEc2InstanceWithFindingsResult
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ScanEc2InstanceWithFindingsResult
scanEc2InstanceWithFindings
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
serviceRole

instance
  Prelude.NFData
    MalwareProtectionConfigurationResult
  where
  rnf :: MalwareProtectionConfigurationResult -> ()
rnf MalwareProtectionConfigurationResult' {Maybe Text
Maybe ScanEc2InstanceWithFindingsResult
serviceRole :: Maybe Text
scanEc2InstanceWithFindings :: Maybe ScanEc2InstanceWithFindingsResult
$sel:serviceRole:MalwareProtectionConfigurationResult' :: MalwareProtectionConfigurationResult -> Maybe Text
$sel:scanEc2InstanceWithFindings:MalwareProtectionConfigurationResult' :: MalwareProtectionConfigurationResult
-> Maybe ScanEc2InstanceWithFindingsResult
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ScanEc2InstanceWithFindingsResult
scanEc2InstanceWithFindings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
serviceRole