Ejemplo n.º 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)
        {
            GetMetricStreamResponse response = new GetMetricStreamResponse();

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

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

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

            return(response);
        }
Ejemplo n.º 2
0
        private static void UnmarshallResult(XmlUnmarshallerContext context, GetMetricStreamResponse 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("CreationDate", targetDepth))
                    {
                        var unmarshaller = DateTimeUnmarshaller.Instance;
                        response.CreationDate = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("ExcludeFilters/member", targetDepth))
                    {
                        var unmarshaller = MetricStreamFilterUnmarshaller.Instance;
                        var item         = unmarshaller.Unmarshall(context);
                        response.ExcludeFilters.Add(item);
                        continue;
                    }
                    if (context.TestExpression("FirehoseArn", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.FirehoseArn = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("IncludeFilters/member", targetDepth))
                    {
                        var unmarshaller = MetricStreamFilterUnmarshaller.Instance;
                        var item         = unmarshaller.Unmarshall(context);
                        response.IncludeFilters.Add(item);
                        continue;
                    }
                    if (context.TestExpression("LastUpdateDate", targetDepth))
                    {
                        var unmarshaller = DateTimeUnmarshaller.Instance;
                        response.LastUpdateDate = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("Name", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.Name = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("OutputFormat", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.OutputFormat = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("RoleArn", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.RoleArn = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("State", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.State = unmarshaller.Unmarshall(context);
                        continue;
                    }
                }
            }

            return;
        }