{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.GetMalwareScanSettings
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns the details of the malware scan settings.
module Amazonka.GuardDuty.GetMalwareScanSettings
  ( -- * Creating a Request
    GetMalwareScanSettings (..),
    newGetMalwareScanSettings,

    -- * Request Lenses
    getMalwareScanSettings_detectorId,

    -- * Destructuring the Response
    GetMalwareScanSettingsResponse (..),
    newGetMalwareScanSettingsResponse,

    -- * Response Lenses
    getMalwareScanSettingsResponse_ebsSnapshotPreservation,
    getMalwareScanSettingsResponse_scanResourceCriteria,
    getMalwareScanSettingsResponse_httpStatus,
  )
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
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetMalwareScanSettings' smart constructor.
data GetMalwareScanSettings = GetMalwareScanSettings'
  { -- | The unique ID of the detector that the scan setting is associated with.
    GetMalwareScanSettings -> Text
detectorId :: Prelude.Text
  }
  deriving (GetMalwareScanSettings -> GetMalwareScanSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMalwareScanSettings -> GetMalwareScanSettings -> Bool
$c/= :: GetMalwareScanSettings -> GetMalwareScanSettings -> Bool
== :: GetMalwareScanSettings -> GetMalwareScanSettings -> Bool
$c== :: GetMalwareScanSettings -> GetMalwareScanSettings -> Bool
Prelude.Eq, ReadPrec [GetMalwareScanSettings]
ReadPrec GetMalwareScanSettings
Int -> ReadS GetMalwareScanSettings
ReadS [GetMalwareScanSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMalwareScanSettings]
$creadListPrec :: ReadPrec [GetMalwareScanSettings]
readPrec :: ReadPrec GetMalwareScanSettings
$creadPrec :: ReadPrec GetMalwareScanSettings
readList :: ReadS [GetMalwareScanSettings]
$creadList :: ReadS [GetMalwareScanSettings]
readsPrec :: Int -> ReadS GetMalwareScanSettings
$creadsPrec :: Int -> ReadS GetMalwareScanSettings
Prelude.Read, Int -> GetMalwareScanSettings -> ShowS
[GetMalwareScanSettings] -> ShowS
GetMalwareScanSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMalwareScanSettings] -> ShowS
$cshowList :: [GetMalwareScanSettings] -> ShowS
show :: GetMalwareScanSettings -> String
$cshow :: GetMalwareScanSettings -> String
showsPrec :: Int -> GetMalwareScanSettings -> ShowS
$cshowsPrec :: Int -> GetMalwareScanSettings -> ShowS
Prelude.Show, forall x. Rep GetMalwareScanSettings x -> GetMalwareScanSettings
forall x. GetMalwareScanSettings -> Rep GetMalwareScanSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMalwareScanSettings x -> GetMalwareScanSettings
$cfrom :: forall x. GetMalwareScanSettings -> Rep GetMalwareScanSettings x
Prelude.Generic)

-- |
-- Create a value of 'GetMalwareScanSettings' 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:
--
-- 'detectorId', 'getMalwareScanSettings_detectorId' - The unique ID of the detector that the scan setting is associated with.
newGetMalwareScanSettings ::
  -- | 'detectorId'
  Prelude.Text ->
  GetMalwareScanSettings
newGetMalwareScanSettings :: Text -> GetMalwareScanSettings
newGetMalwareScanSettings Text
pDetectorId_ =
  GetMalwareScanSettings' {$sel:detectorId:GetMalwareScanSettings' :: Text
detectorId = Text
pDetectorId_}

-- | The unique ID of the detector that the scan setting is associated with.
getMalwareScanSettings_detectorId :: Lens.Lens' GetMalwareScanSettings Prelude.Text
getMalwareScanSettings_detectorId :: Lens' GetMalwareScanSettings Text
getMalwareScanSettings_detectorId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMalwareScanSettings' {Text
detectorId :: Text
$sel:detectorId:GetMalwareScanSettings' :: GetMalwareScanSettings -> Text
detectorId} -> Text
detectorId) (\s :: GetMalwareScanSettings
s@GetMalwareScanSettings' {} Text
a -> GetMalwareScanSettings
s {$sel:detectorId:GetMalwareScanSettings' :: Text
detectorId = Text
a} :: GetMalwareScanSettings)

instance Core.AWSRequest GetMalwareScanSettings where
  type
    AWSResponse GetMalwareScanSettings =
      GetMalwareScanSettingsResponse
  request :: (Service -> Service)
-> GetMalwareScanSettings -> Request GetMalwareScanSettings
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetMalwareScanSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetMalwareScanSettings)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe EbsSnapshotPreservation
-> Maybe ScanResourceCriteria
-> Int
-> GetMalwareScanSettingsResponse
GetMalwareScanSettingsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ebsSnapshotPreservation")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"scanResourceCriteria")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetMalwareScanSettings where
  hashWithSalt :: Int -> GetMalwareScanSettings -> Int
