public AmazonServiceException UnmarshallException(IWebResponseData response, ErrorResponse errorResponse, Exception innerException)
 {
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("InternalError"))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new InternalErrorException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("InvalidConfiguration"))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new InvalidConfigurationException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("InvalidParameter"))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new InvalidParameterException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("NotAuthorizedError"))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new NotAuthorizedException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("ResourceNotFound"))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new ResourceNotFoundException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("TooManyRequests"))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new TooManyRequestsException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     return new AmazonCognitoSyncException(GetDefaultErrorMessage<AmazonCognitoSyncException>(), innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
 }
 public AmazonServiceException UnmarshallException(IWebResponseData response, ErrorResponse errorResponse, Exception innerException)
 {
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("BadRequestException"))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonMobileAnalyticsException>():errorResponse.Message;
         return new BadRequestException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     return new AmazonMobileAnalyticsException(GetDefaultErrorMessage<AmazonMobileAnalyticsException>(), innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
 }
 public AmazonServiceException UnmarshallException(IWebResponseData response, ErrorResponse errorResponse, Exception innerException)
 {
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("ConcurrentModificationException", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoIdentityException>():errorResponse.Message;
         return new ConcurrentModificationException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("InternalErrorException", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoIdentityException>():errorResponse.Message;
         return new InternalErrorException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("InvalidParameterException", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoIdentityException>():errorResponse.Message;
         return new InvalidParameterException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("NotAuthorizedException", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoIdentityException>():errorResponse.Message;
         return new NotAuthorizedException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("ResourceConflictException", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoIdentityException>():errorResponse.Message;
         return new ResourceConflictException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("ResourceNotFoundException", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoIdentityException>():errorResponse.Message;
         return new ResourceNotFoundException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("TooManyRequestsException", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoIdentityException>():errorResponse.Message;
         return new TooManyRequestsException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     return new AmazonCognitoIdentityException(GetDefaultErrorMessage<AmazonCognitoIdentityException>(), innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
 }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public WAFExpiredManagedRuleGroupVersionException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            WAFExpiredManagedRuleGroupVersionException unmarshalledObject = new WAFExpiredManagedRuleGroupVersionException(errorResponse.Message, errorResponse.InnerException,
                                                                                                                           errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
            }

            return(unmarshalledObject);
        }
Esempio n. 5
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public ServiceTemporarilyUnavailableException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            ServiceTemporarilyUnavailableException unmarshalledObject = new ServiceTemporarilyUnavailableException(errorResponse.Message, errorResponse.InnerException,
                                                                                                                   errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("canRetry", targetDepth))
                {
                    var unmarshaller = BoolUnmarshaller.Instance;
                    unmarshalledObject.CanRetry = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(unmarshalledObject);
        }
Esempio n. 6
0
        /// <summary>
        /// Unmarshaller error response to exception.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public DBInstanceAlreadyExistsException Unmarshall(XmlUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            DBInstanceAlreadyExistsException response = new DBInstanceAlreadyExistsException(errorResponse.Message, errorResponse.InnerException,
                                                                                             errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.ReadAtDepth(originalDepth))
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                }
            }
            return(response);
        }
Esempio n. 7
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public ServiceQuotaExceededException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            ServiceQuotaExceededException unmarshalledObject = new ServiceQuotaExceededException(errorResponse.Message, errorResponse.InnerException,
                                                                                                 errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("QuotaCode", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    unmarshalledObject.QuotaCode = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("ResourceId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    unmarshalledObject.ResourceId = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("ResourceType", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    unmarshalledObject.ResourceType = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("ServiceCode", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    unmarshalledObject.ServiceCode = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(unmarshalledObject);
        }
Esempio n. 8
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public WAFInvalidParameterException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            WAFInvalidParameterException unmarshalledObject = new WAFInvalidParameterException(errorResponse.Message, errorResponse.InnerException,
                                                                                               errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("field", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    unmarshalledObject.Field = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("parameter", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    unmarshalledObject.Parameter = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("reason", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    unmarshalledObject.Reason = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(unmarshalledObject);
        }
Esempio n. 9
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public ServiceQuotaTemplateNotInUseException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            ServiceQuotaTemplateNotInUseException unmarshalledObject = new ServiceQuotaTemplateNotInUseException(errorResponse.Message, errorResponse.InnerException,
                                                                                                                 errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
            }

            return(unmarshalledObject);
        }
Esempio n. 10
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public InvalidTrafficRoutingConfigurationException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            InvalidTrafficRoutingConfigurationException unmarshalledObject = new InvalidTrafficRoutingConfigurationException(errorResponse.Message, errorResponse.InnerException,
                                                                                                                             errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
            }

            return(unmarshalledObject);
        }
Esempio n. 11
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public UnsupportedDigitalSignatureMethodException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            UnsupportedDigitalSignatureMethodException unmarshalledObject = new UnsupportedDigitalSignatureMethodException(errorResponse.Message, errorResponse.InnerException,
                                                                                                                           errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
            }

            return(unmarshalledObject);
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public DelegationSetNotAvailableException Unmarshall(XmlUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            DelegationSetNotAvailableException response = new DelegationSetNotAvailableException(errorResponse.Message, errorResponse.InnerException,
                                                                                                 errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                }
            }
            return(response);
        }
Esempio n. 13
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public GitHubAccountTokenNameRequiredException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            GitHubAccountTokenNameRequiredException unmarshalledObject = new GitHubAccountTokenNameRequiredException(errorResponse.Message, errorResponse.InnerException,
                                                                                                                     errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
            }

            return(unmarshalledObject);
        }
Esempio n. 14
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public AutomationDefinitionVersionNotFoundException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            AutomationDefinitionVersionNotFoundException unmarshalledObject = new AutomationDefinitionVersionNotFoundException(errorResponse.Message, errorResponse.InnerException,
                                                                                                                               errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
            }

            return(unmarshalledObject);
        }
Esempio n. 15
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public UnableToDetectSchemaException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            UnableToDetectSchemaException unmarshalledObject = new UnableToDetectSchemaException(errorResponse.Message, errorResponse.InnerException,
                                                                                                 errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("ProcessedInputRecords", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <string, StringUnmarshaller>(StringUnmarshaller.Instance);
                    unmarshalledObject.ProcessedInputRecords = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("RawInputRecords", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <string, StringUnmarshaller>(StringUnmarshaller.Instance);
                    unmarshalledObject.RawInputRecords = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(unmarshalledObject);
        }
Esempio n. 16
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public UnsupportedGrantTypeException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            UnsupportedGrantTypeException unmarshalledObject = new UnsupportedGrantTypeException(errorResponse.Message, errorResponse.InnerException,
                                                                                                 errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("error", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    unmarshalledObject.Error = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("error_description", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    unmarshalledObject.Error_description = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(unmarshalledObject);
        }
Esempio n. 17
0
        /// <summary>
        /// Unmarshaller error response to exception.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public TooManyRequestedAttributesException Unmarshall(XmlUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            TooManyRequestedAttributesException response = new TooManyRequestedAttributesException(errorResponse.Message, errorResponse.InnerException,
                                                                                                   errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.ReadAtDepth(originalDepth))
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("BoxUsage", targetDepth))
                    {
                        response.BoxUsage = FloatUnmarshaller.Instance.Unmarshall(context);
                    }
                }
            }
            return(response);
        }
Esempio n. 18
0
        /// <summary>
        /// Unmarshaller error response to exception.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public InvalidCloudWatchDestinationException Unmarshall(XmlUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            InvalidCloudWatchDestinationException response = new InvalidCloudWatchDestinationException(errorResponse.Message, errorResponse.InnerException,
                                                                                                       errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.ReadAtDepth(originalDepth))
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("ConfigurationSetName", targetDepth))
                    {
                        response.ConfigurationSetName = StringUnmarshaller.Instance.Unmarshall(context);
                    }
                    if (context.TestExpression("EventDestinationName", targetDepth))
                    {
                        response.EventDestinationName = StringUnmarshaller.Instance.Unmarshall(context);
                    }
                }
            }
            return(response);
        }
