/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new XmlUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("AuthorizationError")) { return(AuthorizationErrorExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EndpointDisabled")) { return(EndpointDisabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InternalError")) { return(InternalErrorExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameter")) { return(InvalidParameterExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ParameterValueInvalid")) { return(InvalidParameterValueExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSecurity")) { return(InvalidSecurityExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSAccessDenied")) { return(KMSAccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSDisabled")) { return(KMSDisabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSInvalidState")) { return(KMSInvalidStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSNotFound")) { return(KMSNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSOptInRequired")) { return(KMSOptInRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSThrottling")) { return(KMSThrottlingExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NotFound")) { return(NotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PlatformApplicationDisabled")) { return(PlatformApplicationDisabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonSimpleNotificationServiceException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("AccessDenied")) { return(new AccessDeniedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CNAMEAlreadyExists")) { return(new CNAMEAlreadyExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DistributionAlreadyExists")) { return(new DistributionAlreadyExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InconsistentQuantities")) { return(new InconsistentQuantitiesException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidArgument")) { return(new InvalidArgumentException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDefaultRootObject")) { return(new InvalidDefaultRootObjectException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidErrorCode")) { return(new InvalidErrorCodeException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidForwardCookies")) { return(new InvalidForwardCookiesException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidGeoRestrictionParameter")) { return(new InvalidGeoRestrictionParameterException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidHeadersForS3Origin")) { return(new InvalidHeadersForS3OriginException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidLambdaFunctionAssociation")) { return(new InvalidLambdaFunctionAssociationException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidLocationCode")) { return(new InvalidLocationCodeException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidMinimumProtocolVersion")) { return(new InvalidMinimumProtocolVersionException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidOriginAccessIdentity")) { return(new InvalidOriginAccessIdentityException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidOrigin")) { return(new InvalidOriginException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidOriginKeepaliveTimeout")) { return(new InvalidOriginKeepaliveTimeoutException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidOriginReadTimeout")) { return(new InvalidOriginReadTimeoutException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidProtocolSettings")) { return(new InvalidProtocolSettingsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidQueryStringParameters")) { return(new InvalidQueryStringParametersException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRelativePath")) { return(new InvalidRelativePathException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRequiredProtocol")) { return(new InvalidRequiredProtocolException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidResponseCode")) { return(new InvalidResponseCodeException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTagging")) { return(new InvalidTaggingException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTTLOrder")) { return(new InvalidTTLOrderException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidViewerCertificate")) { return(new InvalidViewerCertificateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidWebACLId")) { return(new InvalidWebACLIdException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MissingBody")) { return(new MissingBodyException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchOrigin")) { return(new NoSuchOriginException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyCacheBehaviors")) { return(new TooManyCacheBehaviorsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyCertificates")) { return(new TooManyCertificatesException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyCookieNamesInWhiteList")) { return(new TooManyCookieNamesInWhiteListException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributionCNAMEs")) { return(new TooManyDistributionCNAMEsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributions")) { return(new TooManyDistributionsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributionsWithLambdaAssociations")) { return(new TooManyDistributionsWithLambdaAssociationsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyHeadersInForwardedValues")) { return(new TooManyHeadersInForwardedValuesException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyLambdaFunctionAssociations")) { return(new TooManyLambdaFunctionAssociationsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyOriginCustomHeaders")) { return(new TooManyOriginCustomHeadersException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyOrigins")) { return(new TooManyOriginsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyQueryStringParameters")) { return(new TooManyQueryStringParametersException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyTrustedSigners")) { return(new TooManyTrustedSignersException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TrustedSignerDoesNotExist")) { return(new TrustedSignerDoesNotExistException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonCloudFrontException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("AuthorizationNotFound")) { return(new AuthorizationNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBClusterNotFoundFault")) { return(new DBClusterNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBInstanceAlreadyExists")) { return(new DBInstanceAlreadyExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBParameterGroupNotFound")) { return(new DBParameterGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBSecurityGroupNotFound")) { return(new DBSecurityGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBSubnetGroupDoesNotCoverEnoughAZs")) { return(new DBSubnetGroupDoesNotCoverEnoughAZsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBSubnetGroupNotFoundFault")) { return(new DBSubnetGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InstanceQuotaExceeded")) { return(new InstanceQuotaExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientDBInstanceCapacity")) { return(new InsufficientDBInstanceCapacityException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDBClusterStateFault")) { return(new InvalidDBClusterStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSubnet")) { return(new InvalidSubnetException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidVPCNetworkStateFault")) { return(new InvalidVPCNetworkStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSKeyNotAccessibleFault")) { return(new KMSKeyNotAccessibleException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("StorageQuotaExceeded")) { return(new StorageQuotaExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("StorageTypeNotSupported")) { return(new StorageTypeNotSupportedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonDocDBException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRestoreFault")) { return(new InvalidRestoreException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InstanceQuotaExceeded")) { return(new InstanceQuotaExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBSubnetGroupNotFoundFault")) { return(new DBSubnetGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBInstanceAlreadyExists")) { return(new DBInstanceAlreadyExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("StorageQuotaExceeded")) { return(new StorageQuotaExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidVPCNetworkStateFault")) { return(new InvalidVPCNetworkStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDBSnapshotState")) { return(new InvalidDBSnapshotStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientDBInstanceCapacity")) { return(new InsufficientDBInstanceCapacityException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBSubnetGroupDoesNotCoverEnoughAZs")) { return(new DBSubnetGroupDoesNotCoverEnoughAZsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSubnet")) { return(new InvalidSubnetException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("OptionGroupNotFoundFault")) { return(new OptionGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ProvisionedIopsNotAvailableInAZFault")) { return(new ProvisionedIopsNotAvailableInAZException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBSnapshotNotFound")) { return(new DBSnapshotNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonRDSException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("AuthorizationNotFound")) { return(new AuthorizationNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CertificateNotFound")) { return(new CertificateNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBInstanceAlreadyExists")) { return(new DBInstanceAlreadyExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBInstanceNotFound")) { return(new DBInstanceNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBParameterGroupNotFound")) { return(new DBParameterGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBSecurityGroupNotFound")) { return(new DBSecurityGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBUpgradeDependencyFailure")) { return(new DBUpgradeDependencyFailureException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientDBInstanceCapacity")) { return(new InsufficientDBInstanceCapacityException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDBInstanceState")) { return(new InvalidDBInstanceStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDBSecurityGroupState")) { return(new InvalidDBSecurityGroupStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidVPCNetworkStateFault")) { return(new InvalidVPCNetworkStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("OptionGroupNotFoundFault")) { return(new OptionGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ProvisionedIopsNotAvailableInAZFault")) { return(new ProvisionedIopsNotAvailableInAZException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("StorageQuotaExceeded")) { return(new StorageQuotaExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("StorageTypeNotSupported")) { return(new StorageTypeNotSupportedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonRDSException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("DBClusterAlreadyExistsFault")) { return(new DBClusterAlreadyExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBClusterNotFoundFault")) { return(new DBClusterNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBClusterParameterGroupNotFound")) { return(new DBClusterParameterGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBClusterQuotaExceededFault")) { return(new DBClusterQuotaExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBClusterSnapshotNotFoundFault")) { return(new DBClusterSnapshotNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBSubnetGroupNotFoundFault")) { return(new DBSubnetGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DomainNotFoundFault")) { return(new DomainNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientDBClusterCapacityFault")) { return(new InsufficientDBClusterCapacityException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientStorageClusterCapacity")) { return(new InsufficientStorageClusterCapacityException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDBClusterSnapshotStateFault")) { return(new InvalidDBClusterSnapshotStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDBClusterStateFault")) { return(new InvalidDBClusterStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDBSnapshotState")) { return(new InvalidDBSnapshotStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRestoreFault")) { return(new InvalidRestoreException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSubnet")) { return(new InvalidSubnetException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidVPCNetworkStateFault")) { return(new InvalidVPCNetworkStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSKeyNotAccessibleFault")) { return(new KMSKeyNotAccessibleException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("OptionGroupNotFoundFault")) { return(new OptionGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("StorageQuotaExceeded")) { return(new StorageQuotaExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonRDSException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new XmlUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("AccessDenied")) { return(AccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CNAMEAlreadyExists")) { return(CNAMEAlreadyExistsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InconsistentQuantities")) { return(InconsistentQuantitiesExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidArgument")) { return(InvalidArgumentExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidOriginAccessIdentity")) { return(InvalidOriginAccessIdentityExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidOrigin")) { return(InvalidOriginExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MissingBody")) { return(MissingBodyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("StreamingDistributionAlreadyExists")) { return(StreamingDistributionAlreadyExistsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyStreamingDistributionCNAMEs")) { return(TooManyStreamingDistributionCNAMEsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyStreamingDistributions")) { return(TooManyStreamingDistributionsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyTrustedSigners")) { return(TooManyTrustedSignersExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TrustedSignerDoesNotExist")) { return(TrustedSignerDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCloudFrontException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new XmlUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("AccessDenied")) { return(AccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CNAMEAlreadyExists")) { return(CNAMEAlreadyExistsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("IllegalFieldLevelEncryptionConfigAssociationWithCacheBehavior")) { return(IllegalFieldLevelEncryptionConfigAssociationWithCacheBehaviorExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("IllegalUpdate")) { return(IllegalUpdateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InconsistentQuantities")) { return(InconsistentQuantitiesExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidArgument")) { return(InvalidArgumentExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDefaultRootObject")) { return(InvalidDefaultRootObjectExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidErrorCode")) { return(InvalidErrorCodeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidForwardCookies")) { return(InvalidForwardCookiesExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidGeoRestrictionParameter")) { return(InvalidGeoRestrictionParameterExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidHeadersForS3Origin")) { return(InvalidHeadersForS3OriginExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidIfMatchVersion")) { return(InvalidIfMatchVersionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidLambdaFunctionAssociation")) { return(InvalidLambdaFunctionAssociationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidLocationCode")) { return(InvalidLocationCodeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidMinimumProtocolVersion")) { return(InvalidMinimumProtocolVersionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidOriginAccessIdentity")) { return(InvalidOriginAccessIdentityExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidOriginKeepaliveTimeout")) { return(InvalidOriginKeepaliveTimeoutExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidOriginReadTimeout")) { return(InvalidOriginReadTimeoutExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidQueryStringParameters")) { return(InvalidQueryStringParametersExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRelativePath")) { return(InvalidRelativePathExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRequiredProtocol")) { return(InvalidRequiredProtocolExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidResponseCode")) { return(InvalidResponseCodeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTTLOrder")) { return(InvalidTTLOrderExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidViewerCertificate")) { return(InvalidViewerCertificateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidWebACLId")) { return(InvalidWebACLIdExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MissingBody")) { return(MissingBodyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchCachePolicy")) { return(NoSuchCachePolicyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchDistribution")) { return(NoSuchDistributionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchFieldLevelEncryptionConfig")) { return(NoSuchFieldLevelEncryptionConfigExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchOrigin")) { return(NoSuchOriginExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchOriginRequestPolicy")) { return(NoSuchOriginRequestPolicyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PreconditionFailed")) { return(PreconditionFailedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyCacheBehaviors")) { return(TooManyCacheBehaviorsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyCertificates")) { return(TooManyCertificatesExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyCookieNamesInWhiteList")) { return(TooManyCookieNamesInWhiteListExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributionCNAMEs")) { return(TooManyDistributionCNAMEsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributionsAssociatedToCachePolicy")) { return(TooManyDistributionsAssociatedToCachePolicyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributionsAssociatedToFieldLevelEncryptionConfig")) { return(TooManyDistributionsAssociatedToFieldLevelEncryptionConfigExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributionsAssociatedToOriginRequestPolicy")) { return(TooManyDistributionsAssociatedToOriginRequestPolicyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributionsWithLambdaAssociations")) { return(TooManyDistributionsWithLambdaAssociationsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributionsWithSingleFunctionARN")) { return(TooManyDistributionsWithSingleFunctionARNExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyHeadersInForwardedValues")) { return(TooManyHeadersInForwardedValuesExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyLambdaFunctionAssociations")) { return(TooManyLambdaFunctionAssociationsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyOriginCustomHeaders")) { return(TooManyOriginCustomHeadersExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyOriginGroupsPerDistribution")) { return(TooManyOriginGroupsPerDistributionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyOrigins")) { return(TooManyOriginsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyQueryStringParameters")) { return(TooManyQueryStringParametersExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyTrustedSigners")) { return(TooManyTrustedSignersExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TrustedSignerDoesNotExist")) { return(TrustedSignerDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCloudFrontException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new XmlUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("AuthorizationNotFound")) { return(AuthorizationNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("BackupPolicyNotFoundFault")) { return(BackupPolicyNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CertificateNotFound")) { return(CertificateNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBInstanceAlreadyExists")) { return(DBInstanceAlreadyExistsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBInstanceNotFound")) { return(DBInstanceNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBParameterGroupNotFound")) { return(DBParameterGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBSecurityGroupNotFound")) { return(DBSecurityGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBUpgradeDependencyFailure")) { return(DBUpgradeDependencyFailureExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DomainNotFoundFault")) { return(DomainNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientDBInstanceCapacity")) { return(InsufficientDBInstanceCapacityExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDBClusterStateFault")) { return(InvalidDBClusterStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDBInstanceState")) { return(InvalidDBInstanceStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDBSecurityGroupState")) { return(InvalidDBSecurityGroupStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidVPCNetworkStateFault")) { return(InvalidVPCNetworkStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSKeyNotAccessibleFault")) { return(KMSKeyNotAccessibleExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("OptionGroupNotFoundFault")) { return(OptionGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ProvisionedIopsNotAvailableInAZFault")) { return(ProvisionedIopsNotAvailableInAZExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("StorageQuotaExceeded")) { return(StorageQuotaExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("StorageTypeNotSupported")) { return(StorageTypeNotSupportedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonRDSException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("AccessToSnapshotDenied")) { return(new AccessToSnapshotDeniedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterAlreadyExists")) { return(new ClusterAlreadyExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterParameterGroupNotFound")) { return(new ClusterParameterGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterQuotaExceeded")) { return(new ClusterQuotaExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterSecurityGroupNotFound")) { return(new ClusterSecurityGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterSnapshotNotFound")) { return(new ClusterSnapshotNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterSubnetGroupNotFoundFault")) { return(new ClusterSubnetGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("HsmClientCertificateNotFoundFault")) { return(new HsmClientCertificateNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("HsmConfigurationNotFoundFault")) { return(new HsmConfigurationNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientClusterCapacity")) { return(new InsufficientClusterCapacityException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidClusterSnapshotState")) { return(new InvalidClusterSnapshotStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidClusterSubnetGroupStateFault")) { return(new InvalidClusterSubnetGroupStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidElasticIpFault")) { return(new InvalidElasticIpException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRestore")) { return(new InvalidRestoreException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSubnet")) { return(new InvalidSubnetException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidVPCNetworkStateFault")) { return(new InvalidVPCNetworkStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NumberOfNodesPerClusterLimitExceeded")) { return(new NumberOfNodesPerClusterLimitExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NumberOfNodesQuotaExceeded")) { return(new NumberOfNodesQuotaExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedOperation")) { return(new UnauthorizedOperationException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonRedshiftException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new XmlUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("CacheClusterNotFound")) { return(CacheClusterNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CacheParameterGroupNotFound")) { return(CacheParameterGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CacheSecurityGroupNotFound")) { return(CacheSecurityGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CacheSubnetGroupNotFoundFault")) { return(CacheSubnetGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterQuotaForCustomerExceeded")) { return(ClusterQuotaForCustomerExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("GlobalReplicationGroupNotFoundFault")) { return(GlobalReplicationGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientCacheClusterCapacity")) { return(InsufficientCacheClusterCapacityExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCacheClusterState")) { return(InvalidCacheClusterStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidGlobalReplicationGroupState")) { return(InvalidGlobalReplicationGroupStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterCombination")) { return(InvalidParameterCombinationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterValue")) { return(InvalidParameterValueExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidVPCNetworkStateFault")) { return(InvalidVPCNetworkStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NodeGroupsPerReplicationGroupQuotaExceeded")) { return(NodeGroupsPerReplicationGroupQuotaExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NodeQuotaForClusterExceeded")) { return(NodeQuotaForClusterExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NodeQuotaForCustomerExceeded")) { return(NodeQuotaForCustomerExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ReplicationGroupAlreadyExists")) { return(ReplicationGroupAlreadyExistsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TagQuotaPerResourceExceeded")) { return(TagQuotaPerResourceExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonElastiCacheException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new XmlUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("BucketPermissionException")) { return(BucketPermissionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CanceledJobIdException")) { return(CanceledJobIdExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ExpiredJobIdException")) { return(ExpiredJobIdExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidAccessKeyIdException")) { return(InvalidAccessKeyIdExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidAddressException")) { return(InvalidAddressExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCustomsException")) { return(InvalidCustomsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidFileSystemException")) { return(InvalidFileSystemExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidJobIdException")) { return(InvalidJobIdExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidManifestFieldException")) { return(InvalidManifestFieldExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterException")) { return(InvalidParameterExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidVersionException")) { return(InvalidVersionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MalformedManifestException")) { return(MalformedManifestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MissingCustomsException")) { return(MissingCustomsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MissingManifestFieldException")) { return(MissingManifestFieldExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MissingParameterException")) { return(MissingParameterExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MultipleRegionsException")) { return(MultipleRegionsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchBucketException")) { return(NoSuchBucketExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnableToUpdateJobIdException")) { return(UnableToUpdateJobIdExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonImportExportException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new XmlUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("AccessToSnapshotDenied")) { return AccessToSnapshotDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterAlreadyExists")) { return ClusterAlreadyExistsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterParameterGroupNotFound")) { return ClusterParameterGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterQuotaExceeded")) { return ClusterQuotaExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterSecurityGroupNotFound")) { return ClusterSecurityGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterSnapshotNotFound")) { return ClusterSnapshotNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterSubnetGroupNotFoundFault")) { return ClusterSubnetGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("DependentServiceRequestThrottlingFault")) { return DependentServiceRequestThrottlingExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("HsmClientCertificateNotFoundFault")) { return HsmClientCertificateNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("HsmConfigurationNotFoundFault")) { return HsmConfigurationNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientClusterCapacity")) { return InsufficientClusterCapacityExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidClusterSnapshotState")) { return InvalidClusterSnapshotStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidClusterSubnetGroupStateFault")) { return InvalidClusterSubnetGroupStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidClusterTrack")) { return InvalidClusterTrackExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidElasticIpFault")) { return InvalidElasticIpExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRestore")) { return InvalidRestoreExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSubnet")) { return InvalidSubnetExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTagFault")) { return InvalidTagExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidVPCNetworkStateFault")) { return InvalidVPCNetworkStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededFault")) { return LimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("NumberOfNodesPerClusterLimitExceeded")) { return NumberOfNodesPerClusterLimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("NumberOfNodesQuotaExceeded")) { return NumberOfNodesQuotaExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("SnapshotScheduleNotFound")) { return SnapshotScheduleNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("TagLimitExceededFault")) { return TagLimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedOperation")) { return UnauthorizedOperationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } } return new AmazonRedshiftException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); }
public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("MalformedManifestException")) { return(new MalformedManifestException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("BucketPermissionException")) { return(new BucketPermissionException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidAddressException")) { return(new InvalidAddressException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterException")) { return(new InvalidParameterException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnableToUpdateJobIdException")) { return(new UnableToUpdateJobIdException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MultipleRegionsException")) { return(new MultipleRegionsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MissingParameterException")) { return(new MissingParameterException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidFileSystemException")) { return(new InvalidFileSystemException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CanceledJobIdException")) { return(new CanceledJobIdException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MissingCustomsException")) { return(new MissingCustomsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchBucketException")) { return(new NoSuchBucketException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ExpiredJobIdException")) { return(new ExpiredJobIdException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidAccessKeyIdException")) { return(new InvalidAccessKeyIdException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCustomsException")) { return(new InvalidCustomsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidManifestFieldException")) { return(new InvalidManifestFieldException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MissingManifestFieldException")) { return(new MissingManifestFieldException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidJobIdException")) { return(new InvalidJobIdException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonImportExportException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("CertificateNotFound")) { return(new CertificateNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DuplicateListener")) { return(new DuplicateListenerException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("IncompatibleProtocols")) { return(new IncompatibleProtocolsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidConfigurationRequest")) { return(new InvalidConfigurationRequestException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidLoadBalancerAction")) { return(new InvalidLoadBalancerActionException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ListenerNotFound")) { return(new ListenerNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("SSLPolicyNotFound")) { return(new SSLPolicyNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TargetGroupAssociationLimit")) { return(new TargetGroupAssociationLimitException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TargetGroupNotFound")) { return(new TargetGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyActions")) { return(new TooManyActionsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyCertificates")) { return(new TooManyCertificatesException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyListeners")) { return(new TooManyListenersException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRegistrationsForTargetId")) { return(new TooManyRegistrationsForTargetIdException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyTargets")) { return(new TooManyTargetsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyUniqueTargetGroupsPerLoadBalancer")) { return(new TooManyUniqueTargetGroupsPerLoadBalancerException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnsupportedProtocol")) { return(new UnsupportedProtocolException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonElasticLoadBalancingV2Exception(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("NodeQuotaForCustomerExceeded")) { return(new NodeQuotaForCustomerExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterQuotaForCustomerExceeded")) { return(new ClusterQuotaForCustomerExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CacheClusterAlreadyExists")) { return(new CacheClusterAlreadyExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientCacheClusterCapacity")) { return(new InsufficientCacheClusterCapacityException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ReplicationGroupNotFoundFault")) { return(new ReplicationGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterCombination")) { return(new InvalidParameterCombinationException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CacheParameterGroupNotFound")) { return(new CacheParameterGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CacheSecurityGroupNotFound")) { return(new CacheSecurityGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NodeQuotaForClusterExceeded")) { return(new NodeQuotaForClusterExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CacheSubnetGroupNotFoundFault")) { return(new CacheSubnetGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidReplicationGroupState")) { return(new InvalidReplicationGroupStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterValue")) { return(new InvalidParameterValueException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidVPCNetworkStateFault")) { return(new InvalidVPCNetworkStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonElastiCacheException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new XmlUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("CertificateNotFound")) { return(CertificateNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DuplicateLoadBalancerName")) { return(DuplicateAccessPointNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DuplicateTagKeys")) { return(DuplicateTagKeysExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidConfigurationRequest")) { return(InvalidConfigurationRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidScheme")) { return(InvalidSchemeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSecurityGroup")) { return(InvalidSecurityGroupExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSubnet")) { return(InvalidSubnetExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("OperationNotPermitted")) { return(OperationNotPermittedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("SubnetNotFound")) { return(SubnetNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyLoadBalancers")) { return(TooManyAccessPointsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyTags")) { return(TooManyTagsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnsupportedProtocol")) { return(UnsupportedProtocolExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonElasticLoadBalancingException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterAlreadyExists")) { return(new ClusterAlreadyExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterNotFound")) { return(new ClusterNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterParameterGroupNotFound")) { return(new ClusterParameterGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterSecurityGroupNotFound")) { return(new ClusterSecurityGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DependentServiceRequestThrottlingFault")) { return(new DependentServiceRequestThrottlingException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("HsmClientCertificateNotFoundFault")) { return(new HsmClientCertificateNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("HsmConfigurationNotFoundFault")) { return(new HsmConfigurationNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientClusterCapacity")) { return(new InsufficientClusterCapacityException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidClusterSecurityGroupState")) { return(new InvalidClusterSecurityGroupStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidClusterState")) { return(new InvalidClusterStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidClusterTrack")) { return(new InvalidClusterTrackException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidElasticIpFault")) { return(new InvalidElasticIpException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRetentionPeriodFault")) { return(new InvalidRetentionPeriodException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededFault")) { return(new LimitExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NumberOfNodesPerClusterLimitExceeded")) { return(new NumberOfNodesPerClusterLimitExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NumberOfNodesQuotaExceeded")) { return(new NumberOfNodesQuotaExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TableLimitExceeded")) { return(new TableLimitExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedOperation")) { return(new UnauthorizedOperationException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnsupportedOptionFault")) { return(new UnsupportedOptionException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonRedshiftException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("AuthorizationNotFound")) { return(new AuthorizationNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("BackupPolicyNotFoundFault")) { return(new BackupPolicyNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBInstanceAlreadyExists")) { return(new DBInstanceAlreadyExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBInstanceNotFound")) { return(new DBInstanceNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBParameterGroupNotFound")) { return(new DBParameterGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBSecurityGroupNotFound")) { return(new DBSecurityGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBSubnetGroupDoesNotCoverEnoughAZs")) { return(new DBSubnetGroupDoesNotCoverEnoughAZsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBSubnetGroupNotFoundFault")) { return(new DBSubnetGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DomainNotFoundFault")) { return(new DomainNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InstanceQuotaExceeded")) { return(new InstanceQuotaExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientDBInstanceCapacity")) { return(new InsufficientDBInstanceCapacityException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDBInstanceState")) { return(new InvalidDBInstanceStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRestoreFault")) { return(new InvalidRestoreException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSubnet")) { return(new InvalidSubnetException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidVPCNetworkStateFault")) { return(new InvalidVPCNetworkStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSKeyNotAccessibleFault")) { return(new KMSKeyNotAccessibleException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("OptionGroupNotFoundFault")) { return(new OptionGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PointInTimeRestoreNotEnabled")) { return(new PointInTimeRestoreNotEnabledException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ProvisionedIopsNotAvailableInAZFault")) { return(new ProvisionedIopsNotAvailableInAZException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("StorageQuotaExceeded")) { return(new StorageQuotaExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("StorageTypeNotSupported")) { return(new StorageTypeNotSupportedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonRDSException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new XmlUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("DBClusterAlreadyExistsFault")) { return(DBClusterAlreadyExistsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBClusterNotFoundFault")) { return(DBClusterNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBClusterParameterGroupNotFound")) { return(DBClusterParameterGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBClusterQuotaExceededFault")) { return(DBClusterQuotaExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBInstanceNotFound")) { return(DBInstanceNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBSubnetGroupDoesNotCoverEnoughAZs")) { return(DBSubnetGroupDoesNotCoverEnoughAZsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DBSubnetGroupNotFoundFault")) { return(DBSubnetGroupNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientStorageClusterCapacity")) { return(InsufficientStorageClusterCapacityExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDBClusterStateFault")) { return(InvalidDBClusterStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDBInstanceState")) { return(InvalidDBInstanceStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDBSubnetGroupStateFault")) { return(InvalidDBSubnetGroupStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSubnet")) { return(InvalidSubnetExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidVPCNetworkStateFault")) { return(InvalidVPCNetworkStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSKeyNotAccessibleFault")) { return(KMSKeyNotAccessibleExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("StorageQuotaExceeded")) { return(StorageQuotaExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonNeptuneException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyCookieNamesInWhiteList")) { return(new TooManyCookieNamesInWhiteListException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidGeoRestrictionParameter")) { return(new InvalidGeoRestrictionParameterException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidResponseCode")) { return(new InvalidResponseCodeException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MissingBody")) { return(new MissingBodyException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidLocationCode")) { return(new InvalidLocationCodeException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributionCNAMEs")) { return(new TooManyDistributionCNAMEsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyDistributions")) { return(new TooManyDistributionsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchOrigin")) { return(new NoSuchOriginException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InconsistentQuantities")) { return(new InconsistentQuantitiesException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidArgument")) { return(new InvalidArgumentException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CNAMEAlreadyExists")) { return(new CNAMEAlreadyExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidOriginAccessIdentity")) { return(new InvalidOriginAccessIdentityException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyCacheBehaviors")) { return(new TooManyCacheBehaviorsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyTrustedSigners")) { return(new TooManyTrustedSignersException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidViewerCertificate")) { return(new InvalidViewerCertificateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyOrigins")) { return(new TooManyOriginsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DistributionAlreadyExists")) { return(new DistributionAlreadyExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRequiredProtocol")) { return(new InvalidRequiredProtocolException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDefaultRootObject")) { return(new InvalidDefaultRootObjectException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidForwardCookies")) { return(new InvalidForwardCookiesException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TrustedSignerDoesNotExist")) { return(new TrustedSignerDoesNotExistException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidOrigin")) { return(new InvalidOriginException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyCertificates")) { return(new TooManyCertificatesException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRelativePath")) { return(new InvalidRelativePathException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidErrorCode")) { return(new InvalidErrorCodeException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("AccessDenied")) { return(new AccessDeniedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonCloudFrontException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); return(new AmazonEC2Exception(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new XmlUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("ClusterNotFound")) { return(ClusterNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DependentServiceUnavailableFault")) { return(DependentServiceUnavailableExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientClusterCapacity")) { return(InsufficientClusterCapacityExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidClusterState")) { return(InvalidClusterStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidReservedNodeState")) { return(InvalidReservedNodeStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededFault")) { return(LimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NumberOfNodesPerClusterLimitExceeded")) { return(NumberOfNodesPerClusterLimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NumberOfNodesQuotaExceeded")) { return(NumberOfNodesQuotaExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ReservedNodeAlreadyExists")) { return(ReservedNodeAlreadyExistsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ReservedNodeAlreadyMigrated")) { return(ReservedNodeAlreadyMigratedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ReservedNodeNotFound")) { return(ReservedNodeNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ReservedNodeOfferingNotFound")) { return(ReservedNodeOfferingNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedOperation")) { return(UnauthorizedOperationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnsupportedOperation")) { return(UnsupportedOperationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnsupportedOptionFault")) { return(UnsupportedOptionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonRedshiftException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }