{-# 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 #-}
module Amazonka.SecurityHub.Types.Malware where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.MalwareState
import Amazonka.SecurityHub.Types.MalwareType
data Malware = Malware'
{
Malware -> Maybe MalwareState
state :: Prelude.Maybe MalwareState,
Malware -> Maybe Text
path :: Prelude.Maybe Prelude.Text,
Malware -> Maybe MalwareType
type' :: Prelude.Maybe MalwareType,
Malware -> Text
name :: Prelude.Text
}
deriving (Malware -> Malware -> Bool
(Malware -> Malware -> Bool)
-> (Malware -> Malware -> Bool) -> Eq Malware
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Malware -> Malware -> Bool
$c/= :: Malware -> Malware -> Bool
== :: Malware -> Malware -> Bool
$c== :: Malware -> Malware -> Bool
Prelude.Eq, ReadPrec [Malware]
ReadPrec Malware
Int -> ReadS Malware
ReadS [Malware]
(Int -> ReadS Malware)
-> ReadS [Malware]
-> ReadPrec Malware
-> ReadPrec [Malware]
-> Read Malware
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Malware]
$creadListPrec :: ReadPrec [Malware]
readPrec :: ReadPrec Malware
$creadPrec :: ReadPrec Malware
readList :: ReadS [Malware]
$creadList :: ReadS [Malware]
readsPrec :: Int -> ReadS Malware
$creadsPrec :: Int -> ReadS Malware
Prelude.Read, Int -> Malware -> ShowS
[Malware] -> ShowS
Malware -> String
(Int -> Malware -> ShowS)
-> (Malware -> String) -> ([Malware] -> ShowS) -> Show Malware
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Malware] -> ShowS
$cshowList :: [Malware] -> ShowS
show :: Malware -> String
$cshow :: Malware -> String
showsPrec :: Int -> Malware -> ShowS
$cshowsPrec :: Int -> Malware -> ShowS
Prelude.Show, (forall x. Malware -> Rep Malware x)
-> (forall x. Rep Malware x -> Malware) -> Generic Malware
forall x. Rep Malware x -> Malware
forall x. Malware -> Rep Malware x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Malware x -> Malware
$cfrom :: forall x. Malware -> Rep Malware x
Prelude.Generic)
newMalware ::
Prelude.Text ->
Malware
newMalware :: Text -> Malware
newMalware Text
pName_ =
Malware' :: Maybe MalwareState
-> Maybe Text -> Maybe MalwareType -> Text -> Malware
Malware'
{ $sel:state:Malware' :: Maybe MalwareState
state = Maybe MalwareState
forall a. Maybe a
Prelude.Nothing,
$sel:path:Malware' :: Maybe Text
path = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:type':Malware' :: Maybe MalwareType
type' = Maybe MalwareType
forall a. Maybe a
Prelude.Nothing,
$sel:name:Malware' :: Text
name = Text
pName_
}
malware_state :: Lens.Lens' Malware (Prelude.Maybe MalwareState)
malware_state :: (Maybe MalwareState -> f (Maybe MalwareState))
-> Malware -> f Malware
malware_state = (Malware -> Maybe MalwareState)
-> (Malware -> Maybe MalwareState -> Malware)
-> Lens Malware Malware (Maybe MalwareState) (Maybe MalwareState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Malware' {Maybe MalwareState
state :: Maybe MalwareState
$sel:state:Malware' :: Malware -> Maybe MalwareState
state} -> Maybe MalwareState
state) (\s :: Malware
s@Malware' {} Maybe MalwareState
a -> Malware
s {$sel:state:Malware' :: Maybe MalwareState
state = Maybe MalwareState
a} :: Malware)
malware_path :: Lens.Lens' Malware (Prelude.Maybe Prelude.Text)
malware_path :: (Maybe Text -> f (Maybe Text)) -> Malware -> f Malware
malware_path = (Malware -> Maybe Text)
-> (Malware -> Maybe Text -> Malware)
-> Lens Malware Malware (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Malware' {Maybe Text
path :: Maybe Text
$sel:path:Malware' :: Malware -> Maybe Text
path} -> Maybe Text
path) (\s :: Malware
s@Malware' {} Maybe Text
a -> Malware
s {$sel:path:Malware' :: Maybe Text
path = Maybe Text
a} :: Malware)
malware_type :: Lens.Lens' Malware (Prelude.Maybe MalwareType)
malware_type :: (Maybe MalwareType -> f (Maybe MalwareType))
-> Malware -> f Malware
malware_type = (Malware -> Maybe MalwareType)
-> (Malware -> Maybe MalwareType -> Malware)
-> Lens Malware Malware (Maybe MalwareType) (Maybe MalwareType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Malware' {Maybe MalwareType
type' :: Maybe MalwareType
$sel:type':Malware' :: Malware -> Maybe MalwareType
type'} -> Maybe MalwareType
type') (\s :: Malware
s@Malware' {} Maybe MalwareType
a -> Malware
s {$sel:type':Malware' :: Maybe MalwareType
type' = Maybe MalwareType
a} :: Malware)
malware_name :: Lens.Lens' Malware Prelude.Text
malware_name :: (Text -> f Text) -> Malware -> f Malware
malware_name = (Malware -> Text)
-> (Malware -> Text -> Malware) -> Lens Malware Malware Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Malware' {Text
name :: Text
$sel:name:Malware' :: Malware -> Text
name} -> Text
name) (\s :: Malware
s@Malware' {} Text
a -> Malware
s {$sel:name:Malware' :: Text
name = Text
a} :: Malware)
instance Core.FromJSON Malware where
parseJSON :: Value -> Parser Malware
parseJSON =
String -> (Object -> Parser Malware) -> Value -> Parser Malware
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Malware"
( \Object
x ->
Maybe MalwareState
-> Maybe Text -> Maybe MalwareType -> Text -> Malware
Malware'
(Maybe MalwareState
-> Maybe Text -> Maybe MalwareType -> Text -> Malware)
-> Parser (Maybe MalwareState)
-> Parser (Maybe Text -> Maybe MalwareType -> Text -> Malware)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe MalwareState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
Parser (Maybe Text -> Maybe MalwareType -> Text -> Malware)
-> Parser (Maybe Text)
-> Parser (Maybe MalwareType -> Text -> Malware)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Path")
Parser (Maybe MalwareType -> Text -> Malware)
-> Parser (Maybe MalwareType) -> Parser (Text -> Malware)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MalwareType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
Parser (Text -> Malware) -> Parser Text -> Parser Malware
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Name")
)
instance Prelude.Hashable Malware
instance Prelude.NFData Malware
instance Core.ToJSON Malware where
toJSON :: Malware -> Value
toJSON Malware' {Maybe Text
Maybe MalwareState
Maybe MalwareType
Text
name :: Text
type' :: Maybe MalwareType
path :: Maybe Text
state :: Maybe MalwareState
$sel:name:Malware' :: Malware -> Text
$sel:type':Malware' :: Malware -> Maybe MalwareType
$sel:path:Malware' :: Malware -> Maybe Text
$sel:state:Malware' :: Malware -> Maybe MalwareState
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"State" Text -> MalwareState -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (MalwareState -> Pair) -> Maybe MalwareState -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MalwareState
state,
(Text
"Path" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
path,
(Text
"Type" Text -> MalwareType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (MalwareType -> Pair) -> Maybe MalwareType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MalwareType
type',
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
]
)