Esempio n. 19
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public InvalidFunctionAssociationException Unmarshall(XmlUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            InvalidFunctionAssociationException response = new InvalidFunctionAssociationException(errorResponse.Message, errorResponse.InnerException,
                                                                                                   errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                }
            }
            return(response);
        }
Esempio n. 20
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public InvalidCodeSignatureException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            InvalidCodeSignatureException unmarshalledObject = new InvalidCodeSignatureException(errorResponse.Message, errorResponse.InnerException,
                                                                                                 errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("Type", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    unmarshalledObject.Type = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(unmarshalledObject);
        }
Esempio n. 21
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public AccountSetupInProgressException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            AccountSetupInProgressException unmarshalledObject = new AccountSetupInProgressException(errorResponse.Message, errorResponse.InnerException,
                                                                                                     errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("code", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    unmarshalledObject.Code = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("docs", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    unmarshalledObject.Docs = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("tip", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    unmarshalledObject.Tip = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(unmarshalledObject);
        }
Esempio n. 22
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public NoSuchResponseHeadersPolicyException Unmarshall(XmlUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            NoSuchResponseHeadersPolicyException response = new NoSuchResponseHeadersPolicyException(errorResponse.Message, errorResponse.InnerException,
                                                                                                     errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                }
            }
            return(response);
        }
Esempio n. 23
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>  
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public AvailabilityZonesMismatchException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            AvailabilityZonesMismatchException unmarshalledObject = new AvailabilityZonesMismatchException(errorResponse.Message, errorResponse.InnerException,
                errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);
        
            int targetDepth = context.CurrentDepth;
            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("ErrorCode", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    unmarshalledObject.ErrorCode = unmarshaller.Unmarshall(context);
                    continue;
                }
            }
          
            return unmarshalledObject;
        }
Esempio n. 24
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public TooManyFieldLevelEncryptionFieldPatternsException Unmarshall(XmlUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            TooManyFieldLevelEncryptionFieldPatternsException response = new TooManyFieldLevelEncryptionFieldPatternsException(errorResponse.Message, errorResponse.InnerException,
                                                                                                                               errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                }
            }
            return(response);
        }