hashWithSalt Int
_salt GetMalwareScanSettings' {Text
detectorId :: Text
$sel:detectorId:GetMalwareScanSettings' :: GetMalwareScanSettings -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
detectorId

instance Prelude.NFData GetMalwareScanSettings where
  rnf :: GetMalwareScanSettings -> ()
rnf GetMalwareScanSettings' {Text
detectorId :: Text
$sel:detectorId:GetMalwareScanSettings' :: GetMalwareScanSettings -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
detectorId

instance Data.ToHeaders GetMalwareScanSettings where
  toHeaders :: GetMalwareScanSettings -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath GetMalwareScanSettings where
  toPath :: GetMalwareScanSettings -> ByteString
toPath GetMalwareScanSettings' {Text
detectorId :: Text
$sel:detectorId:GetMalwareScanSettings' :: GetMalwareScanSettings -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/detector/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
detectorId,
        ByteString
"/malware-scan-settings"
      ]

instance Data.ToQuery GetMalwareScanSettings where
  toQuery :: GetMalwareScanSettings -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetMalwareScanSettingsResponse' smart constructor.
data GetMalwareScanSettingsResponse = GetMalwareScanSettingsResponse'
  { -- | An enum value representing possible snapshot preservation settings.
    GetMalwareScanSettingsResponse -> Maybe EbsSnapshotPreservation
ebsSnapshotPreservation :: Prelude.Maybe EbsSnapshotPreservation,
    -- | Represents the criteria to be used in the filter for scanning resources.
    GetMalwareScanSettingsResponse -> Maybe ScanResourceCriteria
scanResourceCriteria :: Prelude.Maybe ScanResourceCriteria,
    -- | The response's http status code.
    GetMalwareScanSettingsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetMalwareScanSettingsResponse
-> GetMalwareScanSettingsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMalwareScanSettingsResponse
-> GetMalwareScanSettingsResponse -> Bool
$c/= :: GetMalwareScanSettingsResponse
-> GetMalwareScanSettingsResponse -> Bool
== :: GetMalwareScanSettingsResponse
-> GetMalwareScanSettingsResponse -> Bool
$c== :: GetMalwareScanSettingsResponse
-> GetMalwareScanSettingsResponse -> Bool
Prelude.Eq, ReadPrec [GetMalwareScanSettingsResponse]
ReadPrec GetMalwareScanSettingsResponse
Int -> ReadS GetMalwareScanSettingsResponse
ReadS [GetMalwareScanSettingsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMalwareScanSettingsResponse]
$creadListPrec :: ReadPrec [GetMalwareScanSettingsResponse]
readPrec :: ReadPrec GetMalwareScanSettingsResponse
$creadPrec :: ReadPrec GetMalwareScanSettingsResponse
readList :: ReadS [GetMalwareScanSettingsResponse]
$creadList :: ReadS [GetMalwareScanSettingsResponse]
readsPrec :: Int -> ReadS GetMalwareScanSettingsResponse
$creadsPrec :: Int -> ReadS GetMalwareScanSettingsResponse
Prelude.Read, Int -> GetMalwareScanSettingsResponse -> ShowS
[GetMalwareScanSettingsResponse] -> ShowS
GetMalwareScanSettingsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMalwareScanSettingsResponse] -> ShowS
$cshowList :: [GetMalwareScanSettingsResponse] -> ShowS
show :: GetMalwareScanSettingsResponse -> String
$cshow :: GetMalwareScanSettingsResponse -> String
showsPrec :: Int -> GetMalwareScanSettingsResponse -> ShowS
$cshowsPrec :: Int -> GetMalwareScanSettingsResponse -> ShowS
Prelude.Show, forall x.
Rep GetMalwareScanSettingsResponse x
-> GetMalwareScanSettingsResponse
forall x.
GetMalwareScanSettingsResponse
-> Rep GetMalwareScanSettingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetMalwareScanSettingsResponse x
-> GetMalwareScanSettingsResponse
$cfrom :: forall x.
GetMalwareScanSettingsResponse
-> Rep GetMalwareScanSettingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetMalwareScanSettingsResponse' 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:
--
-- 'ebsSnapshotPreservation', 'getMalwareScanSettingsResponse_ebsSnapshotPreservation' - An enum value representing possible snapshot preservation settings.
--
-- 'scanResourceCriteria', 'getMalwareScanSettingsResponse_scanResourceCriteria' - Represents the criteria to be used in the filter for scanning resources.
--
-- 'httpStatus', 'getMalwareScanSettingsResponse_httpStatus' - The response's http status code.
newGetMalwareScanSettingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetMalwareScanSettingsResponse
newGetMalwareScanSettingsResponse :: Int -> GetMalwareScanSettingsResponse
newGetMalwareScanSettingsResponse Int
pHttpStatus_ =
  GetMalwareScanSettingsResponse'
    { $sel:ebsSnapshotPreservation:GetMalwareScanSettingsResponse' :: Maybe EbsSnapshotPreservation
ebsSnapshotPreservation =
        forall a. Maybe a
Prelude.Nothing,
      $sel:scanResourceCriteria:GetMalwareScanSettingsResponse' :: Maybe ScanResourceCriteria
scanResourceCriteria = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetMalwareScanSettingsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An enum value representing possible snapshot preservation settings.
getMalwareScanSettingsResponse_ebsSnapshotPreservation :: Lens.Lens' GetMalwareScanSettingsResponse (Prelude.Maybe EbsSnapshotPreservation)
getMalwareScanSettingsResponse_ebsSnapshotPreservation :: Lens'
  GetMalwareScanSettingsResponse (Maybe EbsSnapshotPreservation)
getMalwareScanSettingsResponse_ebsSnapshotPreservation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMalwareScanSettingsResponse' {Maybe EbsSnapshotPreservation
ebsSnapshotPreservation :: Maybe EbsSnapshotPreservation
$sel:ebsSnapshotPreservation:GetMalwareScanSettingsResponse' :: GetMalwareScanSettingsResponse -> Maybe EbsSnapshotPreservation
ebsSnapshotPreservation} -> Maybe EbsSnapshotPreservation
ebsSnapshotPreservation) (\s :: GetMalwareScanSettingsResponse
s@GetMalwareScanSettingsResponse' {} Maybe EbsSnapshotPreservation
a -> GetMalwareScanSettingsResponse
s {$sel:ebsSnapshotPreservation:GetMalwareScanSettingsResponse' :: Maybe EbsSnapshotPreservation
ebsSnapshotPreservation = Maybe EbsSnapshotPreservation
a} :: GetMalwareScanSettingsResponse)

