{-# LANGUAGE OverloadedStrings #-}
module Network.AWS.XRay.Types
(
xRay
, _InvalidRequestException
, _ThrottledException
, EncryptionStatus (..)
, EncryptionType (..)
, Alias
, alias
, aNames
, aName
, aType
, AnnotationValue
, annotationValue
, avNumberValue
, avStringValue
, avBooleanValue
, BackendConnectionErrors
, backendConnectionErrors
, bceOtherCount
, bceTimeoutCount
, bceHTTPCode5XXCount
, bceConnectionRefusedCount
, bceHTTPCode4XXCount
, bceUnknownHostCount
, Edge
, edge
, eStartTime
, eAliases
, eResponseTimeHistogram
, eReferenceId
, eEndTime
, eSummaryStatistics
, EdgeStatistics
, edgeStatistics
, esFaultStatistics
, esOKCount
, esTotalResponseTime
, esErrorStatistics
, esTotalCount
, EncryptionConfig
, encryptionConfig
, ecStatus
, ecKeyId
, ecType
, ErrorStatistics
, errorStatistics
, eOtherCount
, eThrottleCount
, eTotalCount
, FaultStatistics
, faultStatistics
, fsOtherCount
, fsTotalCount
, HTTP
, hTTP
, httpHTTPMethod
, httpHTTPStatus
, httpClientIP
, httpUserAgent
, httpHTTPURL
, HistogramEntry
, histogramEntry
, heCount
, heValue
, Segment
, segment
, sDocument
, sId
, ServiceId
, serviceId
, siAccountId
, siNames
, siName
, siType
, ServiceInfo
, serviceInfo
, sState
, sStartTime
, sRoot
, sResponseTimeHistogram
, sDurationHistogram
, sReferenceId
, sAccountId
, sNames
, sName
, sEndTime
, sType
, sEdges
, sSummaryStatistics
, ServiceStatistics
, serviceStatistics
, ssFaultStatistics
, ssOKCount
, ssTotalResponseTime
, ssErrorStatistics
, ssTotalCount
, TelemetryRecord
, telemetryRecord
, trSegmentsReceivedCount
, trSegmentsSentCount
, trSegmentsSpilloverCount
, trSegmentsRejectedCount
, trBackendConnectionErrors
, trTimestamp
, Trace
, trace
, tId
, tSegments
, tDuration
, TraceSummary
, traceSummary
, tsAnnotations
, tsHasThrottle
, tsUsers
, tsHasFault
, tsServiceIds
, tsIsPartial
, tsHasError
, tsId
, tsHTTP
, tsDuration
, tsResponseTime
, TraceUser
, traceUser
, tuServiceIds
, tuUserName
, UnprocessedTraceSegment
, unprocessedTraceSegment
, utsErrorCode
, utsId
, utsMessage
, ValueWithServiceIds
, valueWithServiceIds
, vwsiServiceIds
, vwsiAnnotationValue
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Sign.V4
import Network.AWS.XRay.Types.Product
import Network.AWS.XRay.Types.Sum
xRay :: Service
xRay =
Service
{ _svcAbbrev = "XRay"
, _svcSigner = v4
, _svcPrefix = "xray"
, _svcVersion = "2016-04-12"
, _svcEndpoint = defaultEndpoint xRay
, _svcTimeout = Just 70
, _svcCheck = statusSuccess
, _svcError = parseJSONError "XRay"
, _svcRetry = retry
}
where
retry =
Exponential
{ _retryBase = 5.0e-2
, _retryGrowth = 2
, _retryAttempts = 5
, _retryCheck = check
}
check e
| has (hasCode "ThrottledException" . hasStatus 400) e =
Just "throttled_exception"
| has (hasStatus 429) e = Just "too_many_requests"
| has (hasCode "ThrottlingException" . hasStatus 400) e =
Just "throttling_exception"
| has (hasCode "Throttling" . hasStatus 400) e = Just "throttling"
| has (hasStatus 504) e = Just "gateway_timeout"
| has (hasCode "RequestThrottledException" . hasStatus 400) e =
Just "request_throttled_exception"
| has (hasStatus 502) e = Just "bad_gateway"
| has (hasStatus 503) e = Just "service_unavailable"
| has (hasStatus 500) e = Just "general_server_error"
| has (hasStatus 509) e = Just "limit_exceeded"
| otherwise = Nothing
_InvalidRequestException :: AsError a => Getting (First ServiceError) a ServiceError
_InvalidRequestException = _MatchServiceError xRay "InvalidRequestException"
_ThrottledException :: AsError a => Getting (First ServiceError) a ServiceError
_ThrottledException =
_MatchServiceError xRay "ThrottledException" . hasStatus 429