Esempio n. 25
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public MarksNotSupportedForFormatException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            MarksNotSupportedForFormatException unmarshalledObject = new MarksNotSupportedForFormatException(errorResponse.Message, errorResponse.InnerException,
                                                                                                             errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
            }

            return(unmarshalledObject);
        }
Esempio n. 26
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public ResourceAlreadyExistsException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            ResourceAlreadyExistsException unmarshalledObject = new ResourceAlreadyExistsException(errorResponse.Message, errorResponse.InnerException,
                                                                                                   errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("resourceArn", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    unmarshalledObject.ResourceArn = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("resourceId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    unmarshalledObject.ResourceId = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(unmarshalledObject);
        }
Esempio n. 27
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public RepositoryTriggerDestinationArnRequiredException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            RepositoryTriggerDestinationArnRequiredException unmarshalledObject = new RepositoryTriggerDestinationArnRequiredException(errorResponse.Message, errorResponse.InnerException,
                                                                                                                                       errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
            }

            return(unmarshalledObject);
        }
Esempio n. 28
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public ParameterVersionLabelLimitExceededException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            ParameterVersionLabelLimitExceededException unmarshalledObject = new ParameterVersionLabelLimitExceededException(errorResponse.Message, errorResponse.InnerException,
                                                                                                                             errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
            }

            return(unmarshalledObject);
        }
Esempio n. 29
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public IncompatibleRegionForMultiAZException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            IncompatibleRegionForMultiAZException unmarshalledObject = new IncompatibleRegionForMultiAZException(errorResponse.Message, errorResponse.InnerException,
                                                                                                                 errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
            }

            return(unmarshalledObject);
        }
Esempio n. 30
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public TaskAlreadyExistsException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            TaskAlreadyExistsException unmarshalledObject = new TaskAlreadyExistsException(errorResponse.Message, errorResponse.InnerException,
                                                                                           errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
            }

            return(unmarshalledObject);
        }
        /// <summary>
        /// Unmarshaller error response to exception.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public EndpointAuthorizationsPerClusterLimitExceededException Unmarshall(XmlUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            EndpointAuthorizationsPerClusterLimitExceededException response = new EndpointAuthorizationsPerClusterLimitExceededException(errorResponse.Message, errorResponse.InnerException,
                                                                                                                                         errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.ReadAtDepth(originalDepth))
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                }
            }
            return(response);
        }
 public AmazonServiceException UnmarshallException(IWebResponseData response, ErrorResponse errorResponse, Exception innerException)
 {
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("InternalError", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new InternalErrorException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("InvalidLambdaFunctionOutput", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new InvalidLambdaFunctionOutputException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("InvalidParameter", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new InvalidParameterException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("LambdaThrottled", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new LambdaThrottledException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("LimitExceeded", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new LimitExceededException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("NotAuthorizedError", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new NotAuthorizedException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("ResourceConflict", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new ResourceConflictException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("ResourceNotFound", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new ResourceNotFoundException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("TooManyRequests", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new TooManyRequestsException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     return new AmazonCognitoSyncException(GetDefaultErrorMessage<AmazonCognitoSyncException>(), innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
 }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public KeySigningKeyAlreadyExistsException Unmarshall(XmlUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            KeySigningKeyAlreadyExistsException response = new KeySigningKeyAlreadyExistsException(errorResponse.Message, errorResponse.InnerException,
                                                                                                   errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                }
            }
            return(response);
        }
Esempio n. 34
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="errorResponse"></param>
        /// <returns></returns>
        public ClusterQuotaForCustomerExceededException Unmarshall(JsonUnmarshallerContext context, Amazon.Runtime.Internal.ErrorResponse errorResponse)
        {
            context.Read();

            ClusterQuotaForCustomerExceededException unmarshalledObject = new ClusterQuotaForCustomerExceededException(errorResponse.Message, errorResponse.InnerException,
                                                                                                                       errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode);

            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
            }

            return(unmarshalledObject);
        }
 public AmazonServiceException UnmarshallException(IWebResponseData response, ErrorResponse errorResponse, Exception innerException)
 {
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("AlreadyStreamed", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new AlreadyStreamedException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("DuplicateRequest", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new DuplicateRequestException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("InternalError", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new InternalErrorException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("InvalidParameter", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new InvalidParameterException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("NotAuthorizedError", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new NotAuthorizedException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     if (!string.IsNullOrEmpty(errorResponse.Code) && errorResponse.Code.StartsWith("ResourceNotFound", StringComparison.OrdinalIgnoreCase))
     {
         string message = string.IsNullOrEmpty(errorResponse.Message)?GetDefaultErrorMessage<AmazonCognitoSyncException>():errorResponse.Message;
         return new ResourceNotFoundException(message, innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
     }
     return new AmazonCognitoSyncException(GetDefaultErrorMessage<AmazonCognitoSyncException>(), innerException, ErrorType.Unknown, errorResponse.Code, errorResponse.RequestId, response.StatusCode);
 }