{-# 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.Record where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Record = Record'
{
Record -> Maybe Text
jsonPath :: Prelude.Maybe Prelude.Text,
Record -> Maybe Integer
recordIndex :: Prelude.Maybe Prelude.Integer
}
deriving (Record -> Record -> Bool
(Record -> Record -> Bool)
-> (Record -> Record -> Bool) -> Eq Record
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Record -> Record -> Bool
$c/= :: Record -> Record -> Bool
== :: Record -> Record -> Bool
$c== :: Record -> Record -> Bool
Prelude.Eq, ReadPrec [Record]
ReadPrec Record
Int -> ReadS Record
ReadS [Record]
(Int -> ReadS Record)
-> ReadS [Record]
-> ReadPrec Record
-> ReadPrec [Record]
-> Read Record
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Record]
$creadListPrec :: ReadPrec [Record]
readPrec :: ReadPrec Record
$creadPrec :: ReadPrec Record
readList :: ReadS [Record]
$creadList :: ReadS [Record]
readsPrec :: Int -> ReadS Record
$creadsPrec :: Int -> ReadS Record
Prelude.Read, Int -> Record -> ShowS
[Record] -> ShowS
Record -> String
(Int -> Record -> ShowS)
-> (Record -> String) -> ([Record] -> ShowS) -> Show Record
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Record] -> ShowS
$cshowList :: [Record] -> ShowS
show :: Record -> String
$cshow :: Record -> String
showsPrec :: Int -> Record -> ShowS
$cshowsPrec :: Int -> Record -> ShowS
Prelude.Show, (forall x. Record -> Rep Record x)
-> (forall x. Rep Record x -> Record) -> Generic Record
forall x. Rep Record x -> Record
forall x. Record -> Rep Record x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Record x -> Record
$cfrom :: forall x. Record -> Rep Record x
Prelude.Generic)
newRecord ::
Record
newRecord :: Record
newRecord =
Record' :: Maybe Text -> Maybe Integer -> Record
Record'
{ $sel:jsonPath:Record' :: Maybe Text
jsonPath = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:recordIndex:Record' :: Maybe Integer
recordIndex = Maybe Integer
forall a. Maybe a
Prelude.Nothing
}
record_jsonPath :: Lens.Lens' Record (Prelude.Maybe Prelude.Text)
record_jsonPath :: (Maybe Text -> f (Maybe Text)) -> Record -> f Record
record_jsonPath = (Record -> Maybe Text)
-> (Record -> Maybe Text -> Record)
-> Lens Record Record (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Record' {Maybe Text
jsonPath :: Maybe Text
$sel:jsonPath:Record' :: Record -> Maybe Text
jsonPath} -> Maybe Text
jsonPath) (\s :: Record
s@Record' {} Maybe Text
a -> Record
s {$sel:jsonPath:Record' :: Maybe Text
jsonPath = Maybe Text
a} :: Record)
record_recordIndex :: Lens.Lens' Record (Prelude.Maybe Prelude.Integer)
record_recordIndex :: (Maybe Integer -> f (Maybe Integer)) -> Record -> f Record
record_recordIndex = (Record -> Maybe Integer)
-> (Record -> Maybe Integer -> Record)
-> Lens Record Record (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Record' {Maybe Integer
recordIndex :: Maybe Integer
$sel:recordIndex:Record' :: Record -> Maybe Integer
recordIndex} -> Maybe Integer
recordIndex) (\s :: Record
s@Record' {} Maybe Integer
a -> Record
s {$sel:recordIndex:Record' :: Maybe Integer
recordIndex = Maybe Integer
a} :: Record)
instance Core.FromJSON Record where
parseJSON :: Value -> Parser Record
parseJSON =
String -> (Object -> Parser Record) -> Value -> Parser Record
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Record"
( \Object
x ->
Maybe Text -> Maybe Integer -> Record
Record'
(Maybe Text -> Maybe Integer -> Record)
-> Parser (Maybe Text) -> Parser (Maybe Integer -> Record)
forall (f :: * -> *) a b. Functor 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
"JsonPath")
Parser (Maybe Integer -> Record)
-> Parser (Maybe Integer) -> Parser Record
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RecordIndex")
)
instance Prelude.Hashable Record
instance Prelude.NFData Record
instance Core.ToJSON Record where
toJSON :: Record -> Value
toJSON Record' {Maybe Integer
Maybe Text
recordIndex :: Maybe Integer
jsonPath :: Maybe Text
$sel:recordIndex:Record' :: Record -> Maybe Integer
$sel:jsonPath:Record' :: Record -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"JsonPath" 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
jsonPath,
(Text
"RecordIndex" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
recordIndex
]
)