{-# 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.ServiceControl.Types.Product where
import Network.Google.Prelude
import Network.Google.ServiceControl.Types.Sum
data Status = Status'
{ _sDetails :: !(Maybe [StatusDetailsItem])
, _sCode :: !(Maybe (Textual Int32))
, _sMessage :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
status
:: Status
status =
Status'
{ _sDetails = Nothing
, _sCode = Nothing
, _sMessage = Nothing
}
sDetails :: Lens' Status [StatusDetailsItem]
sDetails
= lens _sDetails (\ s a -> s{_sDetails = a}) .
_Default
. _Coerce
sCode :: Lens' Status (Maybe Int32)
sCode
= lens _sCode (\ s a -> s{_sCode = a}) .
mapping _Coerce
sMessage :: Lens' Status (Maybe Text)
sMessage = lens _sMessage (\ s a -> s{_sMessage = a})
instance FromJSON Status where
parseJSON
= withObject "Status"
(\ o ->
Status' <$>
(o .:? "details" .!= mempty) <*> (o .:? "code") <*>
(o .:? "message"))
instance ToJSON Status where
toJSON Status'{..}
= object
(catMaybes
[("details" .=) <$> _sDetails,
("code" .=) <$> _sCode,
("message" .=) <$> _sMessage])
newtype ReportRequest = ReportRequest'
{ _rrOperations :: Maybe [Operation]
} deriving (Eq,Show,Data,Typeable,Generic)
reportRequest
:: ReportRequest
reportRequest =
ReportRequest'
{ _rrOperations = Nothing
}
rrOperations :: Lens' ReportRequest [Operation]
rrOperations
= lens _rrOperations (\ s a -> s{_rrOperations = a})
. _Default
. _Coerce
instance FromJSON ReportRequest where
parseJSON
= withObject "ReportRequest"
(\ o ->
ReportRequest' <$> (o .:? "operations" .!= mempty))
instance ToJSON ReportRequest where
toJSON ReportRequest'{..}
= object
(catMaybes [("operations" .=) <$> _rrOperations])
newtype CheckRequest = CheckRequest'
{ _crOperation :: Maybe Operation
} deriving (Eq,Show,Data,Typeable,Generic)
checkRequest
:: CheckRequest
checkRequest =
CheckRequest'
{ _crOperation = Nothing
}
crOperation :: Lens' CheckRequest (Maybe Operation)
crOperation
= lens _crOperation (\ s a -> s{_crOperation = a})
instance FromJSON CheckRequest where
parseJSON
= withObject "CheckRequest"
(\ o -> CheckRequest' <$> (o .:? "operation"))
instance ToJSON CheckRequest where
toJSON CheckRequest'{..}
= object
(catMaybes [("operation" .=) <$> _crOperation])
newtype MetricValueLabels = MetricValueLabels'
{ _mvlAddtional :: HashMap Text Text
} deriving (Eq,Show,Data,Typeable,Generic)
metricValueLabels
:: HashMap Text Text
-> MetricValueLabels
metricValueLabels pMvlAddtional_ =
MetricValueLabels'
{ _mvlAddtional = _Coerce # pMvlAddtional_
}
mvlAddtional :: Lens' MetricValueLabels (HashMap Text Text)
mvlAddtional
= lens _mvlAddtional (\ s a -> s{_mvlAddtional = a})
. _Coerce
instance FromJSON MetricValueLabels where
parseJSON
= withObject "MetricValueLabels"
(\ o -> MetricValueLabels' <$> (parseJSONObject o))
instance ToJSON MetricValueLabels where
toJSON = toJSON . _mvlAddtional
data Distribution = Distribution'
{ _dSumOfSquaredDeviation :: !(Maybe (Textual Double))
, _dMean :: !(Maybe (Textual Double))
, _dExponentialBuckets :: !(Maybe ExponentialBuckets)
, _dMaximum :: !(Maybe (Textual Double))
, _dLinearBuckets :: !(Maybe LinearBuckets)
, _dCount :: !(Maybe (Textual Int64))
, _dMinimum :: !(Maybe (Textual Double))
, _dBucketCounts :: !(Maybe [Textual Int64])
, _dExplicitBuckets :: !(Maybe ExplicitBuckets)
} deriving (Eq,Show,Data,Typeable,Generic)
distribution
:: Distribution
distribution =
Distribution'
{ _dSumOfSquaredDeviation = Nothing
, _dMean = Nothing
, _dExponentialBuckets = Nothing
, _dMaximum = Nothing
, _dLinearBuckets = Nothing
, _dCount = Nothing
, _dMinimum = Nothing
, _dBucketCounts = Nothing
, _dExplicitBuckets = Nothing
}
dSumOfSquaredDeviation :: Lens' Distribution (Maybe Double)
dSumOfSquaredDeviation
= lens _dSumOfSquaredDeviation
(\ s a -> s{_dSumOfSquaredDeviation = a})
. mapping _Coerce
dMean :: Lens' Distribution (Maybe Double)
dMean
= lens _dMean (\ s a -> s{_dMean = a}) .
mapping _Coerce
dExponentialBuckets :: Lens' Distribution (Maybe ExponentialBuckets)
dExponentialBuckets
= lens _dExponentialBuckets
(\ s a -> s{_dExponentialBuckets = a})
dMaximum :: Lens' Distribution (Maybe Double)
dMaximum
= lens _dMaximum (\ s a -> s{_dMaximum = a}) .
mapping _Coerce
dLinearBuckets :: Lens' Distribution (Maybe LinearBuckets)
dLinearBuckets
= lens _dLinearBuckets
(\ s a -> s{_dLinearBuckets = a})
dCount :: Lens' Distribution (Maybe Int64)
dCount
= lens _dCount (\ s a -> s{_dCount = a}) .
mapping _Coerce
dMinimum :: Lens' Distribution (Maybe Double)
dMinimum
= lens _dMinimum (\ s a -> s{_dMinimum = a}) .
mapping _Coerce
dBucketCounts :: Lens' Distribution [Int64]
dBucketCounts
= lens _dBucketCounts
(\ s a -> s{_dBucketCounts = a})
. _Default
. _Coerce
dExplicitBuckets :: Lens' Distribution (Maybe ExplicitBuckets)
dExplicitBuckets
= lens _dExplicitBuckets
(\ s a -> s{_dExplicitBuckets = a})
instance FromJSON Distribution where
parseJSON
= withObject "Distribution"
(\ o ->
Distribution' <$>
(o .:? "sumOfSquaredDeviation") <*> (o .:? "mean")
<*> (o .:? "exponentialBuckets")
<*> (o .:? "maximum")
<*> (o .:? "linearBuckets")
<*> (o .:? "count")
<*> (o .:? "minimum")
<*> (o .:? "bucketCounts" .!= mempty)
<*> (o .:? "explicitBuckets"))
instance ToJSON Distribution where
toJSON Distribution'{..}
= object
(catMaybes
[("sumOfSquaredDeviation" .=) <$>
_dSumOfSquaredDeviation,
("mean" .=) <$> _dMean,
("exponentialBuckets" .=) <$> _dExponentialBuckets,
("maximum" .=) <$> _dMaximum,
("linearBuckets" .=) <$> _dLinearBuckets,
("count" .=) <$> _dCount,
("minimum" .=) <$> _dMinimum,
("bucketCounts" .=) <$> _dBucketCounts,
("explicitBuckets" .=) <$> _dExplicitBuckets])
data ExponentialBuckets = ExponentialBuckets'
{ _ebGrowthFactor :: !(Maybe (Textual Double))
, _ebScale :: !(Maybe (Textual Double))
, _ebNumFiniteBuckets :: !(Maybe (Textual Int32))
} deriving (Eq,Show,Data,Typeable,Generic)
exponentialBuckets
:: ExponentialBuckets
exponentialBuckets =
ExponentialBuckets'
{ _ebGrowthFactor = Nothing
, _ebScale = Nothing
, _ebNumFiniteBuckets = Nothing
}
ebGrowthFactor :: Lens' ExponentialBuckets (Maybe Double)
ebGrowthFactor
= lens _ebGrowthFactor
(\ s a -> s{_ebGrowthFactor = a})
. mapping _Coerce
ebScale :: Lens' ExponentialBuckets (Maybe Double)
ebScale
= lens _ebScale (\ s a -> s{_ebScale = a}) .
mapping _Coerce
ebNumFiniteBuckets :: Lens' ExponentialBuckets (Maybe Int32)
ebNumFiniteBuckets
= lens _ebNumFiniteBuckets
(\ s a -> s{_ebNumFiniteBuckets = a})
. mapping _Coerce
instance FromJSON ExponentialBuckets where
parseJSON
= withObject "ExponentialBuckets"
(\ o ->
ExponentialBuckets' <$>
(o .:? "growthFactor") <*> (o .:? "scale") <*>
(o .:? "numFiniteBuckets"))
instance ToJSON ExponentialBuckets where
toJSON ExponentialBuckets'{..}
= object
(catMaybes
[("growthFactor" .=) <$> _ebGrowthFactor,
("scale" .=) <$> _ebScale,
("numFiniteBuckets" .=) <$> _ebNumFiniteBuckets])
data Operation = Operation'
{ _oImportance :: !(Maybe OperationImportance)
, _oStartTime :: !(Maybe DateTime')
, _oEndTime :: !(Maybe DateTime')
, _oOperationName :: !(Maybe Text)
, _oLabels :: !(Maybe OperationLabels)
, _oOperationId :: !(Maybe Text)
, _oConsumerId :: !(Maybe Text)
, _oMetricValueSets :: !(Maybe [MetricValueSet])
, _oLogEntries :: !(Maybe [LogEntry])
} deriving (Eq,Show,Data,Typeable,Generic)
operation
:: Operation
operation =
Operation'
{ _oImportance = Nothing
, _oStartTime = Nothing
, _oEndTime = Nothing
, _oOperationName = Nothing
, _oLabels = Nothing
, _oOperationId = Nothing
, _oConsumerId = Nothing
, _oMetricValueSets = Nothing
, _oLogEntries = Nothing
}
oImportance :: Lens' Operation (Maybe OperationImportance)
oImportance
= lens _oImportance (\ s a -> s{_oImportance = a})
oStartTime :: Lens' Operation (Maybe UTCTime)
oStartTime
= lens _oStartTime (\ s a -> s{_oStartTime = a}) .
mapping _DateTime
oEndTime :: Lens' Operation (Maybe UTCTime)
oEndTime
= lens _oEndTime (\ s a -> s{_oEndTime = a}) .
mapping _DateTime
oOperationName :: Lens' Operation (Maybe Text)
oOperationName
= lens _oOperationName
(\ s a -> s{_oOperationName = a})
oLabels :: Lens' Operation (Maybe OperationLabels)
oLabels = lens _oLabels (\ s a -> s{_oLabels = a})
oOperationId :: Lens' Operation (Maybe Text)
oOperationId
= lens _oOperationId (\ s a -> s{_oOperationId = a})
oConsumerId :: Lens' Operation (Maybe Text)
oConsumerId
= lens _oConsumerId (\ s a -> s{_oConsumerId = a})
oMetricValueSets :: Lens' Operation [MetricValueSet]
oMetricValueSets
= lens _oMetricValueSets
(\ s a -> s{_oMetricValueSets = a})
. _Default
. _Coerce
oLogEntries :: Lens' Operation [LogEntry]
oLogEntries
= lens _oLogEntries (\ s a -> s{_oLogEntries = a}) .
_Default
. _Coerce
instance FromJSON Operation where
parseJSON
= withObject "Operation"
(\ o ->
Operation' <$>
(o .:? "importance") <*> (o .:? "startTime") <*>
(o .:? "endTime")
<*> (o .:? "operationName")
<*> (o .:? "labels")
<*> (o .:? "operationId")
<*> (o .:? "consumerId")
<*> (o .:? "metricValueSets" .!= mempty)
<*> (o .:? "logEntries" .!= mempty))
instance ToJSON Operation where
toJSON Operation'{..}
= object
(catMaybes
[("importance" .=) <$> _oImportance,
("startTime" .=) <$> _oStartTime,
("endTime" .=) <$> _oEndTime,
("operationName" .=) <$> _oOperationName,
("labels" .=) <$> _oLabels,
("operationId" .=) <$> _oOperationId,
("consumerId" .=) <$> _oConsumerId,
("metricValueSets" .=) <$> _oMetricValueSets,
("logEntries" .=) <$> _oLogEntries])
data MetricValueSet = MetricValueSet'
{ _mvsMetricName :: !(Maybe Text)
, _mvsMetricValues :: !(Maybe [MetricValue])
} deriving (Eq,Show,Data,Typeable,Generic)
metricValueSet
:: MetricValueSet
metricValueSet =
MetricValueSet'
{ _mvsMetricName = Nothing
, _mvsMetricValues = Nothing
}
mvsMetricName :: Lens' MetricValueSet (Maybe Text)
mvsMetricName
= lens _mvsMetricName
(\ s a -> s{_mvsMetricName = a})
mvsMetricValues :: Lens' MetricValueSet [MetricValue]
mvsMetricValues
= lens _mvsMetricValues
(\ s a -> s{_mvsMetricValues = a})
. _Default
. _Coerce
instance FromJSON MetricValueSet where
parseJSON
= withObject "MetricValueSet"
(\ o ->
MetricValueSet' <$>
(o .:? "metricName") <*>
(o .:? "metricValues" .!= mempty))
instance ToJSON MetricValueSet where
toJSON MetricValueSet'{..}
= object
(catMaybes
[("metricName" .=) <$> _mvsMetricName,
("metricValues" .=) <$> _mvsMetricValues])
newtype LogEntryLabels = LogEntryLabels'
{ _lelAddtional :: HashMap Text Text
} deriving (Eq,Show,Data,Typeable,Generic)
logEntryLabels
:: HashMap Text Text
-> LogEntryLabels
logEntryLabels pLelAddtional_ =
LogEntryLabels'
{ _lelAddtional = _Coerce # pLelAddtional_
}
lelAddtional :: Lens' LogEntryLabels (HashMap Text Text)
lelAddtional
= lens _lelAddtional (\ s a -> s{_lelAddtional = a})
. _Coerce
instance FromJSON LogEntryLabels where
parseJSON
= withObject "LogEntryLabels"
(\ o -> LogEntryLabels' <$> (parseJSONObject o))
instance ToJSON LogEntryLabels where
toJSON = toJSON . _lelAddtional
newtype LogEntryProtoPayload = LogEntryProtoPayload'
{ _leppAddtional :: HashMap Text JSONValue
} deriving (Eq,Show,Data,Typeable,Generic)
logEntryProtoPayload
:: HashMap Text JSONValue
-> LogEntryProtoPayload
logEntryProtoPayload pLeppAddtional_ =
LogEntryProtoPayload'
{ _leppAddtional = _Coerce # pLeppAddtional_
}
leppAddtional :: Lens' LogEntryProtoPayload (HashMap Text JSONValue)
leppAddtional
= lens _leppAddtional
(\ s a -> s{_leppAddtional = a})
. _Coerce
instance FromJSON LogEntryProtoPayload where
parseJSON
= withObject "LogEntryProtoPayload"
(\ o ->
LogEntryProtoPayload' <$> (parseJSONObject o))
instance ToJSON LogEntryProtoPayload where
toJSON = toJSON . _leppAddtional
data LinearBuckets = LinearBuckets'
{ _lbOffSet :: !(Maybe (Textual Double))
, _lbWidth :: !(Maybe (Textual Double))
, _lbNumFiniteBuckets :: !(Maybe (Textual Int32))
} deriving (Eq,Show,Data,Typeable,Generic)
linearBuckets
:: LinearBuckets
linearBuckets =
LinearBuckets'
{ _lbOffSet = Nothing
, _lbWidth = Nothing
, _lbNumFiniteBuckets = Nothing
}
lbOffSet :: Lens' LinearBuckets (Maybe Double)
lbOffSet
= lens _lbOffSet (\ s a -> s{_lbOffSet = a}) .
mapping _Coerce
lbWidth :: Lens' LinearBuckets (Maybe Double)
lbWidth
= lens _lbWidth (\ s a -> s{_lbWidth = a}) .
mapping _Coerce
lbNumFiniteBuckets :: Lens' LinearBuckets (Maybe Int32)
lbNumFiniteBuckets
= lens _lbNumFiniteBuckets
(\ s a -> s{_lbNumFiniteBuckets = a})
. mapping _Coerce
instance FromJSON LinearBuckets where
parseJSON
= withObject "LinearBuckets"
(\ o ->
LinearBuckets' <$>
(o .:? "offset") <*> (o .:? "width") <*>
(o .:? "numFiniteBuckets"))
instance ToJSON LinearBuckets where
toJSON LinearBuckets'{..}
= object
(catMaybes
[("offset" .=) <$> _lbOffSet,
("width" .=) <$> _lbWidth,
("numFiniteBuckets" .=) <$> _lbNumFiniteBuckets])
newtype StatusDetailsItem = StatusDetailsItem'
{ _sdiAddtional :: HashMap Text JSONValue
} deriving (Eq,Show,Data,Typeable,Generic)
statusDetailsItem
:: HashMap Text JSONValue
-> StatusDetailsItem
statusDetailsItem pSdiAddtional_ =
StatusDetailsItem'
{ _sdiAddtional = _Coerce # pSdiAddtional_
}
sdiAddtional :: Lens' StatusDetailsItem (HashMap Text JSONValue)
sdiAddtional
= lens _sdiAddtional (\ s a -> s{_sdiAddtional = a})
. _Coerce
instance FromJSON StatusDetailsItem where
parseJSON
= withObject "StatusDetailsItem"
(\ o -> StatusDetailsItem' <$> (parseJSONObject o))
instance ToJSON StatusDetailsItem where
toJSON = toJSON . _sdiAddtional
data CheckError = CheckError'
{ _ceCode :: !(Maybe CheckErrorCode)
, _ceDetail :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
checkError
:: CheckError
checkError =
CheckError'
{ _ceCode = Nothing
, _ceDetail = Nothing
}
ceCode :: Lens' CheckError (Maybe CheckErrorCode)
ceCode = lens _ceCode (\ s a -> s{_ceCode = a})
ceDetail :: Lens' CheckError (Maybe Text)
ceDetail = lens _ceDetail (\ s a -> s{_ceDetail = a})
instance FromJSON CheckError where
parseJSON
= withObject "CheckError"
(\ o ->
CheckError' <$> (o .:? "code") <*> (o .:? "detail"))
instance ToJSON CheckError where
toJSON CheckError'{..}
= object
(catMaybes
[("code" .=) <$> _ceCode,
("detail" .=) <$> _ceDetail])
data ReportError = ReportError'
{ _reStatus :: !(Maybe Status)
, _reOperationId :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
reportError
:: ReportError
reportError =
ReportError'
{ _reStatus = Nothing
, _reOperationId = Nothing
}
reStatus :: Lens' ReportError (Maybe Status)
reStatus = lens _reStatus (\ s a -> s{_reStatus = a})
reOperationId :: Lens' ReportError (Maybe Text)
reOperationId
= lens _reOperationId
(\ s a -> s{_reOperationId = a})
instance FromJSON ReportError where
parseJSON
= withObject "ReportError"
(\ o ->
ReportError' <$>
(o .:? "status") <*> (o .:? "operationId"))
instance ToJSON ReportError where
toJSON ReportError'{..}
= object
(catMaybes
[("status" .=) <$> _reStatus,
("operationId" .=) <$> _reOperationId])
data MetricValue = MetricValue'
{ _mvBoolValue :: !(Maybe Bool)
, _mvStartTime :: !(Maybe DateTime')
, _mvDoubleValue :: !(Maybe (Textual Double))
, _mvStringValue :: !(Maybe Text)
, _mvDistributionValue :: !(Maybe Distribution)
, _mvEndTime :: !(Maybe DateTime')
, _mvInt64Value :: !(Maybe (Textual Int64))
, _mvLabels :: !(Maybe MetricValueLabels)
} deriving (Eq,Show,Data,Typeable,Generic)
metricValue
:: MetricValue
metricValue =
MetricValue'
{ _mvBoolValue = Nothing
, _mvStartTime = Nothing
, _mvDoubleValue = Nothing
, _mvStringValue = Nothing
, _mvDistributionValue = Nothing
, _mvEndTime = Nothing
, _mvInt64Value = Nothing
, _mvLabels = Nothing
}
mvBoolValue :: Lens' MetricValue (Maybe Bool)
mvBoolValue
= lens _mvBoolValue (\ s a -> s{_mvBoolValue = a})
mvStartTime :: Lens' MetricValue (Maybe UTCTime)
mvStartTime
= lens _mvStartTime (\ s a -> s{_mvStartTime = a}) .
mapping _DateTime
mvDoubleValue :: Lens' MetricValue (Maybe Double)
mvDoubleValue
= lens _mvDoubleValue
(\ s a -> s{_mvDoubleValue = a})
. mapping _Coerce
mvStringValue :: Lens' MetricValue (Maybe Text)
mvStringValue
= lens _mvStringValue
(\ s a -> s{_mvStringValue = a})
mvDistributionValue :: Lens' MetricValue (Maybe Distribution)
mvDistributionValue
= lens _mvDistributionValue
(\ s a -> s{_mvDistributionValue = a})
mvEndTime :: Lens' MetricValue (Maybe UTCTime)
mvEndTime
= lens _mvEndTime (\ s a -> s{_mvEndTime = a}) .
mapping _DateTime
mvInt64Value :: Lens' MetricValue (Maybe Int64)
mvInt64Value
= lens _mvInt64Value (\ s a -> s{_mvInt64Value = a})
. mapping _Coerce
mvLabels :: Lens' MetricValue (Maybe MetricValueLabels)
mvLabels = lens _mvLabels (\ s a -> s{_mvLabels = a})
instance FromJSON MetricValue where
parseJSON
= withObject "MetricValue"
(\ o ->
MetricValue' <$>
(o .:? "boolValue") <*> (o .:? "startTime") <*>
(o .:? "doubleValue")
<*> (o .:? "stringValue")
<*> (o .:? "distributionValue")
<*> (o .:? "endTime")
<*> (o .:? "int64Value")
<*> (o .:? "labels"))
instance ToJSON MetricValue where
toJSON MetricValue'{..}
= object
(catMaybes
[("boolValue" .=) <$> _mvBoolValue,
("startTime" .=) <$> _mvStartTime,
("doubleValue" .=) <$> _mvDoubleValue,
("stringValue" .=) <$> _mvStringValue,
("distributionValue" .=) <$> _mvDistributionValue,
("endTime" .=) <$> _mvEndTime,
("int64Value" .=) <$> _mvInt64Value,
("labels" .=) <$> _mvLabels])
data CheckResponse = CheckResponse'
{ _crCheckErrors :: !(Maybe [CheckError])
, _crServiceConfigId :: !(Maybe Text)
, _crOperationId :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
checkResponse
:: CheckResponse
checkResponse =
CheckResponse'
{ _crCheckErrors = Nothing
, _crServiceConfigId = Nothing
, _crOperationId = Nothing
}
crCheckErrors :: Lens' CheckResponse [CheckError]
crCheckErrors
= lens _crCheckErrors
(\ s a -> s{_crCheckErrors = a})
. _Default
. _Coerce
crServiceConfigId :: Lens' CheckResponse (Maybe Text)
crServiceConfigId
= lens _crServiceConfigId
(\ s a -> s{_crServiceConfigId = a})
crOperationId :: Lens' CheckResponse (Maybe Text)
crOperationId
= lens _crOperationId
(\ s a -> s{_crOperationId = a})
instance FromJSON CheckResponse where
parseJSON
= withObject "CheckResponse"
(\ o ->
CheckResponse' <$>
(o .:? "checkErrors" .!= mempty) <*>
(o .:? "serviceConfigId")
<*> (o .:? "operationId"))
instance ToJSON CheckResponse where
toJSON CheckResponse'{..}
= object
(catMaybes
[("checkErrors" .=) <$> _crCheckErrors,
("serviceConfigId" .=) <$> _crServiceConfigId,
("operationId" .=) <$> _crOperationId])
data ReportResponse = ReportResponse'
{ _rrReportErrors :: !(Maybe [ReportError])
, _rrServiceConfigId :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
reportResponse
:: ReportResponse
reportResponse =
ReportResponse'
{ _rrReportErrors = Nothing
, _rrServiceConfigId = Nothing
}
rrReportErrors :: Lens' ReportResponse [ReportError]
rrReportErrors
= lens _rrReportErrors
(\ s a -> s{_rrReportErrors = a})
. _Default
. _Coerce
rrServiceConfigId :: Lens' ReportResponse (Maybe Text)
rrServiceConfigId
= lens _rrServiceConfigId
(\ s a -> s{_rrServiceConfigId = a})
instance FromJSON ReportResponse where
parseJSON
= withObject "ReportResponse"
(\ o ->
ReportResponse' <$>
(o .:? "reportErrors" .!= mempty) <*>
(o .:? "serviceConfigId"))
instance ToJSON ReportResponse where
toJSON ReportResponse'{..}
= object
(catMaybes
[("reportErrors" .=) <$> _rrReportErrors,
("serviceConfigId" .=) <$> _rrServiceConfigId])
data LogEntry = LogEntry'
{ _leSeverity :: !(Maybe LogEntrySeverity)
, _leTextPayload :: !(Maybe Text)
, _leStructPayload :: !(Maybe LogEntryStructPayload)
, _leName :: !(Maybe Text)
, _leInsertId :: !(Maybe Text)
, _leLabels :: !(Maybe LogEntryLabels)
, _leProtoPayload :: !(Maybe LogEntryProtoPayload)
, _leTimestamp :: !(Maybe DateTime')
} deriving (Eq,Show,Data,Typeable,Generic)
logEntry
:: LogEntry
logEntry =
LogEntry'
{ _leSeverity = Nothing
, _leTextPayload = Nothing
, _leStructPayload = Nothing
, _leName = Nothing
, _leInsertId = Nothing
, _leLabels = Nothing
, _leProtoPayload = Nothing
, _leTimestamp = Nothing
}
leSeverity :: Lens' LogEntry (Maybe LogEntrySeverity)
leSeverity
= lens _leSeverity (\ s a -> s{_leSeverity = a})
leTextPayload :: Lens' LogEntry (Maybe Text)
leTextPayload
= lens _leTextPayload
(\ s a -> s{_leTextPayload = a})
leStructPayload :: Lens' LogEntry (Maybe LogEntryStructPayload)
leStructPayload
= lens _leStructPayload
(\ s a -> s{_leStructPayload = a})
leName :: Lens' LogEntry (Maybe Text)
leName = lens _leName (\ s a -> s{_leName = a})
leInsertId :: Lens' LogEntry (Maybe Text)
leInsertId
= lens _leInsertId (\ s a -> s{_leInsertId = a})
leLabels :: Lens' LogEntry (Maybe LogEntryLabels)
leLabels = lens _leLabels (\ s a -> s{_leLabels = a})
leProtoPayload :: Lens' LogEntry (Maybe LogEntryProtoPayload)
leProtoPayload
= lens _leProtoPayload
(\ s a -> s{_leProtoPayload = a})
leTimestamp :: Lens' LogEntry (Maybe UTCTime)
leTimestamp
= lens _leTimestamp (\ s a -> s{_leTimestamp = a}) .
mapping _DateTime
instance FromJSON LogEntry where
parseJSON
= withObject "LogEntry"
(\ o ->
LogEntry' <$>
(o .:? "severity") <*> (o .:? "textPayload") <*>
(o .:? "structPayload")
<*> (o .:? "name")
<*> (o .:? "insertId")
<*> (o .:? "labels")
<*> (o .:? "protoPayload")
<*> (o .:? "timestamp"))
instance ToJSON LogEntry where
toJSON LogEntry'{..}
= object
(catMaybes
[("severity" .=) <$> _leSeverity,
("textPayload" .=) <$> _leTextPayload,
("structPayload" .=) <$> _leStructPayload,
("name" .=) <$> _leName,
("insertId" .=) <$> _leInsertId,
("labels" .=) <$> _leLabels,
("protoPayload" .=) <$> _leProtoPayload,
("timestamp" .=) <$> _leTimestamp])
newtype OperationLabels = OperationLabels'
{ _olAddtional :: HashMap Text Text
} deriving (Eq,Show,Data,Typeable,Generic)
operationLabels
:: HashMap Text Text
-> OperationLabels
operationLabels pOlAddtional_ =
OperationLabels'
{ _olAddtional = _Coerce # pOlAddtional_
}
olAddtional :: Lens' OperationLabels (HashMap Text Text)
olAddtional
= lens _olAddtional (\ s a -> s{_olAddtional = a}) .
_Coerce
instance FromJSON OperationLabels where
parseJSON
= withObject "OperationLabels"
(\ o -> OperationLabels' <$> (parseJSONObject o))
instance ToJSON OperationLabels where
toJSON = toJSON . _olAddtional
newtype ExplicitBuckets = ExplicitBuckets'
{ _ebBounds :: Maybe [Textual Double]
} deriving (Eq,Show,Data,Typeable,Generic)
explicitBuckets
:: ExplicitBuckets
explicitBuckets =
ExplicitBuckets'
{ _ebBounds = Nothing
}
ebBounds :: Lens' ExplicitBuckets [Double]
ebBounds
= lens _ebBounds (\ s a -> s{_ebBounds = a}) .
_Default
. _Coerce
instance FromJSON ExplicitBuckets where
parseJSON
= withObject "ExplicitBuckets"
(\ o ->
ExplicitBuckets' <$> (o .:? "bounds" .!= mempty))
instance ToJSON ExplicitBuckets where
toJSON ExplicitBuckets'{..}
= object (catMaybes [("bounds" .=) <$> _ebBounds])
newtype LogEntryStructPayload = LogEntryStructPayload'
{ _lespAddtional :: HashMap Text JSONValue
} deriving (Eq,Show,Data,Typeable,Generic)
logEntryStructPayload
:: HashMap Text JSONValue
-> LogEntryStructPayload
logEntryStructPayload pLespAddtional_ =
LogEntryStructPayload'
{ _lespAddtional = _Coerce # pLespAddtional_
}
lespAddtional :: Lens' LogEntryStructPayload (HashMap Text JSONValue)
lespAddtional
= lens _lespAddtional
(\ s a -> s{_lespAddtional = a})
. _Coerce
instance FromJSON LogEntryStructPayload where
parseJSON
= withObject "LogEntryStructPayload"
(\ o ->
LogEntryStructPayload' <$> (parseJSONObject o))
instance ToJSON LogEntryStructPayload where
toJSON = toJSON . _lespAddtional