-- | Represents the criteria to be used in the filter for scanning resources.
getMalwareScanSettingsResponse_scanResourceCriteria :: Lens.Lens' GetMalwareScanSettingsResponse (Prelude.Maybe ScanResourceCriteria)
getMalwareScanSettingsResponse_scanResourceCriteria :: Lens' GetMalwareScanSettingsResponse (Maybe ScanResourceCriteria)
getMalwareScanSettingsResponse_scanResourceCriteria = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMalwareScanSettingsResponse' {Maybe ScanResourceCriteria
scanResourceCriteria :: Maybe ScanResourceCriteria
$sel:scanResourceCriteria:GetMalwareScanSettingsResponse' :: GetMalwareScanSettingsResponse -> Maybe ScanResourceCriteria
scanResourceCriteria} -> Maybe ScanResourceCriteria
scanResourceCriteria) (\s :: GetMalwareScanSettingsResponse
s@GetMalwareScanSettingsResponse' {} Maybe ScanResourceCriteria
a -> GetMalwareScanSettingsResponse
s {$sel:scanResourceCriteria:GetMalwareScanSettingsResponse' :: Maybe ScanResourceCriteria
scanResourceCriteria = Maybe ScanResourceCriteria
a} :: GetMalwareScanSettingsResponse)

-- | The response's http status code.
getMalwareScanSettingsResponse_httpStatus :: Lens.Lens' GetMalwareScanSettingsResponse Prelude.Int
getMalwareScanSettingsResponse_httpStatus :: Lens' GetMalwareScanSettingsResponse Int
getMalwareScanSettingsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMalwareScanSettingsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetMalwareScanSettingsResponse' :: GetMalwareScanSettingsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetMalwareScanSettingsResponse
s@GetMalwareScanSettingsResponse' {} Int
a -> GetMalwareScanSettingsResponse
s {$sel:httpStatus:GetMalwareScanSettingsResponse' :: Int
httpStatus = Int
a} :: GetMalwareScanSettingsResponse)

instance
  Prelude.NFData
    GetMalwareScanSettingsResponse
  where
  rnf :: GetMalwareScanSettingsResponse -> ()
rnf GetMalwareScanSettingsResponse' {Int
Maybe EbsSnapshotPreservation
Maybe ScanResourceCriteria
httpStatus :: Int
scanResourceCriteria :: Maybe ScanResourceCriteria
ebsSnapshotPreservation :: Maybe EbsSnapshotPreservation
$sel:httpStatus:GetMalwareScanSettingsResponse' :: GetMalwareScanSettingsResponse -> Int
$sel:scanResourceCriteria:GetMalwareScanSettingsResponse' :: GetMalwareScanSettingsResponse -> Maybe ScanResourceCriteria
$sel:ebsSnapshotPreservation:GetMalwareScanSettingsResponse' :: GetMalwareScanSettingsResponse -> Maybe EbsSnapshotPreservation
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe EbsSnapshotPreservation
ebsSnapshotPreservation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ScanResourceCriteria
scanResourceCriteria
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus