/// <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("ConflictException")) { return(ConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFound")) { return(ResourceNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonSageMakerException(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("OperationNotPermittedFault")) { return(OperationNotPermittedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnknownResourceFault")) { return(UnknownResourceExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonSimpleWorkflowException(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("DoesNotExistException")) { return(DoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InternalServerError")) { return(InternalServerErrorExceptionUnmarshaller.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("InvalidParameterException")) { return(InvalidParameterExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ServiceUnavailableException")) { return(ServiceUnavailableExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } } return(new AmazonCloudWatchLogsException(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) { ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("DeploymentDoesNotExistException")) { return new DeploymentDoesNotExistException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("DeploymentIdRequiredException")) { return new DeploymentIdRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("DeploymentNotStartedException")) { return new DeploymentNotStartedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDeploymentIdException")) { return new InvalidDeploymentIdException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDeploymentInstanceTypeException")) { return new InvalidDeploymentInstanceTypeException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidInstanceStatusException")) { return new InvalidInstanceStatusException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidInstanceTypeException")) { return new InvalidInstanceTypeException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidNextTokenException")) { return new InvalidNextTokenException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } return new AmazonCodeDeployException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("BadGatewayException")) { return new BadGatewayException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("BadRequestException")) { return new BadRequestException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("ConflictException")) { return new ConflictException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("ForbiddenException")) { return new ForbiddenException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("GatewayTimeoutException")) { return new GatewayTimeoutException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("InternalServerErrorException")) { return new InternalServerErrorException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException")) { return new NotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException")) { return new TooManyRequestsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } return new AmazonMediaLiveException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); }
public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundException")) { return(new ResourceNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("AccessDeniedException")) { return(new AccessDeniedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InternalServiceException")) { return(new InternalServiceException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException")) { return(new LimitExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ValidationException")) { return(new ValidationException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("IncompatibleVersionException")) { return(new IncompatibleVersionException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonElasticTranscoderException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("TypeDeprecatedException")) { return(new TypeDeprecatedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("OperationNotPermittedException")) { return(new OperationNotPermittedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DefaultUndefinedException")) { return(new DefaultUndefinedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnknownResourceException")) { return(new UnknownResourceException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("WorkflowExecutionAlreadyStartedException")) { return(new WorkflowExecutionAlreadyStartedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException")) { return(new LimitExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonSimpleWorkflowException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(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) { ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("ApprovalRuleContentRequiredException")) { return(new ApprovalRuleContentRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ApprovalRuleNameAlreadyExistsException")) { return(new ApprovalRuleNameAlreadyExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ApprovalRuleNameRequiredException")) { return(new ApprovalRuleNameRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionIntegrityChecksFailedException")) { return(new EncryptionIntegrityChecksFailedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyAccessDeniedException")) { return(new EncryptionKeyAccessDeniedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyDisabledException")) { return(new EncryptionKeyDisabledException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyNotFoundException")) { return(new EncryptionKeyNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyUnavailableException")) { return(new EncryptionKeyUnavailableException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidApprovalRuleContentException")) { return(new InvalidApprovalRuleContentException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidApprovalRuleNameException")) { return(new InvalidApprovalRuleNameException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidPullRequestIdException")) { return(new InvalidPullRequestIdException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NumberOfRulesExceededException")) { return(new NumberOfRulesExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PullRequestAlreadyClosedException")) { return(new PullRequestAlreadyClosedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PullRequestDoesNotExistException")) { return(new PullRequestDoesNotExistException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PullRequestIdRequiredException")) { return(new PullRequestIdRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonCodeCommitException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("CloudWatchLogsDeliveryUnavailableException")) { return new CloudWatchLogsDeliveryUnavailableException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientEncryptionPolicyException")) { return new InsufficientEncryptionPolicyException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientS3BucketPolicyException")) { return new InsufficientS3BucketPolicyException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientSnsTopicPolicyException")) { return new InsufficientSnsTopicPolicyException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCloudWatchLogsLogGroupArnException")) { return new InvalidCloudWatchLogsLogGroupArnException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCloudWatchLogsRoleArnException")) { return new InvalidCloudWatchLogsRoleArnException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidKmsKeyIdException")) { return new InvalidKmsKeyIdException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterCombinationException")) { return new InvalidParameterCombinationException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidS3BucketNameException")) { return new InvalidS3BucketNameException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidS3PrefixException")) { return new InvalidS3PrefixException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSnsTopicNameException")) { return new InvalidSnsTopicNameException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTrailNameException")) { return new InvalidTrailNameException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("KmsException")) { return new KmsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("KmsKeyDisabledException")) { return new KmsKeyDisabledException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("KmsKeyNotFoundException")) { return new KmsKeyNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("MaximumNumberOfTrailsExceededException")) { return new MaximumNumberOfTrailsExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("OperationNotPermittedException")) { return new OperationNotPermittedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("S3BucketDoesNotExistException")) { return new S3BucketDoesNotExistException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("TrailAlreadyExistsException")) { return new TrailAlreadyExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("TrailNotProvidedException")) { return new TrailNotProvidedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnsupportedOperationException")) { return new UnsupportedOperationException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); } return new AmazonCloudTrailException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("ClientRequestTokenRequiredException")) { return(new ClientRequestTokenRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionIntegrityChecksFailedException")) { return(new EncryptionIntegrityChecksFailedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyAccessDeniedException")) { return(new EncryptionKeyAccessDeniedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyDisabledException")) { return(new EncryptionKeyDisabledException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyNotFoundException")) { return(new EncryptionKeyNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyUnavailableException")) { return(new EncryptionKeyUnavailableException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("IdempotencyParameterMismatchException")) { return(new IdempotencyParameterMismatchException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidClientRequestTokenException")) { return(new InvalidClientRequestTokenException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDescriptionException")) { return(new InvalidDescriptionException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidReferenceNameException")) { return(new InvalidReferenceNameException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRepositoryNameException")) { return(new InvalidRepositoryNameException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTargetException")) { return(new InvalidTargetException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTargetsException")) { return(new InvalidTargetsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTitleException")) { return(new InvalidTitleException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MaximumOpenPullRequestsExceededException")) { return(new MaximumOpenPullRequestsExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MultipleRepositoriesInPullRequestException")) { return(new MultipleRepositoriesInPullRequestException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ReferenceDoesNotExistException")) { return(new ReferenceDoesNotExistException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ReferenceNameRequiredException")) { return(new ReferenceNameRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ReferenceTypeNotSupportedException")) { return(new ReferenceTypeNotSupportedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryDoesNotExistException")) { return(new RepositoryDoesNotExistException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryNameRequiredException")) { return(new RepositoryNameRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("SourceAndDestinationAreSameException")) { return(new SourceAndDestinationAreSameException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TargetRequiredException")) { return(new TargetRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TargetsRequiredException")) { return(new TargetsRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TitleRequiredException")) { return(new TitleRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonCodeCommitException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(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) { ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("CodeDeliveryFailureException")) { return(new CodeDeliveryFailureException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InternalErrorException")) { return(new InternalErrorException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidEmailRoleAccessPolicyException")) { return(new InvalidEmailRoleAccessPolicyException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidLambdaResponseException")) { return(new InvalidLambdaResponseException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterException")) { return(new InvalidParameterException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSmsRoleAccessPolicyException")) { return(new InvalidSmsRoleAccessPolicyException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSmsRoleTrustRelationshipException")) { return(new InvalidSmsRoleTrustRelationshipException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException")) { return(new LimitExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NotAuthorizedException")) { return(new NotAuthorizedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundException")) { return(new ResourceNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException")) { return(new TooManyRequestsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnexpectedLambdaException")) { return(new UnexpectedLambdaException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UserLambdaValidationException")) { return(new UserLambdaValidationException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UserNotConfirmedException")) { return(new UserNotConfirmedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UserNotFoundException")) { return(new UserNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonCognitoIdentityProviderException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(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("EFSIOException")) { return(EFSIOExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EFSMountConnectivityException")) { return(EFSMountConnectivityExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EFSMountFailureException")) { return(EFSMountFailureExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EFSMountTimeoutException")) { return(EFSMountTimeoutExceptionUnmarshaller.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("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) { ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("AlarmsLimitExceededException")) { return(new AlarmsLimitExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ApplicationDoesNotExistException")) { return(new ApplicationDoesNotExistException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ApplicationNameRequiredException")) { return(new ApplicationNameRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DeploymentConfigDoesNotExistException")) { return(new DeploymentConfigDoesNotExistException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DeploymentGroupAlreadyExistsException")) { return(new DeploymentGroupAlreadyExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DeploymentGroupDoesNotExistException")) { return(new DeploymentGroupDoesNotExistException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("DeploymentGroupNameRequiredException")) { return(new DeploymentGroupNameRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidAlarmConfigException")) { return(new InvalidAlarmConfigException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidApplicationNameException")) { return(new InvalidApplicationNameException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidAutoRollbackConfigException")) { return(new InvalidAutoRollbackConfigException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidAutoScalingGroupException")) { return(new InvalidAutoScalingGroupException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDeploymentConfigNameException")) { return(new InvalidDeploymentConfigNameException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDeploymentGroupNameException")) { return(new InvalidDeploymentGroupNameException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidEC2TagException")) { return(new InvalidEC2TagException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRoleException")) { return(new InvalidRoleException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTagException")) { return(new InvalidTagException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTriggerConfigException")) { return(new InvalidTriggerConfigException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("LifecycleHookLimitExceededException")) { return(new LifecycleHookLimitExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TriggerTargetsLimitExceededException")) { return(new TriggerTargetsLimitExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonCodeDeployException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(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("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("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("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("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) { ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("ConcurrentReferenceUpdateException")) { return(new ConcurrentReferenceUpdateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionIntegrityChecksFailedException")) { return(new EncryptionIntegrityChecksFailedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyAccessDeniedException")) { return(new EncryptionKeyAccessDeniedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyDisabledException")) { return(new EncryptionKeyDisabledException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyNotFoundException")) { return(new EncryptionKeyNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyUnavailableException")) { return(new EncryptionKeyUnavailableException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCommitIdException")) { return(new InvalidCommitIdException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidPullRequestIdException")) { return(new InvalidPullRequestIdException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRepositoryNameException")) { return(new InvalidRepositoryNameException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ManualMergeRequiredException")) { return(new ManualMergeRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PullRequestAlreadyClosedException")) { return(new PullRequestAlreadyClosedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PullRequestApprovalRulesNotSatisfiedException")) { return(new PullRequestApprovalRulesNotSatisfiedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PullRequestDoesNotExistException")) { return(new PullRequestDoesNotExistException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PullRequestIdRequiredException")) { return(new PullRequestIdRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ReferenceDoesNotExistException")) { return(new ReferenceDoesNotExistException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryDoesNotExistException")) { return(new RepositoryDoesNotExistException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryNameRequiredException")) { return(new RepositoryNameRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryNotAssociatedWithPullRequestException")) { return(new RepositoryNotAssociatedWithPullRequestException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TipOfSourceReferenceIsDifferentException")) { return(new TipOfSourceReferenceIsDifferentException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonCodeCommitException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(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) { ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("CommitDoesNotExistException")) { return(new CommitDoesNotExistException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CommitMessageLengthExceededException")) { return(new CommitMessageLengthExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CommitRequiredException")) { return(new CommitRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionIntegrityChecksFailedException")) { return(new EncryptionIntegrityChecksFailedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyAccessDeniedException")) { return(new EncryptionKeyAccessDeniedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyDisabledException")) { return(new EncryptionKeyDisabledException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyNotFoundException")) { return(new EncryptionKeyNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyUnavailableException")) { return(new EncryptionKeyUnavailableException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("FileContentSizeLimitExceededException")) { return(new FileContentSizeLimitExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("FileModeRequiredException")) { return(new FileModeRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("FolderContentSizeLimitExceededException")) { return(new FolderContentSizeLimitExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCommitException")) { return(new InvalidCommitException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidConflictDetailLevelException")) { return(new InvalidConflictDetailLevelException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidConflictResolutionException")) { return(new InvalidConflictResolutionException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidConflictResolutionStrategyException")) { return(new InvalidConflictResolutionStrategyException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidEmailException")) { return(new InvalidEmailException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidFileModeException")) { return(new InvalidFileModeException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidMergeOptionException")) { return(new InvalidMergeOptionException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidPathException")) { return(new InvalidPathException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidReplacementContentException")) { return(new InvalidReplacementContentException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidReplacementTypeException")) { return(new InvalidReplacementTypeException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRepositoryNameException")) { return(new InvalidRepositoryNameException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ManualMergeRequiredException")) { return(new ManualMergeRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MaximumConflictResolutionEntriesExceededException")) { return(new MaximumConflictResolutionEntriesExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MaximumFileContentToLoadExceededException")) { return(new MaximumFileContentToLoadExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MergeOptionRequiredException")) { return(new MergeOptionRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MultipleConflictResolutionEntriesException")) { return(new MultipleConflictResolutionEntriesException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NameLengthExceededException")) { return(new NameLengthExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PathRequiredException")) { return(new PathRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ReplacementContentRequiredException")) { return(new ReplacementContentRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ReplacementTypeRequiredException")) { return(new ReplacementTypeRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryDoesNotExistException")) { return(new RepositoryDoesNotExistException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryNameRequiredException")) { return(new RepositoryNameRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TipsDivergenceExceededException")) { return(new TipsDivergenceExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonCodeCommitException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("BranchNameExistsException")) { return(new BranchNameExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("BranchNameRequiredException")) { return(new BranchNameRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CommitDoesNotExistException")) { return(new CommitDoesNotExistException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CommitIdRequiredException")) { return(new CommitIdRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionIntegrityChecksFailedException")) { return(new EncryptionIntegrityChecksFailedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyAccessDeniedException")) { return(new EncryptionKeyAccessDeniedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyDisabledException")) { return(new EncryptionKeyDisabledException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyNotFoundException")) { return(new EncryptionKeyNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("EncryptionKeyUnavailableException")) { return(new EncryptionKeyUnavailableException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidBranchNameException")) { return(new InvalidBranchNameException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCommitIdException")) { return(new InvalidCommitIdException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRepositoryNameException")) { return(new InvalidRepositoryNameException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryDoesNotExistException")) { return(new RepositoryDoesNotExistException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("RepositoryNameRequiredException")) { return(new RepositoryNameRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonCodeCommitException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(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) { ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); return(new AmazonKinesisAnalyticsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }
/// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); if (errorResponse.Code != null && errorResponse.Code.Equals("AliasExistsException")) { return(new AliasExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("CodeMismatchException")) { return(new CodeMismatchException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ExpiredCodeException")) { return(new ExpiredCodeException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InternalErrorException")) { return(new InternalErrorException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidLambdaResponseException")) { return(new InvalidLambdaResponseException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterException")) { return(new InvalidParameterException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSmsRoleAccessPolicyException")) { return(new InvalidSmsRoleAccessPolicyException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSmsRoleTrustRelationshipException")) { return(new InvalidSmsRoleTrustRelationshipException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidUserPoolConfigurationException")) { return(new InvalidUserPoolConfigurationException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("MFAMethodNotFoundException")) { return(new MFAMethodNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("NotAuthorizedException")) { return(new NotAuthorizedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("PasswordResetRequiredException")) { return(new PasswordResetRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundException")) { return(new ResourceNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException")) { return(new TooManyRequestsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnexpectedLambdaException")) { return(new UnexpectedLambdaException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UserLambdaValidationException")) { return(new UserLambdaValidationException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UserNotConfirmedException")) { return(new UserNotConfirmedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } if (errorResponse.Code != null && errorResponse.Code.Equals("UserNotFoundException")) { return(new UserNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); } return(new AmazonCognitoIdentityProviderException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode)); }