{-# LANGUAGE OverloadedStrings #-}
module Network.AWS.IoTData.Types
(
ioTData
, _InvalidRequestException
, _ConflictException
, _RequestEntityTooLargeException
, _ThrottlingException
, _MethodNotAllowedException
, _InternalFailureException
, _ServiceUnavailableException
, _UnauthorizedException
, _ResourceNotFoundException
, _UnsupportedDocumentEncodingException
) where
import Network.AWS.IoTData.Types.Product
import Network.AWS.IoTData.Types.Sum
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Sign.V4
ioTData :: Service
ioTData =
Service
{ _svcAbbrev = "IoTData"
, _svcSigner = v4
, _svcPrefix = "data.iot"
, _svcVersion = "2015-05-28"
, _svcEndpoint = defaultEndpoint ioTData
, _svcTimeout = Just 70
, _svcCheck = statusSuccess
, _svcError = parseJSONError "IoTData"
, _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 ioTData "InvalidRequestException" . hasStatus 400
_ConflictException :: AsError a => Getting (First ServiceError) a ServiceError
_ConflictException =
_MatchServiceError ioTData "ConflictException" . hasStatus 409
_RequestEntityTooLargeException :: AsError a => Getting (First ServiceError) a ServiceError
_RequestEntityTooLargeException =
_MatchServiceError ioTData "RequestEntityTooLargeException" . hasStatus 413
_ThrottlingException :: AsError a => Getting (First ServiceError) a ServiceError
_ThrottlingException =
_MatchServiceError ioTData "ThrottlingException" . hasStatus 429
_MethodNotAllowedException :: AsError a => Getting (First ServiceError) a ServiceError
_MethodNotAllowedException =
_MatchServiceError ioTData "MethodNotAllowedException" . hasStatus 405
_InternalFailureException :: AsError a => Getting (First ServiceError) a ServiceError
_InternalFailureException =
_MatchServiceError ioTData "InternalFailureException" . hasStatus 500
_ServiceUnavailableException :: AsError a => Getting (First ServiceError) a ServiceError
_ServiceUnavailableException =
_MatchServiceError ioTData "ServiceUnavailableException" . hasStatus 503
_UnauthorizedException :: AsError a => Getting (First ServiceError) a ServiceError
_UnauthorizedException =
_MatchServiceError ioTData "UnauthorizedException" . hasStatus 401
_ResourceNotFoundException :: AsError a => Getting (First ServiceError) a ServiceError
_ResourceNotFoundException =
_MatchServiceError ioTData "ResourceNotFoundException" . hasStatus 404
_UnsupportedDocumentEncodingException :: AsError a => Getting (First ServiceError) a ServiceError
_UnsupportedDocumentEncodingException =
_MatchServiceError ioTData "UnsupportedDocumentEncodingException" .
hasStatus 415