amazonka-securityhub-2.0: gen/Amazonka/SecurityHub/Types/Malware.hs
{-# 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.SecurityHub.Types.Malware
-- 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.SecurityHub.Types.Malware where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.MalwareState
import Amazonka.SecurityHub.Types.MalwareType
-- | A list of malware related to a finding.
--
-- /See:/ 'newMalware' smart constructor.
data Malware = Malware'
{ -- | The file system path of the malware that was observed.
path :: Prelude.Maybe Prelude.Text,
-- | The state of the malware that was observed.
state :: Prelude.Maybe MalwareState,
-- | The type of the malware that was observed.
type' :: Prelude.Maybe MalwareType,
-- | The name of the malware that was observed.
name :: Prelude.Text
}
deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)
-- |
-- Create a value of 'Malware' 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:
--
-- 'path', 'malware_path' - The file system path of the malware that was observed.
--
-- 'state', 'malware_state' - The state of the malware that was observed.
--
-- 'type'', 'malware_type' - The type of the malware that was observed.
--
-- 'name', 'malware_name' - The name of the malware that was observed.
newMalware ::
-- | 'name'
Prelude.Text ->
Malware
newMalware pName_ =
Malware'
{ path = Prelude.Nothing,
state = Prelude.Nothing,
type' = Prelude.Nothing,
name = pName_
}
-- | The file system path of the malware that was observed.
malware_path :: Lens.Lens' Malware (Prelude.Maybe Prelude.Text)
malware_path = Lens.lens (\Malware' {path} -> path) (\s@Malware' {} a -> s {path = a} :: Malware)
-- | The state of the malware that was observed.
malware_state :: Lens.Lens' Malware (Prelude.Maybe MalwareState)
malware_state = Lens.lens (\Malware' {state} -> state) (\s@Malware' {} a -> s {state = a} :: Malware)
-- | The type of the malware that was observed.
malware_type :: Lens.Lens' Malware (Prelude.Maybe MalwareType)
malware_type = Lens.lens (\Malware' {type'} -> type') (\s@Malware' {} a -> s {type' = a} :: Malware)
-- | The name of the malware that was observed.
malware_name :: Lens.Lens' Malware Prelude.Text
malware_name = Lens.lens (\Malware' {name} -> name) (\s@Malware' {} a -> s {name = a} :: Malware)
instance Data.FromJSON Malware where
parseJSON =
Data.withObject
"Malware"
( \x ->
Malware'
Prelude.<$> (x Data..:? "Path")
Prelude.<*> (x Data..:? "State")
Prelude.<*> (x Data..:? "Type")
Prelude.<*> (x Data..: "Name")
)
instance Prelude.Hashable Malware where
hashWithSalt _salt Malware' {..} =
_salt
`Prelude.hashWithSalt` path
`Prelude.hashWithSalt` state
`Prelude.hashWithSalt` type'
`Prelude.hashWithSalt` name
instance Prelude.NFData Malware where
rnf Malware' {..} =
Prelude.rnf path
`Prelude.seq` Prelude.rnf state
`Prelude.seq` Prelude.rnf type'
`Prelude.seq` Prelude.rnf name
instance Data.ToJSON Malware where
toJSON Malware' {..} =
Data.object
( Prelude.catMaybes
[ ("Path" Data..=) Prelude.<$> path,
("State" Data..=) Prelude.<$> state,
("Type" Data..=) Prelude.<$> type',
Prelude.Just ("Name" Data..= name)
]
)