/// <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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidInput")) { return(InvalidInputExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnsupportedTLD")) { return(UnsupportedTLDExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonRoute53DomainsException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("InternalException")) { return(InternalExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundException")) { return(ResourceNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonEventBridgeException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("EC2AccessDeniedException")) { return(EC2AccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EC2ThrottledException")) { return(EC2ThrottledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EC2UnexpectedException")) { return(EC2UnexpectedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ENILimitReachedException")) { return(ENILimitReachedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterValueException")) { return(InvalidParameterValueExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRequestContentException")) { return(InvalidRequestContentExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRuntimeException")) { return(InvalidRuntimeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSecurityGroupIDException")) { return(InvalidSecurityGroupIDExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSubnetIDException")) { return(InvalidSubnetIDExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidZipFileException")) { return(InvalidZipFileExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSAccessDeniedException")) { return(KMSAccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSDisabledException")) { return(KMSDisabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSInvalidStateException")) { return(KMSInvalidStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSNotFoundException")) { return(KMSNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RequestTooLargeException")) { return(RequestTooLargeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceConflictException")) { return(ResourceConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundException")) { return(ResourceNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotReadyException")) { return(ResourceNotReadyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ServiceException")) { return(ServiceExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("SubnetIPAddressLimitReachedException")) { return(SubnetIPAddressLimitReachedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException")) { return(TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnsupportedMediaTypeException")) { return(UnsupportedMediaTypeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonLambdaException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("AlreadyExistsException")) { return(AlreadyExistsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ClientTokenConflictException")) { return(ClientTokenConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ConcurrentOperationException")) { return(ConcurrentOperationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("GeneralServiceException")) { return(GeneralServiceExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("HandlerFailureException")) { return(HandlerFailureExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("HandlerInternalFailureException")) { return(HandlerInternalFailureExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCredentialsException")) { return(InvalidCredentialsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRequestException")) { return(InvalidRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NetworkFailureException")) { return(NetworkFailureExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NotStabilizedException")) { return(NotStabilizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NotUpdatableException")) { return(NotUpdatableExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PrivateTypeException")) { return(PrivateTypeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceConflictException")) { return(ResourceConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundException")) { return(ResourceNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ServiceInternalErrorException")) { return(ServiceInternalErrorExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ServiceLimitExceededException")) { return(ServiceLimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ThrottlingException")) { return(ThrottlingExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TypeNotFoundException")) { return(TypeNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnsupportedActionException")) { return(UnsupportedActionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCloudControlApiException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionIntegrityChecksFailedException")) { return(EncryptionIntegrityChecksFailedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyAccessDeniedException")) { return(EncryptionKeyAccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyDisabledException")) { return(EncryptionKeyDisabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyNotFoundException")) { return(EncryptionKeyNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyUnavailableException")) { return(EncryptionKeyUnavailableExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRepositoryNameException")) { return(InvalidRepositoryNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRepositoryTriggerBranchNameException")) { return(InvalidRepositoryTriggerBranchNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRepositoryTriggerCustomDataException")) { return(InvalidRepositoryTriggerCustomDataExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRepositoryTriggerDestinationArnException")) { return(InvalidRepositoryTriggerDestinationArnExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRepositoryTriggerEventsException")) { return(InvalidRepositoryTriggerEventsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRepositoryTriggerNameException")) { return(InvalidRepositoryTriggerNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRepositoryTriggerRegionException")) { return(InvalidRepositoryTriggerRegionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MaximumBranchesExceededException")) { return(MaximumBranchesExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MaximumRepositoryTriggersExceededException")) { return(MaximumRepositoryTriggersExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryDoesNotExistException")) { return(RepositoryDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryNameRequiredException")) { return(RepositoryNameRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryTriggerBranchNameListRequiredException")) { return(RepositoryTriggerBranchNameListRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryTriggerDestinationArnRequiredException")) { return(RepositoryTriggerDestinationArnRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryTriggerEventsListRequiredException")) { return(RepositoryTriggerEventsListRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryTriggerNameRequiredException")) { return(RepositoryTriggerNameRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryTriggersListRequiredException")) { return(RepositoryTriggersListRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCodeCommitException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("AliasExistsException")) { return(AliasExistsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CodeMismatchException")) { return(CodeMismatchExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ExpiredCodeException")) { return(ExpiredCodeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InternalErrorException")) { return(InternalErrorExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidLambdaResponseException")) { return(InvalidLambdaResponseExceptionUnmarshaller.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("LimitExceededException")) { return(LimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NotAuthorizedException")) { return(NotAuthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundException")) { return(ResourceNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyFailedAttemptsException")) { return(TooManyFailedAttemptsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException")) { return(TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnexpectedLambdaException")) { return(UnexpectedLambdaExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UserLambdaValidationException")) { return(UserLambdaValidationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UserNotFoundException")) { return(UserNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCognitoIdentityProviderException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionIntegrityChecksFailedException")) { return(EncryptionIntegrityChecksFailedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyAccessDeniedException")) { return(EncryptionKeyAccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyDisabledException")) { return(EncryptionKeyDisabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyNotFoundException")) { return(EncryptionKeyNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyUnavailableException")) { return(EncryptionKeyUnavailableExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRepositoryDescriptionException")) { return(InvalidRepositoryDescriptionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRepositoryNameException")) { return(InvalidRepositoryNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSystemTagUsageException")) { return(InvalidSystemTagUsageExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTagsMapException")) { return(InvalidTagsMapExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryLimitExceededException")) { return(RepositoryLimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryNameExistsException")) { return(RepositoryNameExistsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryNameRequiredException")) { return(RepositoryNameRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TagPolicyException")) { return(TagPolicyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyTagsException")) { return(TooManyTagsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCodeCommitException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("ActorDoesNotExistException")) { return(ActorDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionIntegrityChecksFailedException")) { return(EncryptionIntegrityChecksFailedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyAccessDeniedException")) { return(EncryptionKeyAccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyDisabledException")) { return(EncryptionKeyDisabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyNotFoundException")) { return(EncryptionKeyNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyUnavailableException")) { return(EncryptionKeyUnavailableExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidActorArnException")) { return(InvalidActorArnExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidContinuationTokenException")) { return(InvalidContinuationTokenExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidMaxResultsException")) { return(InvalidMaxResultsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidPullRequestEventTypeException")) { return(InvalidPullRequestEventTypeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidPullRequestIdException")) { return(InvalidPullRequestIdExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PullRequestDoesNotExistException")) { return(PullRequestDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PullRequestIdRequiredException")) { return(PullRequestIdRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCodeCommitException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("CustomSchemaCountLimitExceededException")) { return(CustomSchemaCountLimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InternalServerError")) { return(InternalServerErrorExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidInstanceId")) { return(InvalidInstanceIdExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidInventoryItemContextException")) { return(InvalidInventoryItemContextExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidItemContentException")) { return(InvalidItemContentExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTypeNameException")) { return(InvalidTypeNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ItemContentMismatchException")) { return(ItemContentMismatchExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ItemSizeLimitExceededException")) { return(ItemSizeLimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("SubTypeCountLimitExceededException")) { return(SubTypeCountLimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TotalSizeLimitExceededException")) { return(TotalSizeLimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnsupportedInventoryItemContextException")) { return(UnsupportedInventoryItemContextExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnsupportedInventorySchemaVersionException")) { return(UnsupportedInventorySchemaVersionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonSimpleSystemsManagementException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("AssociationDoesNotExist")) { return(AssociationDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("AssociationVersionLimitExceeded")) { return(AssociationVersionLimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InternalServerError")) { return(InternalServerErrorExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidAssociationVersion")) { return(InvalidAssociationVersionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDocument")) { return(InvalidDocumentExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDocumentVersion")) { return(InvalidDocumentVersionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidOutputLocation")) { return(InvalidOutputLocationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameters")) { return(InvalidParametersExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSchedule")) { return(InvalidScheduleExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTarget")) { return(InvalidTargetExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidUpdate")) { return(InvalidUpdateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyUpdates")) { return(TooManyUpdatesExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonSimpleSystemsManagementException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("CloudTrailAccessNotEnabledException")) { return(CloudTrailAccessNotEnabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CloudWatchLogsDeliveryUnavailableException")) { return(CloudWatchLogsDeliveryUnavailableExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientDependencyServiceAccessPermissionException")) { return(InsufficientDependencyServiceAccessPermissionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientEncryptionPolicyException")) { return(InsufficientEncryptionPolicyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientS3BucketPolicyException")) { return(InsufficientS3BucketPolicyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientSnsTopicPolicyException")) { return(InsufficientSnsTopicPolicyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCloudWatchLogsLogGroupArnException")) { return(InvalidCloudWatchLogsLogGroupArnExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCloudWatchLogsRoleArnException")) { return(InvalidCloudWatchLogsRoleArnExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidEventSelectorsException")) { return(InvalidEventSelectorsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidHomeRegionException")) { return(InvalidHomeRegionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidKmsKeyIdException")) { return(InvalidKmsKeyIdExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterCombinationException")) { return(InvalidParameterCombinationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidS3BucketNameException")) { return(InvalidS3BucketNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidS3PrefixException")) { return(InvalidS3PrefixExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSnsTopicNameException")) { return(InvalidSnsTopicNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTrailNameException")) { return(InvalidTrailNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KmsException")) { return(KmsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KmsKeyDisabledException")) { return(KmsKeyDisabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KmsKeyNotFoundException")) { return(KmsKeyNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NotOrganizationMasterAccountException")) { return(NotOrganizationMasterAccountExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("OperationNotPermittedException")) { return(OperationNotPermittedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("OrganizationNotInAllFeaturesModeException")) { return(OrganizationNotInAllFeaturesModeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("OrganizationsNotInUseException")) { return(OrganizationsNotInUseExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("S3BucketDoesNotExistException")) { return(S3BucketDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TrailNotFoundException")) { return(TrailNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TrailNotProvidedException")) { return(TrailNotProvidedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnsupportedOperationException")) { return(UnsupportedOperationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCloudTrailException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("CommitDoesNotExistException")) { return(CommitDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CommitRequiredException")) { return(CommitRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionIntegrityChecksFailedException")) { return(EncryptionIntegrityChecksFailedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyAccessDeniedException")) { return(EncryptionKeyAccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyDisabledException")) { return(EncryptionKeyDisabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyNotFoundException")) { return(EncryptionKeyNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyUnavailableException")) { return(EncryptionKeyUnavailableExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("FileDoesNotExistException")) { return(FileDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCommitException")) { return(InvalidCommitExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidConflictDetailLevelException")) { return(InvalidConflictDetailLevelExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidConflictResolutionStrategyException")) { return(InvalidConflictResolutionStrategyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidContinuationTokenException")) { return(InvalidContinuationTokenExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidMaxMergeHunksException")) { return(InvalidMaxMergeHunksExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidMergeOptionException")) { return(InvalidMergeOptionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidPathException")) { return(InvalidPathExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRepositoryNameException")) { return(InvalidRepositoryNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MaximumFileContentToLoadExceededException")) { return(MaximumFileContentToLoadExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MaximumItemsToCompareExceededException")) { return(MaximumItemsToCompareExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MergeOptionRequiredException")) { return(MergeOptionRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PathRequiredException")) { return(PathRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryDoesNotExistException")) { return(RepositoryDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryNameRequiredException")) { return(RepositoryNameRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TipsDivergenceExceededException")) { return(TipsDivergenceExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCodeCommitException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("BranchDoesNotExistException")) { return(BranchDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("BranchNameIsTagNameException")) { return(BranchNameIsTagNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("BranchNameRequiredException")) { return(BranchNameRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CommitMessageLengthExceededException")) { return(CommitMessageLengthExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DirectoryNameConflictsWithFileNameException")) { return(DirectoryNameConflictsWithFileNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionIntegrityChecksFailedException")) { return(EncryptionIntegrityChecksFailedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyAccessDeniedException")) { return(EncryptionKeyAccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyDisabledException")) { return(EncryptionKeyDisabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyNotFoundException")) { return(EncryptionKeyNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyUnavailableException")) { return(EncryptionKeyUnavailableExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("FileContentAndSourceFileSpecifiedException")) { return(FileContentAndSourceFileSpecifiedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("FileContentSizeLimitExceededException")) { return(FileContentSizeLimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("FileDoesNotExistException")) { return(FileDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("FileEntryRequiredException")) { return(FileEntryRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("FileModeRequiredException")) { return(FileModeRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("FileNameConflictsWithDirectoryNameException")) { return(FileNameConflictsWithDirectoryNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("FilePathConflictsWithSubmodulePathException")) { return(FilePathConflictsWithSubmodulePathExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("FolderContentSizeLimitExceededException")) { return(FolderContentSizeLimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidBranchNameException")) { return(InvalidBranchNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDeletionParameterException")) { return(InvalidDeletionParameterExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidEmailException")) { return(InvalidEmailExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidFileModeException")) { return(InvalidFileModeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParentCommitIdException")) { return(InvalidParentCommitIdExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidPathException")) { return(InvalidPathExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRepositoryNameException")) { return(InvalidRepositoryNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MaximumFileEntriesExceededException")) { return(MaximumFileEntriesExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NameLengthExceededException")) { return(NameLengthExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoChangeException")) { return(NoChangeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ParentCommitDoesNotExistException")) { return(ParentCommitDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ParentCommitIdOutdatedException")) { return(ParentCommitIdOutdatedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ParentCommitIdRequiredException")) { return(ParentCommitIdRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PathRequiredException")) { return(PathRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PutFileEntryConflictException")) { return(PutFileEntryConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryDoesNotExistException")) { return(RepositoryDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryNameRequiredException")) { return(RepositoryNameRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RestrictedSourceFileException")) { return(RestrictedSourceFileExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("SamePathRequestException")) { return(SamePathRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("SourceFileOrContentRequiredException")) { return(SourceFileOrContentRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCodeCommitException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("BranchDoesNotExistException")) { return(BranchDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("BranchNameIsTagNameException")) { return(BranchNameIsTagNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("BranchNameRequiredException")) { return(BranchNameRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CommitDoesNotExistException")) { return(CommitDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CommitRequiredException")) { return(CommitRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ConcurrentReferenceUpdateException")) { return(ConcurrentReferenceUpdateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionIntegrityChecksFailedException")) { return(EncryptionIntegrityChecksFailedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyAccessDeniedException")) { return(EncryptionKeyAccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyDisabledException")) { return(EncryptionKeyDisabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyNotFoundException")) { return(EncryptionKeyNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyUnavailableException")) { return(EncryptionKeyUnavailableExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidBranchNameException")) { return(InvalidBranchNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCommitException")) { return(InvalidCommitExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRepositoryNameException")) { return(InvalidRepositoryNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTargetBranchException")) { return(InvalidTargetBranchExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ManualMergeRequiredException")) { return(ManualMergeRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryDoesNotExistException")) { return(RepositoryDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryNameRequiredException")) { return(RepositoryNameRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TipsDivergenceExceededException")) { return(TipsDivergenceExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCodeCommitException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("ApprovalRuleTemplateDoesNotExistException")) { return(ApprovalRuleTemplateDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ApprovalRuleTemplateNameRequiredException")) { return(ApprovalRuleTemplateNameRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionIntegrityChecksFailedException")) { return(EncryptionIntegrityChecksFailedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyAccessDeniedException")) { return(EncryptionKeyAccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyDisabledException")) { return(EncryptionKeyDisabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyNotFoundException")) { return(EncryptionKeyNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyUnavailableException")) { return(EncryptionKeyUnavailableExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidApprovalRuleTemplateNameException")) { return(InvalidApprovalRuleTemplateNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRepositoryNameException")) { return(InvalidRepositoryNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MaximumRuleTemplatesAssociatedWithRepositoryException")) { return(MaximumRuleTemplatesAssociatedWithRepositoryExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryDoesNotExistException")) { return(RepositoryDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryNameRequiredException")) { return(RepositoryNameRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCodeCommitException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("CloudTrailARNInvalidException")) { return(CloudTrailARNInvalidExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ConflictException")) { return(ConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EventDataStoreNotFoundException")) { return(EventDataStoreNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InactiveEventDataStoreException")) { return(InactiveEventDataStoreExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTagParameterException")) { return(InvalidTagParameterExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTrailNameException")) { return(InvalidTrailNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NotOrganizationMasterAccountException")) { return(NotOrganizationMasterAccountExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("OperationNotPermittedException")) { return(OperationNotPermittedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundException")) { return(ResourceNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceTypeNotSupportedException")) { return(ResourceTypeNotSupportedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TagsLimitExceededException")) { return(TagsLimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnsupportedOperationException")) { return(UnsupportedOperationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCloudTrailException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("CloudTrailAccessNotEnabledException")) { return(CloudTrailAccessNotEnabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EventDataStoreARNInvalidException")) { return(EventDataStoreARNInvalidExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EventDataStoreMaxLimitExceededException")) { return(EventDataStoreMaxLimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EventDataStoreNotFoundException")) { return(EventDataStoreNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientDependencyServiceAccessPermissionException")) { return(InsufficientDependencyServiceAccessPermissionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidEventDataStoreStatusException")) { return(InvalidEventDataStoreStatusExceptionUnmarshaller.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("NotOrganizationMasterAccountException")) { return(NotOrganizationMasterAccountExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("OperationNotPermittedException")) { return(OperationNotPermittedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("OrganizationNotInAllFeaturesModeException")) { return(OrganizationNotInAllFeaturesModeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("OrganizationsNotInUseException")) { return(OrganizationsNotInUseExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnsupportedOperationException")) { return(UnsupportedOperationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCloudTrailException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("BranchDoesNotExistException")) { return(BranchDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("BranchNameIsTagNameException")) { return(BranchNameIsTagNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("BranchNameRequiredException")) { return(BranchNameRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CommitDoesNotExistException")) { return(CommitDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CommitMessageLengthExceededException")) { return(CommitMessageLengthExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CommitRequiredException")) { return(CommitRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ConcurrentReferenceUpdateException")) { return(ConcurrentReferenceUpdateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionIntegrityChecksFailedException")) { return(EncryptionIntegrityChecksFailedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyAccessDeniedException")) { return(EncryptionKeyAccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyDisabledException")) { return(EncryptionKeyDisabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyNotFoundException")) { return(EncryptionKeyNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyUnavailableException")) { return(EncryptionKeyUnavailableExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("FileContentSizeLimitExceededException")) { return(FileContentSizeLimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("FileModeRequiredException")) { return(FileModeRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("FolderContentSizeLimitExceededException")) { return(FolderContentSizeLimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidBranchNameException")) { return(InvalidBranchNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCommitException")) { return(InvalidCommitExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidConflictDetailLevelException")) { return(InvalidConflictDetailLevelExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidConflictResolutionException")) { return(InvalidConflictResolutionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidConflictResolutionStrategyException")) { return(InvalidConflictResolutionStrategyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidEmailException")) { return(InvalidEmailExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidFileModeException")) { return(InvalidFileModeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidPathException")) { return(InvalidPathExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidReplacementContentException")) { return(InvalidReplacementContentExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidReplacementTypeException")) { return(InvalidReplacementTypeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRepositoryNameException")) { return(InvalidRepositoryNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTargetBranchException")) { return(InvalidTargetBranchExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ManualMergeRequiredException")) { return(ManualMergeRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MaximumConflictResolutionEntriesExceededException")) { return(MaximumConflictResolutionEntriesExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MaximumFileContentToLoadExceededException")) { return(MaximumFileContentToLoadExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MaximumItemsToCompareExceededException")) { return(MaximumItemsToCompareExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MultipleConflictResolutionEntriesException")) { return(MultipleConflictResolutionEntriesExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NameLengthExceededException")) { return(NameLengthExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PathRequiredException")) { return(PathRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ReplacementContentRequiredException")) { return(ReplacementContentRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ReplacementTypeRequiredException")) { return(ReplacementTypeRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryDoesNotExistException")) { return(RepositoryDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryNameRequiredException")) { return(RepositoryNameRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TipsDivergenceExceededException")) { return(TipsDivergenceExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCodeCommitException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("AccessDeniedException")) { return(AccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DirectoryNotEnabledException")) { return(DirectoryNotEnabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("IndexedAttributeMissingException")) { return(IndexedAttributeMissingExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InternalServiceException")) { return(InternalServiceExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidArnException")) { return(InvalidArnExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidAttachmentException")) { return(InvalidAttachmentExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException")) { return(LimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("LinkNameAlreadyInUseException")) { return(LinkNameAlreadyInUseExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NotIndexException")) { return(NotIndexExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundException")) { return(ResourceNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RetryableConflictException")) { return(RetryableConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ValidationException")) { return(ValidationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCloudDirectoryException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("ClientRequestTokenRequiredException")) { return(ClientRequestTokenRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionIntegrityChecksFailedException")) { return(EncryptionIntegrityChecksFailedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyAccessDeniedException")) { return(EncryptionKeyAccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyDisabledException")) { return(EncryptionKeyDisabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyNotFoundException")) { return(EncryptionKeyNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyUnavailableException")) { return(EncryptionKeyUnavailableExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("IdempotencyParameterMismatchException")) { return(IdempotencyParameterMismatchExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidClientRequestTokenException")) { return(InvalidClientRequestTokenExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDescriptionException")) { return(InvalidDescriptionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidReferenceNameException")) { return(InvalidReferenceNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRepositoryNameException")) { return(InvalidRepositoryNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTargetException")) { return(InvalidTargetExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTargetsException")) { return(InvalidTargetsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTitleException")) { return(InvalidTitleExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MaximumOpenPullRequestsExceededException")) { return(MaximumOpenPullRequestsExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MultipleRepositoriesInPullRequestException")) { return(MultipleRepositoriesInPullRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ReferenceDoesNotExistException")) { return(ReferenceDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ReferenceNameRequiredException")) { return(ReferenceNameRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ReferenceTypeNotSupportedException")) { return(ReferenceTypeNotSupportedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryDoesNotExistException")) { return(RepositoryDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryNameRequiredException")) { return(RepositoryNameRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("SourceAndDestinationAreSameException")) { return(SourceAndDestinationAreSameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TargetRequiredException")) { return(TargetRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TargetsRequiredException")) { return(TargetsRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TitleRequiredException")) { return(TitleRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCodeCommitException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("AliasExistsException")) { return(AliasExistsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CodeMismatchException")) { return(CodeMismatchExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ExpiredCodeException")) { return(ExpiredCodeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InternalErrorException")) { return(InternalErrorExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidLambdaResponseException")) { return(InvalidLambdaResponseExceptionUnmarshaller.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("InvalidPasswordException")) { return(InvalidPasswordExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSmsRoleAccessPolicyException")) { return(InvalidSmsRoleAccessPolicyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSmsRoleTrustRelationshipException")) { return(InvalidSmsRoleTrustRelationshipExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidUserPoolConfigurationException")) { return(InvalidUserPoolConfigurationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MFAMethodNotFoundException")) { return(MFAMethodNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NotAuthorizedException")) { return(NotAuthorizedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PasswordResetRequiredException")) { return(PasswordResetRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundException")) { return(ResourceNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("SoftwareTokenMFANotFoundException")) { return(SoftwareTokenMFANotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException")) { return(TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnexpectedLambdaException")) { return(UnexpectedLambdaExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UserLambdaValidationException")) { return(UserLambdaValidationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UserNotConfirmedException")) { return(UserNotConfirmedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UserNotFoundException")) { return(UserNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCognitoIdentityProviderException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("AccessDeniedFault")) { return(AccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidResourceStateFault")) { return(InvalidResourceStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSAccessDeniedFault")) { return(KMSAccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSDisabledFault")) { return(KMSDisabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSFault")) { return(KMSExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("KMSInvalidStateFault")) { return(KMSInvalidStateExceptionUnmarshaller.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("KMSNotFoundFault")) { return(KMSNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceAlreadyExistsFault")) { return(ResourceAlreadyExistsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundFault")) { return(ResourceNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("S3AccessDeniedFault")) { return(S3AccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("S3ResourceNotFoundFault")) { return(S3ResourceNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonDatabaseMigrationServiceException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("AccessDeniedException")) { return(AccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("AWSOrganizationsNotInUseException")) { return(AWSOrganizationsNotInUseExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ConcurrentModificationException")) { return(ConcurrentModificationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ConstraintViolationException")) { return(ConstraintViolationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidInputException")) { return(InvalidInputExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PolicyChangesInProgressException")) { return(PolicyChangesInProgressExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PolicyTypeAlreadyEnabledException")) { return(PolicyTypeAlreadyEnabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PolicyTypeNotAvailableForOrganizationException")) { return(PolicyTypeNotAvailableForOrganizationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RootNotFoundException")) { return(RootNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ServiceException")) { return(ServiceExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException")) { return(TooManyRequestsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnsupportedAPIEndpointException")) { return(UnsupportedAPIEndpointExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonOrganizationsException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.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(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("ApprovalStateRequiredException")) { return(ApprovalStateRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionIntegrityChecksFailedException")) { return(EncryptionIntegrityChecksFailedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyAccessDeniedException")) { return(EncryptionKeyAccessDeniedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyDisabledException")) { return(EncryptionKeyDisabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyNotFoundException")) { return(EncryptionKeyNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyUnavailableException")) { return(EncryptionKeyUnavailableExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidApprovalStateException")) { return(InvalidApprovalStateExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidPullRequestIdException")) { return(InvalidPullRequestIdExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRevisionIdException")) { return(InvalidRevisionIdExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MaximumNumberOfApprovalsExceededException")) { return(MaximumNumberOfApprovalsExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PullRequestAlreadyClosedException")) { return(PullRequestAlreadyClosedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PullRequestCannotBeApprovedByAuthorException")) { return(PullRequestCannotBeApprovedByAuthorExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PullRequestDoesNotExistException")) { return(PullRequestDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PullRequestIdRequiredException")) { return(PullRequestIdRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RevisionIdRequiredException")) { return(RevisionIdRequiredExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RevisionNotCurrentException")) { return(RevisionNotCurrentExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCodeCommitException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode)); }