{-# LANGUAGE OverloadedStrings #-}
module Network.AWS.SageMakerRuntime.Types
(
sageMakerRuntime
, _ServiceUnavailable
, _ModelError
, _InternalFailure
, _ValidationError
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.SageMakerRuntime.Types.Product
import Network.AWS.SageMakerRuntime.Types.Sum
import Network.AWS.Sign.V4
sageMakerRuntime :: Service
sageMakerRuntime =
Service
{ _svcAbbrev = "SageMakerRuntime"
, _svcSigner = v4
, _svcPrefix = "runtime.sagemaker"
, _svcVersion = "2017-05-13"
, _svcEndpoint = defaultEndpoint sageMakerRuntime
, _svcTimeout = Just 70
, _svcCheck = statusSuccess
, _svcError = parseJSONError "SageMakerRuntime"
, _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
_ServiceUnavailable :: AsError a => Getting (First ServiceError) a ServiceError
_ServiceUnavailable =
_MatchServiceError sageMakerRuntime "ServiceUnavailable" . hasStatus 503
_ModelError :: AsError a => Getting (First ServiceError) a ServiceError
_ModelError = _MatchServiceError sageMakerRuntime "ModelError" . hasStatus 424
_InternalFailure :: AsError a => Getting (First ServiceError) a ServiceError
_InternalFailure =
_MatchServiceError sageMakerRuntime "InternalFailure" . hasStatus 500
_ValidationError :: AsError a => Getting (First ServiceError) a ServiceError
_ValidationError =
_MatchServiceError sageMakerRuntime "ValidationError" . hasStatus 400