{-# 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.CodeGuruReviewer.Types.RequestMetadata where
import Amazonka.CodeGuruReviewer.Types.EventInfo
import Amazonka.CodeGuruReviewer.Types.VendorName
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data RequestMetadata = RequestMetadata'
{
RequestMetadata -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
RequestMetadata -> Maybe EventInfo
eventInfo :: Prelude.Maybe EventInfo,
RequestMetadata -> Maybe VendorName
vendorName :: Prelude.Maybe VendorName,
RequestMetadata -> Maybe Text
requester :: Prelude.Maybe Prelude.Text
}
deriving (RequestMetadata -> RequestMetadata -> Bool
(RequestMetadata -> RequestMetadata -> Bool)
-> (RequestMetadata -> RequestMetadata -> Bool)
-> Eq RequestMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RequestMetadata -> RequestMetadata -> Bool
$c/= :: RequestMetadata -> RequestMetadata -> Bool
== :: RequestMetadata -> RequestMetadata -> Bool
$c== :: RequestMetadata -> RequestMetadata -> Bool
Prelude.Eq, ReadPrec [RequestMetadata]
ReadPrec RequestMetadata
Int -> ReadS RequestMetadata
ReadS [RequestMetadata]
(Int -> ReadS RequestMetadata)
-> ReadS [RequestMetadata]
-> ReadPrec RequestMetadata
-> ReadPrec [RequestMetadata]
-> Read RequestMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RequestMetadata]
$creadListPrec :: ReadPrec [RequestMetadata]
readPrec :: ReadPrec RequestMetadata
$creadPrec :: ReadPrec RequestMetadata
readList :: ReadS [RequestMetadata]
$creadList :: ReadS [RequestMetadata]
readsPrec :: Int -> ReadS RequestMetadata
$creadsPrec :: Int -> ReadS RequestMetadata
Prelude.Read, Int -> RequestMetadata -> ShowS
[RequestMetadata] -> ShowS
RequestMetadata -> String
(Int -> RequestMetadata -> ShowS)
-> (RequestMetadata -> String)
-> ([RequestMetadata] -> ShowS)
-> Show RequestMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RequestMetadata] -> ShowS
$cshowList :: [RequestMetadata] -> ShowS
show :: RequestMetadata -> String
$cshow :: RequestMetadata -> String
showsPrec :: Int -> RequestMetadata -> ShowS
$cshowsPrec :: Int -> RequestMetadata -> ShowS
Prelude.Show, (forall x. RequestMetadata -> Rep RequestMetadata x)
-> (forall x. Rep RequestMetadata x -> RequestMetadata)
-> Generic RequestMetadata
forall x. Rep RequestMetadata x -> RequestMetadata
forall x. RequestMetadata -> Rep RequestMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RequestMetadata x -> RequestMetadata
$cfrom :: forall x. RequestMetadata -> Rep RequestMetadata x
Prelude.Generic)
newRequestMetadata ::
RequestMetadata
newRequestMetadata :: RequestMetadata
newRequestMetadata =
RequestMetadata' :: Maybe Text
-> Maybe EventInfo
-> Maybe VendorName
-> Maybe Text
-> RequestMetadata
RequestMetadata'
{ $sel:requestId:RequestMetadata' :: Maybe Text
requestId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:eventInfo:RequestMetadata' :: Maybe EventInfo
eventInfo = Maybe EventInfo
forall a. Maybe a
Prelude.Nothing,
$sel:vendorName:RequestMetadata' :: Maybe VendorName
vendorName = Maybe VendorName
forall a. Maybe a
Prelude.Nothing,
$sel:requester:RequestMetadata' :: Maybe Text
requester = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
requestMetadata_requestId :: Lens.Lens' RequestMetadata (Prelude.Maybe Prelude.Text)
requestMetadata_requestId :: (Maybe Text -> f (Maybe Text))
-> RequestMetadata -> f RequestMetadata
requestMetadata_requestId = (RequestMetadata -> Maybe Text)
-> (RequestMetadata -> Maybe Text -> RequestMetadata)
-> Lens RequestMetadata RequestMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestMetadata' {Maybe Text
requestId :: Maybe Text
$sel:requestId:RequestMetadata' :: RequestMetadata -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: RequestMetadata
s@RequestMetadata' {} Maybe Text
a -> RequestMetadata
s {$sel:requestId:RequestMetadata' :: Maybe Text
requestId = Maybe Text
a} :: RequestMetadata)
requestMetadata_eventInfo :: Lens.Lens' RequestMetadata (Prelude.Maybe EventInfo)
requestMetadata_eventInfo :: (Maybe EventInfo -> f (Maybe EventInfo))
-> RequestMetadata -> f RequestMetadata
requestMetadata_eventInfo = (RequestMetadata -> Maybe EventInfo)
-> (RequestMetadata -> Maybe EventInfo -> RequestMetadata)
-> Lens
RequestMetadata RequestMetadata (Maybe EventInfo) (Maybe EventInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestMetadata' {Maybe EventInfo
eventInfo :: Maybe EventInfo
$sel:eventInfo:RequestMetadata' :: RequestMetadata -> Maybe EventInfo
eventInfo} -> Maybe EventInfo
eventInfo) (\s :: RequestMetadata
s@RequestMetadata' {} Maybe EventInfo
a -> RequestMetadata
s {$sel:eventInfo:RequestMetadata' :: Maybe EventInfo
eventInfo = Maybe EventInfo
a} :: RequestMetadata)
requestMetadata_vendorName :: Lens.Lens' RequestMetadata (Prelude.Maybe VendorName)
requestMetadata_vendorName :: (Maybe VendorName -> f (Maybe VendorName))
-> RequestMetadata -> f RequestMetadata
requestMetadata_vendorName = (RequestMetadata -> Maybe VendorName)
-> (RequestMetadata -> Maybe VendorName -> RequestMetadata)
-> Lens
RequestMetadata
RequestMetadata
(Maybe VendorName)
(Maybe VendorName)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestMetadata' {Maybe VendorName
vendorName :: Maybe VendorName
$sel:vendorName:RequestMetadata' :: RequestMetadata -> Maybe VendorName
vendorName} -> Maybe VendorName
vendorName) (\s :: RequestMetadata
s@RequestMetadata' {} Maybe VendorName
a -> RequestMetadata
s {$sel:vendorName:RequestMetadata' :: Maybe VendorName
vendorName = Maybe VendorName
a} :: RequestMetadata)
requestMetadata_requester :: Lens.Lens' RequestMetadata (Prelude.Maybe Prelude.Text)
requestMetadata_requester :: (Maybe Text -> f (Maybe Text))
-> RequestMetadata -> f RequestMetadata
requestMetadata_requester = (RequestMetadata -> Maybe Text)
-> (RequestMetadata -> Maybe Text -> RequestMetadata)
-> Lens RequestMetadata RequestMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RequestMetadata' {Maybe Text
requester :: Maybe Text
$sel:requester:RequestMetadata' :: RequestMetadata -> Maybe Text
requester} -> Maybe Text
requester) (\s :: RequestMetadata
s@RequestMetadata' {} Maybe Text
a -> RequestMetadata
s {$sel:requester:RequestMetadata' :: Maybe Text
requester = Maybe Text
a} :: RequestMetadata)
instance Core.FromJSON RequestMetadata where
parseJSON :: Value -> Parser RequestMetadata
parseJSON =
String
-> (Object -> Parser RequestMetadata)
-> Value
-> Parser RequestMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"RequestMetadata"
( \Object
x ->
Maybe Text
-> Maybe EventInfo
-> Maybe VendorName
-> Maybe Text
-> RequestMetadata
RequestMetadata'
(Maybe Text
-> Maybe EventInfo
-> Maybe VendorName
-> Maybe Text
-> RequestMetadata)
-> Parser (Maybe Text)
-> Parser
(Maybe EventInfo
-> Maybe VendorName -> Maybe Text -> RequestMetadata)
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
"RequestId")
Parser
(Maybe EventInfo
-> Maybe VendorName -> Maybe Text -> RequestMetadata)
-> Parser (Maybe EventInfo)
-> Parser (Maybe VendorName -> Maybe Text -> RequestMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EventInfo)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EventInfo")
Parser (Maybe VendorName -> Maybe Text -> RequestMetadata)
-> Parser (Maybe VendorName)
-> Parser (Maybe Text -> RequestMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe VendorName)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"VendorName")
Parser (Maybe Text -> RequestMetadata)
-> Parser (Maybe Text) -> Parser RequestMetadata
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
"Requester")
)
instance Prelude.Hashable RequestMetadata
instance Prelude.NFData RequestMetadata
instance Core.ToJSON RequestMetadata where
toJSON :: RequestMetadata -> Value
toJSON RequestMetadata' {Maybe Text
Maybe EventInfo
Maybe VendorName
requester :: Maybe Text
vendorName :: Maybe VendorName
eventInfo :: Maybe EventInfo
requestId :: Maybe Text
$sel:requester:RequestMetadata' :: RequestMetadata -> Maybe Text
$sel:vendorName:RequestMetadata' :: RequestMetadata -> Maybe VendorName
$sel:eventInfo:RequestMetadata' :: RequestMetadata -> Maybe EventInfo
$sel:requestId:RequestMetadata' :: RequestMetadata -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"RequestId" 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
requestId,
(Text
"EventInfo" Text -> EventInfo -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (EventInfo -> Pair) -> Maybe EventInfo -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EventInfo
eventInfo,
(Text
"VendorName" Text -> VendorName -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (VendorName -> Pair) -> Maybe VendorName -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VendorName
vendorName,
(Text
"Requester" 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
requester
]
)