public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeCacheResponse response = new DescribeCacheResponse();

            context.Read();

            UnmarshallResult(context, response);
            return(response);
        }
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeCacheResponse response = new DescribeCacheResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("GatewayARN", targetDepth))
                {
                    response.GatewayARN = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("DiskIds", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <String, StringUnmarshaller>(
                        StringUnmarshaller.GetInstance());
                    response.DiskIds = unmarshaller.Unmarshall(context);

                    continue;
                }

                if (context.TestExpression("CacheAllocatedInBytes", targetDepth))
                {
                    response.CacheAllocatedInBytes = LongUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("CacheUsedPercentage", targetDepth))
                {
                    response.CacheUsedPercentage = DoubleUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("CacheDirtyPercentage", targetDepth))
                {
                    response.CacheDirtyPercentage = DoubleUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("CacheHitPercentage", targetDepth))
                {
                    response.CacheHitPercentage = DoubleUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("CacheMissPercentage", targetDepth))
                {
                    response.CacheMissPercentage = DoubleUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeCacheResponse response = new DescribeCacheResponse();

            context.Read();

            response.DescribeCacheResult = DescribeCacheResultUnmarshaller.GetInstance().Unmarshall(context);

            return(response);
        }
        private static void UnmarshallResult(JsonUnmarshallerContext context, DescribeCacheResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.TestExpression("GatewayARN", targetDepth))
                {
                    context.Read();
                    response.GatewayARN = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("DiskIds", targetDepth))
                {
                    context.Read();
                    response.DiskIds = new List <String>();
                    StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        response.DiskIds.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

                if (context.TestExpression("CacheAllocatedInBytes", targetDepth))
                {
                    context.Read();
                    response.CacheAllocatedInBytes = LongUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("CacheUsedPercentage", targetDepth))
                {
                    context.Read();
                    response.CacheUsedPercentage = DoubleUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("CacheDirtyPercentage", targetDepth))
                {
                    context.Read();
                    response.CacheDirtyPercentage = DoubleUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("CacheHitPercentage", targetDepth))
                {
                    context.Read();
                    response.CacheHitPercentage = DoubleUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("CacheMissPercentage", targetDepth))
                {
                    context.Read();
                    response.CacheMissPercentage = DoubleUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.CurrentDepth <= originalDepth)
                {
                    return;
                }
            }

            return;
        }