public TrustedAdvisorCheckSummary Unmarshall(JsonUnmarshallerContext context)
        {
            TrustedAdvisorCheckSummary trustedAdvisorCheckSummary = new TrustedAdvisorCheckSummary();

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

            while (context.Read())
            {
                if ((context.IsKey) && (context.CurrentDepth == targetDepth))
                {
                    context.Read();
                    context.Read();

                    if (context.TestExpression("CheckId", targetDepth))
                    {
                        trustedAdvisorCheckSummary.CheckId = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("Timestamp", targetDepth))
                    {
                        trustedAdvisorCheckSummary.Timestamp = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("Status", targetDepth))
                    {
                        trustedAdvisorCheckSummary.Status = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("HasFlaggedResources", targetDepth))
                    {
                        trustedAdvisorCheckSummary.HasFlaggedResources = BoolUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("ResourcesSummary", targetDepth))
                    {
                        trustedAdvisorCheckSummary.ResourcesSummary = TrustedAdvisorResourcesSummaryUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("CategorySpecificSummary", targetDepth))
                    {
                        trustedAdvisorCheckSummary.CategorySpecificSummary = TrustedAdvisorCategorySpecificSummaryUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(trustedAdvisorCheckSummary);
                }
            }


            return(trustedAdvisorCheckSummary);
        }
示例#2
0
 public static TrustedAdvisorCategorySpecificSummaryUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new TrustedAdvisorCategorySpecificSummaryUnmarshaller();
     }
     return(instance);
 }
        public TrustedAdvisorCheckResult Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }
            TrustedAdvisorCheckResult trustedAdvisorCheckResult = new TrustedAdvisorCheckResult();


            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("checkId", targetDepth))
                {
                    trustedAdvisorCheckResult.CheckId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("timestamp", targetDepth))
                {
                    trustedAdvisorCheckResult.Timestamp = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("status", targetDepth))
                {
                    trustedAdvisorCheckResult.Status = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("resourcesSummary", targetDepth))
                {
                    trustedAdvisorCheckResult.ResourcesSummary = TrustedAdvisorResourcesSummaryUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("categorySpecificSummary", targetDepth))
                {
                    trustedAdvisorCheckResult.CategorySpecificSummary = TrustedAdvisorCategorySpecificSummaryUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("flaggedResources", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <TrustedAdvisorResourceDetail, TrustedAdvisorResourceDetailUnmarshaller>(
                        TrustedAdvisorResourceDetailUnmarshaller.GetInstance());
                    trustedAdvisorCheckResult.FlaggedResources = unmarshaller.Unmarshall(context);

                    continue;
                }
            }

            return(trustedAdvisorCheckResult);
        }
        public TrustedAdvisorCheckSummary Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }
            TrustedAdvisorCheckSummary trustedAdvisorCheckSummary = new TrustedAdvisorCheckSummary();


            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("checkId", targetDepth))
                {
                    trustedAdvisorCheckSummary.CheckId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("timestamp", targetDepth))
                {
                    trustedAdvisorCheckSummary.Timestamp = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("status", targetDepth))
                {
                    trustedAdvisorCheckSummary.Status = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("hasFlaggedResources", targetDepth))
                {
                    trustedAdvisorCheckSummary.HasFlaggedResources = BoolUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("resourcesSummary", targetDepth))
                {
                    trustedAdvisorCheckSummary.ResourcesSummary = TrustedAdvisorResourcesSummaryUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("categorySpecificSummary", targetDepth))
                {
                    trustedAdvisorCheckSummary.CategorySpecificSummary = TrustedAdvisorCategorySpecificSummaryUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }
            }

            return(trustedAdvisorCheckSummary);
        }
        public TrustedAdvisorCheckResult Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }

            TrustedAdvisorCheckResult trustedAdvisorCheckResult = new TrustedAdvisorCheckResult();



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

            while (context.Read())
            {
                if (context.TestExpression("checkId", targetDepth))
                {
                    context.Read();
                    trustedAdvisorCheckResult.CheckId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("timestamp", targetDepth))
                {
                    context.Read();
                    trustedAdvisorCheckResult.Timestamp = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("status", targetDepth))
                {
                    context.Read();
                    trustedAdvisorCheckResult.Status = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("resourcesSummary", targetDepth))
                {
                    context.Read();
                    trustedAdvisorCheckResult.ResourcesSummary = TrustedAdvisorResourcesSummaryUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("categorySpecificSummary", targetDepth))
                {
                    context.Read();
                    trustedAdvisorCheckResult.CategorySpecificSummary = TrustedAdvisorCategorySpecificSummaryUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("flaggedResources", targetDepth))
                {
                    context.Read();

                    if (context.CurrentTokenType == JsonToken.Null)
                    {
                        trustedAdvisorCheckResult.FlaggedResources = null;
                        continue;
                    }
                    trustedAdvisorCheckResult.FlaggedResources = new List <TrustedAdvisorResourceDetail>();
                    TrustedAdvisorResourceDetailUnmarshaller unmarshaller = TrustedAdvisorResourceDetailUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        trustedAdvisorCheckResult.FlaggedResources.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

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


            return(trustedAdvisorCheckResult);
        }
        public TrustedAdvisorCheckResult Unmarshall(JsonUnmarshallerContext context)
        {
            TrustedAdvisorCheckResult trustedAdvisorCheckResult = new TrustedAdvisorCheckResult();

            trustedAdvisorCheckResult.FlaggedResources = null;

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

            while (context.Read())
            {
                if ((context.IsKey) && (context.CurrentDepth == targetDepth))
                {
                    context.Read();
                    context.Read();

                    if (context.TestExpression("CheckId", targetDepth))
                    {
                        trustedAdvisorCheckResult.CheckId = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("Timestamp", targetDepth))
                    {
                        trustedAdvisorCheckResult.Timestamp = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("Status", targetDepth))
                    {
                        trustedAdvisorCheckResult.Status = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("ResourcesSummary", targetDepth))
                    {
                        trustedAdvisorCheckResult.ResourcesSummary = TrustedAdvisorResourcesSummaryUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("CategorySpecificSummary", targetDepth))
                    {
                        trustedAdvisorCheckResult.CategorySpecificSummary = TrustedAdvisorCategorySpecificSummaryUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("FlaggedResources", targetDepth))
                    {
                        trustedAdvisorCheckResult.FlaggedResources = new List <TrustedAdvisorResourceDetail>();
                        TrustedAdvisorResourceDetailUnmarshaller unmarshaller = TrustedAdvisorResourceDetailUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                trustedAdvisorCheckResult.FlaggedResources.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(trustedAdvisorCheckResult);
                }
            }


            return(trustedAdvisorCheckResult);
        }