module Network.Google.CloudTrace.Types.Product where
import Network.Google.CloudTrace.Types.Sum
import Network.Google.Prelude
data Empty =
Empty'
deriving (Eq,Show,Data,Typeable,Generic)
empty
:: Empty
empty = Empty'
instance FromJSON Empty where
parseJSON = withObject "Empty" (\ o -> pure Empty')
instance ToJSON Empty where
toJSON = const emptyObject
newtype TraceSpanLabels = TraceSpanLabels'
{ _tslAddtional :: HashMap Text Text
} deriving (Eq,Show,Data,Typeable,Generic)
traceSpanLabels
:: HashMap Text Text
-> TraceSpanLabels
traceSpanLabels pTslAddtional_ =
TraceSpanLabels'
{ _tslAddtional = _Coerce # pTslAddtional_
}
tslAddtional :: Lens' TraceSpanLabels (HashMap Text Text)
tslAddtional
= lens _tslAddtional (\ s a -> s{_tslAddtional = a})
. _Coerce
instance FromJSON TraceSpanLabels where
parseJSON
= withObject "TraceSpanLabels"
(\ o -> TraceSpanLabels' <$> (parseJSONObject o))
instance ToJSON TraceSpanLabels where
toJSON = toJSON . _tslAddtional
newtype Traces = Traces'
{ _tTraces :: Maybe [Trace]
} deriving (Eq,Show,Data,Typeable,Generic)
traces
:: Traces
traces =
Traces'
{ _tTraces = Nothing
}
tTraces :: Lens' Traces [Trace]
tTraces
= lens _tTraces (\ s a -> s{_tTraces = a}) . _Default
. _Coerce
instance FromJSON Traces where
parseJSON
= withObject "Traces"
(\ o -> Traces' <$> (o .:? "traces" .!= mempty))
instance ToJSON Traces where
toJSON Traces'{..}
= object (catMaybes [("traces" .=) <$> _tTraces])
data TraceSpan = TraceSpan'
{ _tsStartTime :: !(Maybe Text)
, _tsKind :: !(Maybe Text)
, _tsName :: !(Maybe Text)
, _tsEndTime :: !(Maybe Text)
, _tsLabels :: !(Maybe TraceSpanLabels)
, _tsParentSpanId :: !(Maybe (Textual Word64))
, _tsSpanId :: !(Maybe (Textual Word64))
} deriving (Eq,Show,Data,Typeable,Generic)
traceSpan
:: TraceSpan
traceSpan =
TraceSpan'
{ _tsStartTime = Nothing
, _tsKind = Nothing
, _tsName = Nothing
, _tsEndTime = Nothing
, _tsLabels = Nothing
, _tsParentSpanId = Nothing
, _tsSpanId = Nothing
}
tsStartTime :: Lens' TraceSpan (Maybe Text)
tsStartTime
= lens _tsStartTime (\ s a -> s{_tsStartTime = a})
tsKind :: Lens' TraceSpan (Maybe Text)
tsKind = lens _tsKind (\ s a -> s{_tsKind = a})
tsName :: Lens' TraceSpan (Maybe Text)
tsName = lens _tsName (\ s a -> s{_tsName = a})
tsEndTime :: Lens' TraceSpan (Maybe Text)
tsEndTime
= lens _tsEndTime (\ s a -> s{_tsEndTime = a})
tsLabels :: Lens' TraceSpan (Maybe TraceSpanLabels)
tsLabels = lens _tsLabels (\ s a -> s{_tsLabels = a})
tsParentSpanId :: Lens' TraceSpan (Maybe Word64)
tsParentSpanId
= lens _tsParentSpanId
(\ s a -> s{_tsParentSpanId = a})
. mapping _Coerce
tsSpanId :: Lens' TraceSpan (Maybe Word64)
tsSpanId
= lens _tsSpanId (\ s a -> s{_tsSpanId = a}) .
mapping _Coerce
instance FromJSON TraceSpan where
parseJSON
= withObject "TraceSpan"
(\ o ->
TraceSpan' <$>
(o .:? "startTime") <*> (o .:? "kind") <*>
(o .:? "name")
<*> (o .:? "endTime")
<*> (o .:? "labels")
<*> (o .:? "parentSpanId")
<*> (o .:? "spanId"))
instance ToJSON TraceSpan where
toJSON TraceSpan'{..}
= object
(catMaybes
[("startTime" .=) <$> _tsStartTime,
("kind" .=) <$> _tsKind, ("name" .=) <$> _tsName,
("endTime" .=) <$> _tsEndTime,
("labels" .=) <$> _tsLabels,
("parentSpanId" .=) <$> _tsParentSpanId,
("spanId" .=) <$> _tsSpanId])
data ListTracesResponse = ListTracesResponse'
{ _ltrNextPageToken :: !(Maybe Text)
, _ltrTraces :: !(Maybe [Trace])
} deriving (Eq,Show,Data,Typeable,Generic)
listTracesResponse
:: ListTracesResponse
listTracesResponse =
ListTracesResponse'
{ _ltrNextPageToken = Nothing
, _ltrTraces = Nothing
}
ltrNextPageToken :: Lens' ListTracesResponse (Maybe Text)
ltrNextPageToken
= lens _ltrNextPageToken
(\ s a -> s{_ltrNextPageToken = a})
ltrTraces :: Lens' ListTracesResponse [Trace]
ltrTraces
= lens _ltrTraces (\ s a -> s{_ltrTraces = a}) .
_Default
. _Coerce
instance FromJSON ListTracesResponse where
parseJSON
= withObject "ListTracesResponse"
(\ o ->
ListTracesResponse' <$>
(o .:? "nextPageToken") <*>
(o .:? "traces" .!= mempty))
instance ToJSON ListTracesResponse where
toJSON ListTracesResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _ltrNextPageToken,
("traces" .=) <$> _ltrTraces])
data Trace = Trace'
{ _tTraceId :: !(Maybe Text)
, _tSpans :: !(Maybe [TraceSpan])
, _tProjectId :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
trace
:: Trace
trace =
Trace'
{ _tTraceId = Nothing
, _tSpans = Nothing
, _tProjectId = Nothing
}
tTraceId :: Lens' Trace (Maybe Text)
tTraceId = lens _tTraceId (\ s a -> s{_tTraceId = a})
tSpans :: Lens' Trace [TraceSpan]
tSpans
= lens _tSpans (\ s a -> s{_tSpans = a}) . _Default .
_Coerce
tProjectId :: Lens' Trace (Maybe Text)
tProjectId
= lens _tProjectId (\ s a -> s{_tProjectId = a})
instance FromJSON Trace where
parseJSON
= withObject "Trace"
(\ o ->
Trace' <$>
(o .:? "traceId") <*> (o .:? "spans" .!= mempty) <*>
(o .:? "projectId"))
instance ToJSON Trace where
toJSON Trace'{..}
= object
(catMaybes
[("traceId" .=) <$> _tTraceId,
("spans" .=) <$> _tSpans,
("projectId" .=) <$> _tProjectId])