Example #1
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            DescribeTypeResponse response = new DescribeTypeResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.IsStartElement)
                {
                    if (context.TestExpression("DescribeTypeResult", 2))
                    {
                        UnmarshallResult(context, response);
                        continue;
                    }

                    if (context.TestExpression("ResponseMetadata", 2))
                    {
                        response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context);
                    }
                }
            }

            return(response);
        }
Example #2
0
        private static void UnmarshallResult(XmlUnmarshallerContext context, DescribeTypeResponse response)
        {
            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("Arn", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.Arn = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("AutoUpdate", targetDepth))
                    {
                        var unmarshaller = BoolUnmarshaller.Instance;
                        response.AutoUpdate = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("ConfigurationSchema", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.ConfigurationSchema = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("DefaultVersionId", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.DefaultVersionId = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("DeprecatedStatus", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.DeprecatedStatus = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("Description", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.Description = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("DocumentationUrl", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.DocumentationUrl = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("ExecutionRoleArn", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.ExecutionRoleArn = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("IsActivated", targetDepth))
                    {
                        var unmarshaller = BoolUnmarshaller.Instance;
                        response.IsActivated = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("IsDefaultVersion", targetDepth))
                    {
                        var unmarshaller = BoolUnmarshaller.Instance;
                        response.IsDefaultVersion = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("LastUpdated", targetDepth))
                    {
                        var unmarshaller = DateTimeUnmarshaller.Instance;
                        response.LastUpdated = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("LatestPublicVersion", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.LatestPublicVersion = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("LoggingConfig", targetDepth))
                    {
                        var unmarshaller = LoggingConfigUnmarshaller.Instance;
                        response.LoggingConfig = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("OriginalTypeArn", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.OriginalTypeArn = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("OriginalTypeName", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.OriginalTypeName = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("ProvisioningType", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.ProvisioningType = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("PublicVersionNumber", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.PublicVersionNumber = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("PublisherId", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.PublisherId = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("RequiredActivatedTypes/member", targetDepth))
                    {
                        var unmarshaller = RequiredActivatedTypeUnmarshaller.Instance;
                        var item         = unmarshaller.Unmarshall(context);
                        response.RequiredActivatedTypes.Add(item);
                        continue;
                    }
                    if (context.TestExpression("Schema", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.Schema = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("SourceUrl", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.SourceUrl = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("TimeCreated", targetDepth))
                    {
                        var unmarshaller = DateTimeUnmarshaller.Instance;
                        response.TimeCreated = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("Type", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.Type = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("TypeName", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.TypeName = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("TypeTestsStatus", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.TypeTestsStatus = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("TypeTestsStatusDescription", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.TypeTestsStatusDescription = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("Visibility", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.Visibility = unmarshaller.Unmarshall(context);
                        continue;
                    }
                }
            }

            return;
        }
        private static void UnmarshallResult(XmlUnmarshallerContext context, DescribeTypeResponse response)
        {
            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("Arn", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.Arn = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("DefaultVersionId", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.DefaultVersionId = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("DeprecatedStatus", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.DeprecatedStatus = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("Description", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.Description = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("DocumentationUrl", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.DocumentationUrl = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("ExecutionRoleArn", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.ExecutionRoleArn = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("LastUpdated", targetDepth))
                    {
                        var unmarshaller = DateTimeUnmarshaller.Instance;
                        response.LastUpdated = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("LoggingConfig", targetDepth))
                    {
                        var unmarshaller = LoggingConfigUnmarshaller.Instance;
                        response.LoggingConfig = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("ProvisioningType", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.ProvisioningType = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("Schema", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.Schema = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("SourceUrl", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.SourceUrl = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("TimeCreated", targetDepth))
                    {
                        var unmarshaller = DateTimeUnmarshaller.Instance;
                        response.TimeCreated = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("Type", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.Type = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("TypeName", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.TypeName = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("Visibility", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.Visibility = unmarshaller.Unmarshall(context);
                        continue;
                    }
                }
            }

            return;
        }