{-# 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.Segment where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Segment = Segment'
{
Segment -> Maybe Text
document :: Prelude.Maybe Prelude.Text,
Segment -> Maybe Text
id :: Prelude.Maybe Prelude.Text
}
deriving (Segment -> Segment -> Bool
(Segment -> Segment -> Bool)
-> (Segment -> Segment -> Bool) -> Eq Segment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Segment -> Segment -> Bool
$c/= :: Segment -> Segment -> Bool
== :: Segment -> Segment -> Bool
$c== :: Segment -> Segment -> Bool
Prelude.Eq, ReadPrec [Segment]
ReadPrec Segment
Int -> ReadS Segment
ReadS [Segment]
(Int -> ReadS Segment)
-> ReadS [Segment]
-> ReadPrec Segment
-> ReadPrec [Segment]
-> Read Segment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Segment]
$creadListPrec :: ReadPrec [Segment]
readPrec :: ReadPrec Segment
$creadPrec :: ReadPrec Segment
readList :: ReadS [Segment]
$creadList :: ReadS [Segment]
readsPrec :: Int -> ReadS Segment
$creadsPrec :: Int -> ReadS Segment
Prelude.Read, Int -> Segment -> ShowS
[Segment] -> ShowS
Segment -> String
(Int -> Segment -> ShowS)
-> (Segment -> String) -> ([Segment] -> ShowS) -> Show Segment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Segment] -> ShowS
$cshowList :: [Segment] -> ShowS
show :: Segment -> String
$cshow :: Segment -> String
showsPrec :: Int -> Segment -> ShowS
$cshowsPrec :: Int -> Segment -> ShowS
Prelude.Show, (forall x. Segment -> Rep Segment x)
-> (forall x. Rep Segment x -> Segment) -> Generic Segment
forall x. Rep Segment x -> Segment
forall x. Segment -> Rep Segment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Segment x -> Segment
$cfrom :: forall x. Segment -> Rep Segment x
Prelude.Generic)
newSegment ::
Segment
newSegment :: Segment
newSegment =
Segment' :: Maybe Text -> Maybe Text -> Segment
Segment'
{ $sel:document:Segment' :: Maybe Text
document = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:id:Segment' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
segment_document :: Lens.Lens' Segment (Prelude.Maybe Prelude.Text)
segment_document :: (Maybe Text -> f (Maybe Text)) -> Segment -> f Segment
segment_document = (Segment -> Maybe Text)
-> (Segment -> Maybe Text -> Segment)
-> Lens Segment Segment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Segment' {Maybe Text
document :: Maybe Text
$sel:document:Segment' :: Segment -> Maybe Text
document} -> Maybe Text
document) (\s :: Segment
s@Segment' {} Maybe Text
a -> Segment
s {$sel:document:Segment' :: Maybe Text
document = Maybe Text
a} :: Segment)
segment_id :: Lens.Lens' Segment (Prelude.Maybe Prelude.Text)
segment_id :: (Maybe Text -> f (Maybe Text)) -> Segment -> f Segment
segment_id = (Segment -> Maybe Text)
-> (Segment -> Maybe Text -> Segment)
-> Lens Segment Segment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Segment' {Maybe Text
id :: Maybe Text
$sel:id:Segment' :: Segment -> Maybe Text
id} -> Maybe Text
id) (\s :: Segment
s@Segment' {} Maybe Text
a -> Segment
s {$sel:id:Segment' :: Maybe Text
id = Maybe Text
a} :: Segment)
instance Core.FromJSON Segment where
parseJSON :: Value -> Parser Segment
parseJSON =
String -> (Object -> Parser Segment) -> Value -> Parser Segment
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Segment"
( \Object
x ->
Maybe Text -> Maybe Text -> Segment
Segment'
(Maybe Text -> Maybe Text -> Segment)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Segment)
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
"Document")
Parser (Maybe Text -> Segment)
-> Parser (Maybe Text) -> Parser Segment
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
"Id")
)
instance Prelude.Hashable Segment
instance Prelude.NFData Segment