{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.Google.CloudErrorReporting.Types.Product where
import Network.Google.CloudErrorReporting.Types.Sum
import Network.Google.Prelude
data ErrorEvent =
ErrorEvent'
{ _eeContext :: !(Maybe ErrorContext)
, _eeEventTime :: !(Maybe DateTime')
, _eeServiceContext :: !(Maybe ServiceContext)
, _eeMessage :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
errorEvent
:: ErrorEvent
errorEvent =
ErrorEvent'
{ _eeContext = Nothing
, _eeEventTime = Nothing
, _eeServiceContext = Nothing
, _eeMessage = Nothing
}
eeContext :: Lens' ErrorEvent (Maybe ErrorContext)
eeContext
= lens _eeContext (\ s a -> s{_eeContext = a})
eeEventTime :: Lens' ErrorEvent (Maybe UTCTime)
eeEventTime
= lens _eeEventTime (\ s a -> s{_eeEventTime = a}) .
mapping _DateTime
eeServiceContext :: Lens' ErrorEvent (Maybe ServiceContext)
eeServiceContext
= lens _eeServiceContext
(\ s a -> s{_eeServiceContext = a})
eeMessage :: Lens' ErrorEvent (Maybe Text)
eeMessage
= lens _eeMessage (\ s a -> s{_eeMessage = a})
instance FromJSON ErrorEvent where
parseJSON
= withObject "ErrorEvent"
(\ o ->
ErrorEvent' <$>
(o .:? "context") <*> (o .:? "eventTime") <*>
(o .:? "serviceContext")
<*> (o .:? "message"))
instance ToJSON ErrorEvent where
toJSON ErrorEvent'{..}
= object
(catMaybes
[("context" .=) <$> _eeContext,
("eventTime" .=) <$> _eeEventTime,
("serviceContext" .=) <$> _eeServiceContext,
("message" .=) <$> _eeMessage])
data ErrorContext =
ErrorContext'
{ _ecHTTPRequest :: !(Maybe HTTPRequestContext)
, _ecUser :: !(Maybe Text)
, _ecSourceReferences :: !(Maybe [SourceReference])
, _ecReportLocation :: !(Maybe SourceLocation)
}
deriving (Eq, Show, Data, Typeable, Generic)
errorContext
:: ErrorContext
errorContext =
ErrorContext'
{ _ecHTTPRequest = Nothing
, _ecUser = Nothing
, _ecSourceReferences = Nothing
, _ecReportLocation = Nothing
}
ecHTTPRequest :: Lens' ErrorContext (Maybe HTTPRequestContext)
ecHTTPRequest
= lens _ecHTTPRequest
(\ s a -> s{_ecHTTPRequest = a})
ecUser :: Lens' ErrorContext (Maybe Text)
ecUser = lens _ecUser (\ s a -> s{_ecUser = a})
ecSourceReferences :: Lens' ErrorContext [SourceReference]
ecSourceReferences
= lens _ecSourceReferences
(\ s a -> s{_ecSourceReferences = a})
. _Default
. _Coerce
ecReportLocation :: Lens' ErrorContext (Maybe SourceLocation)
ecReportLocation
= lens _ecReportLocation
(\ s a -> s{_ecReportLocation = a})
instance FromJSON ErrorContext where
parseJSON
= withObject "ErrorContext"
(\ o ->
ErrorContext' <$>
(o .:? "httpRequest") <*> (o .:? "user") <*>
(o .:? "sourceReferences" .!= mempty)
<*> (o .:? "reportLocation"))
instance ToJSON ErrorContext where
toJSON ErrorContext'{..}
= object
(catMaybes
[("httpRequest" .=) <$> _ecHTTPRequest,
("user" .=) <$> _ecUser,
("sourceReferences" .=) <$> _ecSourceReferences,
("reportLocation" .=) <$> _ecReportLocation])
data ErrorGroup =
ErrorGroup'
{ _egTrackingIssues :: !(Maybe [TrackingIssue])
, _egName :: !(Maybe Text)
, _egGroupId :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
errorGroup
:: ErrorGroup
errorGroup =
ErrorGroup'
{_egTrackingIssues = Nothing, _egName = Nothing, _egGroupId = Nothing}
egTrackingIssues :: Lens' ErrorGroup [TrackingIssue]
egTrackingIssues
= lens _egTrackingIssues
(\ s a -> s{_egTrackingIssues = a})
. _Default
. _Coerce
egName :: Lens' ErrorGroup (Maybe Text)
egName = lens _egName (\ s a -> s{_egName = a})
egGroupId :: Lens' ErrorGroup (Maybe Text)
egGroupId
= lens _egGroupId (\ s a -> s{_egGroupId = a})
instance FromJSON ErrorGroup where
parseJSON
= withObject "ErrorGroup"
(\ o ->
ErrorGroup' <$>
(o .:? "trackingIssues" .!= mempty) <*>
(o .:? "name")
<*> (o .:? "groupId"))
instance ToJSON ErrorGroup where
toJSON ErrorGroup'{..}
= object
(catMaybes
[("trackingIssues" .=) <$> _egTrackingIssues,
("name" .=) <$> _egName,
("groupId" .=) <$> _egGroupId])
data DeleteEventsResponse =
DeleteEventsResponse'
deriving (Eq, Show, Data, Typeable, Generic)
deleteEventsResponse
:: DeleteEventsResponse
deleteEventsResponse = DeleteEventsResponse'
instance FromJSON DeleteEventsResponse where
parseJSON
= withObject "DeleteEventsResponse"
(\ o -> pure DeleteEventsResponse')
instance ToJSON DeleteEventsResponse where
toJSON = const emptyObject
data ReportedErrorEvent =
ReportedErrorEvent'
{ _reeContext :: !(Maybe ErrorContext)
, _reeEventTime :: !(Maybe DateTime')
, _reeServiceContext :: !(Maybe ServiceContext)
, _reeMessage :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
reportedErrorEvent
:: ReportedErrorEvent
reportedErrorEvent =
ReportedErrorEvent'
{ _reeContext = Nothing
, _reeEventTime = Nothing
, _reeServiceContext = Nothing
, _reeMessage = Nothing
}
reeContext :: Lens' ReportedErrorEvent (Maybe ErrorContext)
reeContext
= lens _reeContext (\ s a -> s{_reeContext = a})
reeEventTime :: Lens' ReportedErrorEvent (Maybe UTCTime)
reeEventTime
= lens _reeEventTime (\ s a -> s{_reeEventTime = a})
. mapping _DateTime
reeServiceContext :: Lens' ReportedErrorEvent (Maybe ServiceContext)
reeServiceContext
= lens _reeServiceContext
(\ s a -> s{_reeServiceContext = a})
reeMessage :: Lens' ReportedErrorEvent (Maybe Text)
reeMessage
= lens _reeMessage (\ s a -> s{_reeMessage = a})
instance FromJSON ReportedErrorEvent where
parseJSON
= withObject "ReportedErrorEvent"
(\ o ->
ReportedErrorEvent' <$>
(o .:? "context") <*> (o .:? "eventTime") <*>
(o .:? "serviceContext")
<*> (o .:? "message"))
instance ToJSON ReportedErrorEvent where
toJSON ReportedErrorEvent'{..}
= object
(catMaybes
[("context" .=) <$> _reeContext,
("eventTime" .=) <$> _reeEventTime,
("serviceContext" .=) <$> _reeServiceContext,
("message" .=) <$> _reeMessage])
data HTTPRequestContext =
HTTPRequestContext'
{ _httprcRemoteIP :: !(Maybe Text)
, _httprcURL :: !(Maybe Text)
, _httprcReferrer :: !(Maybe Text)
, _httprcMethod :: !(Maybe Text)
, _httprcResponseStatusCode :: !(Maybe (Textual Int32))
, _httprcUserAgent :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
hTTPRequestContext
:: HTTPRequestContext
hTTPRequestContext =
HTTPRequestContext'
{ _httprcRemoteIP = Nothing
, _httprcURL = Nothing
, _httprcReferrer = Nothing
, _httprcMethod = Nothing
, _httprcResponseStatusCode = Nothing
, _httprcUserAgent = Nothing
}
httprcRemoteIP :: Lens' HTTPRequestContext (Maybe Text)
httprcRemoteIP
= lens _httprcRemoteIP
(\ s a -> s{_httprcRemoteIP = a})
httprcURL :: Lens' HTTPRequestContext (Maybe Text)
httprcURL
= lens _httprcURL (\ s a -> s{_httprcURL = a})
httprcReferrer :: Lens' HTTPRequestContext (Maybe Text)
httprcReferrer
= lens _httprcReferrer
(\ s a -> s{_httprcReferrer = a})
httprcMethod :: Lens' HTTPRequestContext (Maybe Text)
httprcMethod
= lens _httprcMethod (\ s a -> s{_httprcMethod = a})
httprcResponseStatusCode :: Lens' HTTPRequestContext (Maybe Int32)
httprcResponseStatusCode
= lens _httprcResponseStatusCode
(\ s a -> s{_httprcResponseStatusCode = a})
. mapping _Coerce
httprcUserAgent :: Lens' HTTPRequestContext (Maybe Text)
httprcUserAgent
= lens _httprcUserAgent
(\ s a -> s{_httprcUserAgent = a})
instance FromJSON HTTPRequestContext where
parseJSON
= withObject "HTTPRequestContext"
(\ o ->
HTTPRequestContext' <$>
(o .:? "remoteIp") <*> (o .:? "url") <*>
(o .:? "referrer")
<*> (o .:? "method")
<*> (o .:? "responseStatusCode")
<*> (o .:? "userAgent"))
instance ToJSON HTTPRequestContext where
toJSON HTTPRequestContext'{..}
= object
(catMaybes
[("remoteIp" .=) <$> _httprcRemoteIP,
("url" .=) <$> _httprcURL,
("referrer" .=) <$> _httprcReferrer,
("method" .=) <$> _httprcMethod,
("responseStatusCode" .=) <$>
_httprcResponseStatusCode,
("userAgent" .=) <$> _httprcUserAgent])
newtype TrackingIssue =
TrackingIssue'
{ _tiURL :: Maybe Text
}
deriving (Eq, Show, Data, Typeable, Generic)
trackingIssue
:: TrackingIssue
trackingIssue = TrackingIssue' {_tiURL = Nothing}
tiURL :: Lens' TrackingIssue (Maybe Text)
tiURL = lens _tiURL (\ s a -> s{_tiURL = a})
instance FromJSON TrackingIssue where
parseJSON
= withObject "TrackingIssue"
(\ o -> TrackingIssue' <$> (o .:? "url"))
instance ToJSON TrackingIssue where
toJSON TrackingIssue'{..}
= object (catMaybes [("url" .=) <$> _tiURL])
data ListEventsResponse =
ListEventsResponse'
{ _lerNextPageToken :: !(Maybe Text)
, _lerTimeRangeBegin :: !(Maybe DateTime')
, _lerErrorEvents :: !(Maybe [ErrorEvent])
}
deriving (Eq, Show, Data, Typeable, Generic)
listEventsResponse
:: ListEventsResponse
listEventsResponse =
ListEventsResponse'
{ _lerNextPageToken = Nothing
, _lerTimeRangeBegin = Nothing
, _lerErrorEvents = Nothing
}
lerNextPageToken :: Lens' ListEventsResponse (Maybe Text)
lerNextPageToken
= lens _lerNextPageToken
(\ s a -> s{_lerNextPageToken = a})
lerTimeRangeBegin :: Lens' ListEventsResponse (Maybe UTCTime)
lerTimeRangeBegin
= lens _lerTimeRangeBegin
(\ s a -> s{_lerTimeRangeBegin = a})
. mapping _DateTime
lerErrorEvents :: Lens' ListEventsResponse [ErrorEvent]
lerErrorEvents
= lens _lerErrorEvents
(\ s a -> s{_lerErrorEvents = a})
. _Default
. _Coerce
instance FromJSON ListEventsResponse where
parseJSON
= withObject "ListEventsResponse"
(\ o ->
ListEventsResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "timeRangeBegin")
<*> (o .:? "errorEvents" .!= mempty))
instance ToJSON ListEventsResponse where
toJSON ListEventsResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _lerNextPageToken,
("timeRangeBegin" .=) <$> _lerTimeRangeBegin,
("errorEvents" .=) <$> _lerErrorEvents])
data ErrorGroupStats =
ErrorGroupStats'
{ _egsAffectedServices :: !(Maybe [ServiceContext])
, _egsGroup :: !(Maybe ErrorGroup)
, _egsFirstSeenTime :: !(Maybe DateTime')
, _egsAffectedUsersCount :: !(Maybe (Textual Int64))
, _egsCount :: !(Maybe (Textual Int64))
, _egsTimedCounts :: !(Maybe [TimedCount])
, _egsNumAffectedServices :: !(Maybe (Textual Int32))
, _egsLastSeenTime :: !(Maybe DateTime')
, _egsRepresentative :: !(Maybe ErrorEvent)
}
deriving (Eq, Show, Data, Typeable, Generic)
errorGroupStats
:: ErrorGroupStats
errorGroupStats =
ErrorGroupStats'
{ _egsAffectedServices = Nothing
, _egsGroup = Nothing
, _egsFirstSeenTime = Nothing
, _egsAffectedUsersCount = Nothing
, _egsCount = Nothing
, _egsTimedCounts = Nothing
, _egsNumAffectedServices = Nothing
, _egsLastSeenTime = Nothing
, _egsRepresentative = Nothing
}
egsAffectedServices :: Lens' ErrorGroupStats [ServiceContext]
egsAffectedServices
= lens _egsAffectedServices
(\ s a -> s{_egsAffectedServices = a})
. _Default
. _Coerce
egsGroup :: Lens' ErrorGroupStats (Maybe ErrorGroup)
egsGroup = lens _egsGroup (\ s a -> s{_egsGroup = a})
egsFirstSeenTime :: Lens' ErrorGroupStats (Maybe UTCTime)
egsFirstSeenTime
= lens _egsFirstSeenTime
(\ s a -> s{_egsFirstSeenTime = a})
. mapping _DateTime
egsAffectedUsersCount :: Lens' ErrorGroupStats (Maybe Int64)
egsAffectedUsersCount
= lens _egsAffectedUsersCount
(\ s a -> s{_egsAffectedUsersCount = a})
. mapping _Coerce
egsCount :: Lens' ErrorGroupStats (Maybe Int64)
egsCount
= lens _egsCount (\ s a -> s{_egsCount = a}) .
mapping _Coerce
egsTimedCounts :: Lens' ErrorGroupStats [TimedCount]
egsTimedCounts
= lens _egsTimedCounts
(\ s a -> s{_egsTimedCounts = a})
. _Default
. _Coerce
egsNumAffectedServices :: Lens' ErrorGroupStats (Maybe Int32)
egsNumAffectedServices
= lens _egsNumAffectedServices
(\ s a -> s{_egsNumAffectedServices = a})
. mapping _Coerce
egsLastSeenTime :: Lens' ErrorGroupStats (Maybe UTCTime)
egsLastSeenTime
= lens _egsLastSeenTime
(\ s a -> s{_egsLastSeenTime = a})
. mapping _DateTime
egsRepresentative :: Lens' ErrorGroupStats (Maybe ErrorEvent)
egsRepresentative
= lens _egsRepresentative
(\ s a -> s{_egsRepresentative = a})
instance FromJSON ErrorGroupStats where
parseJSON
= withObject "ErrorGroupStats"
(\ o ->
ErrorGroupStats' <$>
(o .:? "affectedServices" .!= mempty) <*>
(o .:? "group")
<*> (o .:? "firstSeenTime")
<*> (o .:? "affectedUsersCount")
<*> (o .:? "count")
<*> (o .:? "timedCounts" .!= mempty)
<*> (o .:? "numAffectedServices")
<*> (o .:? "lastSeenTime")
<*> (o .:? "representative"))
instance ToJSON ErrorGroupStats where
toJSON ErrorGroupStats'{..}
= object
(catMaybes
[("affectedServices" .=) <$> _egsAffectedServices,
("group" .=) <$> _egsGroup,
("firstSeenTime" .=) <$> _egsFirstSeenTime,
("affectedUsersCount" .=) <$> _egsAffectedUsersCount,
("count" .=) <$> _egsCount,
("timedCounts" .=) <$> _egsTimedCounts,
("numAffectedServices" .=) <$>
_egsNumAffectedServices,
("lastSeenTime" .=) <$> _egsLastSeenTime,
("representative" .=) <$> _egsRepresentative])
data ListGroupStatsResponse =
ListGroupStatsResponse'
{ _lgsrNextPageToken :: !(Maybe Text)
, _lgsrTimeRangeBegin :: !(Maybe DateTime')
, _lgsrErrorGroupStats :: !(Maybe [ErrorGroupStats])
}
deriving (Eq, Show, Data, Typeable, Generic)
listGroupStatsResponse
:: ListGroupStatsResponse
listGroupStatsResponse =
ListGroupStatsResponse'
{ _lgsrNextPageToken = Nothing
, _lgsrTimeRangeBegin = Nothing
, _lgsrErrorGroupStats = Nothing
}
lgsrNextPageToken :: Lens' ListGroupStatsResponse (Maybe Text)
lgsrNextPageToken
= lens _lgsrNextPageToken
(\ s a -> s{_lgsrNextPageToken = a})
lgsrTimeRangeBegin :: Lens' ListGroupStatsResponse (Maybe UTCTime)
lgsrTimeRangeBegin
= lens _lgsrTimeRangeBegin
(\ s a -> s{_lgsrTimeRangeBegin = a})
. mapping _DateTime
lgsrErrorGroupStats :: Lens' ListGroupStatsResponse [ErrorGroupStats]
lgsrErrorGroupStats
= lens _lgsrErrorGroupStats
(\ s a -> s{_lgsrErrorGroupStats = a})
. _Default
. _Coerce
instance FromJSON ListGroupStatsResponse where
parseJSON
= withObject "ListGroupStatsResponse"
(\ o ->
ListGroupStatsResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "timeRangeBegin")
<*> (o .:? "errorGroupStats" .!= mempty))
instance ToJSON ListGroupStatsResponse where
toJSON ListGroupStatsResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _lgsrNextPageToken,
("timeRangeBegin" .=) <$> _lgsrTimeRangeBegin,
("errorGroupStats" .=) <$> _lgsrErrorGroupStats])
data ServiceContext =
ServiceContext'
{ _scResourceType :: !(Maybe Text)
, _scService :: !(Maybe Text)
, _scVersion :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
serviceContext
:: ServiceContext
serviceContext =
ServiceContext'
{_scResourceType = Nothing, _scService = Nothing, _scVersion = Nothing}
scResourceType :: Lens' ServiceContext (Maybe Text)
scResourceType
= lens _scResourceType
(\ s a -> s{_scResourceType = a})
scService :: Lens' ServiceContext (Maybe Text)
scService
= lens _scService (\ s a -> s{_scService = a})
scVersion :: Lens' ServiceContext (Maybe Text)
scVersion
= lens _scVersion (\ s a -> s{_scVersion = a})
instance FromJSON ServiceContext where
parseJSON
= withObject "ServiceContext"
(\ o ->
ServiceContext' <$>
(o .:? "resourceType") <*> (o .:? "service") <*>
(o .:? "version"))
instance ToJSON ServiceContext where
toJSON ServiceContext'{..}
= object
(catMaybes
[("resourceType" .=) <$> _scResourceType,
("service" .=) <$> _scService,
("version" .=) <$> _scVersion])
data TimedCount =
TimedCount'
{ _tcStartTime :: !(Maybe DateTime')
, _tcCount :: !(Maybe (Textual Int64))
, _tcEndTime :: !(Maybe DateTime')
}
deriving (Eq, Show, Data, Typeable, Generic)
timedCount
:: TimedCount
timedCount =
TimedCount' {_tcStartTime = Nothing, _tcCount = Nothing, _tcEndTime = Nothing}
tcStartTime :: Lens' TimedCount (Maybe UTCTime)
tcStartTime
= lens _tcStartTime (\ s a -> s{_tcStartTime = a}) .
mapping _DateTime
tcCount :: Lens' TimedCount (Maybe Int64)
tcCount
= lens _tcCount (\ s a -> s{_tcCount = a}) .
mapping _Coerce
tcEndTime :: Lens' TimedCount (Maybe UTCTime)
tcEndTime
= lens _tcEndTime (\ s a -> s{_tcEndTime = a}) .
mapping _DateTime
instance FromJSON TimedCount where
parseJSON
= withObject "TimedCount"
(\ o ->
TimedCount' <$>
(o .:? "startTime") <*> (o .:? "count") <*>
(o .:? "endTime"))
instance ToJSON TimedCount where
toJSON TimedCount'{..}
= object
(catMaybes
[("startTime" .=) <$> _tcStartTime,
("count" .=) <$> _tcCount,
("endTime" .=) <$> _tcEndTime])
data SourceLocation =
SourceLocation'
{ _slLineNumber :: !(Maybe (Textual Int32))
, _slFilePath :: !(Maybe Text)
, _slFunctionName :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
sourceLocation
:: SourceLocation
sourceLocation =
SourceLocation'
{_slLineNumber = Nothing, _slFilePath = Nothing, _slFunctionName = Nothing}
slLineNumber :: Lens' SourceLocation (Maybe Int32)
slLineNumber
= lens _slLineNumber (\ s a -> s{_slLineNumber = a})
. mapping _Coerce
slFilePath :: Lens' SourceLocation (Maybe Text)
slFilePath
= lens _slFilePath (\ s a -> s{_slFilePath = a})
slFunctionName :: Lens' SourceLocation (Maybe Text)
slFunctionName
= lens _slFunctionName
(\ s a -> s{_slFunctionName = a})
instance FromJSON SourceLocation where
parseJSON
= withObject "SourceLocation"
(\ o ->
SourceLocation' <$>
(o .:? "lineNumber") <*> (o .:? "filePath") <*>
(o .:? "functionName"))
instance ToJSON SourceLocation where
toJSON SourceLocation'{..}
= object
(catMaybes
[("lineNumber" .=) <$> _slLineNumber,
("filePath" .=) <$> _slFilePath,
("functionName" .=) <$> _slFunctionName])
data SourceReference =
SourceReference'
{ _srRepository :: !(Maybe Text)
, _srRevisionId :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
sourceReference
:: SourceReference
sourceReference =
SourceReference' {_srRepository = Nothing, _srRevisionId = Nothing}
srRepository :: Lens' SourceReference (Maybe Text)
srRepository
= lens _srRepository (\ s a -> s{_srRepository = a})
srRevisionId :: Lens' SourceReference (Maybe Text)
srRevisionId
= lens _srRevisionId (\ s a -> s{_srRevisionId = a})
instance FromJSON SourceReference where
parseJSON
= withObject "SourceReference"
(\ o ->
SourceReference' <$>
(o .:? "repository") <*> (o .:? "revisionId"))
instance ToJSON SourceReference where
toJSON SourceReference'{..}
= object
(catMaybes
[("repository" .=) <$> _srRepository,
("revisionId" .=) <$> _srRevisionId])
data ReportErrorEventResponse =
ReportErrorEventResponse'
deriving (Eq, Show, Data, Typeable, Generic)
reportErrorEventResponse
:: ReportErrorEventResponse
reportErrorEventResponse = ReportErrorEventResponse'
instance FromJSON ReportErrorEventResponse where
parseJSON
= withObject "ReportErrorEventResponse"
(\ o -> pure ReportErrorEventResponse')
instance ToJSON ReportErrorEventResponse where
toJSON = const emptyObject