{-# 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.XRay.Types.Http where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Http = Http'
{
Http -> Maybe Text
httpMethod :: Prelude.Maybe Prelude.Text,
Http -> Maybe Int
httpStatus :: Prelude.Maybe Prelude.Int,
Http -> Maybe Text
clientIp :: Prelude.Maybe Prelude.Text,
Http -> Maybe Text
userAgent :: Prelude.Maybe Prelude.Text,
Http -> Maybe Text
httpURL :: Prelude.Maybe Prelude.Text
}
deriving (Http -> Http -> Bool
(Http -> Http -> Bool) -> (Http -> Http -> Bool) -> Eq Http
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Http -> Http -> Bool
$c/= :: Http -> Http -> Bool
== :: Http -> Http -> Bool
$c== :: Http -> Http -> Bool
Prelude.Eq, ReadPrec [Http]
ReadPrec Http
Int -> ReadS Http
ReadS [Http]
(Int -> ReadS Http)
-> ReadS [Http] -> ReadPrec Http -> ReadPrec [Http] -> Read Http
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Http]
$creadListPrec :: ReadPrec [Http]
readPrec :: ReadPrec Http
$creadPrec :: ReadPrec Http
readList :: ReadS [Http]
$creadList :: ReadS [Http]
readsPrec :: Int -> ReadS Http
$creadsPrec :: Int -> ReadS Http
Prelude.Read, Int -> Http -> ShowS
[Http] -> ShowS
Http -> String
(Int -> Http -> ShowS)
-> (Http -> String) -> ([Http] -> ShowS) -> Show Http
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Http] -> ShowS
$cshowList :: [Http] -> ShowS
show :: Http -> String
$cshow :: Http -> String
showsPrec :: Int -> Http -> ShowS
$cshowsPrec :: Int -> Http -> ShowS
Prelude.Show, (forall x. Http -> Rep Http x)
-> (forall x. Rep Http x -> Http) -> Generic Http
forall x. Rep Http x -> Http
forall x. Http -> Rep Http x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Http x -> Http
$cfrom :: forall x. Http -> Rep Http x
Prelude.Generic)
newHttp ::
Http
newHttp :: Http
newHttp =
Http' :: Maybe Text
-> Maybe Int -> Maybe Text -> Maybe Text -> Maybe Text -> Http
Http'
{ $sel:httpMethod:Http' :: Maybe Text
httpMethod = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:Http' :: Maybe Int
httpStatus = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:clientIp:Http' :: Maybe Text
clientIp = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:userAgent:Http' :: Maybe Text
userAgent = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpURL:Http' :: Maybe Text
httpURL = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
http_httpMethod :: Lens.Lens' Http (Prelude.Maybe Prelude.Text)
http_httpMethod :: (Maybe Text -> f (Maybe Text)) -> Http -> f Http
http_httpMethod = (Http -> Maybe Text)
-> (Http -> Maybe Text -> Http)
-> Lens Http Http (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Http' {Maybe Text
httpMethod :: Maybe Text
$sel:httpMethod:Http' :: Http -> Maybe Text
httpMethod} -> Maybe Text
httpMethod) (\s :: Http
s@Http' {} Maybe Text
a -> Http
s {$sel:httpMethod:Http' :: Maybe Text
httpMethod = Maybe Text
a} :: Http)
http_httpStatus :: Lens.Lens' Http (Prelude.Maybe Prelude.Int)
http_httpStatus :: (Maybe Int -> f (Maybe Int)) -> Http -> f Http
http_httpStatus = (Http -> Maybe Int)
-> (Http -> Maybe Int -> Http)
-> Lens Http Http (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Http' {Maybe Int
httpStatus :: Maybe Int
$sel:httpStatus:Http' :: Http -> Maybe Int
httpStatus} -> Maybe Int
httpStatus) (\s :: Http
s@Http' {} Maybe Int
a -> Http
s {$sel:httpStatus:Http' :: Maybe Int
httpStatus = Maybe Int
a} :: Http)
http_clientIp :: Lens.Lens' Http (Prelude.Maybe Prelude.Text)
http_clientIp :: (Maybe Text -> f (Maybe Text)) -> Http -> f Http
http_clientIp = (Http -> Maybe Text)
-> (Http -> Maybe Text -> Http)
-> Lens Http Http (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Http' {Maybe Text
clientIp :: Maybe Text
$sel:clientIp:Http' :: Http -> Maybe Text
clientIp} -> Maybe Text
clientIp) (\s :: Http
s@Http' {} Maybe Text
a -> Http
s {$sel:clientIp:Http' :: Maybe Text
clientIp = Maybe Text
a} :: Http)
http_userAgent :: Lens.Lens' Http (Prelude.Maybe Prelude.Text)
http_userAgent :: (Maybe Text -> f (Maybe Text)) -> Http -> f Http
http_userAgent = (Http -> Maybe Text)
-> (Http -> Maybe Text -> Http)
-> Lens Http Http (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Http' {Maybe Text
userAgent :: Maybe Text
$sel:userAgent:Http' :: Http -> Maybe Text
userAgent} -> Maybe Text
userAgent) (\s :: Http
s@Http' {} Maybe Text
a -> Http
s {$sel:userAgent:Http' :: Maybe Text
userAgent = Maybe Text
a} :: Http)
http_httpURL :: Lens.Lens' Http (Prelude.Maybe Prelude.Text)
http_httpURL :: (Maybe Text -> f (Maybe Text)) -> Http -> f Http
http_httpURL = (Http -> Maybe Text)
-> (Http -> Maybe Text -> Http)
-> Lens Http Http (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Http' {Maybe Text
httpURL :: Maybe Text
$sel:httpURL:Http' :: Http -> Maybe Text
httpURL} -> Maybe Text
httpURL) (\s :: Http
s@Http' {} Maybe Text
a -> Http
s {$sel:httpURL:Http' :: Maybe Text
httpURL = Maybe Text
a} :: Http)
instance Core.FromJSON Http where
parseJSON :: Value -> Parser Http
parseJSON =
String -> (Object -> Parser Http) -> Value -> Parser Http
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Http"
( \Object
x ->
Maybe Text
-> Maybe Int -> Maybe Text -> Maybe Text -> Maybe Text -> Http
Http'
(Maybe Text
-> Maybe Int -> Maybe Text -> Maybe Text -> Maybe Text -> Http)
-> Parser (Maybe Text)
-> Parser
(Maybe Int -> Maybe Text -> Maybe Text -> Maybe Text -> Http)
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
"HttpMethod")
Parser
(Maybe Int -> Maybe Text -> Maybe Text -> Maybe Text -> Http)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> Http)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HttpStatus")
Parser (Maybe Text -> Maybe Text -> Maybe Text -> Http)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Maybe Text -> Http)
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
"ClientIp")
Parser (Maybe Text -> Maybe Text -> Http)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Http)
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
"UserAgent")
Parser (Maybe Text -> Http) -> Parser (Maybe Text) -> Parser Http
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
"HttpURL")
)
instance Prelude.Hashable Http
instance Prelude.NFData Http