{-# LANGUAGE OverloadedStrings #-}
module Network.AWS.SNS.Types
(
sns
, _EndpointDisabledException
, _AuthorizationErrorException
, _InvalidParameterException
, _SubscriptionLimitExceededException
, _PlatformApplicationDisabledException
, _InternalErrorException
, _ThrottledException
, _InvalidParameterValueException
, _NotFoundException
, _TopicLimitExceededException
, Endpoint
, endpoint
, eAttributes
, eEndpointARN
, MessageAttributeValue
, messageAttributeValue
, mavBinaryValue
, mavStringValue
, mavDataType
, PlatformApplication
, platformApplication
, paPlatformApplicationARN
, paAttributes
, Subscription
, subscription
, sProtocol
, sOwner
, sTopicARN
, sEndpoint
, sSubscriptionARN
, Topic
, topic
, tTopicARN
) where
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Sign.V4
import Network.AWS.SNS.Types.Product
import Network.AWS.SNS.Types.Sum
sns :: Service
sns =
Service
{ _svcAbbrev = "SNS"
, _svcSigner = v4
, _svcPrefix = "sns"
, _svcVersion = "2010-03-31"
, _svcEndpoint = defaultEndpoint sns
, _svcTimeout = Just 70
, _svcCheck = statusSuccess
, _svcError = parseXMLError "SNS"
, _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
_EndpointDisabledException :: AsError a => Getting (First ServiceError) a ServiceError
_EndpointDisabledException =
_MatchServiceError sns "EndpointDisabled" . hasStatus 400
_AuthorizationErrorException :: AsError a => Getting (First ServiceError) a ServiceError
_AuthorizationErrorException =
_MatchServiceError sns "AuthorizationError" . hasStatus 403
_InvalidParameterException :: AsError a => Getting (First ServiceError) a ServiceError
_InvalidParameterException =
_MatchServiceError sns "InvalidParameter" . hasStatus 400
_SubscriptionLimitExceededException :: AsError a => Getting (First ServiceError) a ServiceError
_SubscriptionLimitExceededException =
_MatchServiceError sns "SubscriptionLimitExceeded" . hasStatus 403
_PlatformApplicationDisabledException :: AsError a => Getting (First ServiceError) a ServiceError
_PlatformApplicationDisabledException =
_MatchServiceError sns "PlatformApplicationDisabled" . hasStatus 400
_InternalErrorException :: AsError a => Getting (First ServiceError) a ServiceError
_InternalErrorException = _MatchServiceError sns "InternalError" . hasStatus 500
_ThrottledException :: AsError a => Getting (First ServiceError) a ServiceError
_ThrottledException = _MatchServiceError sns "Throttled" . hasStatus 429
_InvalidParameterValueException :: AsError a => Getting (First ServiceError) a ServiceError
_InvalidParameterValueException =
_MatchServiceError sns "ParameterValueInvalid" . hasStatus 400
_NotFoundException :: AsError a => Getting (First ServiceError) a ServiceError
_NotFoundException = _MatchServiceError sns "NotFound" . hasStatus 404
_TopicLimitExceededException :: AsError a => Getting (First ServiceError) a ServiceError
_TopicLimitExceededException =
_MatchServiceError sns "TopicLimitExceeded" . hasStatus 403